mailfixture Messages API
Received email: long-poll lists, full detail, extraction views, attachment downloads, server-side link following.
Received email: long-poll lists, full detail, extraction views, attachment downloads, server-side link following.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/mailfixture-com:mailfixture-com-messages-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
contact:
email: support@mailfixture.com
name: mailfixture support
description: 'REST API for mailfixture: create inboxes, trigger your app''s email flow, then read messages back and assert on extracted OTPs, links, SPF/DKIM/DMARC verdicts, and a SpamAssassin score. Paid plans add dedicated US phone numbers with the same loop for SMS.
Conventions:
- Every request needs `Authorization: Bearer mfx_`.
- Errors are RFC 7807 `application/problem+json` (`{type, title, status, detail}`); `type` is always `about:blank`. 404 uniformly covers both missing and not-owned resources.
- Rate limiting is a per-key token bucket: 2 requests/second sustained, burst 60 (policy `requests`). Refusals are 429 with a `Retry-After` header (integer seconds). Inbox, phone-number, and capture-hook creation draw on a shared second per-key bucket (burst 10, refills 10/minute; policy `creates`).
- Every authenticated response carries rate-limit headers: `RateLimit-Policy: "requests";q=60;w=30` and `RateLimit: "requests";r=;t=` (draft-ietf-httpapi-ratelimit-headers syntax) plus `RateLimit-Limit` / `RateLimit-Remaining` / `RateLimit-Reset` integers. A 429 reports the bucket that refused with `r=0`.
- A 401 carries `WWW-Authenticate: Bearer realm="mailfixture"` (`error="invalid_token"` when a key was presented but rejected).
- Timestamps are RFC 3339 UTC strings; ids are UUIDs. Nullable fields serialize as JSON `null`, never omitted (except where a schema notes otherwise).
- List responses wrap the array in an object key (`{"messages": [...]}`) and are not paginated; message lists take a `since` cursor instead.
- Long-polling: message list endpoints accept `wait` (clamped to 60 s) and hold the request until a match arrives or the window closes. An empty window is a 200 with an empty array, never 204 or 408.'
summary: 'Programmatic email inboxes (and SMS numbers) for automated testing. Receive-only: mailfixture never sends.'
termsOfService: https://mailfixture.com/terms
title: mailfixture Messages API
version: 0.1.0
servers:
- description: Canonical API origin
url: https://api.mailfixture.com
security:
- apiKey: []
tags:
- description: 'Received email: long-poll lists, full detail, extraction views, attachment downloads, server-side link following.'
name: Messages
paths:
/v1/inboxes/{id}/messages:
get:
description: Summaries ordered oldest-first by `received_at`, at most 100 per response. With `wait` > 0 the request holds until a matching message arrives (LISTEN/NOTIFY wake, typically < 2 s after SMTP accept) or the window closes.
operationId: list_messages
parameters:
- description: Inbox id.
in: path
name: id
required: true
schema:
format: uuid
type: string
- $ref: '#/components/parameters/Since'
- description: 'Filter expression: `subject:<term>`, `from:<term>`, or `to:<term>` select a field; any other input — including a bare term — matches against the subject. Case-insensitive substring match; LIKE wildcards in the term are escaped. `to:` matches any recipient.'
in: query
name: match
required: false
schema:
type: string
- $ref: '#/components/parameters/Wait'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/MessageList'
description: Matching messages — empty array when nothing matched within the wait window.
'400':
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
description: '`match` has an empty term after its field prefix.'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
description: No such inbox on this account.
'429':
$ref: '#/components/responses/RateLimited'
'500':
$ref: '#/components/responses/ServerError'
summary: List or long-poll messages
tags:
- Messages
/v1/messages/{id}:
get:
description: 'Full detail: bodies, unfolded headers, extraction results, and attachment metadata. Raw MIME bytes are not included; use the attachment download endpoint for decoded parts.'
operationId: get_message
parameters:
- description: Message id.
in: path
name: id
required: true
schema:
format: uuid
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/MessageDetail'
description: The message.
'401':
$ref: '#/components/responses/Unauthorized'
'404':
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
description: No such message on this account.
'429':
$ref: '#/components/responses/RateLimited'
'500':
$ref: '#/components/responses/ServerError'
summary: Get a message
tags:
- Messages
/v1/messages/{id}/attachments/{index}:
get:
description: 'Decoded bytes of one attachment, served as a forced download: `Content-Type` is always `application/octet-stream` and disposition is always `attachment` regardless of the declared type (emails are hostile input). The filename is sanitized to `[A-Za-z0-9. _-]`, 80 chars max.'
operationId: download_attachment
parameters:
- description: Message id.
in: path
name: id
required: true
schema:
format: uuid
type: string
- description: Zero-based position in the message's `attachments` metadata array.
in: path
name: index
required: true
schema:
minimum: 0
type: integer
responses:
'200':
content:
application/octet-stream:
schema:
format: binary
type: string
description: The decoded attachment bytes.
headers:
Content-Disposition:
description: '`attachment; filename="<sanitized>"` — always a download.'
schema:
type: string
X-Content-Type-Options:
description: Always `nosniff`.
schema:
type: string
'401':
$ref: '#/components/responses/Unauthorized'
'404':
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
description: No such message, no servable attachment at that index (nested message/multipart parts are not servable), or the offloaded raw MIME object no longer exists.
'429':
$ref: '#/components/responses/RateLimited'
'500':
$ref: '#/components/responses/ServerError'
'503':
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
description: The raw MIME was offloaded to object storage and the store is unavailable or not configured.
summary: Download an attachment
tags:
- Messages
/v1/messages/{id}/links:
get:
description: Every URL from the HTML and text parts, with anchor text and a class guess.
operationId: get_message_links
parameters:
- description: Message id.
in: path
name: id
required: true
schema:
format: uuid
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/LinkList'
description: Classified links; empty array when none were extracted.
'401':
$ref: '#/components/responses/Unauthorized'
'404':
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
description: No such message on this account.
'429':
$ref: '#/components/responses/RateLimited'
'500':
$ref: '#/components/responses/ServerError'
summary: Get the extracted links
tags:
- Messages
/v1/messages/{id}/links/follow:
post:
description: 'GETs one of the message''s extracted links (default: the first `verify`-classed link), following up to 5 redirects with every hop re-validated against the SSRF guard (https-only, public hosts; 5 s per hop, 15 s total). The target''s body is never returned. The final hop''s HTTP status is reported in the outcome, not judged — a remote 500 is still a 200 here with `status: 500`.'
operationId: follow_message_link
parameters:
- description: Message id.
in: path
name: id
required: true
schema:
format: uuid
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/FollowRequest'
required: false
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/FollowOutcome'
description: The follow outcome.
'400':
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
description: 'More than one of `url`/`class`/`index` was passed, or the selected link itself is not followable (guard-refused: non-https, private host, …).'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
description: No such message, or no extracted link matches the selector — the detail lists the link classes that do exist.
'429':
$ref: '#/components/responses/RateLimited'
'500':
$ref: '#/components/responses/ServerError'
'502':
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
description: 'The remote misbehaved: unreachable, a redirect hop was guard-refused, more than 5 redirects, or the chain exceeded 15 seconds.'
summary: Follow an extracted link server-side
tags:
- Messages
/v1/messages/{id}/otp:
get:
description: The message's OTP verdict. `best` is null when no candidate scores above the confidence threshold — honesty over guessing. Always this shape, even for messages with no candidates.
operationId: get_message_otp
parameters:
- description: Message id.
in: path
name: id
required: true
schema:
format: uuid
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ExtractedOtp'
description: Ranked OTP candidates and the best pick.
'401':
$ref: '#/components/responses/Unauthorized'
'404':
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
description: No such message on this account.
'429':
$ref: '#/components/responses/RateLimited'
'500':
$ref: '#/components/responses/ServerError'
summary: Get the extracted OTP
tags:
- Messages
components:
schemas:
Extracted:
description: Extraction results computed at receipt. `text`, `auth`, and `spam` are conditionally present keys — see their descriptions.
properties:
auth:
$ref: '#/components/schemas/ExtractedAuth'
links:
items:
$ref: '#/components/schemas/ExtractedLink'
type: array
otp:
$ref: '#/components/schemas/ExtractedOtp'
spam:
$ref: '#/components/schemas/ExtractedSpam'
text:
description: Plain-text rendering of the HTML part; present only when the message had no text/plain part.
type: string
required:
- otp
- links
type: object
AttachmentMeta:
properties:
content_type:
description: Declared MIME type; defaults to application/octet-stream.
type: string
filename:
type:
- string
- 'null'
inline:
description: True for cid-referenced inline parts (e.g. embedded images).
type: boolean
size:
description: Decoded byte length.
type: integer
required:
- filename
- content_type
- size
- inline
type: object
DkimAuth:
properties:
domain:
type: string
error:
description: Present only for non-pass results — e.g. a body-hash mismatch reports `neutral` with the reason here (RFC 6376 §6.1).
type: string
result:
$ref: '#/components/schemas/AuthResult'
selector:
type: string
required:
- result
- domain
- selector
type: object
DmarcAuth:
properties:
domain:
description: RFC5322.From domain; present only when non-empty.
type: string
policy:
description: Present only when a DMARC record exists.
enum:
- none
- quarantine
- reject
type: string
result:
$ref: '#/components/schemas/AuthResult'
required:
- result
type: object
ExtractedSpam:
description: 'SpamAssassin content analysis (local rules only — no network/RBL tests, so scores are deterministic). The whole key is absent when scoring is disabled, the daemon was unreachable, or the message exceeded the scoring size cap — absence means "not scored", never "failed". Observation only: the verdict never affects acceptance.'
properties:
rules:
description: The rules that fired, with their individual score contributions; empty when nothing matched.
items:
$ref: '#/components/schemas/SpamRule'
type: array
score:
description: Total SpamAssassin score; higher is spammier. May be negative.
type: number
threshold:
description: The score at or above which the message is classed spam (default 5.0).
type: number
verdict:
description: 'SpamAssassin''s own decision (its `Spam: True/False`), not a client-side threshold recomputation.'
enum:
- spam
- ham
type: string
required:
- score
- threshold
- verdict
- rules
type: object
AuthResult:
description: RFC 8601 result vocabulary. DNS trouble degrades to `temperror`.
enum:
- pass
- fail
- softfail
- neutral
- none
- temperror
- permerror
type: string
ExtractedAuth:
description: 'Receive-side SPF/DKIM/DMARC verdicts (RFC 8601 vocabulary). The whole key is absent when verification is disabled on the deployment — absence means "not verified", never "failed". Observation only: verdicts never affect acceptance.'
properties:
dkim:
description: One entry per DKIM signature; unsigned mail is an empty array.
items:
$ref: '#/components/schemas/DkimAuth'
type: array
dmarc:
$ref: '#/components/schemas/DmarcAuth'
spf:
$ref: '#/components/schemas/SpfAuth'
required:
- spf
- dkim
- dmarc
type: object
ExtractedOtp:
properties:
best:
description: Top-ranked code, or null when no candidate scores above the confidence threshold.
type:
- string
- 'null'
candidates:
description: At most 5, sorted by descending score.
items:
$ref: '#/components/schemas/OtpCandidate'
type: array
required:
- best
- candidates
type: object
SpamRule:
properties:
description:
description: Human-readable rule description, when spamd supplied one.
type:
- string
- 'null'
name:
description: SpamAssassin rule symbol, e.g. `MISSING_HEADERS`.
type: string
score:
description: This rule's contribution to the total; may be negative.
type: number
required:
- name
- score
type: object
MessageHeader:
properties:
name:
type: string
value:
type: string
required:
- name
- value
type: object
MessageDetail:
properties:
attachments:
items:
$ref: '#/components/schemas/AttachmentMeta'
type: array
expires_at:
description: Retention expiry (plan retention from receipt).
format: date-time
type: string
extracted:
$ref: '#/components/schemas/Extracted'
from_addr:
type: string
headers:
description: All headers in source order, folding unfolded.
items:
$ref: '#/components/schemas/MessageHeader'
type: array
html_body:
type:
- string
- 'null'
id:
format: uuid
type: string
inbox_id:
format: uuid
type: string
raw_size:
description: Size of the raw MIME in bytes.
type: integer
received_at:
format: date-time
type: string
subject:
type:
- string
- 'null'
text_body:
type:
- string
- 'null'
tls:
type: boolean
to_addrs:
items:
type: string
type: array
required:
- id
- inbox_id
- received_at
- from_addr
- to_addrs
- subject
- tls
- text_body
- html_body
- headers
- extracted
- attachments
- raw_size
- expires_at
type: object
MessageList:
properties:
messages:
items:
$ref: '#/components/schemas/MessageSummary'
type: array
required:
- messages
type: object
MessageSummary:
properties:
from_addr:
type: string
id:
format: uuid
type: string
received_at:
format: date-time
type: string
subject:
type:
- string
- 'null'
tls:
description: Whether the delivering SMTP session had negotiated STARTTLS.
type: boolean
to_addrs:
items:
type: string
type: array
required:
- id
- received_at
- from_addr
- to_addrs
- subject
- tls
type: object
Problem:
description: 'RFC 7807 problem document — every error response uses this shape with `Content-Type: application/problem+json`.'
properties:
detail:
description: Human-readable specifics; null on 500.
type:
- string
- 'null'
status:
description: The HTTP status, duplicated in the body.
type: integer
title:
description: Fixed short phrase for the status class, e.g. `bad request`, `not found`.
type: string
type:
const: about:blank
type: string
required:
- type
- title
- status
- detail
type: object
LinkList:
properties:
links:
items:
$ref: '#/components/schemas/ExtractedLink'
type: array
required:
- links
type: object
FollowRequest:
description: Selects which extracted link to follow. Pass at most one field; with none, the first `verify`-classed link is followed.
properties:
class:
description: First link of this class.
enum:
- verify
- reset
- unsubscribe
- other
type: string
index:
description: Zero-based index into the extracted links.
minimum: 0
type: integer
url:
description: Exact match against a URL in the extracted links.
type: string
type: object
FollowOutcome:
properties:
final_url:
description: URL of the final, non-redirect response.
type: string
ok:
description: True when `status` is 2xx.
type: boolean
redirects:
description: Redirect hops followed (max 5).
type: integer
requested_url:
type: string
status:
description: HTTP status of the final response — reported, not judged.
type: integer
required:
- requested_url
- final_url
- status
- redirects
- ok
type: object
OtpCandidate:
properties:
score:
description: Keyword-proximity score, one decimal.
type: number
value:
description: The digit sequence.
type: string
required:
- value
- score
type: object
ExtractedLink:
properties:
class:
description: Class guess from URL path + anchor keywords; magic-link/login URLs class as `verify`.
enum:
- verify
- reset
- unsubscribe
- other
type: string
text:
description: Anchor text; null for bare-text URLs.
type:
- string
- 'null'
url:
type: string
required:
- url
- text
- class
type: object
SpfAuth:
properties:
domain:
description: The identity checked (MAIL FROM, falling back to HELO); may be empty.
type: string
result:
$ref: '#/components/schemas/AuthResult'
required:
- result
- domain
type: object
responses:
ServerError:
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
description: Unexpected server error. `detail` is null — internals are never leaked.
Unauthorized:
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
description: Missing bearer token, malformed key, or unknown/revoked/invalid API key.
headers:
WWW-Authenticate:
description: 'RFC 6750 Bearer challenge: `Bearer realm="mailfixture"` when no token was sent, with `error="invalid_token"` when one was sent but rejected.'
schema:
type: string
RateLimited:
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
description: Per-key rate limit exceeded. `Retry-After` says when the next request will be admitted; the RateLimit headers name the bucket that refused (`requests` or `creates`) with `r=0`.
headers:
RateLimit:
description: 'Live bucket state: `"<bucket>";r=<remaining>;t=<seconds until full>`. Present on every authenticated response, not only 429s.'
schema:
type: string
RateLimit-Limit:
description: Bucket size (legacy integer form).
schema:
type: integer
RateLimit-Policy:
description: 'Quota policy, draft-ietf-httpapi-ratelimit-headers syntax: `"<bucket>";q=<size>;w=<seconds to refill fully>`.'
schema:
type: string
RateLimit-Remaining:
description: Whole tokens left (legacy integer form).
schema:
type: integer
RateLimit-Reset:
description: Seconds until the bucket is full (legacy integer form).
schema:
type: integer
Retry-After:
description: Seconds until the next token is available.
schema:
type: integer
parameters:
Wait:
description: Long-poll window in seconds; default 0 answers immediately. Clamped to 60 — larger values are accepted and treated as 60. The request returns as soon as a matching item arrives; an empty window still answers 200 with an empty list.
in: query
name: wait
required: false
schema:
minimum: 0
type: integer
Since:
description: Only items (messages, SMS, or captured requests) received strictly after this RFC 3339 timestamp. Feed back the last summary's `received_at` as a cursor — the row carrying that exact timestamp is not repeated.
in: query
name: since
required: false
schema:
format: date-time
type: string
securitySchemes:
apiKey:
description: mailfixture API key (`mfx_…`) as a Bearer token. Create one in the dashboard (/app/keys) or via POST /v1/keys.
scheme: bearer
type: http
externalDocs:
description: Hand-written API reference
url: https://mailfixture.com/docs/api