Email
Create an email draft
Creates a new outbound email discussion (stream) with a single draft entry, scoped to your company. Returns the streamId and draftUuid needed to send via POST /api/email/send.
Recipient fields (to, cc, bcc) accept an array of { value, label? } objects where value is the email address.
Adding attachments
Attachments must be uploaded to storage before you reference them here — you cannot post file bytes to this endpoint. Upload each file with the three-step direct upload flow, then attach it:
- Get an upload URL — POST /api/files/upload-url with attachEntityType: "channel", attachEntityId set to the same channelId you're emailing from, and the file's name, extension, size, and contentType. It returns { fileId, url, fields }.
- Upload to S3 — send a multipart/form-data POST to url, appending every entry from fields first and the file bytes last as a file field. S3 returns 204.
- Mark complete — POST /api/files/upload-complete with the fileId from step 1.
Then, on this request:
- Regular attachment — add the fileId(s) to attachmentIds.
- Inline image — embed an <img> in the HTML body whose src is the file's download URL (.../cdn/storage/AptlyFiles/<fileId>/original/..., returned by step 3). It is auto-detected and registered; do not also list it in attachmentIds.
Repeat steps 1–3 per file. Each fileId must reference a finished upload or the request is rejected.
post/api/email/create-draft
Request
- Base URLhttps://core-api.getaptly.com
- Auth
- API key in header x-token
- or API key in header Authorization
- or HTTP bearer
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Request body
Response
Draft stream created.
Changes
No recorded changes to this operation across all 1 revision of this API.