跳到内容
Esc
↑↓导航↵打开⌘J预览

Send an email from an inbox

Sends a new conversation from the inbox address in one call (to, subject, html and/or text, optional cc, bcc and attachments as POST /emails takes them). It runs the same rules as a reply: an inbox that may not start conversations, a first-time recipient past the ramp, or requires_approval: true keeps it as a draft for a person to approve and the answer is 202 with the Draft. Accepts an Idempotency-Key. An inbox on the shared domain takes no attachments.

POST/inboxes/{inbox_id}/emails
授权
AuthorizationBearer 令牌 · header必填

A BillionSend API key (bs_…).

路径参数
inbox_idstring必填

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

标头参数
Idempotency-Keystring

1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request.

最小长度 1 · 最大长度 256
请求体
必填application/json
tostring | string[]必填

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

显示属性
任意项:
string
string
string[]
string 数组
string
ccstring | string[]

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

显示属性
任意项:
string
string
string[]
string 数组
string
bccstring | string[]

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

显示属性
任意项:
string
string
string[]
string 数组
string
subjectstring必填

1-2000 characters on one line

htmlstring

HTML body

textstring

Plain-text body

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

显示属性
object 数组
filenamestring | boolean | null
显示属性
任意项:
string
string
boolean
boolean
null
null
contentstring
content_typestring
content_idstring

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

最小长度 1 · 最大长度 255
pathstring
headersany

Not supported: only an empty value is accepted, anything else answers 422

requires_approvalboolean

BillionSend extension: hold the email as a draft that a person approves (202 with the Draft)

响应
200

Sent

idstring<uuid>必填

The ID of the sent email: GET /emails/{id} reads it

thread_idstring<uuid> | null必填

BillionSend extension: the thread the email was sent in

202

Held for approval

objectstring必填
允许值:inbox_draft
idstring<uuid>必填
typestring必填
允许值:standalonereply
tostring[] | null必填
ccstring[]必填
bccstring[]必填
subjectstring | null必填
htmlstring | null必填
textstring | null必填
thread_idstring<uuid> | null必填
reply_to_email_idstring<uuid> | null必填
email_idstring<uuid> | null必填
created_atstring必填
updated_atstring必填
attachmentsobject[]必填

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

显示属性
object 数组
idstring必填
filenamestring必填
content_typestring必填
sizeinteger必填
statusstring必填
允许值:draftpending_approvalsentrejectedexpired
approval_reasonsstring[]必填
forwardboolean必填
decided_bystring | null必填
decided_atstring | null必填
expires_atstring | null必填
send_atstring | null必填

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

send_errorstring | null必填

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

statusCodenumber必填
namestring必填
messagestring必填
403

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

statusCodenumber必填
namestring必填
messagestring必填
404

Not found

statusCodenumber必填
namestring必填
messagestring必填
409

Idempotency conflict, or a draft already sent

statusCodenumber必填
namestring必填
messagestring必填
422

Validation error

statusCodenumber必填
namestring必填
messagestring必填
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)

statusCodenumber必填
namestring必填
messagestring必填
试一试
服务器
授权
参数
请求体application/json
请求
curl -X POST 'https://api.billionsend.com/inboxes/string/emails' \
  -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"
    }
  ],
  "headers": null,
  "requires_approval": true
}'
响应
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "thread_id": "1de43264-67cb-48af-89f9-e865c375bb84"
}

这个页面有帮助吗?