# Access (/access)
API keys are by request while the API is in private beta. Self-serve keys come once the API terms and test mode are ready.
## Requesting access [#requesting-access]
Write to [support@stylograph.ai](mailto:support@stylograph.ai) from the email address on your Stylograph account. Say what you plan to send, roughly how many notes a month, and which system will call the API.
Stylograph turns API access on for your organization. Once it is on, members make keys in the Note Composer under **Settings**, in the API keys section. See [Authentication](/authentication#making-a-key).
## Organizations and teams [#organizations-and-teams]
Access is for a whole organization. A key belongs to one member and works on one team, the team the member is acting as when they make it.
- Any role but Viewer can make a key.
- Notes sent with a key are paid from the organization's credits.
- An Org Admin sees every key in the organization in Settings and can revoke any of them.
- The daily note limit and the request rate are counted across the organization. See [Limits](/limits).
## Before you send [#before-you-send]
The API sends the same notes the Note Composer does, so the account needs the same things in place:
- A built handwriting font.
- A return address in Settings. A postcard may leave it off.
- Credits. A send charges the format's credits when it is accepted.
## Turning access off [#turning-access-off]
Stylograph can turn access off again. When that happens, every live key in the organization is revoked at once, and requests with those keys answer `401`.
# Authentication (/authentication)
Every request carries an API key as a bearer token:
```text
Authorization: Bearer sg_live_...
```
A missing, revoked or expired key answers `401`. A key without the scope a route needs answers `403`.
## Making a key [#making-a-key]
Keys are made in the Note Composer under **Settings**, in the API keys section, once [API access](/access) is on for your organization. The key works on the team you are acting as when you make it, and only on that team. You need a role other than Viewer, and you need to have signed in within the last 30 minutes. You get an email about every new key.
- The key is shown once, when you make it. Store it then. Stylograph keeps only a hash of it and its first 8 characters, which Settings shows so you can tell keys apart.
- A key expires after 30, 90 or 365 days. You pick when you make it, and 90 is the default.
- Each member can hold up to 10 live keys and make up to 20 new keys in 24 hours. An organization holds at most 50 live keys across its members.
- A key that can send may carry its own daily note cap, from 1 to 1000 notes in 24 hours. You set it when you make the key, and it can't be changed after. The organization's own limit still applies on top of it. Past the cap, a send answers `429` `API_KEY_DAILY_LIMIT_REACHED`.
- Revoke a key in Settings and it stops working at once. An Org Admin can revoke any key in the organization.
- A key whose member leaves its team stops working.
## Scopes [#scopes]
A key holds only the scopes it was made with. A new key starts with `account:read` and `notes:read`, so it can read but not send.
| Scope | What it opens |
| --- | --- |
| `account:read` | `GET /api/v1/account` |
| `notes:read` | `GET /api/v1/notes` and `GET /api/v1/notes/{noteId}` |
| `notes:send` | Sending (`POST /api/v1/notes`), uploading a cover (`POST /api/v1/covers`), cancelling a note (`DELETE /api/v1/notes` and `DELETE /api/v1/notes/{noteId}`), deleting a mailed note's content (`DELETE /api/v1/notes/{noteId}/content`), and reading recipients, card backs, writers, letter designs and templates |
| `recipients:write` | A send to a new `recipient`, who is then added to your address book. With a role that can change recipients, it also adds, edits and imports recipients. See [Recipients](/recipients). |
Any live key can read `GET /api/v1/covers`.
Give each system the smallest set it needs, and its own key, so you can revoke one without stopping the others. A dashboard that only shows delivery status needs `notes:read` and nothing else. An AI agent needs `account:read`, `notes:read` and `notes:send`, without `recipients:write`, so it can send only to people already in your address book. Give it a low daily cap too. A system that keeps your address book, such as a CRM sync, gets its own key with `recipients:write`.
## Keeping a key safe [#keeping-a-key-safe]
- Call the API from your server. The API sends no CORS headers, so a browser can't call it, and a key in a web page or a mobile app is a key anyone can copy.
- Keep keys in a secret store or an environment variable, never in source control.
- If a key leaks, revoke it in Settings and make a new one.
# Card backs (/card-backs)
A folded note can carry a card back: the design on the back of the card, made in **Card Backs** in the Note Composer. Card backs are made and edited there, never through the API.
## Choosing the back [#choosing-the-back]
| `card_back_id` | What the note gets |
| --- | --- |
| Left out | The account's default back, if it has one. This is what the Note Composer does. |
| `null` | No card back. |
| An id | That back, from `GET /api/v1/card-backs`. |
A postcard has no card back, because its back is the address side.
## Listing card backs [#listing-card-backs]
`GET /api/v1/card-backs` needs the `notes:send` scope. Each back has its `id`, its `name`, whether it `is_default`, whether it is `ready` for print, and a preview link that works for an hour.
A send with a back that isn't ready answers `409` `CARD_BACK_NOT_READY`. To fix it, save the back again in Card Backs, or send another `card_back_id` or `null`. An id that isn't one of the account's backs, or one that was archived, answers `404` `CARD_BACK_UNAVAILABLE`.
A dry run shows which back the note would carry, and `default_card_back` says whether it came from the account's default.
# Errors (/errors)
Every error has the same shape:
```json
{
"error": {
"code": "insufficient_credits",
"message": "Not enough credits.",
"details": { "required": 40, "available": 25 }
}
}
```
- `code` is stable. Match on it, never on `message`. Two codes are lower case (`insufficient_credits` and `account_suspended`) because they match what the Note Composer returns.
- `message` is a sentence safe to show a person.
- `details` holds structured context for some codes, such as the suggested address for an address USPS doesn't confirm, or `null`.
Each code always comes with the same HTTP status. Every `409` about the account's state can be checked first with `GET /api/v1/account`.
## Retrying [#retrying]
- `429` and `503` can be tried again later. When the answer carries `Retry-After`, wait that many seconds first.
- A `500` can be tried again with the same `Idempotency-Key`, so the note is never sent twice.
- Other `4xx` codes need a change to the request or the account first.
## Every code [#every-code]
This table is built from the OpenAPI document, so it always matches what the API returns.
# Introduction (/)
The Stylograph API sends a note in your own handwriting. You call it with the message and the recipient. Stylograph writes the card with a pen plotter in the handwriting you captured, then mails it.
Anything you can do with a note in the [Note Composer](https://composer.stylograph.ai) you can do from code: pick a cover and a card back, write the message and a closing, send it now or on a later day, and follow it until USPS delivers it.
## What you need [#what-you-need]
- A Stylograph account with a built handwriting font and a return address.
- Credits for the notes you send. Each format costs a set number of credits, listed in [`GET /api/v1/account`](/reference/getAccount).
- API access for your organization, which you request from Stylograph, and an API key. See [Access](/access).
## How a send works [#how-a-send-works]
1. Check the account with `GET /api/v1/account`: credits, handwriting, return address and today's limits.
2. Try the note with `dry_run: true`. Every check runs and nothing is charged.
3. Send it with an `Idempotency-Key`, so a retry never sends twice.
4. Poll `GET /api/v1/notes` with `updated_since` to follow it from `queued` to `delivered`.
The [Quickstart](/quickstart) walks through those steps with `curl`.
## Base URL [#base-url]
```text
https://composer.stylograph.ai/api/v1
```
Every request and response body is JSON. A successful response wraps its result in `data`, and an error comes back as `{ "error": { "code", "message", "details" } }`.
## Connecting other systems [#connecting-other-systems]
[Integrations](/integrations) covers Shopify, Salesforce, HubSpot, Etsy and Zapier: what works today through the API, and what is planned.
## For AI agents [#for-ai-agents]
An agent can send notes through the [MCP server](/mcp) with the same checks as the API.
This site serves plain text for agents at [`/llms.txt`](/llms.txt), and the full text at [`/llms-full.txt`](/llms-full.txt). Ask for any page with `Accept: text/markdown`, or add `.md` to its path, and you get markdown back. The OpenAPI document is at [`/openapi/v1.json`](https://composer.stylograph.ai/openapi/v1.json) on the Note Composer.
# Etsy (/integrations/etsy)
There is no Etsy connection in Stylograph yet. A built-in one is planned (see below). Until then, any automation that can read your orders can call the API.
## What works today [#what-works-today]
- **From your own code or an automation tool.** Anything that can read your Etsy orders and make an HTTP request can call `POST /api/v1/notes` with the buyer's shipping name and address and an `Idempotency-Key` built from the receipt ID. The [Shopify](/integrations/shopify) page shows the same pattern step by step.
- **Without automation.** Export your orders from Etsy, import the buyers as recipients in the Note Composer, and send them as a campaign.
Etsy's seller policy limits what a seller may do with a buyer's information. A thank-you card for an order the buyer placed fits that. Adding buyers to a mailing list without their consent does not. Read the policy for your own shop.
## Planned [#planned]
An Etsy connection: you connect your shop with Etsy's sign-in, read-only, and a thank-you card goes out in your handwriting when a buyer places a paid order. The plan includes a holdout group, so a seller can measure whether the cards bring buyers back. There is no date yet.
# HubSpot (/integrations/hubspot)
There is no HubSpot connection in Stylograph. HubSpot stays your system of record: you pick who gets a card in HubSpot, and HubSpot calls the Stylograph API to send it.
## What works today [#what-works-today]
- **A HubSpot workflow.** HubSpot plans that include the webhook or custom code workflow action can call `POST /api/v1/notes`. A custom code action can set the `Authorization` header and keep the API key in HubSpot's secrets. Check HubSpot's own docs for which plans include these actions.
- **Zapier.** A HubSpot trigger, such as a contact entering a list or a deal moving to a stage, then a Webhooks by Zapier step. See [Zapier](/integrations/zapier).
- **Without automation.** Export the contacts, import them in the Note Composer under Recipients, and send them as a campaign.
Map the contact's name and mailing address to `recipient`: `firstname`, `lastname`, `company`, `address`, `city`, `state` and `zip`. The API takes US addresses only, with a two-letter state and a five-digit ZIP.
Set the `Idempotency-Key` from the record that started the send, such as `hubspot-deal-1234567890`, so a retried workflow never sends twice. Send `crm_contact` as `{ "source": "hubspot", "id": "" }` too, so two workflows that fire on the same contact mail one card that day. The key needs `notes:send` and `recipients:write`.
To record the card in HubSpot, keep the note `id` or `reference` from the answer. To follow it to delivery, poll `GET /api/v1/notes` with `updated_since`. See [Note status](/note-status).
## Planned [#planned]
A HubSpot app that you install from HubSpot's marketplace and connect without copying a key would need OAuth apps first. It isn't scheduled. Status webhooks would let a workflow hear about a delivery without polling. There is no date yet.
# Overview (/integrations)
Stylograph doesn't replace your CRM or your store. You keep your contacts and orders where they are, pick who gets a card there, and send it through the API or the [MCP server](/mcp).
## What works today [#what-works-today]
| Way in | Who it suits | What it needs |
| --- | --- | --- |
| Call the API from your own code | Teams with a developer | An API key |
| Call the API from a workflow tool, such as Shopify Flow, Zapier or a CRM workflow | Teams without a developer | An API key, and a plan of that tool that can make an HTTP request |
| Export a list and import it in the Note Composer | Anyone | A CSV file, sent as a campaign with one send date |
| Load a list into the address book from code | Teams with a developer | An API key with `recipients:write`. See [Recipients](/recipients#importing-a-list) |
Every source below follows the same pattern: on an event in your system, call `POST /api/v1/notes` with the person's name and mailing address and an `Idempotency-Key` built from your own record's ID. That makes a retried event safe, and lets you [cancel the note](/send-later#cancelling) by the same ID while it is queued.
Stylograph doesn't store your record's ID on the note, and you can't list notes by it. Keep the note `id` the send answers with if your system needs to link back.
## By source [#by-source]
| Source | Today | Planned |
| --- | --- | --- |
| [Shopify](/integrations/shopify) | Flow or Zapier calls the API on a paid order, and cancels the card on a cancelled order or full refund | A Shopify app |
| [Salesforce](/integrations/salesforce) | A Flow, Apex or Zapier calls the API | A built-in connection |
| [HubSpot](/integrations/hubspot) | A workflow or Zapier calls the API | A HubSpot app, once OAuth apps ship |
| [Etsy](/integrations/etsy) | Your own automation calls the API | An Etsy connection |
| [Zapier](/integrations/zapier) | Webhooks by Zapier calls the API, or the Stylograph app by invite | A public listing for the app on Zapier |
## Planned for every integration [#planned-for-every-integration]
- **Status webhooks**: Stylograph calls your URL when a note is printed, mailed or delivered, so you don't have to poll.
- **OAuth apps**: a Connect button in place of copying an API key.
- **Test mode**: test keys that make real notes you can follow through their statuses, with nothing printed or charged. Until then, use `dry_run: true`.
None of these has a date yet.
# Salesforce (/integrations/salesforce)
Salesforce stays your system of record. You pick who gets a card in Salesforce, and Salesforce calls the Stylograph API to send it.
## What works today [#what-works-today]
Anything in Salesforce that can make an HTTP request can send a note: a Flow with an HTTP callout, or Apex. Zapier works too, with a Salesforce trigger and a Webhooks by Zapier step, as on the [Zapier](/integrations/zapier) page. Check Salesforce's own docs for how to set up a callout in your org.
Keep the API key in a Named Credential or another secret store, never in a Flow's text.
The call is `POST /api/v1/notes` with an `Idempotency-Key` built from the record that started it, such as `sf-task-00T5e00000AbCdE`. Map the Contact's mailing address to `recipient`:
| Salesforce Contact | `recipient` field |
| --- | --- |
| `Salutation` | `honorific` |
| `FirstName` | `first_name` |
| `LastName` | `last_name` |
| `Account.Name` | `company` |
| `MailingStreet`, first line | `address_line1` |
| `MailingStreet`, any other lines | `address_line2` |
| `MailingCity` | `city` |
| `MailingState`, as a two-letter code | `state` |
| `MailingPostalCode` | `zip` |
The API takes US addresses only, with a two-letter state and a five-digit ZIP, so leave out Contacts with a mailing address in another country. A send whose address USPS doesn't confirm is refused, so try a new list with `dry_run: true` first.
Send `crm_contact` as `{ "source": "salesforce", "id": "" }` too, so two Flows that fire on the same Contact mail one card that day.
The key needs `notes:send` and `recipients:write`. A Contact is added to your Stylograph address book the first time you send to them, and matched to the same entry after that.
To record the card in Salesforce, keep the note `id` or `reference` from the answer on the record that started it. To follow it to delivery, poll `GET /api/v1/notes` with `updated_since`. See [Note status](/note-status).
### Without automation [#without-automation]
Export a report of Contacts, import it in the Note Composer under Recipients, and send them as a campaign.
To load the same list into your address book from code instead, send it to `POST /api/v1/recipients/import`. See [Recipients](/recipients#importing-a-list).
## Planned [#planned]
A built-in Salesforce connection is planned. An Org Admin would connect your org to a team from Settings and pick one active Campaign. Its Contacts with a US mailing address would be added to your address book, and when a card to one of them is mailed, a completed Task would be logged on the Contact with the note's reference, never its message. There is no date yet.
A Salesforce app that you install from the AppExchange and connect without copying a key would need OAuth apps first. It isn't scheduled.
# Shopify (/integrations/shopify)
There is no Shopify app yet. A store can still send cards from its orders today, by calling the API from Shopify Flow or from Zapier.
## What works today [#what-works-today]
Each paid order that qualifies calls `POST /api/v1/notes` with:
- The shipping name and address as `recipient`. The key needs `recipients:write`.
- `scheduled_for` set to the order date plus your delay, up to 90 days ahead. The note exists at once, shows in your Notes list, and goes to print on that day.
- An `Idempotency-Key` built from the order, such as `shopify-order-5551234567`. A retried event then returns the same note and never sends twice.
When an order is cancelled or fully refunded before its card prints, cancel the card by that same key:
```text
DELETE https://composer.stylograph.ai/api/v1/notes?idempotency_key=shopify-order-5551234567
```
The credits go back to the account. A partial refund keeps the card, so leave it alone.
A queued card can be cancelled until the printer starts on it. A cancel that comes after that answers `409` `NOTE_NOT_CANCELLABLE` and changes nothing. To leave time for a cancel, set `scheduled_for` a day or two out. See [Cancelling](/send-later#cancelling).
Try the first one with `"dry_run": true` in the body. It runs every check, including the address, and sends nothing.
### Shopify Flow [#shopify-flow]
Flow's Send HTTP request action is on Shopify's Grow, Advanced and Plus plans. Check Shopify's own docs for the current plans.
1. Trigger on the order being paid, or fulfilled if your delay should start when it ships.
2. Add a condition for the product, tag or collection that qualifies.
3. Send HTTP request: `POST https://composer.stylograph.ai/api/v1/notes`, with the headers `Authorization: Bearer {{secrets.stylograph_key}}`, `Idempotency-Key: shopify-order-{{order.legacyResourceId}}` and `Content-Type: application/json`. Keep the key in Flow's secrets, never in the body of the workflow.
4. Flow can retry a failed request for up to a day. A retry with the same `Idempotency-Key` is safe. A `400` or `422` means the request itself is wrong, such as an address USPS doesn't confirm, and a retry won't fix it.
5. A second workflow on cancellation or refund sends the `DELETE` above. Add a condition so only a full refund cancels.
```json
{
"format": "folded",
"recipient": {
"first_name": "{{order.shippingAddress.firstName}}",
"last_name": "{{order.shippingAddress.lastName}}",
"address_line1": "{{order.shippingAddress.address1}}",
"address_line2": "{{order.shippingAddress.address2}}",
"city": "{{order.shippingAddress.city}}",
"state": "{{order.shippingAddress.provinceCode}}",
"zip": "{{order.shippingAddress.zip}}"
},
"message": "Hi {{order.shippingAddress.firstName}}, thank you for your order.",
"scheduled_for": "2027-01-15"
}
```
Build `scheduled_for` from the order date in Flow. For a delay longer than 90 days, add a Wait step first and set `scheduled_for` for the rest.
### Zapier [#zapier]
This doesn't need Flow. Webhooks by Zapier needs a paid Zapier plan.
1. Trigger: Shopify, New Paid Order.
2. Filter: a line item matches the product that qualifies.
3. Formatter, Date/Time: the order date plus your delay, written as `YYYY-MM-DD`.
4. Webhooks by Zapier, Custom Request: the same `POST`, headers and body as above.
Zapier's own delay step can't wait 90 days, so keep the delay in `scheduled_for`, not in the Zap.
### Without automation [#without-automation]
Export the month's qualifying orders, import them as recipients in the Note Composer, and send them as a campaign. A campaign has one send date, so this works in monthly batches, not per order.
## Things to plan for [#things-to-plan-for]
- The note is charged when it is sent, which can be up to 90 days before it mails. Cancelling gives the credits back.
- The account sends 25 API notes in any 24 hours unless support raises it, counted on the day the order comes in. A busy sale day can pass that. Ask support to raise the limit before a launch or a sale.
- A card scheduled at the first order goes out whether or not the customer is still a customer by then. If that matters, trigger on a later event, such as a renewal order, with a shorter delay.
## Planned [#planned]
A Shopify app: connect a store from Settings, pick the products that qualify, set the delay and the card, and it runs. It would handle cancellations and refunds on its own, and delays longer than 90 days. A first version would run as a custom app for a few beta stores. There is no date yet.
# Zapier (/integrations/zapier)
The Stylograph app for Zapier is private for now and shared by invite. Without it, any Zap can call the API with Webhooks by Zapier, which needs a paid Zapier plan.
## What works today [#what-works-today]
Use any trigger, then a Webhooks by Zapier Custom Request step:
- Method: `POST`
- URL: `https://composer.stylograph.ai/api/v1/notes`
- Headers: `Authorization: Bearer `, `Content-Type: application/json`, and `Idempotency-Key` set to the ID of the record that triggered the Zap
- Data: the note as JSON, as in [Sending a note](/sending-a-note)
```json
{
"format": "folded",
"recipient": {
"first_name": "Ada",
"last_name": "Lovelace",
"address_line1": "12 St James's Square",
"city": "Boston",
"state": "MA",
"zip": "02108"
},
"message": "Thank you for coming in today.",
"dry_run": true
}
```
Map each field from the trigger. Leave `"dry_run": true` in while you test the Zap: Zapier sends a real request when it tests a step, and a dry run checks everything and mails nothing. Take it out before you turn the Zap on.
When the person comes from a CRM, add `crm_contact` with the CRM's name and their id there. Then the Zap and any other integration mail them at most one note a day. See [One note a day per CRM contact](/sending-a-note#one-note-a-day-per-crm-contact).
A key made for Zapier needs `notes:send`, and `recipients:write` if the Zap sends to people who aren't in your address book yet. Give it its own key with a daily cap, so you can revoke it without stopping anything else.
To follow notes from a Zap, poll `GET /api/v1/notes` with `updated_since`. See [Note status](/note-status).
## The Stylograph app [#the-stylograph-app]
The Stylograph app for Zapier is built and registered with Zapier as a private app. While it is private, it is shared by invite: ask [support@stylograph.ai](mailto:support@stylograph.ai) for one. It will be listed publicly on Zapier later. It has:
- **Send Handwritten Note**, an action with fields for the recipient, format, message, closing and cover, and for the CRM and the contact's id there, which it sends as `crm_contact`. Its dry run is on by default, so testing the step mails nothing.
- **Note Status Changed**, a trigger that fires each time a note moves to a new status. It skips the notes the app sent itself, which carry `client: "zapier"`, so a Zap can't set itself off.
- Connecting with an API key. A Connect button in place of a key waits on OAuth sign-in.
Status webhooks would let a trigger fire as soon as a note changes, instead of polling. There is no date yet.
# Limits (/limits)
| Limit | Value |
| --- | --- |
| Requests | 60 requests a minute per organization, across every key and the MCP server, dry runs included |
| API notes | 25 API notes per organization in any 24 hours, unless Stylograph sets otherwise |
| Address checks | 60 address checks an hour per account, dry runs included |
| Request body | 16 KB |
| Recipient import | 500 rows and 256 KB a request |
| New recipients | 1000 a team in any 24 hours |
| Address edits | 200 a team in any 24 hours |
| Send later | Up to 90 days ahead |
| Keys | Up to 10 live keys, and 20 new keys in 24 hours, per member. Up to 50 live keys per organization |
| Notes per key | An optional cap of 1 to 1000 notes in 24 hours, set when the key is made |
| Duplicates | The same message to the same recipient once in 24 hours across the team, unless `allow_duplicate` is set |
| CRM contacts | One note a day to each `crm_contact` across the team, unless `allow_duplicate` is set |
## Request rate [#request-rate]
Every answer carries `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset`. Past the limit, a request answers `429` `RATE_LIMITED` with `Retry-After`.
## API notes [#api-notes]
`api_notes` in `GET /api/v1/account` shows the organization's daily limit, how many were used in the last 24 hours, how many remain and when the next one can go. Past it, a send answers `429` `API_DAILY_LIMIT_REACHED`. A note you cancel stops counting, up to as many cancelled notes as the limit.
## A key's own cap [#a-keys-own-cap]
A key can carry its own daily note cap, set when it is made. Past it, a send answers `429` `API_KEY_DAILY_LIMIT_REACHED`. The organization's limit still applies on top of every key's cap.
## Printing capacity [#printing-capacity]
Printing capacity is shared by every account. It is counted by the day a note goes to print, and a larger format takes more of a day. When that day's is full, a send answers `503` `VENDOR_DAILY_CEILING_REACHED`, and `vendor_capacity_available` in `GET /api/v1/account` is `false`. Try again the next day, or send for a later day. A send-later note counts toward the day it prints.
An account that sends in volume can have its own share of each print day. Past it, a send for that day answers `429` `ACCOUNT_PRINT_SHARE_REACHED`. Nothing is charged.
# MCP server (/mcp)
The Stylograph MCP server lets an AI agent look up recipients, preview a note, send it and follow it, with the same checks and charges as the REST API.
| Setting | Value |
| --- | --- |
| Server URL | `https://composer.stylograph.ai/api/mcp` |
| Transport | Streamable HTTP, not SSE. The server keeps no session and answers each POST with JSON. |
| Sign-in | An API key in the request header `Authorization: Bearer sg_live_...` |
| OAuth | Not yet. Choose "no sign-in" or header auth in your client. |
Opening the URL in a browser shows "Method not allowed". That's expected, because the server only answers POST.
## 1. Make a key for the agent [#1-make-a-key-for-the-agent]
1. Sign in to the [Note Composer](https://composer.stylograph.ai), open **Settings** and scroll to **API keys**. Making a key needs a sign-in from the last 30 minutes, so sign out and back in if it asks.
2. Name the key after the agent.
3. Give it `account:read`, `notes:read` and `notes:send`: **Read account**, **Read notes** and **Send notes**. Leave **Add and edit recipients** (`recipients:write`) off, so the agent can mail only people already in your address book and can't change it.
4. Set a low number of notes the key may send a day, such as 5. It can't be changed later. To raise it, revoke the key and make a new one.
5. Make the key and copy it right away. It's shown once.
Give the key to the agent through a secret store or an environment variable. Keep it out of chat, source control, tickets and shared docs. If it leaks, revoke it in Settings and it stops working at once.
An agent that should also add people to the address book needs a separate key with `recipients:write`, made by a member whose role can change recipients. See [Recipients](/recipients#who-can-change-the-address-book).
## 2. Connect your client [#2-connect-your-client]
### claude.ai [#claudeai]
1. Open **Customize**, then **Connectors**, then **Add custom connector**.
2. URL: `https://composer.stylograph.ai/api/mcp`.
3. **Authentication**: **No sign-in**. Ignore a "Detected: OAuth sign-in" label.
4. **Request headers**: name `authorization`, value `Bearer ` followed by the key, with the space.
A header can't be edited after it is saved. To fix one, remove the connector and add it again. The **Request headers** setting is in beta in claude.ai, and not every organization has it yet.
### Claude Code [#claude-code]
```bash
export STYLOGRAPH_API_KEY="sg_live_..."
claude mcp add --transport http stylograph https://composer.stylograph.ai/api/mcp \
--header "Authorization: Bearer $STYLOGRAPH_API_KEY"
```
### Any other MCP client [#any-other-mcp-client]
Point it at the server URL, set the transport to Streamable HTTP, and add the `Authorization` header with `Bearer ` in front of the key. A client that tries SSE when no transport is set fails to connect, so set it.
Without a key, the server still lists its tools, but every tool call is refused with a message that says to send the key. Every request counts toward the organization's 60 requests a minute.
## Tools [#tools]
| Tool | What it does | Scope |
| --- | --- | --- |
| `get_account` | Credits, whether the handwriting and return address are ready, notes left today, each format with its price and limit, the key's own cap | `account:read` |
| `search_recipients` | Finds people in the address book by name or company | `notes:send` |
| `list_covers` | The cover art a note can carry, and your own uploaded covers | any key |
| `list_card_backs` | The card backs and which is the default | `notes:send` |
| `list_writers` | The writers on the key's team whose handwriting is ready | `notes:send` |
| `list_letter_designs` | The stationery a letter can be written on. Empty unless letters are on for the account | `notes:send` |
| `list_templates` | The team's saved message templates | `notes:send` |
| `preview_note` | Runs every check a send runs and answers what the note would be and cost, without sending or charging | `notes:send` |
| `send_note` | Mails the note and charges its credits | `notes:send` |
| `list_notes` | Recent notes, newest first, with their status | `notes:read` |
| `get_note` | One note with its history and delivery estimate | `notes:read` |
| `cancel_note` | Cancels a queued note until the printer starts on it, and gives the credits back | `notes:send` |
| `delete_note_content` | Deletes a mailed note's message, names and address for good | `notes:send` |
| `add_recipient` | Adds one person to the address book without mailing them | `recipients:write` |
| `update_recipient` | Changes the fields given on one person | `recipients:write` |
| `import_recipients` | Adds up to 500 people in one step, with a dry run first | `recipients:write` |
Each tool calls the same code as its REST route, so a note sent through MCP is the same as one sent with `POST /api/v1/notes`. The recipient tools also need a role that can change recipients.
## How an agent should send [#how-an-agent-should-send]
1. Call `get_account` first. It tells the agent why a send would be refused before it tries.
2. Find the person with `search_recipients`. When more than one person matches, ask which one.
3. Run `preview_note`. Show the person the recipient, the message, any QR code and the cost, and send only once they approve it.
4. Call `send_note` with the same arguments. When the person came from a CRM, pass `crm_contact`, so the team mails them at most one note a day.
5. Follow the note with `get_note` or `list_notes`.
- `send_note` makes its own idempotency key from the note when the agent sends none, so a retry the same day returns the first note and charges nothing.
- A second copy of the same message to the same recipient within 24 hours is refused unless the agent sends `allow_duplicate: true`. Only do that when the person asks for it.
- Before adding, changing or importing recipients, show the person what will change. Run `import_recipients` with `dry_run` first.
- Use `delete_note_content` only when the person asks. Nothing brings the content back.
## When it doesn't work [#when-it-doesnt-work]
| What you see | What to do |
| --- | --- |
| Every call fails with `INVALID_API_KEY` | The header is missing `Bearer ` or the key was cut off. Enter it again. |
| Tool calls answer `UNAUTHENTICATED` | No `Authorization` header reached the server. Check the client saved it. |
| `INSUFFICIENT_SCOPE` | The key lacks a scope. `details.required_scope` names it. Make a new key with it. |
| `TEAM_ROLE_REQUIRED` | The key's member doesn't have a role that allows the call. Ask an Org Admin. |
| The agent can't find a person | They aren't in the team's address book. Add them in the Note Composer, or with a key that can add recipients. |
| The connection fails at once | The client is using SSE. Switch it to Streamable HTTP. |
| A new tool or option doesn't show | The client cached an old tool list. Reconnect, or start a new session. |
## Reading the docs [#reading-the-docs]
Give an agent [`/llms.txt`](/llms.txt) or [`/llms-full.txt`](/llms-full.txt) to read these docs, and the [OpenAPI document](https://composer.stylograph.ai/openapi/v1.json) for every route.
# Note status (/note-status)
A note moves through these statuses:
| Status | Meaning |
| --- | --- |
| `queued` | Accepted and waiting to print. |
| `printed` | Written by the plotter. |
| `mailed` | Handed to USPS. |
| `delivered` | Delivered, from USPS scans. |
| `returned` | Sent back, from USPS scans. |
| `failed` | Not sent. See `failure_code`. |
| `cancelled` | A queued note you cancelled before the printer started on it. Nothing is mailed and the credits go back. See [Cancelling](/send-later#cancelling). |
`GET /api/v1/notes/{noteId}` adds the note's history and, once USPS has scanned it, a delivery estimate.
## Polling for changes [#polling-for-changes]
`GET /api/v1/notes` lists the account's notes, newest first. It takes these query fields:
- `limit`, from 1 to 100. The default is 25.
- `cursor`, the `next_cursor` of the page before.
- `status`, to list one status.
- `recipient_id`, to list one person's notes.
- `updated_since`, a time with its time zone, to list only notes changed after it.
To follow your notes, keep the newest `updated_at` you saw and pass it as `updated_since` on the next call. Write the time zone as `Z`, or encode `+` as `%2B`.
## Failed notes [#failed-notes]
A `failed` note carries a `failure_code` when a reason was given.
`content_rejected` means the card was declined because of its content, by our review before printing or by our print partner. It can't be sent again as it is. A note our review declines is refunded. A note our print partner declines is not.
## Refunds [#refunds]
A note sent through the API that fails before it is printed is refunded once, soon after it fails. The note's `refund` shows the credits given back and when. If bought credits reached the end of their term while the note waited, those credits are not given back, and `refund` shows only what came back.
A cancelled note is refunded when you cancel it, and its `refund` shows that too.
These are not refunded:
- A note our print partner declined for its content.
- A note that failed after it was printed.
## Deleting a note's content [#deleting-a-notes-content]
Once a note is mailed, you can delete what it held: the message, the recipient's name and address, and the drawing files. This is permanent. Nothing brings the content back.
```bash
curl -X DELETE https://composer.stylograph.ai/api/v1/notes/NOTE_ID/content \
-H "Authorization: Bearer $STYLOGRAPH_API_KEY"
```
- It needs the `notes:send` scope.
- It answers `200` with the note, now with `content_purged: true`, `content_purged_at` set, and `recipient.first_name` and `recipient.last_name` `null`. The note keeps its id, status, dates and credits.
- Deleting again answers `200` with the same note.
- It works on a note that is mailed, delivered, returned, failed or cancelled. A note still queued or printed answers `409` `NOTE_CONTENT_STILL_NEEDED`, because the printer needs its content. Cancel it while it is queued, or delete its content once it is mailed.
- An account can also have its notes' content deleted a set number of days after mailing. Ask Stylograph to set that up.
In an agent, the [MCP server](/mcp)'s `delete_note_content` tool does the same. It should only be used when the person asks.
# Quickstart (/quickstart)
This walks through one note from start to finish. You need an API key with the `account:read`, `notes:read` and `notes:send` scopes. Keep the key in an environment variable on your server:
```bash
export STYLOGRAPH_API_KEY="sg_live_..."
```
## 1. Check the account [#1-check-the-account]
```bash
curl https://composer.stylograph.ai/api/v1/account \
-H "Authorization: Bearer $STYLOGRAPH_API_KEY"
```
The answer tells you whether a send can go now. Look at `credit_balance`, `handwriting.ready`, `return_address_ready`, `api_notes.remaining` and `vendor_capacity_available`. If any of them says no, a send answers with the matching error, so fix it first.
## 2. Find the recipient [#2-find-the-recipient]
Search your address book by name or company. The `id` of a match is the `recipient_id` you send to.
```bash
curl "https://composer.stylograph.ai/api/v1/recipients?q=Lovelace" \
-H "Authorization: Bearer $STYLOGRAPH_API_KEY"
```
To send to someone who isn't in your address book yet, send a `recipient` with their name and address instead. That needs the `recipients:write` scope. See [Sending a note](/sending-a-note#the-recipient). To add people ahead of time, or load a list, see [Recipients](/recipients).
## 3. Try the note [#3-try-the-note]
A dry run runs every check a send runs and charges nothing. It needs no `Idempotency-Key`.
```bash
curl https://composer.stylograph.ai/api/v1/notes \
-H "Authorization: Bearer $STYLOGRAPH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"recipient_id": "8c1f2a4e-5b6d-4c3a-9e7f-1a2b3c4d5e6f",
"format": "folded",
"message": "Thank you for coming by the shop last week. It was a real pleasure to meet you.",
"closing": { "salutation": "Warmly,", "signature": true },
"dry_run": true
}'
```
The answer shows the message as it will print, the cover and card back it will carry, and the credits it will cost.
## 4. Send it [#4-send-it]
Send the same body without `dry_run`, and add an `Idempotency-Key` that is unique to this note. A UUID works.
```bash
curl https://composer.stylograph.ai/api/v1/notes \
-H "Authorization: Bearer $STYLOGRAPH_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 3f6d8a52-91b4-4f0e-a1c2-7d9e5b6a4c31" \
-d '{
"recipient_id": "8c1f2a4e-5b6d-4c3a-9e7f-1a2b3c4d5e6f",
"format": "folded",
"message": "Thank you for coming by the shop last week. It was a real pleasure to meet you.",
"closing": { "salutation": "Warmly,", "signature": true }
}'
```
A new note answers `201` with the note in `data`. Its `status` is `queued`. If the network drops before you see the answer, send the same request again with the same key. You get the same note back with `200` and `Idempotent-Replayed: true`, and nothing is charged twice.
## 5. Follow it [#5-follow-it]
```bash
curl "https://composer.stylograph.ai/api/v1/notes?updated_since=2026-10-30T00:00:00Z" \
-H "Authorization: Bearer $STYLOGRAPH_API_KEY"
```
Keep the newest `updated_at` you saw and pass it as `updated_since` next time. See [Note status](/note-status) for what each status means.
## Next [#next]
- [Sending a note](/sending-a-note) covers new recipients, covers, QR codes, closings and postcards.
- [Send later](/send-later) covers picking a print day and cancelling a note.
- [Errors](/errors) lists every error code.
# Recipients (/recipients)
A note goes to someone in your team's address book, named by `recipient_id`, or to a new person sent inline as `recipient`. These routes let a system keep the address book itself, so a later send only needs the id.
## Searching [#searching]
`GET /api/v1/recipients?q=` finds people by name or company. It needs the `notes:send` scope. See [Sending a note](/sending-a-note#the-recipient) for how a search matches.
A match shows the names, company, city and state, and `address_complete`. It never shows the street lines or ZIP.
## Who can change the address book [#who-can-change-the-address-book]
Adding, editing and importing need two things:
- A key with the `recipients:write` scope. A new key doesn't have it, so make a separate key for the system that keeps your address book.
- A role on the key's team that can change recipients: Org Admin, Team Admin or Operator. The role is read on every call, so a member whose role changes loses the right at once. Without it, a call answers `403` `TEAM_ROLE_REQUIRED`.
A team adds at most 1000 new recipients through the API in any 24 hours, counting every route that adds one. Past it, a call answers `429` `RECIPIENT_DAILY_LIMIT_REACHED` and adds nobody. For a bigger list, import a CSV in the Note Composer.
## Adding a recipient [#adding-a-recipient]
`POST /api/v1/recipients` adds one person without mailing them. Nothing is charged.
```bash
curl https://composer.stylograph.ai/api/v1/recipients \
-H "Authorization: Bearer $STYLOGRAPH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"first_name": "Ada",
"last_name": "Lovelace",
"company": "Analytical Engines",
"address_line1": "12 St James Square",
"city": "Boston",
"state": "MA",
"zip": "02108"
}'
```
The fields are the ones an envelope shows: `honorific`, `first_name`, `last_name`, `company`, `address_line1`, `address_line2`, `city`, `state` and `zip`. A name and a full address are required.
- A new person answers `201` with `created: true` and the recipient in `data`.
- Someone already in the address book with the same name and address, ignoring case, answers `200` with `created: false` and that entry. Nobody is added twice, so a retry is safe.
- The address isn't checked here. The send checks it with USPS, as it does for anyone.
## Editing a recipient [#editing-a-recipient]
`PATCH /api/v1/recipients/{recipientId}` changes only the fields you send.
```bash
curl -X PATCH https://composer.stylograph.ai/api/v1/recipients/RECIPIENT_ID \
-H "Authorization: Bearer $STYLOGRAPH_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "address_line1": "14 St James Square" }'
```
- A required field can't be blanked. That answers `400` `INVALID_ARGUMENT`.
- A change to the address means the next note to them checks the new address. A note already sent keeps the address it was sent with.
- A team changes at most 200 addresses through the API in any 24 hours. Past it, an edit answers `429` `RECIPIENT_EDIT_LIMIT_REACHED` and changes nothing. Name changes don't count. Stylograph keeps the old address of every edit, so a wrong change can be undone.
- An edit that would make the entry the same as another one in the address book answers `409` `RECIPIENT_EXISTS` and changes nothing.
- An archived recipient, one on another team and an unknown id all answer `404` `NOT_FOUND`.
## Importing a list [#importing-a-list]
`POST /api/v1/recipients/import` adds up to 500 rows in one call, from a spreadsheet, a CRM export or an event's attendee list. Each row takes the same fields as adding one person.
```bash
curl https://composer.stylograph.ai/api/v1/recipients/import \
-H "Authorization: Bearer $STYLOGRAPH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"dry_run": true,
"rows": [
{ "first_name": "Ada", "last_name": "Lovelace", "address_line1": "12 St James Square", "city": "Boston", "state": "MA", "zip": "02108" },
{ "first_name": "Charles", "last_name": "Babbage", "address_line1": "1 Dorset Street", "city": "Boston", "state": "MA", "zip": "02127" }
]
}'
```
The answer:
```json
{
"data": {
"dry_run": true,
"added": 2,
"existing": 0,
"skipped": [],
"recipient_ids": []
}
}
```
- An import only adds. Someone already in the address book is counted in `existing` and left unchanged. To change an entry, edit it.
- A row missing a name or a full address is skipped and listed in `skipped` with its row number and what was wrong.
- The rest go in together or not at all. A batch that would go past the team's daily limit adds nobody.
- With `dry_run: true`, nothing is added and `recipient_ids` is empty. Run a dry run first and check the counts.
- A real import answers `201` when it added someone, and `200` when everyone was already there. `recipient_ids` lists the ids to send to.
- The request body may be up to 256 KB.
## From an agent [#from-an-agent]
The [MCP server](/mcp) has the same three as tools: `add_recipient`, `update_recipient` and `import_recipients`. They need the same scope and role. An agent should show the person what it is about to add or change, and run `import_recipients` with `dry_run` first.
# Send later (/send-later)
Set `scheduled_for` to a date and the note goes to print on that day.
```json
{
"scheduled_for": "2026-12-01"
}
```
- The date is written as `YYYY-MM-DD`. It must be after today's date in UTC and no more than 90 days ahead.
- The note is queued and charged when you send it, and it counts toward the 24-hour API note limit then.
- Leave `scheduled_for` out, or send `null`, and the note goes to print as soon as possible.
The note's `scheduled_for` shows the day it goes to print. It stays `queued` until then.
## Cancelling [#cancelling]
Any queued note can be cancelled until the printer starts on it, whether it was sent to print right away or for a later day. Cancelling needs the `notes:send` scope. There are two ways to name the note:
```bash
# By the note's id
curl -X DELETE https://composer.stylograph.ai/api/v1/notes/NOTE_ID \
-H "Authorization: Bearer $STYLOGRAPH_API_KEY"
# By the Idempotency-Key you sent it with
curl -X DELETE "https://composer.stylograph.ai/api/v1/notes?idempotency_key=order-1042" \
-H "Authorization: Bearer $STYLOGRAPH_API_KEY"
```
The second form is for a system that keeps its own reference and not the note id, or that never saw the send's answer. If you sent the note with your order number as its `Idempotency-Key`, you can cancel it by that order number.
- A cancel answers `200` with the note, now `cancelled`, and its `refund`. The credits go back and nothing is mailed.
- Cancelling the same note again answers the same and refunds nothing more, so a repeated event from your system is safe.
- Once the printer has started on the note, or it is no longer queued, a cancel answers `409` `NOTE_NOT_CANCELLABLE` with the note's `status` and a `reason` in `details`, and changes nothing. The printer starts on notes as it prints them, so a note can sit in the queue for a while and still be cancelled.
- A note from a campaign can't be cancelled through the API.
- A note that isn't yours, and an id or key that matches no note, answer `404`.
- A cancelled note stops counting toward the daily note limits, up to as many cancelled notes as the limit.
## Changing the date [#changing-the-date]
The date can't be moved. Cancel the note and send it again with the new `scheduled_for` and a new `Idempotency-Key`. A cancelled note keeps its key, so a retry with the old key answers the cancelled note and sends nothing. A cancelled note never counts as a duplicate.
# Sending a note (/sending-a-note)
`POST /api/v1/notes` sends one note. It needs the `notes:send` scope and an `Idempotency-Key` header.
The body needs a `format`, a `message` and exactly one of `recipient_id` and `recipient`. Unknown fields are refused, so a typo in a field name answers `400` instead of being ignored.
## The recipient [#the-recipient]
Send `recipient_id` for someone already in your address book. To find one, search by name or company:
```bash
curl "https://composer.stylograph.ai/api/v1/recipients?q=Ada%20Lovelace" \
-H "Authorization: Bearer $STYLOGRAPH_API_KEY"
```
Every word of `q` must appear in the first name, last name or company, without case. A match shows the names, company, city and state, never the street lines or ZIP. `limit` runs from 1 to 50, and the default is 20. The search needs the `notes:send` scope, the scope that can already send to anyone in the address book. Archived recipients are left out.
Send `recipient` for someone new. It needs the `recipients:write` scope.
```json
{
"recipient": {
"first_name": "Ada",
"last_name": "Lovelace",
"company": "Analytical Engines",
"address_line1": "12 St James's Square",
"city": "Boston",
"state": "MA",
"zip": "02108"
}
}
```
If your address book already has someone with the same name and address, ignoring case, the note goes to that entry. Otherwise the person is added once the send passes every check, so a refused send never leaves a half-made entry behind. `company` is written on the envelope under the name.
To add people without sending them anything, or to load a whole list, see [Recipients](/recipients).
## The address check [#the-address-check]
Every send checks the address with USPS. The API is stricter than the Note Composer, because nobody is there to look at the card:
- An address USPS doesn't confirm is refused with the verdict and a suggested address in `details`. There is no way to send anyway.
- If the check can't run just now, the send answers `503` and you can try again.
- An address the account already checked isn't checked again.
## Format and message [#format-and-message]
| `format` | What it is | Message limit |
| --- | --- | --- |
| `folded` | A 5×7 folded notecard | 400 characters |
| `postcard` | A 4×6 postcard | 180 characters |
| `letter` | One handwritten page on stationery, mailed flat in a 9×12 envelope | 2000 characters, and the design's own limit |
| `flat` | A 4×6 flat card in an A6 envelope, the cover on the front and the message on the back | 300 characters |
Letters and flat cards are turned on by Stylograph, letters for an account and flat cards for an organization. Ask [support@stylograph.ai](mailto:support@stylograph.ai) if you want either. Without it, a send or a dry run in that format answers `400` `PRODUCT_UNAVAILABLE` and charges nothing.
`GET /api/v1/account` lists each format with its cost in credits, its message limit and whether it is `available`. A format that is paused answers `PRODUCT_UNAVAILABLE`.
The message is counted as printed. Curly quotes, dashes and ellipses are made plain first, and an ellipsis prints as three periods. Every character must be one the handwriting can write. An emoji, or a letter that wasn't captured, is refused instead of printed blank.
Even under the limit, a long message may not fit the card at the handwriting's size. That send answers `422` `MESSAGE_DOES_NOT_FIT` and charges nothing.
### Letters [#letters]
- A letter needs `letter_design_id`, the stationery it is written on. `GET /api/v1/letter-designs` lists the designs the account can use, each with its own `max_chars`. A design it can't use answers `422` `LETTER_DESIGN_UNAVAILABLE`.
- Blank lines in the message separate paragraphs.
- A letter takes no cover, no card back and no `cta`. For a QR code, send `qr_url`: an https link of up to 120 characters on a site Stylograph support listed for the account. Any other link answers `422` `QR_URL_NOT_ALLOWED`.
- `letters` in `GET /api/v1/account` says what a letter still needs: whether letters are on, the handwriting, a captured signature, the return block on the envelope and how many designs the account can use.
### Flat cards [#flat-cards]
- A flat card has no inside, so it takes no card back and no `verbal_cue`.
- It carries a QR code only where Stylograph has turned the flat card QR code on for the organization. Then the code prints on the front.
- `GET /api/v1/account` lists `flat` only for an organization that has it.
## Whose handwriting [#whose-handwriting]
A note is written in the handwriting of the key's member. `GET /api/v1/writers` lists the writers on the key's team whose handwriting is ready, with each one's id and `handwriting_profile_id`.
An Operator's key may send `writer_id` to write in a teammate's handwriting. The note is still paid by the organization and recorded as sent by the key's member. Any other key sees only its own member, with `can_choose` set to `false`, and a `writer_id` for someone else answers `403` `WRITER_NOT_ALLOWED`.
## The closing [#the-closing]
```json
{
"closing": { "salutation": "Warmly,", "signature": true }
}
```
With `signature: true` the note is signed with the captured signature. Otherwise `name` is written in the handwriting.
## The cover [#the-cover]
Every folded note, postcard and flat card has a cover, and a letter has none. Leave `card_image_key` out to use the account's default cover, which `GET /api/v1/account` shows as `default_cover_key`. To pick one, send a `key` from `GET /api/v1/covers`. For a key with `notes:send`, that list also holds your own uploads under `uploaded_covers`.
To upload a cover of your own, send it as a form to `POST /api/v1/covers`:
```bash
curl https://composer.stylograph.ai/api/v1/covers \
-H "Authorization: Bearer $STYLOGRAPH_API_KEY" \
-F "file=@my-cover.jpg"
```
- It takes a PNG, JPEG or WebP of 4 MB or smaller, and needs the `notes:send` scope.
- Photo metadata such as location is removed, and the image is screened before it is stored. An image the screening refuses answers `422` `IMAGE_NOT_ALLOWED` and is stored nowhere.
- The answer's `data.key` is the `card_image_key` to send.
- A team keeps at most 100 uploaded covers. Delete one in the Note Composer to free a slot.
- Up to 30 images an hour are screened. Past that, an upload answers `429` `IMAGE_SCREENING_RATE_LIMITED`.
## A QR code [#a-qr-code]
Set `cta` and the note carries a QR code, with an optional line beside it in the handwriting. A letter uses `qr_url` instead (see [Letters](#letters)), and a flat card has its own rule (see [Flat cards](#flat-cards)). There are two kinds.
A `referral` code opens the account's own referral link:
```json
{
"cta": { "type": "referral", "verbal_cue": "Scan to send some notes of your own, on me." }
}
```
- Someone who scans it and signs up is credited to the account as its referral.
- `referral_qr_available` in `GET /api/v1/account` says whether the account can carry one. Without a referral code, a send answers `409` `REFERRAL_LINK_UNAVAILABLE`.
A `visit` code opens a link of your own:
```json
{
"cta": { "type": "visit", "url": "https://www.example.com/welcome", "verbal_cue": "Scan for 10% off your next visit." }
}
```
- The link must be https and on one of the account's QR code sites, which you add in the Note Composer under **Settings**, in QR code sites, or on one of Stylograph's own sites. A site that isn't listed answers `422` `QR_SITE_NOT_LISTED`, and one still waiting for review answers `422` `QR_SITE_PENDING`.
- A link that passes the visitor on to another address answers `422` `QR_LINK_REDIRECTS`.
- Every link is checked against Google's list of unsafe sites before the send. Nothing is charged when a link is refused.
For both kinds:
- A scan goes through Stylograph's short link, and the note's `cta.scans` counts the scans.
- The line is up to 100 characters on a folded note and 40 on a postcard. It doesn't count toward the message.
- On a folded note with a card back, the QR code is printed inside the card.
## The return address [#the-return-address]
The note carries the account's return address. A postcard may send `return_address_on: false` to leave it off.
## Holding to one handwriting [#holding-to-one-handwriting]
`GET /api/v1/account` returns `handwriting.profile_id`. Pass it as `handwriting_profile_id` and the send is refused if the account's handwriting has changed since you read it.
## Dry runs [#dry-runs]
`dry_run: true` runs every check a send runs and answers `200` with what it would send: the message as it will print, the cover, the card back, the credits and whether the recipient is new. It creates no note and no recipient, and charges nothing. A dry run needs no `Idempotency-Key`, but it counts toward the request and address check limits.
## Idempotency [#idempotency]
Every send needs an `Idempotency-Key` header of 1 to 255 visible ASCII characters, unique to the note across your team.
- The same key with the same body answers `200` with the note it made and `Idempotent-Replayed: true`, and charges nothing.
- The same key with a different body answers `422` `IDEMPOTENCY_KEY_REUSED`.
- Keys never expire.
A client that can't set headers may send `idempotency_key` in the body instead. If both are sent, they must match.
Use a key your own system already has when there is one, such as an order number. Then a retry after a timeout can never send twice, and you can [cancel the note](/send-later#cancelling) by that same key while it is queued.
## Duplicates [#duplicates]
A send of the same message to the same recipient within 24 hours, from anyone on your team, is refused with `409` `DUPLICATE_NOTE`, and nothing is charged. `details.reason` is `same_message`. The guard is there for a caller with no person watching each send, such as an agent that loops and makes a new key each time. To mail a second copy on purpose, send `allow_duplicate: true`. A cancelled note never counts as a duplicate.
### One note a day per CRM contact [#one-note-a-day-per-crm-contact]
When the note is for someone in your CRM, send `crm_contact` with the CRM's name and the contact's id there:
```json
{
"crm_contact": { "source": "hubspot", "id": "4512" }
}
```
Your team then mails at most one note a day to that contact, whichever app or integration sends it. The day is the one the note goes to print: `scheduled_for`, or the day it is sent. So a Zap and a CRM connector that fire on the same closing mail one card. A second send that day answers `409` `DUPLICATE_NOTE` with `details.reason` `same_crm_contact_day`, unless it sets `allow_duplicate: true`.
- `source` is 1 to 40 lower-case letters, digits, dots, dashes or underscores, such as `hubspot` or `followupboss`.
- `id` is the contact's id in that CRM, up to 100 characters with no spaces or colons.
- Leave it out for anyone who isn't in a CRM. Two people at one address are then never mistaken for one.
## Labelling the app that sent it [#labelling-the-app-that-sent-it]
An app may send `client`, a short label such as `zapier`, with the same rules as `crm_contact.source`. It is kept on the note and returned as the note's `client`, so an app can tell its own notes apart, for example so a trigger on new notes doesn't fire on the notes it sent. It changes nothing about the send, and a retry with a different `client` still replays the note.
## The content check [#the-content-check]
Every send is checked for its content. A note whose check flags something, or couldn't run, is held for a person at Stylograph to look at before it prints. It shows as `queued` while it waits. If it is turned down, it becomes `failed` with `failure_code: content_rejected` and its credits are refunded.
## What a send charges [#what-a-send-charges]
The format's credits are taken when the send is accepted. A note sent through the API that fails before it is printed is refunded once. See [Note status](/note-status).
# Templates (/templates)
A template is a message your team saved in the Note Composer, with a name and a category. The API reads them so a system or an agent can start from wording you already use. Templates are written and edited in the Note Composer only.
```bash
curl "https://composer.stylograph.ai/api/v1/templates?category=Thank%20you" \
-H "Authorization: Bearer $STYLOGRAPH_API_KEY"
```
```json
{
"data": [
{
"id": "0b7e2c1a-4f3d-4e9b-8a6c-2d5f1e7b9c30",
"name": "After a first visit",
"category": "Thank you",
"message": "Thank you for coming by the shop last week. It was a real pleasure to meet you.",
"created_at": "2026-11-02T15:04:05Z"
}
],
"has_more": false
}
```
- It needs the `notes:send` scope.
- It lists the templates of the key's team, newest first, up to 100. `has_more` is `true` when there are more.
- `category` is optional and lists one category, up to 100 characters.
- A template is a starting point. Put its `message` in a send as it is or changed, and the send's usual checks apply.
In an agent, the [MCP server](/mcp)'s `list_templates` tool does the same. The agent should offer a template when the person wants wording they've used before, adjust it with them, then preview the note.
# What the account can send now (/reference/getAccount)
```json
{
"path": "/api/v1/account",
"method": "get",
"operation": {
"tags": [
"Account"
],
"operationId": "getAccount",
"summary": "What the account can send now",
"description": "Credits, whether the handwriting and return address are ready, API notes left, printing capacity, the default cover, the formats with prices and limits, and this key. Every refusal a send can answer for the account's state can be read here first. Scope: `account:read`.",
"x-required-scope": "account:read",
"responses": {
"200": {
"description": "The account.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AccountResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
}
}
}
}
```
# The covers a note can carry (/reference/listCovers)
```json
{
"path": "/api/v1/covers",
"method": "get",
"operation": {
"tags": [
"Covers"
],
"operationId": "listCovers",
"summary": "The covers a note can carry",
"description": "The published library art the composer's picker offers, for a format's card. Any live key. A key with `notes:send` also gets `uploaded_covers`: the covers the account's team uploaded, newest first (up to 100), with the key a send takes.",
"x-required-scope": null,
"parameters": [
{
"name": "format",
"in": "query",
"schema": {
"type": "string",
"enum": [
"folded",
"postcard",
"flat"
],
"default": "folded"
},
"description": "A letter takes no cover, so `letter` is not a value here."
},
{
"name": "category",
"in": "query",
"schema": {
"type": "string",
"pattern": "^[a-z][a-z0-9_]{1,39}$"
},
"description": "One category, e.g. `thank_you`."
}
],
"responses": {
"200": {
"description": "The covers, and the default.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CoverList"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
}
}
}
}
```
# Upload a cover (/reference/uploadCover)
```json
{
"path": "/api/v1/covers",
"method": "post",
"operation": {
"tags": [
"Covers"
],
"operationId": "uploadCover",
"summary": "Upload a cover",
"description": "Upload one of your own covers: one PNG, JPEG or WebP of up to 4 MB, in a multipart form field named `file`. It takes the composer's checks: re-encoded with no photo metadata (location, camera), screened before it is stored, and refused once the account's team keeps 100 uploaded covers (delete one in the Note Composer to free a slot) or has uploaded 30 images in the last hour (`IMAGE_SCREENING_RATE_LIMITED`). The answer's `key` is what a send takes as `card_image_key`, and the cover is listed under `uploaded_covers` from then on.",
"x-required-scope": "notes:send",
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"required": [
"file"
],
"additionalProperties": false,
"properties": {
"file": {
"contentMediaType": "application/octet-stream",
"description": "One PNG, JPEG or WebP, 4 MB or smaller."
}
}
}
}
}
},
"responses": {
"201": {
"description": "Stored. Send its `key` as `card_image_key`.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UploadedCoverResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"409": {
"$ref": "#/components/responses/Conflict"
},
"413": {
"$ref": "#/components/responses/PayloadTooLarge"
},
"415": {
"$ref": "#/components/responses/UnsupportedMediaType"
},
"422": {
"$ref": "#/components/responses/Unprocessable"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
}
}
}
}
```
# The card backs a note can carry (/reference/listCardBacks)
```json
{
"path": "/api/v1/card-backs",
"method": "get",
"operation": {
"tags": [
"Card backs"
],
"operationId": "listCardBacks",
"summary": "The card backs a note can carry",
"description": "The account's card backs that aren't archived, newest first, each with a preview signed for an hour. `is_default` marks the one a send gets when it leaves out `card_back_id`. Empty when card backs are off for the account. Scope: `notes:send`.",
"x-required-scope": "notes:send",
"responses": {
"200": {
"description": "The card backs.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CardBackList"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
}
}
}
}
```
# The stationery a letter can be written on (/reference/listLetterDesigns)
```json
{
"path": "/api/v1/letter-designs",
"method": "get",
"operation": {
"tags": [
"Letter designs"
],
"operationId": "listLetterDesigns",
"summary": "The stationery a letter can be written on",
"description": "The letter designs the account can send a letter on, by name, each with its version, its message limit, its safe area and a preview signed for an hour. Name one in a send's `letter_design_id`. Empty when letters aren't on for the account. Scope: `notes:send`.",
"x-required-scope": "notes:send",
"responses": {
"200": {
"description": "The letter designs.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LetterDesignList"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
}
}
}
}
```
# The writers a note can be written in (/reference/listWriters)
```json
{
"path": "/api/v1/writers",
"method": "get",
"operation": {
"tags": [
"Writers"
],
"operationId": "listWriters",
"summary": "The writers a note can be written in",
"description": "The Writers on the key's team whose handwriting is ready, the key's own member first. An Operator's key lists every one, and may name any as a send's `writer_id`; any other key lists only its own member (`can_choose` false). Scope: `notes:send`.",
"x-required-scope": "notes:send",
"responses": {
"200": {
"description": "The writers.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/WriterList"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
}
}
}
}
```
# Find recipients in the address book (/reference/searchRecipients)
```json
{
"path": "/api/v1/recipients",
"method": "get",
"operation": {
"tags": [
"Recipients"
],
"operationId": "searchRecipients",
"summary": "Find recipients in the address book",
"description": "Finds people in the account's address book, so a send can name one by `recipient_id`. Every word of `q` must appear in the first name, last name or company, without case; with no `q`, the list starts at the top of the alphabet. Archived recipients are left out. A match shows names, company, city and state, never the street lines or ZIP. Needs `notes:send`, the scope that can already send to anyone in the address book.",
"x-required-scope": "notes:send",
"parameters": [
{
"name": "q",
"in": "query",
"schema": {
"type": "string",
"maxLength": 80
},
"description": "Up to 5 words, e.g. `Aaron Tainter` or `AlphaLab`. Letters, digits, spaces and `. , ' & -` only."
},
{
"name": "limit",
"in": "query",
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 50,
"default": 20
}
}
],
"responses": {
"200": {
"description": "The matches, and whether more matched than `limit`.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RecipientList"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
}
}
}
}
```
# Add a recipient without mailing them (/reference/addRecipient)
```json
{
"path": "/api/v1/recipients",
"method": "post",
"operation": {
"tags": [
"Recipients"
],
"operationId": "addRecipient",
"summary": "Add a recipient without mailing them",
"description": "Adds someone to the address book of the key's team, so a later send can name them by `recipient_id`. Nothing is mailed or charged, and no address check runs here: the send checks the address. Takes the fields a send's `recipient` takes and nothing more (never an email, notes about the person or a birthday). Someone already in the address book with the same name and address (ignoring case) is answered with their entry and `created: false`. The key's member needs a role that can change recipients (Org Admin, Team Admin or Operator). A team adds at most 1000 recipients in any 24 hours through the API.",
"x-required-scope": "recipients:write",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewRecipient"
}
}
}
},
"responses": {
"200": {
"description": "Already in the address book; nothing was added.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RecipientWritten"
}
}
}
},
"201": {
"description": "Added.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RecipientWritten"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"409": {
"$ref": "#/components/responses/Conflict"
},
"413": {
"$ref": "#/components/responses/PayloadTooLarge"
},
"415": {
"$ref": "#/components/responses/UnsupportedMediaType"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
}
}
}
}
```
# Edit a recipient (/reference/updateRecipient)
```json
{
"path": "/api/v1/recipients/{recipientId}",
"method": "patch",
"operation": {
"tags": [
"Recipients"
],
"operationId": "updateRecipient",
"summary": "Edit a recipient",
"description": "Changes one recipient of the key's team: only the fields sent. A recipient on another team, or one that was deleted, answers 404. The key's member needs a role that can change recipients. A team changes at most 200 addresses a day through the API (a name or company edit doesn't count); past that, 429 `RECIPIENT_EDIT_LIMIT_REACHED`. Stylograph keeps each edit's old fields, so a wrong edit can be put back.",
"x-required-scope": "recipients:write",
"parameters": [
{
"name": "recipientId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RecipientUpdate"
}
}
}
},
"responses": {
"200": {
"description": "Changed.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RecipientWritten"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"409": {
"$ref": "#/components/responses/Conflict"
},
"413": {
"$ref": "#/components/responses/PayloadTooLarge"
},
"415": {
"$ref": "#/components/responses/UnsupportedMediaType"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
}
}
}
}
```
# Import a list of recipients (/reference/importRecipients)
```json
{
"path": "/api/v1/recipients/import",
"method": "post",
"operation": {
"tags": [
"Recipients"
],
"operationId": "importRecipients",
"summary": "Import a list of recipients",
"description": "Adds up to 500 people to the address book of the key's team in one step, all or nothing, without mailing anyone. Add only: a row that matches someone already in the address book is counted as `existing` and that person is left unchanged (use the Note Composer's CSV import to merge). Rows missing a name or a full address are skipped and listed. Send `dry_run: true` first to see what would happen. The key's member needs a role that can change recipients, and the team's new recipients stay within 1000 in any 24 hours: a batch that would pass that adds nobody. The body may be up to 256 KB.",
"x-required-scope": "recipients:write",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ImportRequest"
}
}
}
},
"responses": {
"200": {
"description": "A dry run, or nobody new to add.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ImportResult"
}
}
}
},
"201": {
"description": "Imported.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ImportResult"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"409": {
"$ref": "#/components/responses/Conflict"
},
"413": {
"$ref": "#/components/responses/PayloadTooLarge"
},
"415": {
"$ref": "#/components/responses/UnsupportedMediaType"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
}
}
}
}
```
# List the team's message templates (/reference/listTemplates)
```json
{
"path": "/api/v1/templates",
"method": "get",
"operation": {
"tags": [
"Templates"
],
"operationId": "listTemplates",
"summary": "List the team's message templates",
"description": "The message templates the key's team saved in the Note Composer, newest first, at most 100. A message may hold merge fields such as `{{first_name}}`, as written in the Note Composer: fill them in before you send, because a send refuses `{` and `}` with `UNSUPPORTED_CHARACTERS`. Read only: templates are written in the Note Composer. Needs `notes:send`.",
"x-required-scope": "notes:send",
"parameters": [
{
"name": "category",
"in": "query",
"schema": {
"type": "string",
"maxLength": 100
},
"description": "Only templates in this category."
}
],
"responses": {
"200": {
"description": "The templates.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TemplateList"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
}
}
}
}
```
# List the account's notes (/reference/listNotes)
```json
{
"path": "/api/v1/notes",
"method": "get",
"operation": {
"tags": [
"Notes"
],
"operationId": "listNotes",
"summary": "List the account's notes",
"description": "Every note the account sent (the API, the composer and campaigns), newest first, a page at a time. To poll for changes, pass the newest `updated_at` you saw as `updated_since`. Scope: `notes:read`.",
"x-required-scope": "notes:read",
"parameters": [
{
"name": "limit",
"in": "query",
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 25
}
},
{
"name": "cursor",
"in": "query",
"schema": {
"type": "string"
},
"description": "The `next_cursor` of the page before."
},
{
"name": "status",
"in": "query",
"schema": {
"$ref": "#/components/schemas/NoteStatus"
}
},
{
"name": "recipient_id",
"in": "query",
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "updated_since",
"in": "query",
"schema": {
"type": "string",
"format": "date-time"
},
"description": "Only notes changed after this time, with its time zone (`Z`, or `+` encoded as `%2B`)."
}
],
"responses": {
"200": {
"description": "A page of notes.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NoteList"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
}
}
}
}
```
# Send a note (/reference/sendNote)
```json
{
"path": "/api/v1/notes",
"method": "post",
"operation": {
"tags": [
"Notes"
],
"operationId": "sendNote",
"summary": "Send a note",
"description": "Checks the account, the card back, the cover (or a letter's design), the address and every character, then charges the format's credits and queues the note for printing. Scope: `notes:send`, and `recipients:write` for a new `recipient`. Every send needs an `Idempotency-Key`; a dry run needs none. A note whose content check flags something, or couldn't run, is held for a person at Stylograph to look at before it prints. It shows as `queued` while it waits; if it is turned down it becomes `failed` with `failure_code: content_rejected` and its credits are refunded.",
"x-required-scope": "notes:send",
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"required": false,
"description": "Required for a send (not a dry run): unique to the note, e.g. a UUID. A retry with the same key and body returns the same note and charges nothing.",
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"pattern": "^[!-~]{1,255}$"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SendNoteRequest"
}
}
}
},
"responses": {
"200": {
"description": "A dry run (what the send would do), or a retry of a send with the same key (`Idempotent-Replayed: true`).",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
},
"Idempotent-Replayed": {
"$ref": "#/components/headers/IdempotentReplayed"
},
"Location": {
"$ref": "#/components/headers/Location"
}
},
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/NoteResponse"
},
{
"$ref": "#/components/schemas/DryRunResponse"
}
]
}
}
}
},
"201": {
"description": "Sent.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
},
"Location": {
"$ref": "#/components/headers/Location"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NoteResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"402": {
"$ref": "#/components/responses/PaymentRequired"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"409": {
"$ref": "#/components/responses/Conflict"
},
"413": {
"$ref": "#/components/responses/PayloadTooLarge"
},
"415": {
"$ref": "#/components/responses/UnsupportedMediaType"
},
"422": {
"$ref": "#/components/responses/Unprocessable"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
},
"503": {
"$ref": "#/components/responses/Unavailable"
}
}
}
}
```
# Cancel a send-later note by the Idempotency-Key it was sent with (/reference/cancelNoteByIdempotencyKey)
```json
{
"path": "/api/v1/notes",
"method": "delete",
"operation": {
"tags": [
"Notes"
],
"operationId": "cancelNoteByIdempotencyKey",
"summary": "Cancel a send-later note by the Idempotency-Key it was sent with",
"description": "Scope: `notes:send`. The same cancel as DELETE /api/v1/notes/{noteId}, for a caller that knows its own key (an order number, say) and not the note id. 400 `IDEMPOTENCY_KEY_REQUIRED` without the parameter, and 404 when no note was sent with that key.",
"x-required-scope": "notes:send",
"parameters": [
{
"name": "idempotency_key",
"in": "query",
"required": true,
"description": "The `Idempotency-Key` the note was sent with.",
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"pattern": "^[!-~]{1,255}$"
}
}
],
"responses": {
"200": {
"description": "The note as it now stands: `cancelled`, with its `refund`. A note that was already cancelled answers the same, with nothing more refunded.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NoteDetailResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"409": {
"$ref": "#/components/responses/Conflict"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
}
}
}
}
```
# One note, with its history and delivery estimate (/reference/getNote)
```json
{
"path": "/api/v1/notes/{noteId}",
"method": "get",
"operation": {
"tags": [
"Notes"
],
"operationId": "getNote",
"summary": "One note, with its history and delivery estimate",
"description": "Scope: `notes:read`. Someone else's note and an unknown id both answer 404.",
"x-required-scope": "notes:read",
"parameters": [
{
"name": "noteId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "The note.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NoteDetailResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
}
}
}
}
```
# Cancel a queued note before the printer starts on it (/reference/cancelNote)
```json
{
"path": "/api/v1/notes/{noteId}",
"method": "delete",
"operation": {
"tags": [
"Notes"
],
"operationId": "cancelNote",
"summary": "Cancel a queued note before the printer starts on it",
"description": "Scope: `notes:send`. Cancels a queued note the printer hasn't started on yet, sent to print right away or for a later day, and gives back the credits it was charged. Nothing is mailed. A repeat cancel answers 200 with the note and refunds nothing more. Once the printer has it, or for a campaign note: 409 `NOTE_NOT_CANCELLABLE`. Someone else's note and an unknown id both answer 404. To change the date, cancel and send again with a new `Idempotency-Key`.",
"x-required-scope": "notes:send",
"parameters": [
{
"name": "noteId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "The note as it now stands: `cancelled`, with its `refund`. A note that was already cancelled answers the same, with nothing more refunded.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NoteDetailResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"409": {
"$ref": "#/components/responses/Conflict"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
}
}
}
}
```
# Permanently delete a mailed note's content (/reference/deleteNoteContent)
```json
{
"path": "/api/v1/notes/{noteId}/content",
"method": "delete",
"operation": {
"tags": [
"Notes"
],
"operationId": "deleteNoteContent",
"summary": "Permanently delete a mailed note's content",
"description": "Scope: `notes:send`. PERMANENTLY deletes the content of one of your notes: its message, the recipient's name and address, and the drawing files. Nothing brings it back. The note keeps its id, status, dates and credits, and answers `content_purged: true`, with the recipient's names `null`. Works on a note that is mailed, delivered, returned, failed or cancelled; a repeat answers 200 with the note as it stands. A note still queued or printed answers 409 `NOTE_CONTENT_STILL_NEEDED`, because the printer needs it: cancel a queued note instead. Accounts with a retention setting have this done automatically some days after mailing. Someone else's note, a draft and an unknown id all answer 404.",
"x-required-scope": "notes:send",
"parameters": [
{
"name": "noteId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "The note as it now stands, with `content_purged: true`.",
"headers": {
"RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitReset"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NoteDetailResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"409": {
"$ref": "#/components/responses/Conflict"
},
"429": {
"$ref": "#/components/responses/TooManyRequests"
},
"500": {
"$ref": "#/components/responses/Internal"
}
}
}
}
```