curl https://api.maqetin.com/v1/public/messages \
-H 'Authorization: Bearer mq_sec_…' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: order-42:receipt' \
-d '{
"channel": "email",
"templateId": "tpl_receipt",
"to": { "email": "ada@example.com" },
"from": "Receipts <receipts@mail.harbour-money.example>",
"subject": "Your receipt",
"data": { "order": { "id": "o_42", "total": 12.5 } }
}'
{
"success": true,
"data": { "messageId": "hT3kq9Vx2LmPzQ8a", "status": "queued" },
"meta": { "requestId": "4f8Kq2LmZ7xR1tN9pW3sY", "timestamp": "2026-12-03T09:30:00.000Z" }
}
{
"success": false,
"error": {
"code": "SENDER_DOMAIN_INVALID",
"message": "Sending is not available: sender_domain_invalid."
},
"meta": { "requestId": "4f8Kq2LmZ7xR1tN9pW3sY", "timestamp": "2026-12-03T09:30:00.000Z" }
}
Messages and contacts
Send a message
Queue one transactional email from your server with a secret key.
POST
/
v1
/
public
/
messages
curl https://api.maqetin.com/v1/public/messages \
-H 'Authorization: Bearer mq_sec_…' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: order-42:receipt' \
-d '{
"channel": "email",
"templateId": "tpl_receipt",
"to": { "email": "ada@example.com" },
"from": "Receipts <receipts@mail.harbour-money.example>",
"subject": "Your receipt",
"data": { "order": { "id": "o_42", "total": 12.5 } }
}'
{
"success": true,
"data": { "messageId": "hT3kq9Vx2LmPzQ8a", "status": "queued" },
"meta": { "requestId": "4f8Kq2LmZ7xR1tN9pW3sY", "timestamp": "2026-12-03T09:30:00.000Z" }
}
{
"success": false,
"error": {
"code": "SENDER_DOMAIN_INVALID",
"message": "Sending is not available: sender_domain_invalid."
},
"meta": { "requestId": "4f8Kq2LmZ7xR1tN9pW3sY", "timestamp": "2026-12-03T09:30:00.000Z" }
}
Send a template, a recipient and your data; Maqetin answers
In the samples, replace
202 with the message id, and the email follows. Use it for mail a person expects from an action of theirs: a receipt, a password reset, an invite.
A transactional message ignores the contact’s email opt-in, never reaches a suppressed address and has no unsubscribe link.
Limits
| What | Limit |
|---|---|
| Body | 100 KiB |
data | 16 KiB (16,384 bytes) as JSON |
Idempotency-Key | Letters, digits and _ . : -, at most 100 characters. Remembered for 7 days. |
| Rate, per key | 300 sends a minute, and 600 requests a minute across messages and contacts |
Headers
Bearer mq_sec_…, a secret key with the messages:send scope. A public key is a 401. A secret key without the scope is a 403.Send the same key on a retry and Maqetin sends the message once. See Send a retry safely.
Body
Any top-level field that is not listed here is a400.
The id of a template in your workspace.
Name <local@domain> or local@domain, 3 to 320 characters on one line. Without a name, Maqetin uses the workspace name. The domain must be a verified sending domain of the workspace.Merge data for the template. It goes over the traits of the person but never over
email or user_id.templateId with one of your templates and the domain of from with a verified sending domain of your workspace.
Send it from Node
The server entry of the JavaScript SDK makes this call, and makes an idempotency key when you give none.import { MaqetinServer } from '@maqetin/sdk-js/server';
const mq = new MaqetinServer({ secretKey: process.env.MAQETIN_SECRET_KEY });
const { messageId } = await mq.messages.send({
channel: 'email',
templateId: 'tpl_receipt',
to: { userId: 'u_42' }, // or { email: 'guest@example.com' }
from: 'Harbour Money <receipts@mail.harbour-money.example>',
data: { order: { id: 'o_42', total: 12.5 } },
idempotencyKey: 'order-42:receipt',
});
Send a retry safely
A retry with the sameIdempotency-Key sends the message once and answers 202 with the same messageId. The first body sent with a key is the one that counts. The SDK retries after a 5xx, a 429 or a network error with the same key, and gives up on a request that does not answer after requestTimeoutMs, 15 seconds by default.
Response
A reply holdssuccess, data and meta. See Answers.
The id of the message. A contact’s messages carry it as
id.Errors
A send checks the workspace, then the template, then the sender, then the recipient, and answers the first problem it finds. Themessage of a 409 names the reason in lower case, for example Sending is not available: sender_domain_invalid.
| Status | error.code | Meaning |
|---|---|---|
400 | VALIDATION_FAILED | The body, the from address or the Idempotency-Key does not parse. |
401 | API_KEY_INVALID | The request has no active secret key. |
403 | FORBIDDEN | The key has no messages:send scope. |
403 | WORKSPACE_SUSPENDED | The workspace of the key is suspended. |
409 | SENDING_DISABLED | Maqetin has turned sending off for now. |
409 | WORKSPACE_INACTIVE | The workspace is not active. |
409 | SENDING_NOT_APPROVED | The workspace is not approved to send yet. See Sending approval. |
409 | SENDING_PAUSED | Maqetin has paused the sending of the workspace. |
404 | NOT_FOUND | The template is not there. |
409 | SENDER_DOMAIN_INVALID | The domain of from is not a verified sending domain of this workspace. |
404 | NOT_FOUND | The userId has no profile, or the profile has no email address. |
413 | PAYLOAD_TOO_LARGE | The body is over 100 KiB. |
429 | RATE_LIMITED | Over 300 sends a minute for the key, or over its 600 requests a minute. Wait for Retry-After. |
curl https://api.maqetin.com/v1/public/messages \
-H 'Authorization: Bearer mq_sec_…' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: order-42:receipt' \
-d '{
"channel": "email",
"templateId": "tpl_receipt",
"to": { "email": "ada@example.com" },
"from": "Receipts <receipts@mail.harbour-money.example>",
"subject": "Your receipt",
"data": { "order": { "id": "o_42", "total": 12.5 } }
}'
{
"success": true,
"data": { "messageId": "hT3kq9Vx2LmPzQ8a", "status": "queued" },
"meta": { "requestId": "4f8Kq2LmZ7xR1tN9pW3sY", "timestamp": "2026-12-03T09:30:00.000Z" }
}
{
"success": false,
"error": {
"code": "SENDER_DOMAIN_INVALID",
"message": "Sending is not available: sender_domain_invalid."
},
"meta": { "requestId": "4f8Kq2LmZ7xR1tN9pW3sY", "timestamp": "2026-12-03T09:30:00.000Z" }
}