REST API
The REST API allows you to send emails from any application using standard HTTP requests. Use it from any backend, serverless function, or CI/CD pipeline — no Cloudflare Workers binding is required.
For the full OpenAPI specification, refer to the Email Sending API reference ↗.
POST https://api.cloudflare.com/client/v4/accounts/{account_id}/email/sending/sendAuthenticate with a Cloudflare API token that has permission to send emails. Include it in the Authorization header:
Authorization: Bearer <API_TOKEN>curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/email/sending/send" \ --header "Authorization: Bearer <API_TOKEN>" \ --header "Content-Type: application/json" \ --data '{ "to": "recipient@example.com", "from": "welcome@yourdomain.com", "subject": "Welcome to our service!", "html": "<h1>Welcome!</h1><p>Thanks for signing up.</p>", "text": "Welcome! Thanks for signing up." }'curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/email/sending/send" \ --header "Authorization: Bearer <API_TOKEN>" \ --header "Content-Type: application/json" \ --data '{ "to": ["user1@example.com", "user2@example.com"], "from": { "address": "newsletter@yourdomain.com", "name": "Newsletter Team" }, "subject": "Monthly Newsletter", "html": "<h1>This month'\''s updates</h1>", "text": "This month'\''s updates" }'curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/email/sending/send" \ --header "Authorization: Bearer <API_TOKEN>" \ --header "Content-Type: application/json" \ --data '{ "to": "customer@example.com", "cc": ["manager@company.com"], "bcc": ["archive@company.com"], "from": "orders@yourdomain.com", "reply_to": "support@yourdomain.com", "subject": "Order Confirmation #12345", "html": "<h1>Your order is confirmed</h1>", "text": "Your order is confirmed" }'Send files by including base64-encoded content in the attachments array:
curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/email/sending/send" \ --header "Authorization: Bearer <API_TOKEN>" \ --header "Content-Type: application/json" \ --data '{ "to": "customer@example.com", "from": "invoices@yourdomain.com", "subject": "Your Invoice", "html": "<h1>Invoice attached</h1><p>Please find your invoice attached.</p>", "attachments": [ { "content": "JVBERi0xLjQKJeLjz9MK...", "filename": "invoice-12345.pdf", "type": "application/pdf", "disposition": "attachment" } ] }'Set custom headers for threading, list management, or tracking. Refer to the email headers reference for the full list of allowed headers.
curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/email/sending/send" \ --header "Authorization: Bearer <API_TOKEN>" \ --header "Content-Type: application/json" \ --data '{ "to": "user@example.com", "from": "notifications@yourdomain.com", "subject": "Your weekly digest", "html": "<h1>Weekly Digest</h1>", "headers": { "List-Unsubscribe": "<https://yourdomain.com/unsubscribe?id=abc123>", "List-Unsubscribe-Post": "List-Unsubscribe=One-Click", "X-Campaign-ID": "weekly-digest-2026-03" } }'A successful response returns the delivery status for each recipient:
{ "success": true, "errors": [], "messages": [], "result": { "delivered": ["recipient@example.com"], "permanent_bounces": [], "queued": [] }}delivered- Email addresses to which the message was delivered immediatelypermanent_bounces- Email addresses that permanently bouncedqueued- Email addresses for which delivery was queued for later
The REST API returns standard Cloudflare API error responses. A failed request returns an errors array with numeric error codes and machine-readable messages:
{ "success": false, "errors": [ { "code": 10001, "message": "email.sending.error.invalid_request_schema" } ], "messages": [], "result": null}Common REST API error codes:
| HTTP Status | Code | Message | Description |
|---|---|---|---|
| 400 | 10001 | email.sending.error.invalid_request_schema | Invalid request format |
| 400 | 10200 | email.sending.error.email.invalid | Invalid email content |
| 400 | 10201 | email.sending.error.email.no_content_length | Missing content length |
| 400 | 10202 | email.sending.error.email.too_big | Email exceeds size limit |
| 403 | 10203 | email.sending.error.email.sending_disabled | Sending disabled for this zone/account |
| 429 | 10004 | email.sending.error.throttled | Rate limit exceeded |
| 500 | 10002 | email.sending.error.internal_server | Internal server error |
- Refer to the Email Sending API reference ↗ for the full request and response schemas.
- See the Workers API for sending emails directly from Cloudflare Workers using bindings.
- Review email headers for threading, list management, and custom tracking headers.