The CloudMailin Core API.
This is currently for private Beta, if an API key is required please contact us.
Please note that all endpoint require sending the accountID as part of the URL. This can be found on your account page in the GUI.
However, for sending email over API this ID is the Username in your SMTP credentials.
For some end points this may not be enough, specifically the incoming_statuses endpoint
returns a fixed number of results and may receive faster than the results can be fetched.
Please contact us if this is an issue.
Inbound Addresses are referred to as Addresses in the API.
Each address receives email and forwards it to your HTTP endpoint as a POST request. To view messages received by an address, see Inbound Messages.
[- {
- "id": "aaaa740b4c5c37b1aaaa",
- "target_format": "json+n",
- "nickname": null,
- "attachments": { }
}
]| target required | string <uri> The target for the HTTP POST to be sent to. |
| target_format required | string Enum: "json+n" "multipart+n" The format of the HTTP POST request sent to the target. |
| nickname | string or null An optional, short, nickname for the address to help differeniate them. |
object or Attachment (object) |
{- "target_format": "json+n",
- "nickname": null,
- "attachments": { }
}{- "id": "aaaa740b4c5c37b1aaaa",
- "target_format": "json+n",
- "nickname": null,
- "attachments": { }
}| addressID required | string (addressID) Example: aaaa740b4c5c37b1aaaa Identifier, please be aware that the format may change |
{- "id": "aaaa740b4c5c37b1aaaa",
- "target_format": "json+n",
- "nickname": null,
- "attachments": { }
}Updates an address with the specified ID.
| addressID required | string (addressID) Example: aaaa740b4c5c37b1aaaa Identifier, please be aware that the format may change |
| target required | string <uri> The target for the HTTP POST to be sent to. |
| target_format required | string Enum: "json+n" "multipart+n" The format of the HTTP POST request sent to the target. |
| nickname | string or null An optional, short, nickname for the address to help differeniate them. |
object or Attachment (object) |
{- "target_format": "json+n",
- "nickname": null,
- "attachments": { }
}{- "id": "aaaa740b4c5c37b1aaaa",
- "target_format": "json+n",
- "nickname": null,
- "attachments": { }
}Deletes an address with the specified ID. Note that a 202 response is expected. Deletion may not happen immediately.
| addressID required | string (addressID) Example: aaaa740b4c5c37b1aaaa Identifier, please be aware that the format may change |
{- "id": "aaaa740b4c5c37b1aaaa",
- "target_format": "json+n",
- "nickname": null,
- "attachments": { }
}Inbound Messages are referred to as Incoming Statuses in the API.
Each message includes metadata such as sender, recipient, subject, and delivery status.
Use the address_id parameter to filter messages for a specific address.
Incoming statuses are ordered newest first. This doesn't really help with pagination as new records will be added frequently. A new scheme will be added in future to handle this issue more effectively.
| address_id required | string (addressID) Example: address_id=aaaa740b4c5c37b1aaaa Identifier, please be aware that the format may change |
| page | integer Deprecated The page of results to return |
| query | string A query string to search the statuses for. |
[- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "message_id": "CAB=Hge+gC2LqXPu14qy82qPLk0YXcKrLeS7WZ3MPkOJJ-tMkMQ@mail.gmail.com",
- "to": "recipient@example.net",
- "from": "sender@example.net",
- "status": 200,
- "subject": "Example Subject Line",
- "tls": "TLSv1.3",
- "md5": "string",
- "created_at": "2019-08-24T14:15:22Z"
}
]Inbound Domains are referred to as Custom Domains in the API.
Custom domains allow you to receive email at your own domain (e.g., anything@yourdomain.com)
instead of the default CloudMailin address.
| address_id required | string (addressID) Example: address_id=aaaa740b4c5c37b1aaaa Identifier, please be aware that the format may change |
| page | integer Deprecated The page of results to return |
| query | string The domain to search for, partial domains are accepted. |
[- {
- "id": "aaaa111122223333",
- "domain": "example.com",
- "auth_regex": "allowed[0-9]*@example.com",
}
]| address_id required | string (addressID) Example: address_id=aaaa740b4c5c37b1aaaa Identifier, please be aware that the format may change |
| domain required | string The domain to receive email on. MX records for the domain must already be set. |
| auth_regex | string or null |
| domain_target | string or null Domain target changes the address target for this specific Custom Domain. This feature is not available to all accounts. |
{- "domain": "example.com",
- "auth_regex": "allowed[0-9]*@example.com",
}{- "id": "aaaa111122223333",
- "domain": "example.com",
- "auth_regex": "allowed[0-9]*@example.com",
}Note that a 202 response is expected. Deletion may not happen immediately.
| customDomainID required | string (customDomainID) [0-9a-f]{16} Example: aaaa111122223333 Identifier, please be aware that the format may change |
| address_id required | string (addressID) Example: address_id=aaaa740b4c5c37b1aaaa Identifier, please be aware that the format may change |
{- "id": "aaaa111122223333",
- "domain": "example.com",
- "auth_regex": "allowed[0-9]*@example.com",
}Send email messages via the API.
Messages can also be sent via SMTP. Use the Outbound Messages endpoints to retrieve sent messages and track their delivery status.
The message events webhook will send events relating to the delivery of messages sent via SMTP or the API. This information includes bounce and delivery statuses. Each post will be an array of one or more events.
Array of objects (MessageEvent) |
{- "events": [
- {
- "kind": "delivery",
- "message_id": "544a9141-8924-4d70-899c-4e1a4dd860d1",
- "recipient": "from@example.com",
- "original_message_id": "something-you-set@example.com",
- "timestamp": "2023-06-27T22:30:00.000Z"
}
]
}| from required | string The from address of the email message.
The from address will be replaced with an address used for bounce handling.
For raw messages, this must match a |
required | Array of strings or string One or more recipients for the email message.
For raw messages, this must match a |
Array of strings or string One or more CC recipients for the email message.
For raw messages, this must match a | |
| test_mode | boolean Whether to send this message in test mode. This will validate the messge but no actually send it if true. If the server is in test mode then it will always be in test mode regardless of this value. |
| subject | string The subject of the email. This will override any subject set in headers or raw messages. |
Array of strings or string Tags that help filter the messages within the dashboard | |
| plain | string The plain text part of the email message. Either the plain text, html, or markdown parts are required. |
| html | string The HTML part of the email message. Either the plain text, html, or markdown parts are required. |
| markdown | string A markdown body for the email message. The markdown will be
converted to HTML during delivery. If no When combined with Note: This feature is not yet generally available. Contact support to enable it for your account. |
object | |
| priority | string Enum: "standard" "priority" "digest" The delivery priority of the email message: |
Array of objects (MessageAttachment) |
{- "from": "Sender Name <sender@example.com>",
- "to": [
- "Recipient <recipient@example.com>",
- "Another <another@example.com>"
], - "cc": [
- "Carbon Copy <cc@example.com>"
], - "test_mode": false,
- "subject": "Hello from CloudMailin 😃",
- "tags": [
- "api-tag",
- "cloudmailin-tag"
], - "plain": "Hello Plain Text",
- "html": "<h1>Hello Html</h1><p>An inline image: <img src=\"cid:pixel\" alt=\"just a CloudMailin blue pixel\" /></p>",
- "markdown": "# Hello Markdown\n\nThis is a **bold** message with a [link](https://example.com).\n",
- "headers": {
- "x-api-test": "Test",
- "x-additional-header": "Value"
}, - "priority": "standard",
- "attachments": [
- {
- "file_name": "pixel.png",
- "content": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAGklEQVR4nGPwrdpFNmIY1TyqeVTzqOaB1QwAF4tZrw174pgAAAAASUVORK5CYII=",
- "content_type": "image/png",
- "content_id": "pixel"
}
]
}{- "id": "string",
- "from": "Sender Name <sender@example.com>",
- "to": [
- "Recipient <recipient@example.com>",
- "Another <another@example.com>"
], - "cc": [
- "Carbon Copy <cc@example.com>"
], - "test_mode": false,
- "subject": "Hello from CloudMailin 😃",
- "tags": [
- "api-tag",
- "cloudmailin-tag"
]
}Beta — These endpoints are functional but may change without notice. We'd love feedback on what works and what doesn't.
Retrieve sent email messages and their delivery events.
To send messages, use SMTP or the POST /messages endpoint.
This section provides endpoints to retrieve those messages and track delivery status.
Each message has one or more recipients, and each recipient has a series of events tracking the delivery lifecycle (e.g., registration, dispatch, delivery, open, click).
Returns a paginated list of sent messages for the specified outbound account. Messages are ordered newest first.
Messages are created by sending email via SMTP or the POST /messages endpoint.
This endpoint retrieves those messages along with their delivery status.
Each message includes a recipients array showing the current last_event for
each recipient. Use the show endpoint to get full event history.
| outbound_account_id required | string (outboundAccountID) [0-9a-f]{16} Example: outbound_account_id=aaaa111122223333 The outbound account ID (shown as ID/Username in the dashboard) |
| page | integer Deprecated The page of results to return |
| query | string A query string to search the messages for. |
[- {
- "id": "724b9ef2-94ee-4fb0-b722-082204633911",
- "from": "sender@example.com",
- "subject": "Hello from CloudMailin",
- "message_id": "<724b9ef2-94ee-4fb0-b722-082204633911@cloudmta.net>",
- "to": [
- "recipient@example.com"
], - "cc": [ ],
- "tags": [
- "marketing",
- "newsletter"
], - "test_mode": false,
- "created_at": "2019-08-24T14:15:22Z",
- "recipients": [
- {
- "email": "recipient@example.com",
- "last_event": "delivery"
}
]
}
]Returns a sent message with full event history for each recipient.
The recipients array includes an events array showing all delivery events
(e.g., registration, dispatch, delivery, open, click) in chronological order.
Note: Internal events (process, spamd, complaint) are excluded from the response.
| outboundMessageID required | string <uuid> (outboundMessageID) Example: 724b9ef2-94ee-4fb0-b722-082204633911 The CloudMailin outbound message ID (UUID) |
{- "id": "724b9ef2-94ee-4fb0-b722-082204633911",
- "from": "sender@example.com",
- "subject": "Hello from CloudMailin",
- "message_id": "<724b9ef2-94ee-4fb0-b722-082204633911@cloudmta.net>",
- "to": [
- "recipient@example.com"
], - "cc": [ ],
- "tags": [
- "marketing",
- "newsletter"
], - "test_mode": false,
- "created_at": "2019-08-24T14:15:22Z",
- "recipients": [
- {
- "email": "recipient@example.com",
- "last_event": "delivery",
- "events": [
- {
- "kind": "delivery",
- "timestamp": "2019-08-24T14:15:22Z",
- "details": {
- "agent": "DSN",
- "reply_code": "250",
- "delivery_status": "2.0.0",
- "smtp_response": "250 2.0.0 OK",
- "remote_host": "aspmx.l.google.com"
}
}
]
}
]
}Outbound Domains are referred to as Sending Domains in the API.
Before sending email from a domain, you must add it and verify your DNS records.
POST /sending_domains with your domain namePOST /sending_domains/{id}/verify to check the records are in place| page | integer Deprecated The page of results to return |
| query | string The domain to search for, partial domains are accepted. |
[- {
- "id": "aaaa111122223333",
- "domain": "example.com",
- "mta_domain": "mta.example.com",
- "dkim_selector": "0e7c28e2e4cm",
- "dkim_domain": "0e7c28e2e4cm._domainkey.example.com",
- "dkim_public_record": "v=DKIM1; h=sha256; k=rsa; s=email; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzPzZ1k4BjmTZbaS43mhI+HJE2seKeudrExH7kd7YzQ7H0Ci3BBvzQkh6WjUGdibEUOgdo0Mm4VN4H6myc9LvX8qpM+C4MaBNW3hr2kOG/nKSI+Gp0usSj+THc3/4u1+J7IhKBuKaZdj4k5uDKcwKw3uM3RDiwQjppVJvORhuvoMfsGjD296FatQf53j9XExxM4j2ugLnHdhtXtVsGfQb3DoE87Hzc2W6wg7Je3C8eZZ/w9cI2OHBFL3xi39dgwOlbMrLUqTPtvIl+aRMikGS2RZadiGEPnXVS3Ac57ekqprDD7M7Uapyn2a0NX4A/VOtWOFceXSk6iHBbDlM/fO3SwIDAQAB",
- "required_cname": "feedback-smtp.cloudmta.net",
- "dkim_verified": true,
- "return_path_verified": true,
- "spf_verified": true
}
]| domain | string The domain used for sending mail |
{- "domain": "example.com"
}{- "id": "aaaa111122223333",
- "domain": "example.com",
- "mta_domain": "mta.example.com",
- "dkim_selector": "0e7c28e2e4cm",
- "dkim_domain": "0e7c28e2e4cm._domainkey.example.com",
- "dkim_public_record": "v=DKIM1; h=sha256; k=rsa; s=email; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzPzZ1k4BjmTZbaS43mhI+HJE2seKeudrExH7kd7YzQ7H0Ci3BBvzQkh6WjUGdibEUOgdo0Mm4VN4H6myc9LvX8qpM+C4MaBNW3hr2kOG/nKSI+Gp0usSj+THc3/4u1+J7IhKBuKaZdj4k5uDKcwKw3uM3RDiwQjppVJvORhuvoMfsGjD296FatQf53j9XExxM4j2ugLnHdhtXtVsGfQb3DoE87Hzc2W6wg7Je3C8eZZ/w9cI2OHBFL3xi39dgwOlbMrLUqTPtvIl+aRMikGS2RZadiGEPnXVS3Ac57ekqprDD7M7Uapyn2a0NX4A/VOtWOFceXSk6iHBbDlM/fO3SwIDAQAB",
- "required_cname": "feedback-smtp.cloudmta.net",
- "dkim_verified": true,
- "return_path_verified": true,
- "spf_verified": true
}| sendingDomainID required | string (sendingDomainID) [0-9a-f]{16} Example: aaaa111122223333 Identifier, please be aware that the format may change |
{- "id": "aaaa111122223333",
- "domain": "example.com",
- "mta_domain": "mta.example.com",
- "dkim_selector": "0e7c28e2e4cm",
- "dkim_domain": "0e7c28e2e4cm._domainkey.example.com",
- "dkim_public_record": "v=DKIM1; h=sha256; k=rsa; s=email; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzPzZ1k4BjmTZbaS43mhI+HJE2seKeudrExH7kd7YzQ7H0Ci3BBvzQkh6WjUGdibEUOgdo0Mm4VN4H6myc9LvX8qpM+C4MaBNW3hr2kOG/nKSI+Gp0usSj+THc3/4u1+J7IhKBuKaZdj4k5uDKcwKw3uM3RDiwQjppVJvORhuvoMfsGjD296FatQf53j9XExxM4j2ugLnHdhtXtVsGfQb3DoE87Hzc2W6wg7Je3C8eZZ/w9cI2OHBFL3xi39dgwOlbMrLUqTPtvIl+aRMikGS2RZadiGEPnXVS3Ac57ekqprDD7M7Uapyn2a0NX4A/VOtWOFceXSk6iHBbDlM/fO3SwIDAQAB",
- "required_cname": "feedback-smtp.cloudmta.net",
- "dkim_verified": true,
- "return_path_verified": true,
- "spf_verified": true
}Note that a 202 response is expected. Deletion may not happen immediately.
| sendingDomainID required | string (sendingDomainID) [0-9a-f]{16} Example: aaaa111122223333 Identifier, please be aware that the format may change |
{- "id": "aaaa111122223333",
- "domain": "example.com",
- "mta_domain": "mta.example.com",
- "dkim_selector": "0e7c28e2e4cm",
- "dkim_domain": "0e7c28e2e4cm._domainkey.example.com",
- "dkim_public_record": "v=DKIM1; h=sha256; k=rsa; s=email; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzPzZ1k4BjmTZbaS43mhI+HJE2seKeudrExH7kd7YzQ7H0Ci3BBvzQkh6WjUGdibEUOgdo0Mm4VN4H6myc9LvX8qpM+C4MaBNW3hr2kOG/nKSI+Gp0usSj+THc3/4u1+J7IhKBuKaZdj4k5uDKcwKw3uM3RDiwQjppVJvORhuvoMfsGjD296FatQf53j9XExxM4j2ugLnHdhtXtVsGfQb3DoE87Hzc2W6wg7Je3C8eZZ/w9cI2OHBFL3xi39dgwOlbMrLUqTPtvIl+aRMikGS2RZadiGEPnXVS3Ac57ekqprDD7M7Uapyn2a0NX4A/VOtWOFceXSk6iHBbDlM/fO3SwIDAQAB",
- "required_cname": "feedback-smtp.cloudmta.net",
- "dkim_verified": true,
- "return_path_verified": true,
- "spf_verified": true
}| sendingDomainID required | string (sendingDomainID) [0-9a-f]{16} Example: aaaa111122223333 Identifier, please be aware that the format may change |
{- "id": "aaaa111122223333",
- "domain": "example.com",
- "mta_domain": "mta.example.com",
- "dkim_selector": "0e7c28e2e4cm",
- "dkim_domain": "0e7c28e2e4cm._domainkey.example.com",
- "dkim_public_record": "v=DKIM1; h=sha256; k=rsa; s=email; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzPzZ1k4BjmTZbaS43mhI+HJE2seKeudrExH7kd7YzQ7H0Ci3BBvzQkh6WjUGdibEUOgdo0Mm4VN4H6myc9LvX8qpM+C4MaBNW3hr2kOG/nKSI+Gp0usSj+THc3/4u1+J7IhKBuKaZdj4k5uDKcwKw3uM3RDiwQjppVJvORhuvoMfsGjD296FatQf53j9XExxM4j2ugLnHdhtXtVsGfQb3DoE87Hzc2W6wg7Je3C8eZZ/w9cI2OHBFL3xi39dgwOlbMrLUqTPtvIl+aRMikGS2RZadiGEPnXVS3Ac57ekqprDD7M7Uapyn2a0NX4A/VOtWOFceXSk6iHBbDlM/fO3SwIDAQAB",
- "required_cname": "feedback-smtp.cloudmta.net",
- "dkim_verified": true,
- "return_path_verified": true,
- "spf_verified": true
}