Pular para o conteúdo
Esc
↑↓navegar↵abrir⌘Jpré-visualizar

Create a draft

A standalone draft, or with thread_id and reply_to_email_id a reply draft in that thread. One unsent reply draft per email: creating another answers 200 with the existing one. A reply draft copies no recipients; set to before sending. attachments are kept encrypted with the draft until it is sent, rejected, expired or deleted. Nothing is sent until POST /inboxes/{inbox_id}/drafts/{draft_id}/send, or until send_at (BillionSend extension) when it is given: the draft is then sent as the caller at that time, through every rule and limit, and must have a recipient. With send_at, a reply draft for an email that already has one answers 409 instead of the existing draft.

POST/inboxes/{inbox_id}/drafts
Autorização
AuthorizationToken Bearer · headerobrigatório

A BillionSend API key (bs_…).

Parâmetros de caminho
inbox_idstringobrigatório

The inbox ID or its email address, such as support@example.com

Corpo da requisição
application/json
tostring | string[] | null

An address or a list of them; "Name <address>" works too

Mostrar propriedades
Pelo menos um de:
string
string
string[]
Array de string
string
null
null
ccstring | string[] | null

An address or a list of them; "Name <address>" works too

Mostrar propriedades
Pelo menos um de:
string
string
string[]
Array de string
string
null
null
bccstring | string[] | null

An address or a list of them; "Name <address>" works too

Mostrar propriedades
Pelo menos um de:
string
string
string[]
Array de string
string
null
null
subjectstring | null
htmlstring | null
textstring | null
attachmentsobject[] | null

Files with base64 content (no remote paths), 10 MiB decoded in all; none on the shared domain. A held send keeps them with its draft

Mostrar propriedades
Array de object
filenamestring | boolean | null
Mostrar propriedades
Pelo menos um de:
string
string
boolean
boolean
null
null
contentstring
content_typestring
content_idstring

Inline part: the HTML shows it with <img src="cid:<content_id>">

comprimento mín. 1 · comprimento máx. 255
pathstring
send_atstring | null

BillionSend extension: send the draft at this time, as the caller, within 30 days: an ISO 8601 datetime with offset (e.g. "2026-09-01T12:00:00Z") or a relative time like "in 2 hours". A past time sends it within a minute; null cancels. The send runs every rule and limit then; a refused one leaves the draft unsent with send_error set and fires inbox.draft.send_failed. A draft waiting for approval cannot be scheduled (409)

thread_idstring<uuid>

With reply_to_email_id: a reply draft in this thread

reply_to_email_idstring<uuid>

The email of the thread the draft answers

Respostas
200

The existing reply draft

objectstringobrigatório
Valores permitidos:inbox_draft
idstring<uuid>obrigatório
typestringobrigatório
Valores permitidos:standalonereply
tostring[] | nullobrigatório
ccstring[]obrigatório
bccstring[]obrigatório
subjectstring | nullobrigatório
htmlstring | nullobrigatório
textstring | nullobrigatório
thread_idstring<uuid> | nullobrigatório
reply_to_email_idstring<uuid> | nullobrigatório
email_idstring<uuid> | nullobrigatório
created_atstringobrigatório
updated_atstringobrigatório
attachmentsobject[]obrigatório

The draft's files, by position; empty once it is sent, rejected or expired

Mostrar propriedades
Array de object
idstringobrigatório
filenamestringobrigatório
content_typestringobrigatório
sizeintegerobrigatório
statusstringobrigatório
Valores permitidos:draftpending_approvalsentrejectedexpired
approval_reasonsstring[]obrigatório
forwardbooleanobrigatório
decided_bystring | nullobrigatório
decided_atstring | nullobrigatório
expires_atstring | nullobrigatório
send_atstring | nullobrigatório

BillionSend extension: when the scheduled send goes out; null when not scheduled

send_errorstring | nullobrigatório

