Send an email
Sends an outbound email scoped to your company. Two usage patterns:
userId and channelId are required on every call.
From an existing draft — also provide discussionId and uuid returned by POST /api/email/create-draft. The draft's stored recipients, subject, and body are used.
On-the-fly — omit uuid and provide userId, channelId, recipients, subject, and body. A draft is created automatically before sending. Supplying discussionId (without uuid) sends the message as a reply into that existing thread — the thread's subject is kept; omitting both discussionId and uuid starts a new thread.
Adding attachments
Attachments apply to the on-the-fly pattern (for an existing draft, attach files when you call POST /api/email/create-draft). Upload each file with the three-step direct upload flow first — you cannot post file bytes to this endpoint:
- Get an upload URL — POST /api/files/upload-url with attachEntityType: "channel", attachEntityId set to the same channelId you're sending from, and the file's name, extension, size, and contentType. Returns { fileId, url, fields }.
- Upload to S3 — multipart/form-data POST to url, all fields first then the file bytes last as a file field. S3 returns 204.
- Mark complete — POST /api/files/upload-complete with the fileId.
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/...). Auto-detected and registered; do not also list it in attachmentIds.
Each fileId must reference a finished upload.
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
Email sent successfully.
Changes
No recorded changes to this operation across all 1 revision of this API.