Legacy send endpoints
The /send/{project}/raw/email and /send/{project}/template/email compatibility endpoints, and how to migrate to /messages/email.
When to use these endpoints
Relayit keeps two older send endpoints so existing integrations keep working:
POST /send/{project}/raw/emailsends inline HTML or text.POST /send/{project}/template/emailsends a Template by slug.
They run through the same pipeline as POST /messages/email, so Domains, Templates, suppression, and limits behave the same way.
Use them only if you already have code that calls them. New integrations should use POST /messages/email. It supports more features (multiple recipients, cc, bcc, reply-to, tags, custom headers, scheduling, idempotency) and returns more precise errors.
Authentication and path
{project}is your Project slug. Find it under Settings > Project details.- Send the API key in
x-api-key(orX-API-Key). The key must belong to the Project in the path.
| Status | Body message | When |
|---|---|---|
401 | Unauthorized or the key error | The key is missing or invalid. |
404 | Project not found | The key is valid but belongs to a different Project than {project}. |
Raw email
curl -X POST https://api.relayit.io/send/my-project/raw/email \
-H "x-api-key: $RELAYIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "[email protected]",
"from": "[email protected]",
"payload": {
"subject": "Your receipt",
"html": "<p>Thanks for your order.</p>",
"text": "Thanks for your order."
}
}'payload needs a non-empty subject and at least one of html or text.
Template email
curl -X POST https://api.relayit.io/send/my-project/template/email \
-H "x-api-key: $RELAYIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "[email protected]",
"from": "[email protected]",
"template": {
"slug": "welcome-email",
"props": { "name": "Jane" }
}
}'template.slug accepts a slug or a tmpl_ id. props is passed as the Template variables.
Shared fields
| Field | Type | Description |
|---|---|---|
to | string | One recipient email address. |
from | string | Optional plain email address (no display name). When omitted, Relayit uses noreply@ your Project's oldest verified Domain, or the sandbox address if the Project has no verified Domain and the Sandbox Domain is active. |
contact | object | Optional. name and externalIdentifiers (string map) for the recipient. |
app | string | Optional App attribution. Ignored unless appEnvironment is also set. |
appEnvironment | string | Optional App Environment attribution. Ignored unless app is also set. |
attachments | array | Up to 20. Each has filename and either content (base64) or path (URL), plus optional contentType and contentId. |
If you omit from and the Project has no verified Domain and no usable Sandbox Domain, the request fails with 400 and the message No sender identity available; pass from or provision Sandbox Domain.
Responses
Success returns 201:
{
"id": "msg_01jbxk3c1ef6h8w2m4n9qz7r5t",
"status": "queued"
}Errors use { "message": "...", "details": [...] }:
| Status | Example body | Meaning |
|---|---|---|
400 | { "message": "Validation error", "details": ["Invalid from address"] } | Bad from address. |
400 | { "message": "The 'from' address is not a verified sending domain for this Project.", "details": ["invalid_from_address"] } | Accept error. details[0] is the same code that /messages/email returns. |
429 | { "message": "Monthly email send limit exceeded", "details": ["monthly_limit_exceeded"] } | Limit reached. No retry_after_seconds. |
500 | { "message": "Something went wrong", "details": [] } | Server error. |
The accept error codes are listed in Errors and limits.
Migrate to /messages/email
The move is mostly renaming fields.
| Legacy | /messages/email |
|---|---|
POST /send/{project}/raw/email | POST /messages/email (the Project comes from the API key) |
POST /send/{project}/template/email | POST /messages/email with template |
payload.subject | subject |
payload.html | html |
payload.text | text |
template.slug | template.id (slug or tmpl_ id) |
template.props | template.variables |
to (one address) | to (address, list, or Contact objects, up to 50) |
contact.name | to: { "email": "...", "first_name": "..." } |
contact.externalIdentifiers | to: { "email": "...", "properties": { ... } } |
app and appEnvironment body fields | app and environment headers |
attachments[].contentType | attachments[].content_type |
attachments[].contentId | attachments[].content_id |
from optional, defaults to noreply@ a verified Domain or sandbox | from required |
Response { id, status } | Response { id, stripped? } |
Errors 400 with details: [code] | Errors 422 with code and details object |
401 for bad keys | 403 with code: "invalid_api_key" |
Before:
{
"to": "[email protected]",
"from": "[email protected]",
"contact": { "name": "Jane" },
"app": "shop",
"appEnvironment": "production",
"template": { "slug": "welcome-email", "props": { "name": "Jane" } }
}After:
curl -X POST https://api.relayit.io/messages/email \
-H "x-api-key: $RELAYIT_API_KEY" \
-H "app: shop" \
-H "environment: production" \
-H "Content-Type: application/json" \
-d '{
"from": "[email protected]",
"to": { "email": "[email protected]", "first_name": "Jane" },
"template": { "id": "welcome-email", "variables": { "name": "Jane" } }
}'Things to check when you switch:
- Always set
from. There is no default sender. - Handle
422withcodeinstead of400withdetails. - If you only sent one of
apporappEnvironmentbefore, it was ignored. On/messages/emailsending only one header is a400error. - Add an
Idempotency-Keyheader to make retries safe.