BillionSend extension: the error name of the last scheduled send that was refused (e.g. invalid_api_key, inbox_send_cap_reached, not_found); null otherwise

201

Created

objectstringobrigatório
Valores permitidos:inbox_draft
idstring<uuid>obrigatório
typestringobrigatório
Valores permitidos:standalonereply
tostring[] | nullobrigatório
ccstring[]obrigatório
bccstring[]obrigatório
subjectstring | nullobrigatório
htmlstring | nullobrigatório
textstring | nullobrigatório
thread_idstring<uuid> | nullobrigatório
reply_to_email_idstring<uuid> | nullobrigatório
email_idstring<uuid> | nullobrigatório
created_atstringobrigatório
updated_atstringobrigatório
attachmentsobject[]obrigatório

The draft's files, by position; empty once it is sent, rejected or expired

Mostrar propriedades
Array de object
idstringobrigatório
filenamestringobrigatório
content_typestringobrigatório
sizeintegerobrigatório
statusstringobrigatório
Valores permitidos:draftpending_approvalsentrejectedexpired
approval_reasonsstring[]obrigatório
forwardbooleanobrigatório
decided_bystring | nullobrigatório
decided_atstring | nullobrigatório
expires_atstring | nullobrigatório
send_atstring | nullobrigatório

BillionSend extension: when the scheduled send goes out; null when not scheduled

send_errorstring | nullobrigatório

BillionSend extension: the error name of the last scheduled send that was refused (e.g. invalid_api_key, inbox_send_cap_reached, not_found); null otherwise

401

Missing, malformed, unknown or revoked API key

statusCodenumberobrigatório
namestringobrigatório
messagestringobrigatório
403

Restricted API key, the inbox's or the shared domain's rules, or held mail

statusCodenumberobrigatório
namestringobrigatório
messagestringobrigatório
404

Not found

statusCodenumberobrigatório
namestringobrigatório
messagestringobrigatório
409

Idempotency conflict, or a draft already sent

statusCodenumberobrigatório
namestringobrigatório
messagestringobrigatório
422

Validation error

statusCodenumberobrigatório
namestringobrigatório
messagestringobrigatório
429

The inbox's daily send limit, or the team's daily limit for mail from the shared domain, or the rate limit (rate_limit_exceeded, with Retry-After)

statusCodenumberobrigatório
namestringobrigatório
messagestringobrigatório
Experimentar
Servidor
Autorização
Parâmetros
Corpoapplication/json
Requisição
curl -X POST 'https://api.billionsend.com/inboxes/string/drafts' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "to": "string",
  "cc": "string",
  "bcc": "string",
  "subject": "string",
  "html": "string",
  "text": "string",
  "attachments": [
    {
      "filename": "string",
      "content": "string",
      "content_type": "string",
      "content_id": "string",
      "path": "string"
    }
  ],
  "send_at": "string",
  "thread_id": "1de43264-67cb-48af-89f9-e865c375bb84",
  "reply_to_email_id": "5e00f13a-4994-422b-8a76-6ae8ac072852"
}'
Resposta
{
  "object": "inbox_draft",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "type": "standalone",
  "to": [
    "string"
  ],
  "cc": [
    "string"
  ],
  "bcc": [
    "string"
  ],
  "subject": "string",
  "html": "string",
  "text": "string",
  "thread_id": "1de43264-67cb-48af-89f9-e865c375bb84",
  "reply_to_email_id": "5e00f13a-4994-422b-8a76-6ae8ac072852",
  "email_id": "8e6bf5ae-e456-4654-87f8-33e2156caffc",
  "created_at": "string",
  "updated_at": "string",
  "attachments": [
    {
      "id": "string",
      "filename": "string",
      "content_type": "string",
      "size": 0
    }
  ],
  "status": "draft",
  "approval_reasons": [
    "string"
  ],
  "forward": true,
  "decided_by": "string",
  "decided_at": "string",
  "expires_at": "string",
  "send_at": "string",
  "send_error": "string"
}

Esta página foi útil?