Skip to main content
POST
/
email
/
drafts
cURL
curl --request POST \
  --url https://api.useanima.sh/v1/email/drafts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "agentId": "<string>",
  "fromIdentityId": "<string>",
  "to": [],
  "cc": [],
  "bcc": [],
  "subject": "<string>",
  "body": "<string>",
  "bodyHtml": "<string>",
  "inReplyTo": "<string>",
  "references": [],
  "metadata": {}
}
'
{
  "id": "<string>",
  "agentId": "<string>",
  "orgId": "<string>",
  "fromIdentityId": "<string>",
  "to": [
    "<string>"
  ],
  "cc": [
    "<string>"
  ],
  "bcc": [
    "<string>"
  ],
  "subject": "<string>",
  "body": "<string>",
  "bodyHtml": "<string>",
  "inReplyTo": "<string>",
  "references": [
    "<string>"
  ],
  "metadata": {},
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

JWT Bearer token obtained from authentication. Pass as: Authorization: Bearer

Body

application/json

Request body for creating an email draft

agentId
string
required

Owning agent ID

Pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
fromIdentityId
string

Optional EmailIdentity ID to send from. Must belong to this agent and be verified.

Pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
to
string[]

Recipient email addresses (may be empty for an incomplete draft)

cc
string[]

CC recipients

bcc
string[]

BCC recipients

subject
string

Subject line

body
string

Plain-text body

bodyHtml
string

HTML body

inReplyTo
string

Optional In-Reply-To header for threading on send

references
string[]

Optional References chain for threading

metadata
object

Arbitrary metadata

Response

200 - application/json

OK

Email draft resource

id
string
required

Unique identifier of the draft

Pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
agentId
string
required

Owning agent ID

Pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
orgId
string
required

Owning organization ID

Pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
fromIdentityId
string | null
required

EmailIdentity used as the sender, or null to use the agent's primary identity at send time

Pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
to
string[]
required

Recipient email addresses

cc
string[]
required

CC recipient email addresses

bcc
string[]
required

BCC recipient email addresses

subject
string | null
required

Subject line, or null if not yet written

body
string | null
required

Plain-text body, or null if not yet written

bodyHtml
string | null
required

HTML body, or null if not provided

inReplyTo
string | null
required

Optional In-Reply-To Message-ID for threading on send

references
string[]
required

Optional References Message-ID chain for threading

metadata
object | null
required

Arbitrary metadata

createdAt
string<date-time>
required

Timestamp when the draft was created

updatedAt
string<date-time>
required

Timestamp when the draft was last updated