SendlySendly
API ReferenceMailboxes

Send a message from a mailbox

POST
/api/mailboxes/{id}/messages

Compose and send a NEW message from a hosted mailbox — a first email to someone, not a reply inside a thread that already exists. It goes out from the mailbox's own address, over its own domain, and the recipient can reply to it.

The sender is the mailbox in the path. There is no from field: a route that sends under a customer's own identity must not take the identity as an argument.

The body is plain text. Sendly renders the HTML part from it, escaping as it goes, so there is one place where text becomes markup and it is inside Sendly. HTML is not accepted.

Bcc recipients are delivered to but appear in no header, which also means the copy filed in the mailbox's Sent folder does not record them.

Refusals worth handling by name:

  • 422 RECIPIENT_SUPPRESSED — one or more recipients are on this project's suppression list. The message names them; remove them or take them off the list.
  • 422 CONTENT_REFUSED — the outbound content scanner refused the message.
  • 503 CONTENT_SCAN_UNAVAILABLE — screening could not reach a verdict for a young project. Nothing was sent; retry shortly.
  • 429 — a mailbox may send 60 messages an hour through this endpoint.

The message is stored as a new conversation on the mailbox, so the reply threads onto it.

Requires the mailboxes:send scope — Write and send new email from your hosted mailboxes, as that address.

Authorization

AuthorizationBearer <token>

API key authentication. Use a sk_* (FULL) or pk_* (SENDING_ONLY) key as the bearer token. Public keys (pk_*) are restricted to the email-send endpoints and the self-serve list subscribe/unsubscribe pair; every other endpoint — event tracking included — answers 403 for them. In scope terms (used by /api/v1/* operations): FULL keys hold every scope; SENDING_ONLY keys hold only emails:send.

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Body for POST /api/mailboxes/{id}/messages — a new outbound message from a hosted mailbox.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/mailboxes/497f6eca-6276-4993-bfeb-53cbbbba6f08/messages" \  -H "Content-Type: application/json" \  -d '{    "to": [      "user@example.com"    ],    "subject": "string",    "body": "string"  }'
{
  "success": true,
  "data": {
    "submitted": true,
    "conversationId": "ee6e55e8-45fe-4a3e-9bc8-4669f9fdf77a",
    "messageId": "8540d774-4863-4d2b-b788-4ecb19412e85"
  }
}
{
  "success": false,
  "error": {
    "message": "string",
    "code": "string",
    "details": {
      "errors": [
        null
      ]
    }
  }
}
{
  "success": false,
  "error": {
    "message": "string",
    "code": "string",
    "details": {
      "errors": [
        null
      ]
    }
  }
}
{
  "success": false,
  "error": {
    "message": "string",
    "code": "string",
    "details": {
      "errors": [
        null
      ]
    }
  }
}
{
  "success": false,
  "error": {
    "message": "string",
    "code": "string",
    "details": {
      "errors": [
        null
      ]
    }
  }
}
{
  "success": false,
  "error": {
    "message": "string",
    "code": "string",
    "details": {
      "errors": [
        null
      ]
    }
  }
}
{
  "success": false,
  "error": {
    "message": "string",
    "code": "string",
    "details": {
      "errors": [
        null
      ]
    }
  }
}
{
  "success": false,
  "error": {
    "message": "string",
    "code": "string",
    "details": {
      "errors": [
        null
      ]
    }
  }
}
{
  "success": false,
  "error": {
    "message": "string",
    "code": "string",
    "details": {
      "errors": [
        null
      ]
    }
  }
}
{
  "success": false,
  "error": {
    "message": "string",
    "code": "string",
    "details": {
      "errors": [
        null
      ]
    }
  }
}