Send an email
const url = 'https://relay.velumrelay.email/v1/send';const options = { method: 'POST', headers: { 'Idempotency-Key': 'signup-7f3a9c', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"template":"welcome","from":"Acme <noreply@acme.example>","to":["ada@example.com"],"data":{"name":"Ada","verify_url":"https://acme.example/verify?t=abc"}}'};
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://relay.velumrelay.email/v1/send \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: signup-7f3a9c' \ --data '{ "template": "welcome", "from": "Acme <noreply@acme.example>", "to": [ "ada@example.com" ], "data": { "name": "Ada", "verify_url": "https://acme.example/verify?t=abc" } }'Renders the template with data and queues the email. A 202 means the message is safely queued, not yet delivered. Up to 50 recipients in total across to, cc and bcc. The request body may be up to 1 MiB.
Idempotency: send an Idempotency-Key header (any string up to 255 characters, unique per message) to make retries safe. Repeating a key with the same API key within 24 hours returns the original message with status duplicate instead of sending again.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Example
signup-7f3a9cMakes retries safe: the same key (per API key) within 24 hours sends only once.
Request Bodyrequired
Section titled “Request Bodyrequired”object
ID of one of your templates to render, e.g. welcome.
Sender, as noreply@acme.example or Acme <noreply@acme.example>. Must be an address this relay key may send as.
Where replies go, if not the sender.
Recipients. At least one; at most 50 across to, cc and bcc.
Carbon-copy recipients.
Blind carbon-copy recipients (not shown to other recipients).
Template variables. {{name}} in the template reads data.name. Values are HTML-escaped in the HTML body.
object
Example
{ "template": "welcome", "from": "Acme <noreply@acme.example>", "to": [ "ada@example.com" ], "data": { "name": "Ada", "verify_url": "https://acme.example/verify?t=abc" }}Responses
Section titled “Responses”Duplicate: this Idempotency-Key was already used in the last 24 hours. Nothing new was sent; you get the original message’s IDs.
object
Example
{ "message_id": "105db76d635bb3776fa8ba0c37ae4052", "email_message_id": "<105db76d635bb3776fa8ba0c37ae4052@velumrelay.email>", "status": "duplicate", "request_id": "req_9QwErTy2UiOp4AsDfGh6Jk"}Headers
Section titled “Headers”Example
req_3kTMd9vXq2LwB8nYpR4sZaUnique ID of this request (req_ + 22 characters). Include it when you contact support.
Queued for delivery.
object
The message’s ID (32 hex characters). Use it to find the message in Activity.
The email’s Message-ID header, as recipients see it.
Same as the X-Request-Id header.
Example
{ "message_id": "105db76d635bb3776fa8ba0c37ae4052", "email_message_id": "<105db76d635bb3776fa8ba0c37ae4052@velumrelay.email>", "status": "queued", "request_id": "req_3kTMd9vXq2LwB8nYpR4sZa"}Headers
Section titled “Headers”Example
req_3kTMd9vXq2LwB8nYpR4sZaUnique ID of this request (req_ + 22 characters). Include it when you contact support.
Invalid request: a field breaks a rule, an address isn’t valid, there are too many recipients, or the Idempotency-Key is too long.
object
What went wrong, in plain words.
Example
{ "error": "invalid request: to: Add at least one recipient"}Missing or invalid relay key.
object
What went wrong, in plain words.
Example
{ "error": "invalid or missing API key"}This key may not send from that address. Each relay key lists the From addresses it may use.
object
What went wrong, in plain words.
Example
{ "error": "this API key may not send from that address"}No template with that ID in this key’s account.
object
What went wrong, in plain words.
Example
{ "error": "unknown template"}Request body larger than 1 MiB.
object
What went wrong, in plain words.
Example
{ "error": "request body too large"}The template couldn’t be rendered with this data.
object
What went wrong, in plain words.
Example
{ "error": "template render failed"}Rate limit exceeded (10 requests per second, bursts up to 20, per key). Wait for Retry-After seconds, then retry.
object
What went wrong, in plain words.
Example
{ "error": "rate limit exceeded"}Headers
Section titled “Headers”Example
1Example
req_3kTMd9vXq2LwB8nYpR4sZaUnique ID of this request (req_ + 22 characters). Include it when you contact support.
Temporarily unable to queue the message. Retry with the same Idempotency-Key.
object
What went wrong, in plain words.
Example
{ "error": "queue unavailable, retry later"}