Messages
Send one email to one recipient, then read what happened to it. This page is generated from the OpenAPI document of release main-6976024, the one the API serves, so it lists only what the API has.
How to authenticate, where errors are explained, and the other resources are in the API reference.
Messages, newest first
GET /v1/messages
Its API key needs messages:read.
Parameters
| Parameter | What it is |
|---|---|
cursor | text, up to 64 characters, in the query. The previous page’s next_cursor. |
status | one of queued, sending, sent, delivered, bounced, complained, failed, suppressed or test, in the query. Only messages with this status. |
created_after | a date and time (RFC 3339), in the query. Only messages created after this time (RFC 3339). |
created_before | a date and time (RFC 3339), in the query. Only messages created before this time (RFC 3339). |
limit | a whole number from 1 to 100, in the query. |
Answers
- 200: A page of messages
- 401:
- API key missing (
api_key_missing) - Invalid API key (
api_key_invalid) - API key revoked (
api_key_revoked) - API key expired (
api_key_expired)
- API key missing (
- 403:
- Account closed (
account_closed) - Missing scope (
api_key_scope_missing)
- Account closed (
- 422:
- Validation failed (
validation_failed)
- Validation failed (
- 429:
- Too many requests (
rate_limited)
- Too many requests (
- 500:
- Internal error (
internal)
- Internal error (
- 503:
- API keys unavailable (
api_keys_unavailable)
- API keys unavailable (
What a 200 answers
| Field | What it is |
|---|---|
data (required) | a list, each an object. |
data[].id (required) | text. |
data[].status (required) | text. queued → sending → sent → delivered, or bounced or complained after that. failed and suppressed were never sent (see reason). A test key's messages end as test. |
data[].mode (required) | text. live, or test for a test key’s message, which never delivers. |
data[].category (required) | text. |
data[].from (required) | an object. |
data[].from.address (required) | text. |
data[].from.name (required) | text, or null. |
data[].to (required) | text. |
data[].reply_to (required) | a list, each text. |
data[].subject (required) | text. |
data[].tags (required) | an object whose values are each text. |
data[].created_at (required) | a date and time (RFC 3339). |
data[].status_changed_at (required) | a date and time (RFC 3339). |
data[].reason (required) | an object, or null. Why a failed or suppressed message wasn’t sent. Null otherwise. |
data[].reason.code (required) | text. A stable code to branch on. |
data[].reason.detail (required) | text. What it means, in plain language. |
data[].reason.retryable (required) | true or false. True when sending the same message again, unchanged, may work once retry_after has passed. It isn’t a promise that it will. Read the message again first: if a late answer from the email service moved its status on, it was sent. Send it as a new request with a new Idempotency-Key, since the original key returns this message. False means don’t send it again unchanged: detail says what to do instead. ses_outcome_unknown is false because the message may have been sent, and so is a code this API version doesn’t know. |
data[].reason.retry_after (required) | a whole number, or null. Whole seconds, rounded up, left to wait before sending it again. The wait starts when the message failed, so reading it again doesn’t start it over: for a 15-minute wait, a read 10 minutes after the failure says 300. 0 means the wait is over. Null when retryable is false. |
data[].template (required) | an object, or null. The stored template the message was sent from, or null. Once the template is deleted, alias is null, and the id and version stay. |
data[].template.id (required) | text. |
data[].template.alias (required) | text, or null. |
data[].template.version (required) | a whole number, or null. |
next_cursor (required) | text, or null. Null on the last page. |
Send a transactional message
POST /v1/messages
Accepts one message to one recipient and answers at once with its id; Flyanote sends it within seconds. Poll GET /v1/messages/{id} for what happened. A test key (fan_test_…) never delivers and costs nothing. It runs every check but one: it's never refused for an address on Flyanote's own abuse list, so a passing test send isn't proof the live one will go. Always send an Idempotency-Key, and reuse it when you retry: a retry never sends twice. The request body can be up to 2 MiB.
Its API key needs messages:send.
Parameters
| Parameter | What it is |
|---|---|
idempotency-key (required) | text, in the header. Required. A value unique to this message, like a UUID or your own order id. Once a request with it is accepted, a retry with the same key and body within 24 hours returns that 202 instead of sending again, and the same key with a different body is refused with 409. Retry any 5xx, or a timeout, with the same key and the same body: the message may have been accepted before the error. A 4xx kept nothing new: fix the request and retry (after a 409, the key already names another message, so use a new one). |
Request body
A application/json body.
| Field | What it is |
|---|---|
from (required) | an object. |
from.address (required) | text, up to 254 characters. An address on one of the account's verified domains or its Flyanote address. With a fan_test_ key, test@sandbox.flyanote.com also works before the account has a sender. |
from.name | text, up to 256 characters. The display name recipients see. |
to (required) | text, up to 320 characters. The one recipient. To send to several people, send one message each. |
subject | text, up to 998 characters. Required, unless the message is sent from a template, which has its own. |
html | text, up to 262,144 characters. The HTML body, up to 256 KiB in UTF-8. |
text | text, up to 262,144 characters. The plain-text body, up to 256 KiB in UTF-8. Without it, Flyanote makes one from html. |
template | text, up to 64 characters. A stored template to send, by its alias or its id (tpl_…), in place of subject, html, and text. Flyanote renders its newest published version, or template_version, with data before it answers, so a template that fails to render is refused here and nothing is sent. Only a transactional template can be sent here. With a test key, each one also counts toward the account’s render-account limit for test keys, as a render does. |
template_version | a whole number, at least 1. The number of the template's published version to send. Without it, the newest. |
data | an object. The data.* the template reads: an object of at most 256 KiB of JSON, nested at most 10 levels, without NUL characters or unpaired surrogates. It reaches the message only where the template puts it, and no warning or error repeats it. A field the template reads that's missing here shows its fallback, and the answer's warnings names it. |
reply_to | a list of up to 10, each text, up to 320 characters. Where replies go, if not the sender. |
headers | an object whose values are each text. Extra headers, from this list only: In-Reply-To, References, X-Entity-Ref-ID. In-Reply-To and References take message ids in angle brackets, to thread a reply; X-Entity-Ref-ID stops Gmail from grouping unrelated messages. |
tags | an object whose values are each text, up to 256 characters. Your own labels, returned when you read the message: up to 10, each value up to 256 characters. |
category | transactional. What the message is. Only transactional for now: receipts, resets, notifications. |
Answers
- 202: Accepted
- 400:
- Malformed request (
malformed_request)
- Malformed request (
- 401:
- API key missing (
api_key_missing) - Invalid API key (
api_key_invalid) - API key revoked (
api_key_revoked) - API key expired (
api_key_expired)
- API key missing (
- 402:
- Insufficient credit (
insufficient_credit)
- Insufficient credit (
- 403:
- Account closed (
account_closed) - Missing scope (
api_key_scope_missing) - Account paused (
account_paused) - Not one of this key's domains (
api_key_domain_not_allowed)
- Account closed (
- 404:
- Template not found (
template_not_found) - Template version not found (
template_version_not_found) - Rendering isn't available here (
rendering_not_configured)
- Template not found (
- 409:
- Idempotency key already used (
idempotency_key_reused) - Template archived (
template_archived) - Template not published (
template_not_published)
- Idempotency key already used (
- 413:
- Request body too large (
payload_too_large)
- Request body too large (
- 415:
- Unsupported media type (
unsupported_media_type)
- Unsupported media type (
- 422:
- Sender not ready (
sender_not_ready) - Reply-to not confirmed (
reply_to_unverified) - Not a transactional template (
template_category_not_allowed) - Template couldn't be rendered (
template_render_failed) - Message too large (
message_too_large) - Validation failed (
validation_failed)
- Sender not ready (
- 429:
- Too many requests (
rate_limited)
- Too many requests (
- 500:
- Internal error (
internal)
- Internal error (
- 503:
- API keys unavailable (
api_keys_unavailable) - No price in effect (
pricing_unavailable) - Sending unavailable (
sending_unavailable) - Rendering unavailable (
rendering_unavailable)
- API keys unavailable (
What a 202 answers
| Field | What it is |
|---|---|
id (required) | text. |
status (required) | text. queued: accepted, and sending shortly. suppressed: not sent, and not charged (see the message). |
template (required) | an object, or null. The template the message was rendered from, or null without one. |
template.id (required) | text. |
template.alias (required) | text. |
template.version (required) | a whole number. The published version sent. |
warnings (required) | a list, each an object. What a template's render noticed. The message was accepted anyway. Always empty without a template. |
warnings[].code (required) | text. template_data_missing: the template read fields data didn't have, which render empty there. A merge field with a fallback isn't counted where it's the only read, since its fallback shows. link_dropped: a link or image rendered with an address it can't have, so the address was taken out: a link's text stays, unlinked, and an image is left out. In the HTML, a link keeps an address that parses as an http, https, mailto, or tel URL (as a browser reads one: spaces and control characters at its ends, and tabs and newlines anywhere, ignored), an in-page one (#, then only ASCII letters, digits, _, ., :, or -), or one of nothing but spaces and control characters; an image keeps an http or https URL, or an empty one. Any other is taken out, a relative one included. A mailto link is also taken out if a field in it is named attach, attachment, or insert (in any case or width, with spaces and control characters around the name ignored), whether its fields are read as a browser reads them or after the whole address is decoded once; and a tel link unless it's a phone number: an optional leading +, ASCII digits, and -, ., (, ), or spaces (written as such or as %20), with at least one digit and nothing else. In the text, a link is checked only where it reads <address> (see positions), and taken out unless it passes the same rules. message_size_over_clip: the HTML is over 100 KB, so Gmail may cut it off. subject_truncated: the rendered subject was cut to 998 characters. More codes may come. |
warnings[].detail (required) | text. What it means, in plain language. |
warnings[].paths | a list, each text. For template_data_missing: the fields, up to 100. |
warnings[].positions | a list, each an object. For link_dropped: where each one was, up to 100. Never its address, which came from data. |
warnings[].positions[].part (required) | one of html or text. The part it was in. |
warnings[].positions[].kind (required) | one of link or image. |
warnings[].positions[].index (required) | a whole number, at least 1. Its place among the part's links, or its images, counting from 1 in the order they appear, kept ones included. In the HTML, the links are its href attributes, and the images its src and background attributes and CSS url()s, Outlook's markup in comments included. In the text, where a link reads text <address>, the links are each <, then a scheme (after any spaces or control characters), then no space (U+0020) up to the next >. |
A message, with what happened to it
GET /v1/messages/{id}
Its API key needs messages:read.
Parameters
| Parameter | What it is |
|---|---|
id (required) | text, up to 64 characters, in the path. |
Answers
- 200: The message
- 401:
- API key missing (
api_key_missing) - Invalid API key (
api_key_invalid) - API key revoked (
api_key_revoked) - API key expired (
api_key_expired)
- API key missing (
- 403:
- Account closed (
account_closed) - Missing scope (
api_key_scope_missing)
- Account closed (
- 404:
- Message not found (
message_not_found)
- Message not found (
- 422:
- Validation failed (
validation_failed)
- Validation failed (
- 429:
- Too many requests (
rate_limited)
- Too many requests (
- 500:
- Internal error (
internal)
- Internal error (
- 503:
- API keys unavailable (
api_keys_unavailable)
- API keys unavailable (
What a 200 answers
| Field | What it is |
|---|---|
id (required) | text. |
status (required) | text. queued → sending → sent → delivered, or bounced or complained after that. failed and suppressed were never sent (see reason). A test key's messages end as test. |
mode (required) | text. live, or test for a test key’s message, which never delivers. |
category (required) | text. |
from (required) | an object. |
from.address (required) | text. |
from.name (required) | text, or null. |
to (required) | text. |
reply_to (required) | a list, each text. |
subject (required) | text. |
tags (required) | an object whose values are each text. |
created_at (required) | a date and time (RFC 3339). |
status_changed_at (required) | a date and time (RFC 3339). |
reason (required) | an object, or null. Why a failed or suppressed message wasn’t sent. Null otherwise. |
reason.code (required) | text. A stable code to branch on. |
reason.detail (required) | text. What it means, in plain language. |
reason.retryable (required) | true or false. True when sending the same message again, unchanged, may work once retry_after has passed. It isn’t a promise that it will. Read the message again first: if a late answer from the email service moved its status on, it was sent. Send it as a new request with a new Idempotency-Key, since the original key returns this message. False means don’t send it again unchanged: detail says what to do instead. ses_outcome_unknown is false because the message may have been sent, and so is a code this API version doesn’t know. |
reason.retry_after (required) | a whole number, or null. Whole seconds, rounded up, left to wait before sending it again. The wait starts when the message failed, so reading it again doesn’t start it over: for a 15-minute wait, a read 10 minutes after the failure says 300. 0 means the wait is over. Null when retryable is false. |
template (required) | an object, or null. The stored template the message was sent from, or null. Once the template is deleted, alias is null, and the id and version stay. |
template.id (required) | text. |
template.alias (required) | text, or null. |
template.version (required) | a whole number, or null. |
events (required) | a list, each an object. What happened to the message, oldest first. |
events[].type (required) | text. send, delivery, deferral, bounce, complaint, not_spam, reject, failed, or suppressed. not_spam is a feedback report that the recipient moved the mail out of spam (code fbl_not_spam): it isn’t a complaint, and never marks the message complained. |
events[].at (required) | a date and time (RFC 3339). |
events[].code (required) | text, or null. A code for what happened, if any. |
events[].bounce_class (required) | text, or null. For a bounce: its type and subtype. |