Skip to Content

Create a draft

Saves a draft of a new message, or of a reply when `inReplyToMessageId` names a message in the mailbox, and returns it with status 201.

POST
/v1/mailboxes/{id}/drafts

Saves a draft of a new message, or of a reply when inReplyToMessageId names a message in the mailbox, and returns it with status 201. A phone channel's draft holds a recipient number and text. Send it with POST /v1/mailboxes/{id}/drafts/{draftId}/send.

Authorization

apiKey
headerx-api-key<token>

Path Parameters

id*string
Match^mbx_[0-9a-hjkmnp-tv-z]{16,24}$

Request Body

application/json
  1. body
channel?|null
endpointId?|null
to?array<string>|null
cc?array<string>|null
bcc?array<string>|null
replyTo?array<string>|null
subject?string|null
text?string|null
html?string|null
attachments?array<>|null
inReplyToMessageId?|null

Response Body

Success

application/json
  1. response
id*MailboxDraftId
Match^mdraft_[0-9a-hjkmnp-tv-z]{16,24}$
channel*"email"
Value in"email"
threadId*|null
inReplyToMessageId*|null
state*MailboxDraftState
Value in"saved""locked""sent"
lockedByActionId*|null
to*array<string>
subject*string|null
createdAt*string
updatedAt*string
revision*integer
Range1 <= value <= 9007199254740991
endpointId*|null
cc*array<string>
bcc*array<string>
replyTo*array<string>
html*string|null
text*string|null
attachments*array<>
Itemsitems <= 10
Example Request
import { createClient } from "samva";

const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });

const result = await samva.mailboxes.createDraft({
  "id": "example"
});
Example Response
{
  "id": "string",
  "channel": "email",
  "threadId": "string",
  "inReplyToMessageId": "string",
  "state": "saved",
  "lockedByActionId": "string",
  "to": [
    "string"
  ],
  "subject": "string",
  "createdAt": "string",
  "updatedAt": "string",
  "revision": 1,
  "endpointId": "string",
  "cc": [
    "string"
  ],
  "bcc": [
    "string"
  ],
  "replyTo": [
    "string"
  ],
  "html": "string",
  "text": "string",
  "attachments": [
    {
      "filename": "string",
      "content": "string",
      "mediaId": "string",
      "contentType": "string",
      "size": 1
    }
  ]
}

Related documentation