Integrations
Mail API reference
Send feedbackThe Mail API lets your own code read, search, send and reply to mail, and lets an admin manage the mailboxes on a domain. It is a plain JSON API over HTTPS — no SDK is required, and anything that can make an HTTP request can use it.
Base URL and authentication
- Base URL —
https://nevtanemailapi.nevtan.com:5008/api/v1 - Authentication — an API key on every request, as
Authorization: Bearer nvt_live_…orX-API-Key: nvt_live_… - Request bodies — JSON, with
Content-Type: application/json - Responses — JSON. Field names use lower case with underscores, and timestamps are ISO 8601.
Keys belong on the server
Anyone who can read your key can read and send your mail. Call the API from a server you control, never from a browser, a mobile app or anywhere else the key would ship to the people using it.
Your first request
Start with /me. It confirms the key works and tells you which account and role it carries:
curl https://nevtanemailapi.nevtan.com:5008/api/v1/me \ -H "Authorization: Bearer nvt_live_xxxxxxxx…"
{
"id": 1042,
"email": "priya@yourcompany.com",
"name": "Priya Singh",
"role": "admin"
}The role field tells you whether the key may use the admin-only endpoints below.
Endpoints
Every path below is relative to the base URL.
| Endpoint | What it does | Notes |
|---|---|---|
GET /me | The account the key belongs to. | Use it to check a key. |
GET /emails | Newest messages in a folder. | Accepts folder (inbox or sent, default inbox) and limit. |
GET /emails/search | Messages matching a query. | Accepts q and limit. |
GET /emails/{id} | One message in full, including its body. | |
POST /emails/send | Send a message. | Body: to, cc, bcc, subject, body, is_html. |
POST /emails/{id}/reply | Reply to a message, keeping it in its thread. | Body: body, is_html, reply_all. |
POST /drafts | Save a message as a draft without sending it. | Same body as send. |
GET /mailboxes | Mailboxes in the workspace. | Admin key only. |
POST /mailboxes | Create a mailbox. | Admin key only. Body: username, domain, name, password. |
GET /hooks | Webhook subscriptions on this account. | See Webhooks. |
POST /hooks | Subscribe a URL to an event. | Body: event, target_url. |
DELETE /hooks/{id} | Remove a subscription. |
Sending a message takes a single address or a list, whichever suits your code:
curl -X POST https://nevtanemailapi.nevtan.com:5008/api/v1/emails/send \
-H "Authorization: Bearer nvt_live_xxxxxxxx…" \
-H "Content-Type: application/json" \
-d '{
"to": ["customer@example.com"],
"subject": "Your order has shipped",
"body": "<p>It is on its way.</p>",
"is_html": true
}'The email object
Returned by the message endpoints, and delivered by the email.received and email.sent webhooks:
| Field | Type | What it holds |
|---|---|---|
id | number | The message's identifier, used in the single-message and reply endpoints. |
event | string | Which event produced this object. |
mailbox | string | The mailbox the message belongs to. |
message_id | string | The internet message ID, for matching against other mail systems. |
thread_id | string | Groups a message with its replies. |
from | string | Sender address. |
from_name | string | Sender display name, where one was supplied. |
to | array | Recipient addresses. |
cc | array | Copied addresses. |
subject | string | Subject line. |
snippet | string | The first 200 characters of the plain-text body, for list views. |
body_text | string | Plain-text body. |
body_html | string | HTML body, or null when the message was plain text. |
received_at | string | When it arrived, ISO 8601. |
sent_at | string | When it was sent, ISO 8601. |
has_attachments | boolean | Whether anything is attached. |
attachment_count | number | How many attachments. |
is_read | boolean | Whether the message has been opened. |
direction | string | Whether the message came in or went out. |
Long bodies are shortened
A body over 100,000 characters is cut at that point. If you are processing newsletters or long threads, treat the body as possibly truncated rather than assuming it is complete.
The mailbox object
Returned by the mailbox endpoints, and delivered by the mailbox.created webhook:
| Field | Type | What it holds |
|---|---|---|
id | number | The mailbox's identifier. |
event | string | Which event produced this object. |
email | string | The full address. |
name | string | The person's display name. |
domain | string | The domain the mailbox sits on. |
active | boolean | Whether the mailbox is in use. |
created_at | string | When it was created, ISO 8601. |
Limits
| Limit | Value |
|---|---|
| Requests | 120 per minute, per key. |
| Messages per response | 10 by default, 50 at most. Ask for more with limit; anything higher is treated as 50. |
| Body length | 100,000 characters, after which the body is cut. |
| Snippet length | 200 characters. |
| Webhook subscriptions | 50 per account. |
Read mail in batches, not in bulk
The API returns the newest messages rather than a complete archive, so it suits keeping an application up to date rather than exporting a mailbox. To move mail wholesale, connect an email app over IMAP instead — see Connect an email app.
Errors
An error returns the matching HTTP status and a JSON body with a single error field describing what went wrong:
{ "error": "Not found" }| Status | What it means | What to do |
|---|---|---|
| 401 | The key is missing, wrong, or has been revoked. | Check the header spelling, then confirm the key is still listed on the Integrations screen. |
| 403 | The key is valid but not allowed to do this. | Mailbox endpoints need a key created by an admin. |
| 404 | No such message, mailbox or subscription — or it belongs to another account. | Check the identifier came from this same account. |
| 409 | The request conflicts with something that already exists. | Creating a mailbox that is already taken, for instance. |
| 429 | More than 120 requests in a minute. | Slow down and retry after the minute rolls over. |
| 400 | The request itself was not usable. | The error field names the problem — usually a missing or malformed value. |
