Skip to content

POST · Bearer

POST /api/v1/inboxes/:id/messages

Summary

Send Internet mail via Cloudflare Email Sending, falling through to Resend on Cloudflare auth/permission errors, from username@cooperemail.com. Accepts text, html, cc, bcc, reply_to, headers, labels, and attachments [{filename, content_type, content_base64, content_id?}]. in_reply_to may be a msg_ id: the wire In-Reply-To uses that message's Message-ID and the send keeps its thread_id. Any other in_reply_to value is sent as-is. Inline images use content_id and cid: in HTML. A paused inbox returns 403 inbox_paused and does not send or count the attempt. A new Free account past its warmup cap returns HTTP 429 new_account_send_limit and does not send or store the message. A suspended account returns HTTP 403 account_suspended. A high trailing 7-day bounce or complaint rate returns HTTP 403 sending_paused and does not send or store the message. Sending resumes automatically when the trailing 7-day rate falls below the pause threshold. The error includes sending, the same object as GET /api/v1/sending-status. Allow and block lists are checked before the provider is called. HTTP 403 recipient_blocked means nothing is sent, stored, or counted. HTTP 403 recipient_suppressed means the address is on the suppression list and nothing is sent, stored, or counted. Outbound JSON includes delivery_events. Progress email to a verified owner is exempt from allow and block lists, and owner confirmation and progress mail are not checked against the suppression list. If no sending credential is usable, the API returns HTTP 503 smtp_not_configured — Cooper does not fake a send. Idempotency-Key is optional (example: Idempotency-Key: send-001). It is 1 to 256 characters of letters, digits, and - . _ ~. The same key and the same request within 24 hours returns HTTP 200 with idempotent true and Idempotent-Replayed: true and does not send again. A different request with that key is 409 idempotency_key_conflict. A second call while the first is still running is 409 idempotency_request_in_progress. An empty or invalid key is 400 invalid_idempotency_key. A definitive refusal removes the key. An ambiguous failure keeps it and the same request returns HTTP 409 idempotency_outcome_unknown. When client_id is also set, client_id is checked first. The daily cron deletes keys after 24 hours. When usage is at 80 percent of a plan limit, the response includes notices. include_signature defaults to true. false sends this message without the inbox signature. When a signature is set, plain text gains a blank line, a line of two dashes and a space, and the signature text after the caller's content and before any quoted original. HTML gains a div with class cooper-signature in the same place. A body that already contains the signature text is sent as written. The stored message matches what was sent. Sign-in mail, owner alerts, and approval requests are not signed. HTTP 422 outbound_spam_blocked includes reasons when outbound spam enforcement blocks the send. Nothing is sent or stored. A reply to a thread the recipient started is exempt. OTP-Token must be one header with a quoted code and a canonical https origin, for example "123456"; origin="https://example.com". A bad value is HTTP 400 invalid_headers and nothing is sent. Cloudflare Email Sending carries that header. A custom header Cloudflare would drop is sent on the configured fallback path. When only Cloudflare is configured, that send is HTTP 400 invalid_headers. From, To, Subject, Reply-To, and Message-ID stay on their existing path.

Request

{
  "to": [
    "ada@example.com"
  ],
  "subject": "Hello",
  "text": "Tuesday works.",
  "html": "<p>Tuesday works.</p><img src=\"cid:logo\" alt=\"\" />",
  "attachments": [
    {
      "filename": "logo.png",
      "content_type": "image/png",
      "content_base64": "iVBORw0KGgo…",
      "content_id": "logo"
    }
  ],
  "client_id": "send-001"
}

Response

HTTP 200. Sample values illustrate the schema.

{
  "id": "msg_example",
  "inbox_id": "inb_example",
  "thread_id": "thr_example",
  "folder": "inbox",
  "direction": "outbound",
  "from": "ada@example.com",
  "to": [
    "string"
  ],
  "subject": "Hello",
  "text": "Tuesday works.",
  "html": null,
  "extracted_text": "string",
  "alias": null,
  "aliases": [
    "string"
  ],
  "extracted_html": "string",
  "preview": "string",
  "verification": {
    "codes": [
      "string"
    ],
    "links": [
      {
        "url": "https://example.com/hooks/cooper",
        "text": "Tuesday works."
      }
    ]
  },
  "delivery_events": [
    {
      "type": "string",
      "recipient": "string",
      "created_at": "2026-10-18T12:00:00.000Z",
      "detail": "string"
    }
  ],
  "cc": [
    "string"
  ],
  "bcc": [
    "string"
  ],
  "reply_to": null,
  "in_reply_to": null,
  "references": [
    "string"
  ],
  "labels": [
    "string"
  ],
  "auth": {
    "spf": null,
    "dkim": null,
    "dmarc": null
  }
}

Errors

  • HTTP 403 inbox_paused
  • HTTP 429 new_account_send_limit
  • HTTP 403 account_suspended
  • HTTP 403 sending_paused
  • HTTP 403 recipient_blocked
  • HTTP 403 recipient_suppressed
  • HTTP 503 smtp_not_configured
  • HTTP 409 idempotency_key_conflict
  • HTTP 409 idempotency_request_in_progress
  • HTTP 400 invalid_idempotency_key
  • HTTP 409 idempotency_outcome_unknown
  • HTTP 422 outbound_spam_blocked
  • HTTP 400 invalid_headers

Idempotency

Idempotency-Key is 1 to 256 characters of letters, digits, and - . _ ~. The same key and the same request within 24 hours returns the original response with HTTP 200 and Idempotent-Replayed: true. A different request is HTTP 409 idempotency_key_conflict. A second call while the first is running is HTTP 409 idempotency_request_in_progress. An empty or invalid key is HTTP 400 invalid_idempotency_key. A definitive refusal removes the key. An ambiguous failure keeps it and the same request returns HTTP 409 idempotency_outcome_unknown. client_id is checked first when both are set. Done keys expire after 24 hours. Unknown keys are kept for 7 days.