Skip to content
Start here

Send an email

POST/accounts/{account_id}/email/sending/send

Send an email for the specified account using the structured builder. Provide the sender, recipients, subject, and at least one of text or html; attachments are optional.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Path ParametersExpand Collapse
account_id: string

Identifier of the account.

Body ParametersJSONExpand Collapse
body:
ReturnsExpand Collapse
errors: array of object { code, message }
code: number
message: string
messages: array of object { code, message }
code: number
message: string
result: object { delivered, message_id, permanent_bounces, 2 more }
delivered: array of string

Email addresses to which the message was delivered immediately.

message_id: string

Message ID of the sent email.

permanent_bounces: array of string

Email addresses that permanently bounced.

queued: array of string

Email addresses for which delivery was queued for later.

suppressed_recipients: array of string

Email addresses dropped because they are on the suppression list. Returned when suppressed-recipient dropping is enabled for the sending subdomain; otherwise the request fails instead.

success: true
result_info: optional object { count, per_page, total_count, 2 more }
count: number
per_page: number
total_count: number
cursor: optional string
page: optional number

Send an email

curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/email/sending/send \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
    -d '{
          "attachments": [
            {
              "content": "JVBERi0xLjQK...",
              "disposition": "attachment",
              "filename": "report.pdf",
              "type": "application/pdf"
            }
          ],
          "from": "sender@example.com",
          "html": "<h1>Hello</h1><p>Please find your report attached.</p>",
          "subject": "Monthly Report",
          "text": "Hello\\n\\nPlease find your report attached.",
          "to": [
            "recipient@example.com"
          ],
          "bcc": [
            "bcc-recipient@example.com"
          ],
          "cc": [
            "cc-recipient@example.com"
          ],
          "headers": {
            "X-Custom-Header": "value"
          },
          "reply_to": "replies@example.com"
        }'
{
  "errors": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "result": {
    "delivered": [
      "recipient@example.com"
    ],
    "message_id": "<aB3xK9mP2qR5sT8uV0wX1yZ4cD6fG7hJ9kL0@example.com>",
    "permanent_bounces": [
      "string"
    ],
    "queued": [
      "string"
    ],
    "suppressed_recipients": [
      "string"
    ]
  },
  "success": true,
  "result_info": {
    "count": 0,
    "per_page": 0,
    "total_count": 0,
    "cursor": "cursor",
    "page": 0
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "result": {
    "delivered": [
      "recipient@example.com"
    ],
    "message_id": "<aB3xK9mP2qR5sT8uV0wX1yZ4cD6fG7hJ9kL0@example.com>",
    "permanent_bounces": [
      "string"
    ],
    "queued": [
      "string"
    ],
    "suppressed_recipients": [
      "string"
    ]
  },
  "success": true,
  "result_info": {
    "count": 0,
    "per_page": 0,
    "total_count": 0,
    "cursor": "cursor",
    "page": 0
  }
}