# API reference

This is every operation in Flyanote's API, what each takes, and what it answers, generated from the OpenAPI document the API serves (release `main-6976024`), so it lists only what the API has. For a first send, start with the [quick start](https://flyanote.com/docs/quickstart).

## Where is the API?

At `https://app.flyanote.com/api`. Every path in this reference is under it: `GET /v1/messages` is `https://app.flyanote.com/api/v1/messages`. Bodies are JSON, and so are answers.

## How does a request authenticate?

An API key (ADR-0009), sent as `Authorization: Bearer fan_live_…`. Test keys (`fan_test_…`) run everything but never send real mail, and run every check but one: a test send is never refused for an address on Flyanote's own abuse list, so a test send that passes doesn't prove the live one will. Each operation lists the scope it needs.

Each operation below names the scope its key needs. A request without a key, or with a key that lacks the scope, is refused before anything else is read.

## What happens when a request fails?

The API answers with an RFC 9457 problem (`application/problem+json`) whose `code` never changes, so branch on that. [API errors](https://flyanote.com/docs/errors) lists every code, and the steps that fix it. Each operation below lists the codes it can answer, linked to their entries.

## How often can I call it?

Each key, and each account across its keys, has its own limits. Once the API knows the key, its answers state what's left in the `RateLimit` and `RateLimit-Policy` headers. Past a limit, the answer is 429 `rate_limited` with `Retry-After`: wait that many seconds, then retry.

## What can the API do?

* [Messages](https://flyanote.com/docs/api/messages): Send one email to one recipient, then read what happened to it.
* [Sending domains](https://flyanote.com/docs/api/domains): Add the domain your mail comes from, read the DNS records to publish, and check them again.
* [Account and API keys](https://flyanote.com/docs/api/account): Read your account's profile and credit balance, change the profile, and see which API key is calling.
* [Sender profile](https://flyanote.com/docs/api/sender-profile): Read and set your account's sender profile: who your mail is from, as your marketing email's footer shows it.
* [Contacts](https://flyanote.com/docs/api/contacts): Add the people you write to, find them, change them, and keep their subscriptions and custom fields.
* [Topics](https://flyanote.com/docs/api/topics): Topics are the lists your contacts subscribe to: make them, change or archive them, and subscribe contacts.
* [Tags](https://flyanote.com/docs/api/tags): Tags are your own labels for contacts: make, rename, or delete them, and tag or untag contacts in bulk.
* [Segments](https://flyanote.com/docs/api/segments): A segment picks contacts by rules: make one, count who it matches, and change its rules.
* [Status and the OpenAPI document](https://flyanote.com/docs/api/status): Check the API is up and which release it runs, and fetch the OpenAPI document it serves.

## Is there a machine-readable copy?

Yes: [the OpenAPI document](https://flyanote.com/openapi.json) this reference is generated from. Any page's address with`.md` added is its Markdown.
