Skip to main content
POST
/
send
Send an Email
curl --request POST \
  --url https://api.mailchannels.net/tx/v1/send \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <x-api-key>' \
  --data '
{
  "content": [
    {
      "type": "<string>",
      "value": "<string>"
    }
  ],
  "from": {
    "email": "<string>",
    "name": "<string>"
  },
  "personalizations": [
    {
      "to": [
        {
          "email": "<string>",
          "name": "<string>"
        }
      ],
      "bcc": [
        {
          "email": "<string>",
          "name": "<string>"
        }
      ],
      "cc": [
        {
          "email": "<string>",
          "name": "<string>"
        }
      ],
      "dkim_domain": "<string>",
      "dkim_private_key": "<string>",
      "dkim_selector": "<string>",
      "dynamic_template_data": {},
      "headers": {},
      "subject": "<string>"
    }
  ],
  "subject": "<string>",
  "attachments": [
    {
      "content": "<string>",
      "filename": "<string>",
      "type": "<string>"
    }
  ],
  "campaign_id": "<string>",
  "dkim_domain": "<string>",
  "dkim_private_key": "<string>",
  "dkim_selector": "<string>",
  "headers": {},
  "tracking_settings": {
    "click_tracking": {
      "enable": false
    },
    "open_tracking": {
      "enable": false
    }
  },
  "transactional": true
}
'
{
  "data": [
    "<string>"
  ]
}

Headers

X-Api-Key
string
required

Query Parameters

dry-run
boolean

When present and set to true, the message will not be sent. Instead, the fully rendered message is returned. This can be useful for testing.

Body

application/json
content
object[]
required
from
object
required
personalizations
object[]
required
Maximum array length: 1000
subject
string
required
attachments
object[]
Maximum array length: 1000
campaign_id
string

The campaign identifier. If specified, this ID will be included in all relevant webhooks. It can be up to 48 UTF-8 characters long and must not contain spaces.

dkim_domain
string

If set, you must also provide the matching dkim_selector.

dkim_private_key
string

Encoded in Base64. If set, you must also provide the matching dkim_domain and dkim_selector.

dkim_selector
string

If set without a matching dkim_domain, the domain will be taken from the from email address.

envelope_from
object

Optional envelope sender address. If not set, the envelope sender defaults to the from.email field. Can be overridden per-personalization. Only the email portion is used; the name field is ignored.

headers
object

A JSON object containing key-value pairs, where both keys (header names) and values must be strings. These pairs represent custom headers to be substituted. Please note the following restrictions and behavior:

  • Reserved headers: The following headers cannot be modified:
    • Authentication-Results
    • BCC
    • CC
    • Content-Transfer-Encoding
    • Content-Type
    • DKIM-Signature
    • From
    • Message-ID
    • Received
    • Reply-To
    • Subject
    • To
  • Header precedence: If a header is defined in both the personalizations object and the root headers, the value from personalizations will be used.
  • Case sensitivity: Headers are treated as case-insensitive. If multiple headers differ only by case, only one will be used, with no guarantee of which one.
reply_to
object
tracking_settings
object

Settings to adjust open and click tracking for the message. Please note that enabling tracking for your messages requires a subscription that supports open and click tracking.

transactional
boolean | null
default:true

Mark these messages as transactional or non-transactional. In order for a message to be marked as non-transactional, it must have exactly one recipient per personalization, and it must be DKIM signed. 400 Bad Request will be returned if there are more than one recipient in any personalization for non-transactional messages. If a message is marked as non-transactional, it changes the sending process as follows:

  • List-Unsubscribe headers will be added.

Response

Success. Returned if dry-run is present in the query

data
string[]

a string representation of a rendered message, one per personalization in the request