Skip to content

Send an email

POST
/v1/send
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.

Idempotency-Key
string
<= 255 characters

Example

signup-7f3a9c

Makes retries safe: the same key (per API key) within 24 hours sends only once.

Media typeapplication/json
object
template
required

ID of one of your templates to render, e.g. welcome.

string
/^[a-z][a-z0-9_]{0,47}$/
from
required

Sender, as noreply@acme.example or Acme <noreply@acme.example>. Must be an address this relay key may send as.

string
>= 1 characters <= 320 characters
reply_to

Where replies go, if not the sender.

string
>= 1 characters <= 320 characters
to
required

Recipients. At least one; at most 50 across to, cc and bcc.

Array<string>
>= 1 items <= 1000 items
cc

Carbon-copy recipients.

Array<string>
<= 1000 items
bcc

Blind carbon-copy recipients (not shown to other recipients).

Array<string>
<= 1000 items
data

Template variables. {{name}} in the template reads data.name. Values are HTML-escaped in the HTML body.

object
key
additional properties

Example

{
"template": "welcome",
"from": "Acme <noreply@acme.example>",
"to": [
"ada@example.com"
],
"data": {
"name": "Ada",
"verify_url": "https://acme.example/verify?t=abc"
}
}

Duplicate: this Idempotency-Key was already used in the last 24 hours. Nothing new was sent; you get the original message’s IDs.

Media typeapplication/json
object
message_id
string
email_message_id
string
status
string
Allowed values: duplicate
request_id
string

Example

{
"message_id": "105db76d635bb3776fa8ba0c37ae4052",
"email_message_id": "<105db76d635bb3776fa8ba0c37ae4052@velumrelay.email>",
"status": "duplicate",
"request_id": "req_9QwErTy2UiOp4AsDfGh6Jk"
}
X-Request-Id
string
Example
req_3kTMd9vXq2LwB8nYpR4sZa

Unique ID of this request (req_ + 22 characters). Include it when you contact support.

Queued for delivery.

Media typeapplication/json
object
message_id
required

The message’s ID (32 hex characters). Use it to find the message in Activity.

string
email_message_id
required

The email’s Message-ID header, as recipients see it.

string
status
required
string
Allowed values: queued
request_id
required

Same as the X-Request-Id header.

string

Example

{
"message_id": "105db76d635bb3776fa8ba0c37ae4052",
"email_message_id": "<105db76d635bb3776fa8ba0c37ae4052@velumrelay.email>",
"status": "queued",
"request_id": "req_3kTMd9vXq2LwB8nYpR4sZa"
}
X-Request-Id
string
Example
req_3kTMd9vXq2LwB8nYpR4sZa

Unique 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.

Media typeapplication/json
object
error
required

What went wrong, in plain words.

string

Example

{
"error": "invalid request: to: Add at least one recipient"
}

Missing or invalid relay key.

Media typeapplication/json
object
error
required

What went wrong, in plain words.

string

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.

Media typeapplication/json
object
error
required

What went wrong, in plain words.

string

Example

{
"error": "this API key may not send from that address"
}

No template with that ID in this key’s account.

Media typeapplication/json
object
error
required

What went wrong, in plain words.

string

Example

{
"error": "unknown template"
}

Request body larger than 1 MiB.

Media typeapplication/json
object
error
required

What went wrong, in plain words.

string

Example

{
"error": "request body too large"
}

The template couldn’t be rendered with this data.

Media typeapplication/json
object
error
required

What went wrong, in plain words.

string

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.

Media typeapplication/json
object
error
required

What went wrong, in plain words.

string

Example

{
"error": "rate limit exceeded"
}
Retry-After
integer
Example
1
X-Request-Id
string
Example
req_3kTMd9vXq2LwB8nYpR4sZa

Unique 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.

Media typeapplication/json
object
error
required

What went wrong, in plain words.

string

Example

{
"error": "queue unavailable, retry later"
}