Send an email
const url = 'https://api.siprtc.io/v1/Accounts/AC000000000000000000/SendEmail';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"attachments":[{"content":"JVBERi0xLjcK","content_type":"application/pdf","file_id":"invoice-1001","name":"invoice-1001.pdf","url":"https://files.example.com/invoice-1001.pdf"}],"bcc":["archive@example.com"],"cc":["manager@example.com"],"email":"customer@example.net","emailBody":"","email_type":"send","from":"support@example.com","headers":{"X-Campaign":"november"},"html_body":"<p>Hello, your invoice is attached.</p>","idempotency_key":"","message_id":"<CAF0000000000000000000000000@mail.example.com>","reply_to":"replies@example.com","status_callback":"https://example.com/email/status","subject":"Your invoice","template_id":"","text_body":"Hello, your invoice is attached.","thread":{"in_reply_to":"<CAF0000000000000000000000000@mail.example.com>","references":["<CAF0000000000000000000000000@mail.example.com>"]},"to":["customer@example.net"],"vars":{}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.siprtc.io/v1/Accounts/AC000000000000000000/SendEmail \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "attachments": [ { "content": "JVBERi0xLjcK", "content_type": "application/pdf", "file_id": "invoice-1001", "name": "invoice-1001.pdf", "url": "https://files.example.com/invoice-1001.pdf" } ], "bcc": [ "archive@example.com" ], "cc": [ "manager@example.com" ], "email": "customer@example.net", "emailBody": "", "email_type": "send", "from": "support@example.com", "headers": { "X-Campaign": "november" }, "html_body": "<p>Hello, your invoice is attached.</p>", "idempotency_key": "", "message_id": "<CAF0000000000000000000000000@mail.example.com>", "reply_to": "replies@example.com", "status_callback": "https://example.com/email/status", "subject": "Your invoice", "template_id": "", "text_body": "Hello, your invoice is attached.", "thread": { "in_reply_to": "<CAF0000000000000000000000000@mail.example.com>", "references": [ "<CAF0000000000000000000000000@mail.example.com>" ] }, "to": [ "customer@example.net" ], "vars": {} }'Queues an email for sending through one of your account’s email mailboxes. from must be the SMTP user (address) of an email mailbox configured on your account: the email is sent through that mailbox’s SMTP server with its credentials (port 465 uses TLS, other ports STARTTLS when offered). SIPRTC does not verify sending domains; deliverability depends on the mailbox’s provider.
Recipients: to (or email for a single address) must hold at least one address containing “@”; entries without “@” and duplicates are dropped, also from cc and bcc, which may be arrays or one comma/semicolon-separated string. Body: html_body (alias emailBody) or text_body; when HTML is given it is the only body part. A body is required unless attachments or template_id are given (and except for replies without a subject). Up to 5 attachments, each at most 10 MB, given as base64 content or as a url fetched at send time; audio/*, disk images and .exe, .bat, .sh, .apk and .msi files are refused.
Replies: set email_type to reply or reply_all (or just give message_id) with the Message-ID of an email in one of your email conversations; from and message_id are then required. The reply gets In-Reply-To/References headers and a “Re: “ subject (the conversation’s subject when subject is empty). thread.in_reply_to/thread.references set the same headers on any email. After sending, the email is recorded in your conversations: a reply is added to the matching conversation and its agents are notified; a new email starts a conversation whose id is the email’s sid.
The call only validates and queues: it answers 202 with status = queued and the email’s sid. Mailbox lookup, attachment checks and SMTP delivery happen afterwards; their failures are not reported back (there is no public status endpoint, and status_callback is currently not called). Sending is not retried. Emails are not charged. template_id, vars and idempotency_key are accepted but not used.
multipart/form-data is also accepted (form fields email or to, from, subject, emailBody/html_body/body, cc, bcc, files in file or files, each read up to 10 MB); a multipart request is answered 200 with an empty JSON object instead of the 202 body.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Your account’s Auth ID (20 upper-case letters and digits).
Example
AC000000000000000000Request Bodyrequired
Section titled “ Request Bodyrequired ”Email to send.
object
Files to attach; at most 5 per email in total.
object
File content, standard base64 (at most 10 MB decoded).
Example
JVBERi0xLjcKMIME type; default application/octet-stream. audio/* and application/x-apple-diskimage are refused.
Example
application/pdfYour own reference for the file; not used for sending.
Example
invoice-1001File name shown to the recipient; default “attachment”.
Example
invoice-1001.pdfHTTP(S) URL the file is downloaded from when the email is sent (30 s timeout, at most 10 MB).
Example
https://files.example.com/invoice-1001.pdfBcc recipients: an array, or one string with addresses separated by commas or semicolons. Delivered but not shown in the headers.
Example
[ "archive@example.com"]Cc recipients: an array, or one string with addresses separated by commas or semicolons.
Example
[ "manager@example.com"]Single recipient; used only when to is empty.
Example
customer@example.netAlias of html_body.
Example
How to send: “send” (default, a new email), “reply”, “reply_all” or “forward”. Any other non-empty value is treated as “reply”. Also accepted as emailType.
Example
sendRequired. Sender address. It must be the SMTP user of an email mailbox configured on your account; the email is sent through that mailbox’s SMTP server.
Example
support@example.comExtra header lines added to the message as given (name: value); empty values are skipped.
object
Example
{ "X-Campaign": "november"}HTML body. When set it is the only body part sent (text_body is then not included).
Example
<p>Hello, your invoice is attached.</p>Accepted but not used: repeating a request sends the email again.
Example
Message-ID of an email in one of your email conversations. Required for replies; when given without email_type the email is sent as a reply. Also accepted as messageID.
Example
<CAF0000000000000000000000000@mail.example.com>Reply-To header.
Example
replies@example.comAccepted but not used: no request is made to this URL.
Example
https://example.com/email/statusSubject; an empty subject is sent as “No Subject” (“Re: …” when thread.in_reply_to is set).
Example
Your invoiceAccepted but no template is applied. When set, the body requirement is waived and the email is sent with whatever body is given (possibly none).
Example
Plain-text body, sent when there is no HTML body.
Example
Hello, your invoice is attached.Threading headers.
object
Message-ID of the email being answered; sent as In-Reply-To, and the subject gets a “Re: “ prefix.
Example
<CAF0000000000000000000000000@mail.example.com>Message-IDs sent space-separated as References; defaults to in_reply_to.
Example
[ "<CAF0000000000000000000000000@mail.example.com>"]Recipients. At least one address containing “@” is required (here or in email); entries without “@” and duplicates are dropped.
Example
[ "customer@example.net"]Accepted but not used.
object
Responses
Section titled “ Responses ”Email accepted and queued.
object
Auth ID of the account the email is sent for.
Always “v1”.
Bcc recipients after clean-up.
Cc recipients after clean-up.
Always “outbound-api”.
Sender address as given.
Mailbox label; “default”.
Always “USD”; emails are not charged.
Always “smtp”: the email goes out through your mailbox’s SMTP server.
When the email was queued, RFC 1123 in UTC.
Reply-To address as given.
Identifier of the queued email (a UUID).
Always “queued”: the email is waiting to be sent.
Subject as given (an empty subject is sent as “No Subject”).
Paths of related resources. Not served on the public API.
object
Attachments path (not served).
Events path (not served).
Recipients after clean-up (entries without “@” and duplicates removed).
How the email is sent: “new”, “reply”, “reply_all” or “forward”.
Path of the email resource. Not served on the public API.
Example
{ "account_sid": "AC000000000000000000", "api_version": "v1", "bcc": [ "archive@example.com" ], "cc": [ "manager@example.com" ], "direction": "outbound-api", "from": "support@example.com", "mailBox": "default", "price_unit": "USD", "provider": "smtp", "queue_time": "Thu, 26 Nov 2026 10:15:00 UTC", "reply_to": "replies@example.com", "sid": "3f2b8c1e-6d4a-4f0b-9c7e-1a2b3c4d5e6f", "status": "queued", "subject": "Your invoice", "subresource_uris": { "attachments": "/v1/Accounts/AC000000000000000000/Emails/3f2b8c1e-6d4a-4f0b-9c7e-1a2b3c4d5e6f/Attachments", "events": "/v1/Accounts/AC000000000000000000/Emails/3f2b8c1e-6d4a-4f0b-9c7e-1a2b3c4d5e6f/Events" }, "to": [ "customer@example.net" ], "type": "new", "uri": "/v1/Accounts/AC000000000000000000/Emails/3f2b8c1e-6d4a-4f0b-9c7e-1a2b3c4d5e6f"}Invalid request. error is one of ‘invalid json body’ (not JSON, or to is not an array), ‘email is required’ (no usable recipient), ‘email body is required when template_id is not provided’, ‘from is required for reply emails’, ‘message_id is required for reply emails’. For some forward requests field validation answers instead with {“code”:“INVALID_REQUEST”,“message”:“One or more parameters are invalid”,“details”:{“
object
Human-readable reason.
Example
{ "error": "email is required"}Missing or wrong credentials, or credentials that may not act for {auth_id}. Body: ‘Authentication failed’.
Example generated
exampleThe email could not be recorded (message ‘failed to persist email request’).
object
Human-readable reason.
Always “failed”.
Example
{ "message": "email queue temporarily unavailable", "status": "failed"}The send queue is unavailable (message ‘email queue temporarily unavailable’); retry later.
object
Human-readable reason.
Always “failed”.
Example
{ "message": "email queue temporarily unavailable", "status": "failed"}