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

Create a template

POST/templates
授权
AuthorizationBearer 令牌 · header必填

A BillionSend API key (bs_…).

请求体
必填application/json
namestring必填
最小长度 1 · 最大长度 200
subjectstring | null

"" or null clears the subject

最大长度 998
htmlstring必填

Stored as sent; the dashboard sanitizes at render

最小长度 1 · 最大长度 500000
textstring | null

"" or null clears the text part

最大长度 500000
aliasstring | null

Case-sensitive handle, unique per team; GET /templates/{alias} resolves it

最小长度 1 · 最大长度 100 · 匹配 ^[A-Za-z0-9][A-Za-z0-9._-]*$
fromstring | null

Not supported: any value is a 422

reply_tostring | string[] | null

Not supported: any value is a 422

显示属性
任意项:
string
string
string[]
string 数组
string
null
null
variablesany[]

Not supported: a non-empty list is a 422

响应
200

Template created. Every save through the API is live and publishes a new version, so status is always published. The dashboard editor keeps a working copy and publishes on request, with a version history.

objectstring必填
允许值:template
idstring<uuid>必填
401

Missing, malformed, unknown or revoked API key

statusCodenumber必填
namestring必填
messagestring必填
409

Alias already in use

statusCodenumber必填
namestring必填
messagestring必填
422

Validation error, including from/reply_to/variables (not supported)

statusCodenumber必填
namestring必填
messagestring必填
429

Over the rate limit (rate_limit_exceeded, with Retry-After)

statusCodenumber必填
namestring必填
messagestring必填
试一试
服务器
授权
请求体application/json
请求
curl -X POST 'https://api.billionsend.com/templates' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "subject": "string",
  "html": "string",
  "text": "string",
  "alias": "string",
  "from": "string",
  "reply_to": "string",
  "variables": [
    null
  ]
}'
响应
{
  "object": "template",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
}

这个页面有帮助吗?