Skip to main content

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
ParameterRequiredDescription
subjectYesThe subject of the message
bodyYesThe text content of the message
autoDeletionDateNoThe date of auto deletion date of the message. The deletion happens and the end of the given date.
requestSignatureNoIndicates whether to request a signature from the recipients
canReplyNoIndicates whether the recipients can reply to the message
recipientsYesAn array of recipients. Must contain at least one object.
recipients[].ssnYesThe SSN of the recipient
recipients[].countryYesThe country associated with the given SSN
recipients[].emailNoAn email to send a notification to
recipients[].phoneNoA phone number to send a notification to
agentYesThe agent to indentify as
agent.ssnNoThe SSN of the agent, if the agent is a eID user.
agent.countryNoThe country associated with the given SSN, if any.
agent.usernameNoThe username of the agent, if the agent is a username/password user.
agent.nameIdNoThe 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) }