The short answer
The Email API is a REST API for application email — notifications, invoices, verification, password resets. Your app sends one JSON request per batch to /email-api/messages, and RuangMail handles validation, credit accounting, quota queueing, delivery, and open/click recording.
What RuangMail handles
- API key auth and per-customer data isolation
- Recipient, sender, domain, and final MIME size validation
- Atomic credit debit, plus a refund when delivery fails
- Per-minute quota reservation and a durable queue when the quota is full
- Bounce quarantine, suppression, and the pixel plus redirect tracking
What stays in your hands
- The email content, recipient list, and your business metadata
- Creating API keys with the email:send and email:read scopes
- Registering the sending domain and publishing its DNS
- Sending a unique Idempotency-Key on every request
This is not the SMTP relay. If your app already has an SMTP client and you would rather not write HTTP code, use the SMTP path — same outcome, different door. Open the SMTP Relay guide
Your first send
One request, one batch. Swap the sender for one that is active on a verified domain, then send.
curl -X POST https://api.ruangmail.com/api/v1/email-api/messages \
-H "Authorization: Bearer rmk_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: invoice-202610-000482" \
-d '{
"from": "[email protected]",
"from_name": "Brand Anda",
"reply_to": "[email protected]",
"to": [{"email": "[email protected]", "name": "Customer"}],
"subject": "Invoice INV-202610-000482",
"html": "<p>Terima kasih, pembayaran Anda sudah kami terima.</p>",
"metadata": {"invoice_id": "INV-202610-000482"}
}'{
"data": {
"batch_id": "3f9a1c72-1d84-4b60-9a11-7c0e5b2f8d31",
"status": "sent",
"message_ids": ["8b2d4e01-5c77-4a19-b3e2-90af6d1c4471"],
"final_size_bytes": 1420,
"credit_per_recipient": 1,
"total_credit_cost": 1
},
"meta": { "request_id": "req_9c1f4a" }
}For volume, put up to 50 unique recipients in the to array of a single request. A batch of 50 normal-sized recipients costs 50 credits and is still one call.
{
"from": "[email protected]",
"to": [
{ "email": "[email protected]" },
{ "email": "[email protected]" },
{ "email": "[email protected]" }
],
"subject": "Pengumuman layanan",
"html": "<p>Ada pemeliharaan terjadwal malam ini.</p>"
}Sending scale
Email API quota is counted in units, not just message count. One unit is one chunk of at most 2,008,192 bytes for each unique recipient — so a normal-sized recipient costs one unit, and a large attachment can cost more.
- units per minute
- 18,000
- recipients per rolling 24 hours
- 50,000
- recipients per request
- 50
| Limit | Value | Scope |
|---|---|---|
| Send rate | 18,000 units / minute | Product budget, shared |
| Daily volume | 50,000 recipients / rolling 24 hours | Product budget, shared |
| Recipients per request | 1 – 50 | Per request |
| Unit size | 2,008,192 bytes | Per unique recipient |
Quota reservation uses per-minute buckets inside a database transaction with an advisory lock, so multiple backend instances and the worker cannot cross the limit at the same time. The Email API dashboard shows minute and rolling-24-hour usage against these limits.
A full quota is not a failure. The request is answered with 202 and queued durably; the worker retries automatically and no credits are held while it waits. For capacity beyond this budget, talk to support.
Open & click tracking
RuangMail injects signed URLs into your HTML email, so you add nothing yourself. A 1x1 pixel records opens, and every link is replaced with a redirect that records the click then forwards the recipient to the original destination.
| Method | Path | Purpose |
|---|---|---|
| GET | /email-api/engagement/open?id=…&sig=… | Returns a 1x1 pixel and records the open. |
| GET | /email-api/engagement/click?id=…&url=…&sig=… | Validates the target, records the click, then redirects with 302. |
Reading the results
Message history returns open_count, click_count, opened_at, and clicked_at. The counters count deduplicated events, and the timestamps show the first occurrence.
{
"id": "8b2d4e01-5c77-4a19-b3e2-90af6d1c4471",
"status": "delivered",
"open_count": 3,
"click_count": 1,
"opened_at": "2026-10-03T02:14:07Z",
"clicked_at": "2026-10-03T02:14:31Z"
}Single-recipient HTML only
A batch with more than one recipient gets no tracking URLs, so an open or click is never attributed to the wrong person. Send per recipient when you need the numbers.
A signature that cannot be forged
Each URL carries a 64-character HMAC-SHA256 over the event kind and message ID. A request with an invalid signature still gets its pixel or redirect, but is not recorded as an event.
No status change, no credits
Opens and clicks neither raise nor lower the delivery status, and they cost no credits. Counters are deduplicated per minute so a refresh does not inflate them.
Size, credits, and limits
Credits are counted from unique recipients across To + Cc + Bcc and the final email size after attachments are encoded, MIME headers included. The same recipient twice still counts once.
Credits per recipient
| Final MIME size | Credits |
|---|---|
| ≤ 300,000 bytes (≤ 0.3 MB) | 1 |
| > 300,000 – 600,000 bytes | 2 |
| > 600,000 – 2,008,192 bytes | 3 |
A message above 2,008,192 bytes is rejected before any credit is debited. Because the size ceiling is already 2 MB, the higher tiers never apply on this path.
Technical limits per request
| Parameter | Value |
|---|---|
| Unique recipients | 1 – 50 |
| Subject length | 250 characters |
| Body length | 200,000 characters (html + text) |
| Attachments | up to 10 |
| Metadata | 16 KiB |
| Final MIME size | 2,008,192 bytes |
| Idempotency-Key | 1 – 160 characters |
Status and the queue
The HTTP code tells you what happened to the request; the message status tells you what happened to the email.
| HTTP | Status | Meaning |
|---|---|---|
| 200 | sent | Accepted and handed to the send path. |
| 202 | queued | Queued on quota. The worker retries automatically. |
| 402 | WALLET_INSUFFICIENT_BALANCE | Not enough credits. |
| 409 | idempotency_conflict | The same Idempotency-Key was used with a different payload. |
| 502 | failed | The send was rejected or failed. Credits are refunded when the refund succeeds. |
Suppressed addresses are skipped before the send is called, so they cost no credits. A hard bounce or spam complaint adds the address to the suppression list, and each unique bounce event costs a one-time 30-credit penalty. A soft failure does not become a permanent suppression by itself.
Things that trip people up
The things people ask about most once their first send succeeds.
- Idempotency-Key is required, not optional
- Without this key the request is rejected. The same key with the same payload returns the earlier result with reused, while a different payload with the same key answers 409. Never reuse a key for content that changed.
- Tracking disappears past one recipient
- The pixel and redirects are only injected into single-recipient HTML email. If open numbers matter, send one request per recipient — you can still pack up to 50 recipients for email that does not need tracking.
- A full quota is not an error
- The request is answered with 202 and queued durably. No credits are held while it waits, and the worker retries on its own. Do not retry from your side just because you saw a 202.
- Attachments count after base64
- The 2,008,192-byte ceiling applies to the final MIME size, including base64 encoding, headers, and boundaries. A 1.6 MB raw attachment can cross the line once encoded, and the message is rejected before any credit is debited.
- A bounce is more than a failure
- A bounced address enters suppression and the next send to it is skipped before any credit is debited. Each unique bounce event also costs 30 credits once, and deduplication prevents a double penalty.
- An empty Reply-To becomes From
- If you leave reply_to empty, customer replies land on the sender address. Set it explicitly if replies need to go somewhere else.
Read next
The pages people usually open after this one.
Ready to send at volume?
Create an API key with the email:send scope, register a sending domain, then fire your first request. Minute and daily usage show up in the dashboard right away.