Sending Messages
Stage a message
The POST /v3/safemail/stage
endpoint is used to stage a SafeMail message before sending it.
POST /v3/safemail/stage
Authorization: Basic ${ base64(apiKey + ':' + secretKey) }
Content-Type: application/json
Parameter | Required | Description |
---|---|---|
subject | Yes | The subject of the message |
body | Yes | The text content of the message |
autoDeletionDate | No | The date of auto deletion date of the message. The deletion happens and the end of the given date. |
requestSignature | No | Indicates whether to request a signature from the recipients |
canReply | No | Indicates whether the recipients can reply to the message |
recipients | Yes | An array of recipients. Must contain at least one object. |
recipients[].ssn | Yes | The SSN of the recipient |
recipients[].country | Yes | The country associated with the given SSN |
recipients[].email | No | An email to send a notification to |
recipients[].phone | No | A phone number to send a notification to |
agent | Yes | The agent to indentify as |
agent.ssn | No | The SSN of the agent, if the agent is a eID user. |
agent.country | No | The country associated with the given SSN, if any. |
agent.username | No | The username of the agent, if the agent is a username/password user. |
agent.nameId | No | The nameId of the agent, if the agent is a SSO user. |
Response example:
HTTP/2.0 200 OK
{
"id": "1668b9da-bff1-4dfc-ad48-60507b5a8d12",
"autoDeletionDate": "2022-07-25",
"subject": "Subject",
"body": "Body",
"attachments": ["file.pdf"],
"recipients": [
{
"ssn": "YYYYMMDDXXXX",
"country": "SWEDEN"
}
]
}
Add an attachment to a message
The POST /v3/safemail/stage/{id}/attachment
endpoint is used to add attachments to a staged SafeMail message.
POST /v3/safemail/stage/{id}/attachment
Authorization: Basic ${ base64(apiKey + ':' + secretKey) }
Content-Type: multipart/form-data; boundary=boundary
--boundary
Content-Disposition: form-data; name="my-file"; filename="my-file.pdf"
// File content
Send a staged message
The POST /v3/safemail/stage/{id}/send
endpoint is used to send a staged SafeMail message.
POST /v3/safemail/stage/{id}/send
Authorization: Basic ${ base64(apiKey + ':' + secretKey) }