{
  "openapi": "3.0.3",
  "info": {
    "title": "Stylograph API",
    "version": "1.0.0",
    "description": "Send notes written in your own handwriting from your systems or an AI agent. Stylograph plots each note with a pen plotter in the handwriting you captured, and mails it.\n\n## Authentication\nSupport turns API access on for an organization; then its Writers and Operators make API keys in Settings. A key belongs to you and to one team: it reads and sends for that team (its notes, address book, card backs and uploaded covers), and the notes it sends are written in your handwriting. Credits come from the organization's wallet. A key stops working when you leave the team, and an Org Admin can see every key in the organization (never the key itself) and revoke it. Send a key as `Authorization: Bearer <key>`. A key is shown once, expires (30, 90 or 365 days), and holds scopes:\n\n- `account:read`: GET /api/v1/account\n- `notes:read`: GET /api/v1/notes and GET /api/v1/notes/{noteId}\n- `notes:send`: POST /api/v1/notes, DELETE /api/v1/notes (by idempotency key) and DELETE /api/v1/notes/{noteId}, DELETE /api/v1/notes/{noteId}/content, GET /api/v1/card-backs and GET /api/v1/letter-designs\n- `recipients:write`: a send to a new `recipient`, who is added to the team's address book; POST /api/v1/recipients and PATCH /api/v1/recipients/{recipientId} (add or edit someone without mailing them) and POST /api/v1/recipients/import (a list, add only); these also need a role that can change recipients\n\nA new key starts with `account:read` and `notes:read`. Any live key can read GET /api/v1/covers. Never put a key in a browser or a mobile app.\n\n## Limits\n- 60 requests a minute per organization, across every key of every member, dry runs included. Every answer carries `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset`; past the limit, 429 `RATE_LIMITED` with `Retry-After`.\n- 25 API notes per organization in any 24 hours, across every key, unless support sets otherwise (`api_notes` in GET /api/v1/account).\n- An organization holds at most 50 live keys, and each member at most 10 (20 made in any 24 hours).\n- A key can carry its own daily note cap, set in Settings when the key is made (1 to 1000, and never changed). Past it, 429 `API_KEY_DAILY_LIMIT_REACHED`. Give an AI agent its own key with a low cap; GET /api/v1/account shows it as `api_key.daily_notes`.\n- A note you cancel stops counting toward both, up to as many cancelled notes in 24 hours as the limit itself. Past that, each cancelled note counts again.\n- The same message to the same recipient within 24 hours, from anyone on the team, is refused with 409 `DUPLICATE_NOTE` unless the send sets `allow_duplicate: true`.\n- A send that names a `crm_contact` (the person in your CRM it is for) is refused with 409 `DUPLICATE_NOTE` (`details.reason` `same_crm_contact_day`) when the team already has a live note to that contact going to print the same UTC day, whichever app or integration sent it, unless the send sets `allow_duplicate: true`. Sends without `crm_contact` are never merged by name or address.\n- Printing capacity is shared and counted by the day a note goes to print: when that day's is full, a send answers 503 `VENDOR_DAILY_CEILING_REACHED`. A larger format takes more of a day than a card. 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` while other days stay open. A send-later note counts toward the day it prints, and toward the 24-hour note limits on the day you send it.\n- 60 address checks an hour per account, dry runs included. An address the account already checked isn't checked again.\n\n## Card backs\nA folded note can carry a card back, designed in Card Backs. Leave out `card_back_id` and the note gets the account's default back, if it has one, as the Note Composer does; send `null` for none, or an id from GET /api/v1/card-backs for that back. A postcard has no card back: its back is the address side. Card backs are made and edited in Card Backs, never through the API.\n\n## Idempotency\nEvery send needs an `Idempotency-Key` header: 1 to 255 visible ASCII characters, unique to the note on your team (a UUID works); a teammate's key with the same idempotency key answers the same note. A retry with the same key and the same body answers 200 with the note it made, `Idempotent-Replayed: true`, and charges nothing, even if something changed since. The same key with a different body answers 422 `IDEMPOTENCY_KEY_REUSED`. Keys never expire. A dry run needs no key. A client that can't set headers may send `idempotency_key` in the body instead. A cancelled note keeps its key: a retry with it answers the cancelled note, so send a cancelled note again with a new key.\n\n## Send later\nSet `scheduled_for` to a date (YYYY-MM-DD) after today in UTC and no more than 90 days ahead, and the note goes to print on that day. It is queued and charged when you send it, and counts toward the 24-hour limit then.\n\nThe date itself can't be moved. To change it, cancel the note and send it again with a new `Idempotency-Key` and the new `scheduled_for`. A cancelled note never counts as a duplicate.\n\n## Cancelling\nA queued note can be cancelled until the printer starts on it, whether it was sent to print right away or for a later day: `DELETE /api/v1/notes/{noteId}`, or `DELETE /api/v1/notes?idempotency_key=...` with the key you sent it with (an order number works, if that is your key). A cancel answers 200 with the note, now `cancelled`, and its `refund`: the credits go back to the account. Cancelling it again answers the same and refunds nothing more, so a repeated event is safe. Once the printer has it, a cancel answers 409 `NOTE_NOT_CANCELLABLE` with the note's `status` and a `reason` (`claimed`), and changes nothing. A campaign note can't be cancelled.\n\n## QR codes\nSet `cta` to `{ \"type\": \"referral\", \"verbal_cue\": \"...\" }` and the note carries a QR code to the account's own referral link, with the line beside it in the account's handwriting. Someone who scans it and signs up is credited to the account as its referral (see Refer & Earn in the Note Composer).\n\nSet `cta` to `{ \"type\": \"visit\", \"url\": \"https://...\", \"verbal_cue\": \"...\" }` and the QR code opens a link of your own. Its site must be one of the account's QR code sites (Settings > QR code sites in the Note Composer), or one of Stylograph's own, such as https://www.stylograph.ai/walkthrough. A site goes live at once for an account that has made a purchase; otherwise, and for link shorteners and shared hosting, Stylograph reviews it first. Every link is checked against Google's list of unsafe sites before the send, and a site Stylograph turns off stops redirecting, even on cards already mailed.\n\nEither way `cta.scans` on the note counts the scans. The line is optional, up to 100 characters on a folded note and 40 on a postcard, and never counts toward the message.\n\n## Dry runs\n`dry_run: true` runs every check a send runs (the account, the cover, the address, the characters) and answers 200 with what it would send and charge. It creates no note and no recipient, and charges nothing.\n\n## Stricter than the Note Composer\nNobody is there to look at the card, so a send that can't be sure is refused, never guessed at: an address USPS doesn't confirm is refused with the verdict and Google's suggested address (there is no \"send anyway\"); an address check that can't run answers 503; and a character the handwriting can't write (an emoji, or a letter that wasn't captured) is refused instead of printed blank.\n\n## Errors\nEvery error is `{ \"error\": { \"code\", \"message\", \"details\" } }`, and each code always comes with the same HTTP status (see `ErrorCode`). Every 409 for the account's state can be checked first with GET /api/v1/account.",
    "contact": {
      "email": "support@stylograph.ai"
    }
  },
  "servers": [
    {
      "url": "https://composer.stylograph.ai",
      "description": "Production"
    },
    {
      "url": "http://localhost:3000",
      "description": "Local development"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "tags": [
    {
      "name": "Account"
    },
    {
      "name": "Notes"
    },
    {
      "name": "Covers"
    },
    {
      "name": "Card backs"
    },
    {
      "name": "Letter designs"
    },
    {
      "name": "Writers",
      "description": "Whose handwriting a note is written in (issue #973)."
    },
    {
      "name": "Recipients"
    },
    {
      "name": "Templates",
      "description": "The team's saved message wording."
    }
  ],
  "paths": {
    "/api/v1/account": {
      "get": {
        "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"
          }
        }
      }
    },
    "/api/v1/covers": {
      "get": {
        "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"
          }
        }
      },
      "post": {
        "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": {
                    "type": "string",
                    "format": "binary",
                    "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"
          }
        }
      }
    },
    "/api/v1/card-backs": {
      "get": {
        "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"
          }
        }
      }
    },
    "/api/v1/letter-designs": {
      "get": {
        "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"
          }
        }
      }
    },
    "/api/v1/writers": {
      "get": {
        "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"
          }
        }
      }
    },
    "/api/v1/recipients": {
      "get": {
        "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"
          }
        }
      },
      "post": {
        "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"
          }
        }
      }
    },
    "/api/v1/recipients/{recipientId}": {
      "patch": {
        "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"
          }
        }
      }
    },
    "/api/v1/recipients/import": {
      "post": {
        "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"
          }
        }
      }
    },
    "/api/v1/templates": {
      "get": {
        "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"
          }
        }
      }
    },
    "/api/v1/notes": {
      "post": {
        "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"
          }
        }
      },
      "get": {
        "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"
          }
        }
      },
      "delete": {
        "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"
          }
        }
      }
    },
    "/api/v1/notes/{noteId}": {
      "get": {
        "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"
          }
        }
      },
      "delete": {
        "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"
          }
        }
      }
    },
    "/api/v1/notes/{noteId}/content": {
      "delete": {
        "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"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key (sg_live_...)",
        "description": "An API key from Settings."
      }
    },
    "headers": {
      "RateLimitLimit": {
        "description": "Requests the account may make in the window.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitRemaining": {
        "description": "Requests left in the window.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitReset": {
        "description": "Seconds until the window resets.",
        "schema": {
          "type": "integer"
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait before trying again.",
        "schema": {
          "type": "integer"
        }
      },
      "WWWAuthenticate": {
        "description": "RFC 6750: `Bearer realm=\"stylograph\"`, with `error` and, for `insufficient_scope`, `scope`.",
        "schema": {
          "type": "string"
        }
      },
      "IdempotentReplayed": {
        "description": "`true` when the answer is the note an earlier send with this key made.",
        "schema": {
          "type": "string",
          "enum": [
            "true"
          ]
        }
      },
      "Location": {
        "description": "The note's URL.",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "The request is malformed.",
        "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/Error"
            }
          }
        },
        "x-error-codes": [
          "INVALID_ARGUMENT",
          "INVALID_CURSOR",
          "INVALID_IDEMPOTENCY_KEY",
          "IDEMPOTENCY_KEY_REQUIRED",
          "MESSAGE_TOO_LONG",
          "PRODUCT_UNAVAILABLE",
          "INVALID_COVER",
          "WRITER_REQUIRED",
          "CARD_BACK_NOT_AVAILABLE"
        ]
      },
      "Unauthorized": {
        "description": "No usable API key (`WWW-Authenticate: Bearer`).",
        "headers": {
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "WWW-Authenticate": {
            "$ref": "#/components/headers/WWWAuthenticate"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "x-error-codes": [
          "UNAUTHENTICATED",
          "INVALID_API_KEY",
          "API_KEY_REVOKED",
          "API_KEY_EXPIRED",
          "API_KEY_NOT_LIVE"
        ]
      },
      "PaymentRequired": {
        "description": "Not enough credits, or the key's team reached its credit limit for the period (`team_allocation_exceeded`, issue #976).",
        "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/Error"
            }
          }
        },
        "x-error-codes": [
          "insufficient_credits",
          "team_allocation_exceeded"
        ]
      },
      "Forbidden": {
        "description": "The key or account may not do this (`insufficient_scope` names the scope needed).",
        "headers": {
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "WWW-Authenticate": {
            "$ref": "#/components/headers/WWWAuthenticate"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "x-error-codes": [
          "API_ACCESS_DISABLED",
          "account_suspended",
          "INSUFFICIENT_SCOPE",
          "TEAM_ROLE_REQUIRED",
          "WRITER_NOT_ALLOWED",
          "WRITER_NOT_ON_TEAM"
        ]
      },
      "NotFound": {
        "description": "Not found.",
        "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/Error"
            }
          }
        },
        "x-error-codes": [
          "NOT_FOUND",
          "CARD_BACK_UNAVAILABLE"
        ]
      },
      "Conflict": {
        "description": "The account's state, or another request, stands in the way. Each state can be read first from GET /api/v1/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/Error"
            }
          }
        },
        "x-error-codes": [
          "HANDWRITING_NOT_READY",
          "HANDWRITING_PROFILE_MISMATCH",
          "WRITER_HAS_NO_HANDWRITING",
          "RETURN_ADDRESS_MISSING",
          "RECIPIENT_ADDRESS_CHANGED",
          "RECIPIENT_EXISTS",
          "API_KEY_TEAM_MISMATCH",
          "TEAM_ARCHIVED",
          "CARD_BACK_NOT_READY",
          "REFERRAL_LINK_UNAVAILABLE",
          "DUPLICATE_NOTE",
          "NOTE_NOT_CANCELLABLE",
          "NOTE_CONTENT_STILL_NEEDED",
          "COVER_LIMIT_REACHED"
        ]
      },
      "PayloadTooLarge": {
        "description": "The body is too large.",
        "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/Error"
            }
          }
        },
        "x-error-codes": [
          "PAYLOAD_TOO_LARGE"
        ]
      },
      "UnsupportedMediaType": {
        "description": "The body is not JSON.",
        "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/Error"
            }
          }
        },
        "x-error-codes": [
          "UNSUPPORTED_MEDIA_TYPE"
        ]
      },
      "Unprocessable": {
        "description": "The note cannot be sent as asked.",
        "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/Error"
            }
          }
        },
        "x-error-codes": [
          "IDEMPOTENCY_KEY_REUSED",
          "RECIPIENT_NOT_FOUND",
          "RECIPIENT_INCOMPLETE",
          "ADDRESS_INVALID",
          "UNSUPPORTED_CHARACTERS",
          "LETTER_DESIGN_UNAVAILABLE",
          "QR_URL_NOT_ALLOWED",
          "LETTER_DESIGN_NO_QR",
          "QR_SITE_NOT_LISTED",
          "QR_SITE_PENDING",
          "QR_SITE_BLOCKED",
          "QR_LINK_REDIRECTS",
          "RECIPIENT_TOO_LONG_FOR_POSTCARD",
          "MESSAGE_DOES_NOT_FIT",
          "CUE_TOO_LONG_FOR_POSTCARD",
          "RETURN_ADDRESS_TOO_LONG_FOR_POSTCARD",
          "RECIPIENT_NOT_DRAWABLE",
          "RETURN_ADDRESS_NOT_DRAWABLE",
          "NO_FONT",
          "IMAGE_NOT_ALLOWED"
        ]
      },
      "TooManyRequests": {
        "description": "A limit was reached. `Retry-After` says when to try again.",
        "headers": {
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "x-error-codes": [
          "RATE_LIMITED",
          "API_DAILY_LIMIT_REACHED",
          "ADDRESS_CHECK_RATE_LIMITED",
          "API_KEY_DAILY_LIMIT_REACHED",
          "ACCOUNT_PRINT_SHARE_REACHED",
          "IMAGE_SCREENING_RATE_LIMITED",
          "RECIPIENT_DAILY_LIMIT_REACHED",
          "RECIPIENT_EDIT_LIMIT_REACHED"
        ]
      },
      "Internal": {
        "description": "An error on our side.",
        "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/Error"
            }
          }
        },
        "x-error-codes": [
          "INTERNAL"
        ]
      },
      "Unavailable": {
        "description": "A check or the printer is unavailable just now. Nothing was charged. `Retry-After` says when to try again.",
        "headers": {
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "x-error-codes": [
          "VENDOR_DAILY_CEILING_REACHED",
          "ADDRESS_CHECK_UNAVAILABLE",
          "POSTCARD_CHECK_UNAVAILABLE",
          "LETTER_CHECK_UNAVAILABLE",
          "FLAT_NOTECARD_CHECK_UNAVAILABLE"
        ]
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "details"
            ],
            "properties": {
              "code": {
                "$ref": "#/components/schemas/ErrorCode"
              },
              "message": {
                "type": "string",
                "description": "A sentence safe to show a person."
              },
              "details": {
                "nullable": true,
                "description": "Structured context for the code, or null."
              }
            }
          }
        }
      },
      "ErrorCode": {
        "type": "string",
        "enum": [
          "INVALID_ARGUMENT",
          "INVALID_CURSOR",
          "INVALID_IDEMPOTENCY_KEY",
          "IDEMPOTENCY_KEY_REQUIRED",
          "MESSAGE_TOO_LONG",
          "PRODUCT_UNAVAILABLE",
          "INVALID_COVER",
          "WRITER_REQUIRED",
          "CARD_BACK_NOT_AVAILABLE",
          "NOT_FOUND",
          "CARD_BACK_UNAVAILABLE",
          "PAYLOAD_TOO_LARGE",
          "UNSUPPORTED_MEDIA_TYPE",
          "UNAUTHENTICATED",
          "INVALID_API_KEY",
          "API_KEY_REVOKED",
          "API_KEY_EXPIRED",
          "API_KEY_NOT_LIVE",
          "API_ACCESS_DISABLED",
          "account_suspended",
          "INSUFFICIENT_SCOPE",
          "TEAM_ROLE_REQUIRED",
          "WRITER_NOT_ALLOWED",
          "WRITER_NOT_ON_TEAM",
          "RATE_LIMITED",
          "insufficient_credits",
          "team_allocation_exceeded",
          "HANDWRITING_NOT_READY",
          "HANDWRITING_PROFILE_MISMATCH",
          "WRITER_HAS_NO_HANDWRITING",
          "RETURN_ADDRESS_MISSING",
          "CARD_BACK_NOT_READY",
          "REFERRAL_LINK_UNAVAILABLE",
          "RECIPIENT_ADDRESS_CHANGED",
          "RECIPIENT_EXISTS",
          "API_KEY_TEAM_MISMATCH",
          "TEAM_ARCHIVED",
          "DUPLICATE_NOTE",
          "NOTE_NOT_CANCELLABLE",
          "NOTE_CONTENT_STILL_NEEDED",
          "COVER_LIMIT_REACHED",
          "IDEMPOTENCY_KEY_REUSED",
          "RECIPIENT_NOT_FOUND",
          "RECIPIENT_INCOMPLETE",
          "ADDRESS_INVALID",
          "UNSUPPORTED_CHARACTERS",
          "LETTER_DESIGN_UNAVAILABLE",
          "QR_URL_NOT_ALLOWED",
          "LETTER_DESIGN_NO_QR",
          "QR_SITE_NOT_LISTED",
          "QR_SITE_PENDING",
          "QR_SITE_BLOCKED",
          "QR_LINK_REDIRECTS",
          "IMAGE_NOT_ALLOWED",
          "RECIPIENT_TOO_LONG_FOR_POSTCARD",
          "MESSAGE_DOES_NOT_FIT",
          "CUE_TOO_LONG_FOR_POSTCARD",
          "RETURN_ADDRESS_TOO_LONG_FOR_POSTCARD",
          "RECIPIENT_NOT_DRAWABLE",
          "RETURN_ADDRESS_NOT_DRAWABLE",
          "NO_FONT",
          "API_DAILY_LIMIT_REACHED",
          "API_KEY_DAILY_LIMIT_REACHED",
          "RECIPIENT_DAILY_LIMIT_REACHED",
          "RECIPIENT_EDIT_LIMIT_REACHED",
          "ACCOUNT_PRINT_SHARE_REACHED",
          "ADDRESS_CHECK_RATE_LIMITED",
          "IMAGE_SCREENING_RATE_LIMITED",
          "INTERNAL",
          "VENDOR_DAILY_CEILING_REACHED",
          "ADDRESS_CHECK_UNAVAILABLE",
          "POSTCARD_CHECK_UNAVAILABLE",
          "LETTER_CHECK_UNAVAILABLE",
          "FLAT_NOTECARD_CHECK_UNAVAILABLE"
        ],
        "description": "Every error code, with the one HTTP status it always comes with:\n\n| Code | Status | Meaning |\n| --- | --- | --- |\n| `INVALID_ARGUMENT` | 400 | A field or query parameter is missing, malformed or unknown. `details` names it when it can. |\n| `INVALID_CURSOR` | 400 | `cursor` is not a `next_cursor` from an earlier page. |\n| `INVALID_IDEMPOTENCY_KEY` | 400 | The key is not 1 to 255 visible ASCII characters, or the header and `idempotency_key` differ. |\n| `IDEMPOTENCY_KEY_REQUIRED` | 400 | A send without an `Idempotency-Key` (a dry run needs none). |\n| `MESSAGE_TOO_LONG` | 400 | The message is over its format's limit, or over its letter design's `max_chars`. `details.limit` and `details.length`. |\n| `PRODUCT_UNAVAILABLE` | 400 | The format is paused, or it is a letter and letters aren't on for the account (`available: false` in GET /api/v1/account), or it is `flat` and the organization doesn't have it. |\n| `INVALID_COVER` | 400 | `card_image_key` is not a key from GET /api/v1/covers: `data` for the library, or `uploaded_covers` for your own uploads. |\n| `WRITER_REQUIRED` | 400 | The key's member has no handwriting of their own (an Operator only): send `writer_id`, a writer from GET /api/v1/writers. |\n| `CARD_BACK_NOT_AVAILABLE` | 400 | `card_back_id` names a back for a postcard, or card backs are off for the account. Send `card_back_id: null`. |\n| `NOT_FOUND` | 404 | No such note on the key's team (a cancel or a content delete: no such note of yours). |\n| `CARD_BACK_UNAVAILABLE` | 404 | `card_back_id` isn't one of the account's team's card backs, or it was archived. |\n| `PAYLOAD_TOO_LARGE` | 413 | The body is over 16 KB. |\n| `UNSUPPORTED_MEDIA_TYPE` | 415 | The body was not sent as `application/json`. |\n| `UNAUTHENTICATED` | 401 | No `Authorization` header. |\n| `INVALID_API_KEY` | 401 | The key is malformed or unknown. |\n| `API_KEY_REVOKED` | 401 | The key was revoked, by you or an Org Admin, or you left its team. Make a new one in Settings. |\n| `API_KEY_EXPIRED` | 401 | The key expired (`details.expires_at`). Make a new one in Settings. |\n| `API_KEY_NOT_LIVE` | 401 | The key was revoked or expired, or you left its team, while the send ran. Nothing was charged. |\n| `API_ACCESS_DISABLED` | 403 | API access is turned off for the organization. |\n| `account_suspended` | 403 | The account is suspended. |\n| `INSUFFICIENT_SCOPE` | 403 | The key lacks the scope in `details.required_scope`. |\n| `TEAM_ROLE_REQUIRED` | 403 | You are on the key's team but no longer a Writer or an Operator, so the key can't send. Nothing was charged. |\n| `WRITER_NOT_ALLOWED` | 403 | `writer_id` names a teammate and the key's member isn't an Operator on the key's team. Nothing was charged. |\n| `WRITER_NOT_ON_TEAM` | 403 | `writer_id` isn't a Writer on the key's team. GET /api/v1/writers lists them. Nothing was charged. |\n| `RATE_LIMITED` | 429 | Over 60 requests a minute for the organization. Wait `Retry-After` seconds. |\n| `insufficient_credits` | 402 | Not enough credits. `details.required` and `details.available` when known. |\n| `team_allocation_exceeded` | 402 | The key's team reached its credit limit (its hard cap) for this period, though the organization may still have credits. Nothing was charged. An Org Admin raises it in Settings, Teams, or it resets at the start of the next month (UTC). |\n| `HANDWRITING_NOT_READY` | 409 | The account's handwriting font isn't built yet. |\n| `HANDWRITING_PROFILE_MISMATCH` | 409 | `handwriting_profile_id` isn't the writer's current handwriting (the key's member's, or `writer_id`'s). |\n| `WRITER_HAS_NO_HANDWRITING` | 409 | The writer named by `writer_id` has no handwriting ready. Nothing was charged. |\n| `RETURN_ADDRESS_MISSING` | 409 | The account has no complete name and return address (only a postcard may leave it off). |\n| `CARD_BACK_NOT_READY` | 409 | The card back, or the account's default back, isn't rendered for print. Save it again in Card Backs, or send another `card_back_id` or `null`. |\n| `REFERRAL_LINK_UNAVAILABLE` | 409 | The send asked for a referral QR code (`cta.type: referral`) and the account has no referral link. Leave out `cta`, or ask support. |\n| `RECIPIENT_ADDRESS_CHANGED` | 409 | The recipient's address changed while the note was sent. Nothing was charged; send again. |\n| `RECIPIENT_EXISTS` | 409 | Another request added this recipient a moment before. Nothing was charged; send again. |\n| `API_KEY_TEAM_MISMATCH` | 409 | You now send for another team than the key's. Nothing was charged. Make a new key in Settings. |\n| `TEAM_ARCHIVED` | 409 | An Org Admin archived the key's team, so it sends nothing new. Nothing was charged. Make a key on another team in Settings. |\n| `DUPLICATE_NOTE` | 409 | This recipient was sent this same message in the last 24 hours, by anyone on the team (`details.reason` `same_message`), or this `crm_contact` already has a live note going to print that day (`same_crm_contact_day`). Nothing was sent or charged. `details.note_id` is the earlier note. Set `allow_duplicate: true` to send it again on purpose. |\n| `NOTE_NOT_CANCELLABLE` | 409 | The note can't be cancelled: the printer has started on it, it is no longer queued, or it was sent from a campaign. `details.status` is the note's status and `details.reason` says which. Nothing was changed or refunded. |\n| `NOTE_CONTENT_STILL_NEEDED` | 409 | The note hasn't been mailed yet, so its content is still needed to print it. Delete it once it is mailed, or cancel it while it is queued. |\n| `COVER_LIMIT_REACHED` | 409 | The account's team keeps 100 uploaded covers, the most it can. Delete one in the Note Composer, then upload again. |\n| `IDEMPOTENCY_KEY_REUSED` | 422 | This `Idempotency-Key` was used for a different request. Use a new key for each note, also when you send a cancelled note again. |\n| `RECIPIENT_NOT_FOUND` | 422 | `recipient_id` is not in your address book. |\n| `RECIPIENT_INCOMPLETE` | 422 | The recipient has no name, street, city, state or ZIP. |\n| `ADDRESS_INVALID` | 422 | USPS doesn't confirm the address. `details.result`, `details.cause`, and Google's `details.suggestion` (or null). |\n| `UNSUPPORTED_CHARACTERS` | 422 | Characters the handwriting cannot write: `details.missing_characters` (capture them) and `details.unsupported_characters` (remove them). |\n| `LETTER_DESIGN_UNAVAILABLE` | 422 | `letter_design_id` isn't a letter design this account can use. GET /api/v1/letter-designs lists them. |\n| `QR_URL_NOT_ALLOWED` | 422 | `qr_url` isn't a link this account can print: it must be an https link of at most 120 characters on a site enabled for the account. The answer is the same for a wrong shape, a site off the list, and an account with no list. |\n| `LETTER_DESIGN_NO_QR` | 422 | The letter design has no place for a QR code (or for the account's footer line). Choose another design, or leave `qr_url` out. Nothing was charged. |\n| `QR_SITE_NOT_LISTED` | 422 | `cta.url`'s site isn't one of the account's QR code sites. Add it in the Note Composer (Settings > QR code sites), then send. Nothing was charged. |\n| `QR_SITE_PENDING` | 422 | `cta.url`'s site is waiting for Stylograph's review. Send once it's approved. Nothing was charged. |\n| `QR_SITE_BLOCKED` | 422 | Stylograph turned `cta.url`'s site off, or Google lists the link as unsafe. Nothing was charged. |\n| `QR_LINK_REDIRECTS` | 422 | `cta.url` passes the visitor on to another address (an open redirect). Link to the page itself. Nothing was charged. |\n| `IMAGE_NOT_ALLOWED` | 422 | Screening refused the uploaded cover. Nothing was stored. |\n| `RECIPIENT_TOO_LONG_FOR_POSTCARD` | 422 | The recipient's address doesn't fit a postcard. |\n| `MESSAGE_DOES_NOT_FIT` | 422 | The message doesn't fit the postcard, or a `flat` card's message would be written under its smallest letter size (`details.reason` is `below_floor`, with `details.over_by`, about how many characters to cut, `details.x_height_mm` and `details.floor_x_height_mm`; nothing was charged), or a letter would be written under its design's smallest letter size (`details.reason` is `below_floor`, with `details.x_height_mm`, `details.floor_x_height_mm` and `details.lines`), or a letter has a closing and no message (`no_body`), or the account's footer line doesn't fit beside the QR code (`details.part` is `footer`, with `details.x_height_mm` and `details.floor_x_height_mm`; nothing was charged). |\n| `CUE_TOO_LONG_FOR_POSTCARD` | 422 | The line beside the QR code doesn't fit the postcard. |\n| `RETURN_ADDRESS_TOO_LONG_FOR_POSTCARD` | 422 | The return address doesn't fit the postcard. |\n| `RECIPIENT_NOT_DRAWABLE` | 422 | The recipient's name or address has characters the handwriting cannot write. |\n| `RETURN_ADDRESS_NOT_DRAWABLE` | 422 | The name or return address has characters the handwriting cannot write. |\n| `NO_FONT` | 422 | The handwriting cannot draw a postcard or a `flat` card yet. Finish it in My Handwriting, then send. |\n| `API_DAILY_LIMIT_REACHED` | 429 | The organization sent its API notes for the last 24 hours. A cancelled note counts only past as many cancelled notes as the limit. `details.daily_limit`, `details.next_slot_at`, and `Retry-After`. |\n| `API_KEY_DAILY_LIMIT_REACHED` | 429 | This key sent the notes its own daily cap allows for the last 24 hours. A cancelled note counts only past as many cancelled notes as the cap. `details.daily_limit`, `details.next_slot_at`, and `Retry-After`. |\n| `RECIPIENT_DAILY_LIMIT_REACHED` | 429 | Your team added 1000 recipients in the last 24 hours, the most the API adds in a day. Nothing was added. |\n| `RECIPIENT_EDIT_LIMIT_REACHED` | 429 | Your team changed 200 addresses through the API in the last 24 hours, the most the API changes in a day. Nothing was changed. A name or company edit doesn't count. |\n| `ACCOUNT_PRINT_SHARE_REACHED` | 429 | Your account's share of printing capacity for the note's print day is used. Nothing was charged. Send it for a later day with `scheduled_for`, or try again after `Retry-After`. |\n| `ADDRESS_CHECK_RATE_LIMITED` | 429 | The account checked 60 addresses in the last hour. Wait `Retry-After` seconds. |\n| `IMAGE_SCREENING_RATE_LIMITED` | 429 | The account uploaded 30 images in the last hour. Nothing was stored. Wait `Retry-After` seconds. |\n| `INTERNAL` | 500 | Something went wrong on our side. Try again. |\n| `VENDOR_DAILY_CEILING_REACHED` | 503 | Printing capacity for the note's print day is full. Nothing was charged. Send it for a later day with `scheduled_for`, or try again after `Retry-After`. |\n| `ADDRESS_CHECK_UNAVAILABLE` | 503 | The address couldn't be checked just now. Nothing was charged. Try again after `Retry-After`. |\n| `POSTCARD_CHECK_UNAVAILABLE` | 503 | The postcard's fit couldn't be checked just now. Nothing was charged. |\n| `LETTER_CHECK_UNAVAILABLE` | 503 | The check that a letter fits its page couldn't run. Nothing was sent or charged. Retry after `Retry-After`. |\n| `FLAT_NOTECARD_CHECK_UNAVAILABLE` | 503 | The check that a `flat` card's message fits its back couldn't run. Nothing was sent or charged. Retry after `Retry-After`. |"
      },
      "Scope": {
        "type": "string",
        "enum": [
          "account:read",
          "notes:read",
          "notes:send",
          "recipients:write"
        ]
      },
      "NoteStatus": {
        "type": "string",
        "enum": [
          "queued",
          "printed",
          "mailed",
          "delivered",
          "returned",
          "failed",
          "cancelled"
        ],
        "description": "`queued` (accepted, waiting to print), `printed`, `mailed` (handed to USPS), `delivered` and `returned` (from USPS scans), `failed` (see `failure_code`), `cancelled` (cancelled before the printer started on it; nothing is mailed and its credits are refunded)."
      },
      "Format": {
        "type": "object",
        "required": [
          "format",
          "name",
          "credits",
          "message_limit",
          "available"
        ],
        "properties": {
          "format": {
            "type": "string",
            "enum": [
              "folded",
              "postcard",
              "letter",
              "flat"
            ]
          },
          "name": {
            "type": "string"
          },
          "credits": {
            "type": "integer",
            "description": "What one note costs."
          },
          "message_limit": {
            "type": "integer",
            "description": "The most characters a message may have, counted as printed. For a `letter` this is a ceiling: each letter design has its own, smaller `max_chars`."
          },
          "available": {
            "type": "boolean",
            "description": "False while the format is paused, or, for a `letter`, when letters aren't on for the account: a send refuses it (`PRODUCT_UNAVAILABLE`). `flat` is listed only for an organization that has it, always as available."
          }
        }
      },
      "Account": {
        "type": "object",
        "required": [
          "credit_balance",
          "team",
          "organization",
          "handwriting",
          "return_address_ready",
          "referral_qr_available",
          "api_notes",
          "vendor_capacity_available",
          "default_cover_key",
          "formats",
          "letters",
          "api_key"
        ],
        "properties": {
          "credit_balance": {
            "type": "integer",
            "description": "The organization's credits you can spend: its wallet, plus any credits you earned yourself."
          },
          "team": {
            "type": "object",
            "required": [
              "id",
              "name"
            ],
            "description": "The one team this key reads and sends for.",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "organization": {
            "type": "object",
            "required": [
              "id",
              "name"
            ],
            "description": "The team's organization: it pays for the notes, and holds the API access and the daily note limit.",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "handwriting": {
            "type": "object",
            "required": [
              "ready",
              "profile_id"
            ],
            "properties": {
              "ready": {
                "type": "boolean",
                "description": "False: a send answers 409 `HANDWRITING_NOT_READY`."
              },
              "profile_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true,
                "description": "The handwriting a send writes in; pass it as `handwriting_profile_id` to refuse a send if it changes."
              }
            }
          },
          "return_address_ready": {
            "type": "boolean",
            "description": "False: a send answers 409 `RETURN_ADDRESS_MISSING` (a postcard may turn it off)."
          },
          "referral_qr_available": {
            "type": "boolean",
            "description": "Whether a send can carry the account's referral QR code (`cta.type: referral`). When false, such a send answers 409 `REFERRAL_LINK_UNAVAILABLE`."
          },
          "api_notes": {
            "type": "object",
            "required": [
              "daily_limit",
              "used_last_24h",
              "remaining",
              "next_slot_at"
            ],
            "properties": {
              "daily_limit": {
                "type": "integer"
              },
              "used_last_24h": {
                "type": "integer",
                "description": "API notes the organization sent in the last 24 hours that count: a cancelled note counts only past as many cancelled notes as `daily_limit`."
              },
              "remaining": {
                "type": "integer"
              },
              "next_slot_at": {
                "type": "string",
                "format": "date-time",
                "nullable": true,
                "description": "When the next API note can go, once the limit is reached."
              }
            }
          },
          "vendor_capacity_available": {
            "type": "boolean",
            "description": "False: today's printing capacity is full (a send for today answers 503 `VENDOR_DAILY_CEILING_REACHED`), or your account's own share of today is used (429 `ACCOUNT_PRINT_SHARE_REACHED`). A later day, set with `scheduled_for`, may still have room."
          },
          "default_cover_key": {
            "type": "string",
            "description": "The cover a send gets when it names none. Every folded note and postcard has a cover; a letter takes none."
          },
          "formats": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Format"
            }
          },
          "letters": {
            "type": "object",
            "nullable": true,
            "required": [
              "enabled",
              "handwriting_ready",
              "signature_captured",
              "return_ready",
              "designs_available"
            ],
            "description": "What a letter send needs, for an account Stylograph has turned letters on for; null for every other account.",
            "properties": {
              "enabled": {
                "type": "boolean",
                "description": "Whether the account can send a letter now. False: a letter send answers 400 `PRODUCT_UNAVAILABLE`."
              },
              "handwriting_ready": {
                "type": "boolean",
                "description": "False: a send answers 409 `HANDWRITING_NOT_READY`."
              },
              "signature_captured": {
                "type": "boolean",
                "nullable": true,
                "description": "Whether the account's handwriting has a captured signature. False: a signed letter closes with the closing name written in the account's letters. Null when that couldn't be read just now."
              },
              "return_ready": {
                "type": "boolean",
                "description": "Whether the envelope has a return block: the account's return lines, or its name and return address. False: a letter send answers 409 `RETURN_ADDRESS_MISSING`."
              },
              "designs_available": {
                "type": "integer",
                "nullable": true,
                "description": "How many letter designs the account can send on (GET /api/v1/letter-designs); null when that couldn't be read just now."
              }
            }
          },
          "api_key": {
            "type": "object",
            "required": [
              "prefix",
              "scopes",
              "expires_at",
              "daily_notes"
            ],
            "properties": {
              "prefix": {
                "type": "string",
                "description": "The key's first 8 characters, as Settings shows them."
              },
              "scopes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Scope"
                }
              },
              "expires_at": {
                "type": "string",
                "format": "date-time"
              },
              "daily_notes": {
                "type": "object",
                "nullable": true,
                "required": [
                  "daily_limit",
                  "used_last_24h",
                  "remaining",
                  "next_slot_at"
                ],
                "description": "This key's own daily note cap and what is left of it; null for a key with no cap of its own. Past it, a send answers 429 `API_KEY_DAILY_LIMIT_REACHED`.",
                "properties": {
                  "daily_limit": {
                    "type": "integer"
                  },
                  "used_last_24h": {
                    "type": "integer",
                    "description": "Notes this key sent in the last 24 hours that count: a cancelled note counts only past as many cancelled notes as `daily_limit`."
                  },
                  "remaining": {
                    "type": "integer"
                  },
                  "next_slot_at": {
                    "type": "string",
                    "format": "date-time",
                    "nullable": true,
                    "description": "When the key can send again, once the cap is reached."
                  }
                }
              }
            }
          }
        }
      },
      "AccountResponse": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Account"
          }
        }
      },
      "Cover": {
        "type": "object",
        "required": [
          "key",
          "name",
          "category",
          "category_label",
          "orientation",
          "thumbnail_url"
        ],
        "properties": {
          "key": {
            "type": "string",
            "description": "Send this as `card_image_key`."
          },
          "name": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "category_label": {
            "type": "string"
          },
          "orientation": {
            "type": "string",
            "enum": [
              "landscape",
              "portrait"
            ]
          },
          "thumbnail_url": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "description": "A small preview; the print uses the original."
          }
        }
      },
      "CoverList": {
        "type": "object",
        "required": [
          "data",
          "default_cover_key"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Cover"
            }
          },
          "uploaded_covers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UploadedCover"
            },
            "description": "Only for a key with `notes:send`: the account's own uploaded covers, newest first, up to 100. Their orientation isn't recorded, so pick one that suits the card."
          },
          "default_cover_key": {
            "type": "string",
            "description": "The cover a send gets when it names none. Every note has a cover."
          }
        }
      },
      "UploadedCover": {
        "type": "object",
        "required": [
          "key",
          "name",
          "source",
          "uploaded_at",
          "thumbnail_url"
        ],
        "properties": {
          "key": {
            "type": "string",
            "description": "Send this as `card_image_key`. It works only for the account that uploaded it."
          },
          "name": {
            "type": "string",
            "description": "The file's name when it was uploaded."
          },
          "source": {
            "type": "string",
            "enum": [
              "upload"
            ],
            "description": "The account's team's own art, not the library's."
          },
          "uploaded_at": {
            "type": "string",
            "format": "date-time"
          },
          "thumbnail_url": {
            "type": "string",
            "format": "uri",
            "description": "A small preview that stops working after an hour; the print uses the original.",
            "nullable": true
          }
        }
      },
      "UploadedCoverResponse": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/UploadedCover"
          }
        }
      },
      "CardBack": {
        "type": "object",
        "required": [
          "id",
          "name",
          "is_default",
          "ready",
          "updated_at",
          "preview_url"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Send this as `card_back_id`."
          },
          "name": {
            "type": "string"
          },
          "is_default": {
            "type": "boolean",
            "description": "The back a send gets when it leaves out `card_back_id`."
          },
          "ready": {
            "type": "boolean",
            "description": "Whether it is rendered for print. A send with a back that isn't ready answers 409 `CARD_BACK_NOT_READY`."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "preview_url": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "description": "A preview, signed for an hour; null when it couldn't be signed just now."
          }
        }
      },
      "CardBackList": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CardBack"
            }
          }
        }
      },
      "LetterDesign": {
        "type": "object",
        "required": [
          "id",
          "slug",
          "name",
          "version",
          "max_chars",
          "safe_area_mm",
          "preview_url"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Send this as `letter_design_id`."
          },
          "slug": {
            "type": "string",
            "description": "A stable short name for the design, e.g. `holly-and-ribbon`."
          },
          "name": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "description": "Goes up when the stationery or its safe area changes. A letter keeps the version it was sent with."
          },
          "max_chars": {
            "type": "integer",
            "description": "The most characters a letter on this design may carry, counted as printed. A longer message answers 400 `MESSAGE_TOO_LONG` with `details.limit` and `details.length`."
          },
          "safe_area_mm": {
            "type": "object",
            "required": [
              "x",
              "y",
              "w",
              "h"
            ],
            "description": "Where the pen may write, in millimetres from the top left corner of the 215.9 x 279.4 mm page.",
            "properties": {
              "x": {
                "type": "number"
              },
              "y": {
                "type": "number"
              },
              "w": {
                "type": "number"
              },
              "h": {
                "type": "number"
              }
            }
          },
          "preview_url": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "description": "A preview of the stationery, signed for an hour; null when it couldn't be signed just now."
          }
        }
      },
      "LetterDesignList": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LetterDesign"
            }
          }
        }
      },
      "Recipient": {
        "type": "object",
        "required": [
          "id",
          "honorific",
          "first_name",
          "last_name",
          "company",
          "city",
          "state",
          "address_complete"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Send this as `recipient_id`."
          },
          "honorific": {
            "type": "string",
            "nullable": true
          },
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          },
          "company": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "address_complete": {
            "type": "boolean",
            "description": "False when the address lacks a line a send needs; a send to this recipient answers `RECIPIENT_INCOMPLETE`."
          }
        }
      },
      "RecipientList": {
        "type": "object",
        "required": [
          "data",
          "has_more"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Recipient"
            }
          },
          "has_more": {
            "type": "boolean",
            "description": "More recipients matched than `limit`. Narrow `q` to find the one you want."
          }
        }
      },
      "NewRecipient": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "first_name",
          "last_name",
          "address_line1",
          "city",
          "state",
          "zip"
        ],
        "description": "Someone not in your address book yet (needs `recipients:write`). Matched to an existing entry with the same name and address, ignoring case; otherwise added once the send passes every check.",
        "properties": {
          "honorific": {
            "type": "string",
            "maxLength": 20,
            "nullable": true
          },
          "first_name": {
            "type": "string",
            "maxLength": 100
          },
          "last_name": {
            "type": "string",
            "maxLength": 100
          },
          "company": {
            "type": "string",
            "maxLength": 100,
            "nullable": true,
            "description": "Written on the envelope under the name."
          },
          "address_line1": {
            "type": "string",
            "maxLength": 200
          },
          "address_line2": {
            "type": "string",
            "maxLength": 200,
            "nullable": true
          },
          "city": {
            "type": "string",
            "maxLength": 100
          },
          "state": {
            "type": "string",
            "pattern": "^[A-Za-z]{2}$",
            "description": "Two-letter state code."
          },
          "zip": {
            "type": "string",
            "pattern": "^\\d{5}(-\\d{4})?$"
          }
        }
      },
      "Closing": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "salutation": {
            "type": "string",
            "maxLength": 30,
            "nullable": true,
            "example": "Warmly,"
          },
          "name": {
            "type": "string",
            "maxLength": 60,
            "nullable": true,
            "description": "Written only when `signature` is false (or the handwriting has no captured signature)."
          },
          "signature": {
            "type": "boolean",
            "default": false,
            "description": "Sign with the captured signature."
          }
        }
      },
      "SendCta": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "referral",
              "visit"
            ],
            "description": "`referral`: a QR code to the account's own referral link. A scan goes through Stylograph's short link, which counts it, to the referral page, and someone who signs up there is credited to the account as its referral. `visit`: a QR code to `url`, a link of your own on one of the account's QR code sites (Settings > QR code sites in the Note Composer) or on one of Stylograph's own sites. A scan goes through Stylograph's short link, which counts it."
          },
          "url": {
            "type": "string",
            "nullable": true,
            "maxLength": 2048,
            "description": "For `visit` only, and required there: the https link the QR code opens. Its site must be one of the account's QR code sites, approved by Stylograph, or one of Stylograph's own (www.stylograph.ai). A site that isn't listed answers 422 `QR_SITE_NOT_LISTED`, one waiting for review 422 `QR_SITE_PENDING`, and one Stylograph turned off 422 `QR_SITE_BLOCKED`; 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. Leave it out for `referral`."
          },
          "verbal_cue": {
            "type": "string",
            "nullable": true,
            "maxLength": 100,
            "description": "One line written beside the QR code in the account's handwriting, e.g. \"Scan to send some notes of your own, on me.\" Up to 100 characters for a `folded` note and 40 for a `postcard`. A `letter` takes no call to action. A `flat` card takes no verbal cue: its QR code prints alone on the front. It doesn't count toward the message's limit, and is held to the same character check. Leave it out, or send null or blank, for the QR code alone."
          }
        },
        "description": "A call to action printed with the note: a QR code and an optional line beside it. On a folded note with a card back, the QR code is printed inside the card, never on the back."
      },
      "SendNoteRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "format",
          "message"
        ],
        "description": "Send exactly one of `recipient_id` and `recipient`. Unknown fields are refused.",
        "properties": {
          "recipient_id": {
            "type": "string",
            "format": "uuid",
            "description": "Someone in your address book. Find one with GET /api/v1/recipients."
          },
          "recipient": {
            "$ref": "#/components/schemas/NewRecipient"
          },
          "format": {
            "type": "string",
            "enum": [
              "folded",
              "postcard",
              "letter",
              "flat"
            ],
            "description": "`folded`: a folded notecard. `postcard`: a 4x6 postcard. `letter`: one handwritten page on stationery, mailed flat in a 9x12 envelope; it needs `letter_design_id`, and only an account with letters on can send one (`letters` in GET /api/v1/account). `flat`: a 4x6 flat card mailed in an A6 envelope, the cover on its front and the message on its back. It takes a `cta` only where the organization has the flat notecard QR on (the QR prints on the front, with no verbal cue; any other key gets 400 `INVALID_ARGUMENT`), it takes no card back, and only an organization Stylograph has turned it on for can send one (GET /api/v1/account lists `flat` only then; any other key gets 400 `PRODUCT_UNAVAILABLE`)."
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000,
            "description": "The note's text. At most 400 characters for a `folded` note, 180 characters for a `postcard`, 2000 characters for a `letter` and 300 characters for a `flat` card, counted as printed: curly quotes, dashes and ellipses are made plain first (an ellipsis prints as three periods). A letter is also held to its design's own, smaller limit (`max_chars` in GET /api/v1/letter-designs), and keeps its line breaks: a blank line starts a new paragraph. A `flat` card's message, with its closing, must also fit the 4x6 back at a readable size in the writer's hand: one that doesn't answers 422 `MESSAGE_DOES_NOT_FIT` with `details.over_by`, about how many characters to cut."
          },
          "closing": {
            "$ref": "#/components/schemas/Closing"
          },
          "card_image_key": {
            "type": "string",
            "maxLength": 512,
            "description": "A key from GET /api/v1/covers, or one of your uploads. Leave it out for the default cover (default_cover_key). Every folded note, postcard and `flat` card has a cover. A letter takes none: sending one with a letter answers 400 `INVALID_ARGUMENT`."
          },
          "card_back_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "A folded note's card back: an id from GET /api/v1/card-backs, or null for none. Leave it out for the account's default back, if it has one (none on a postcard, a letter or a `flat` card). An id sent with a letter answers 400 `INVALID_ARGUMENT`."
          },
          "letter_design_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The stationery a letter is written on: an id from GET /api/v1/letter-designs. Required for a `letter`. On any other format, leave it out or send null. A design the account can't use answers 422 `LETTER_DESIGN_UNAVAILABLE`."
          },
          "qr_url": {
            "type": "string",
            "nullable": true,
            "maxLength": 120,
            "description": "Letters only: an https link the letter's QR code opens, at most 120 characters, with a lower-case site name and no spaces. It is stored on the note and returned as `qr_url`. It must start with an origin on the account's allow-list, which Stylograph support sets; a link on any other site, or on an account with no list, answers 422 `QR_URL_NOT_ALLOWED`, and a design with no place for the code (or for the account's footer line) answers 422 `LETTER_DESIGN_NO_QR`. A folded note or postcard takes its QR link in `cta` instead. Leave it out for no QR code. On any other format, leave it out or send null."
          },
          "writer_id": {
            "type": "string",
            "format": "uuid",
            "description": "Whose handwriting the note is written in (issue #973): a writer from GET /api/v1/writers. Leave it out for the key's own member. Only an Operator's key can name a teammate; the note is still paid by the organization and recorded as sent by the key's member. Not on a letter."
          },
          "handwriting_profile_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional: refuse the send if it isn't the writer's current handwriting (the key's member's, or `writer_id`'s; GET /api/v1/writers shows it)."
          },
          "return_address_on": {
            "type": "boolean",
            "default": true,
            "description": "Only a postcard may set false. A letter's envelope always carries a return block: the account's return lines when Stylograph has set them, otherwise its name and return address."
          },
          "scheduled_for": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Send later: the day the note goes to print, as YYYY-MM-DD. After today's date in UTC and no more than 90 days ahead. The note is queued and charged now, and the printer doesn't see it before that day. Leave it out, or send null, to print as soon as possible. Until the printer starts on it the note can be cancelled (DELETE /api/v1/notes/{noteId}) and its credits come back. The date can't be moved: cancel and send again with a new `Idempotency-Key`."
          },
          "cta": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SendCta"
              }
            ],
            "nullable": true,
            "description": "Print a QR code on the note, to the account's referral link (`type: referral`) or to a link of your own on one of the account's QR code sites (`type: visit`, with `url`), with an optional line beside it. Leave it out, or send null, for no QR code. A letter takes none (it has `qr_url`; sending one answers 400 `INVALID_ARGUMENT`). A `flat` card takes one only where the organization has the flat notecard QR on: the code prints on the front with no `verbal_cue`, and any other organization gets 400 `INVALID_ARGUMENT`."
          },
          "client": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40,
            "pattern": "^[a-z0-9][a-z0-9._-]{0,39}$",
            "description": "Optional: a short label for the app sending the note, e.g. `zapier`. It is kept on the note and returned as `client`, and changes nothing about the send: no price, limit or check reads it. It is left out of the request an `Idempotency-Key` is matched against."
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "pattern": "^[!-~]{1,255}$",
            "description": "Only for a client that cannot set the `Idempotency-Key` header; when both are sent they must match."
          },
          "dry_run": {
            "type": "boolean",
            "default": false
          },
          "crm_contact": {
            "type": "object",
            "nullable": true,
            "additionalProperties": false,
            "required": [
              "source",
              "id"
            ],
            "properties": {
              "source": {
                "type": "string",
                "minLength": 1,
                "maxLength": 40,
                "pattern": "^[a-z0-9][a-z0-9._-]{0,39}$",
                "description": "The CRM, as a short lower-case name, e.g. `followupboss` or `hubspot`."
              },
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100,
                "pattern": "^[!-9;-~]{1,100}$",
                "description": "The contact's id in that CRM: visible characters, no spaces or colons. A number is taken as its digits."
              }
            },
            "description": "Optional: the person in your CRM the note is for. A team mails at most one note a day (the UTC day it goes to print: `scheduled_for`, else the day it is sent) to a CRM contact, whichever app or integration sends it, so a Zap and a CRM connector firing on one event mail one card. A second is refused with 409 `DUPLICATE_NOTE` (`details.reason` `same_crm_contact_day`) unless `allow_duplicate` is set. Sends without it are never merged by name or address, so siblings at one address all get their own note."
          },
          "allow_duplicate": {
            "type": "boolean",
            "default": false,
            "description": "Send even though this recipient was sent this same message in the last 24 hours, or this `crm_contact` already has a note going to print that day. Without it, such a send is refused with `DUPLICATE_NOTE` and nothing is charged. It doesn't change what an `Idempotency-Key` replays."
          }
        }
      },
      "RecipientSummary": {
        "type": "object",
        "required": [
          "id",
          "first_name",
          "last_name"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "first_name": {
            "type": "string",
            "nullable": true,
            "description": "Null once the note's content was deleted (`content_purged`)."
          },
          "last_name": {
            "type": "string",
            "nullable": true,
            "description": "Null once the note's content was deleted (`content_purged`)."
          }
        }
      },
      "CardBackSummary": {
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "The name the back had when the note was sent."
          }
        }
      },
      "LetterDesignSummary": {
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "description": "The name the design had when the letter was sent."
          }
        }
      },
      "Note": {
        "type": "object",
        "required": [
          "id",
          "reference",
          "status",
          "format",
          "source",
          "client",
          "recipient",
          "failure_code",
          "refund",
          "card_back",
          "letter_design",
          "qr_url",
          "stylograph_back",
          "scheduled_for",
          "cta",
          "created_at",
          "updated_at",
          "content_purged",
          "content_purged_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "reference": {
            "type": "string",
            "nullable": true,
            "description": "The support reference, e.g. 261017-ABCDEF12."
          },
          "status": {
            "$ref": "#/components/schemas/NoteStatus"
          },
          "format": {
            "type": "string",
            "enum": [
              "folded",
              "postcard",
              "letter",
              "flat"
            ],
            "nullable": true
          },
          "source": {
            "type": "string",
            "enum": [
              "api",
              "composer",
              "campaign"
            ],
            "description": "How the note was sent."
          },
          "client": {
            "type": "string",
            "nullable": true,
            "description": "The app that sent the note through this API, as the send's `client` gave it (e.g. `zapier`), or null. Always null for a note from the Note Composer or a campaign."
          },
          "recipient": {
            "$ref": "#/components/schemas/RecipientSummary"
          },
          "content_purged": {
            "type": "boolean",
            "description": "True once the note's content (message, recipient name and address, drawing files) was deleted, after mailing under the account's retention setting or on request with DELETE /api/v1/notes/{noteId}/content. The note keeps its id, status, dates and credits. While true, `recipient.first_name` and `recipient.last_name` are null."
          },
          "content_purged_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the content was deleted, or null while the note still has it."
          },
          "failure_code": {
            "type": "string",
            "nullable": true,
            "description": "Why a failed note failed; null unless `status` is `failed`, and null when no reason was given. `content_rejected`: the card was declined because of its content, by our print partner or by our review before printing; it can't be resent as is."
          },
          "refund": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Refund"
              }
            ],
            "nullable": true,
            "description": "The credits given back for this note, or null. A note sent through this API that fails before it is printed is refunded once, soon after it fails. So is a note our review declines before printing. A note our print partner declines for its content, or one that failed after it was printed, is not."
          },
          "card_back": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CardBackSummary"
              }
            ],
            "nullable": true,
            "description": "The card back the note was sent with, or null."
          },
          "letter_design": {
            "allOf": [
              {
                "$ref": "#/components/schemas/LetterDesignSummary"
              }
            ],
            "nullable": true,
            "description": "The stationery a letter was written on, by the name it had then, or null for any other format."
          },
          "qr_url": {
            "type": "string",
            "nullable": true,
            "maxLength": 120,
            "description": "The link the letter's QR code opens, as it was sent in `qr_url`. Null for anything but a letter sent with one."
          },
          "stylograph_back": {
            "type": "boolean",
            "nullable": true,
            "description": "True when the note prints the Stylograph back in place of card_back: decided when the card goes to the printer, by whether the account had an active subscription then. Null for a folded note that hasn't gone to the printer yet; false for a postcard or a letter."
          },
          "scheduled_for": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "The day the note goes to print (YYYY-MM-DD), or null when it went to print at once."
          },
          "cta": {
            "type": "object",
            "nullable": true,
            "required": [
              "type",
              "verbal_cue",
              "qr",
              "scans"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "referral",
                  "visit"
                ],
                "description": "`referral`: the account's referral QR code. `visit`: a link of your own, from the Note Composer or `cta.url`."
              },
              "verbal_cue": {
                "type": "string",
                "nullable": true,
                "description": "The line written beside the QR code, or null."
              },
              "qr": {
                "type": "boolean",
                "description": "Whether the note printed a QR code."
              },
              "scans": {
                "type": "integer",
                "minimum": 0,
                "description": "How many times the QR code was scanned since the note was sent."
              }
            },
            "description": "The call to action printed with the note, or null for none. Its link is never returned."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Pass the newest one you saw as `updated_since` to poll for changes."
          }
        }
      },
      "Refund": {
        "type": "object",
        "required": [
          "credits",
          "refunded_at"
        ],
        "properties": {
          "credits": {
            "type": "integer",
            "minimum": 1,
            "description": "The credits given back."
          },
          "refunded_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "StatusChange": {
        "type": "object",
        "required": [
          "status",
          "at"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/NoteStatus"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EstimatedDelivery": {
        "type": "object",
        "required": [
          "estimated_delivery_at",
          "basis"
        ],
        "properties": {
          "estimated_delivery_at": {
            "type": "string",
            "format": "date-time"
          },
          "basis": {
            "type": "string",
            "enum": [
              "usps",
              "first_scan_fallback"
            ],
            "description": "USPS's own date, or our estimate counted from the first scan."
          },
          "business_days": {
            "type": "integer",
            "description": "For our estimate: the business days counted from the first scan."
          }
        }
      },
      "NoteDetail": {
        "type": "object",
        "required": [
          "id",
          "reference",
          "status",
          "format",
          "source",
          "client",
          "recipient",
          "content_purged",
          "content_purged_at",
          "failure_code",
          "refund",
          "card_back",
          "letter_design",
          "qr_url",
          "stylograph_back",
          "scheduled_for",
          "cta",
          "created_at",
          "updated_at",
          "status_history",
          "estimated_delivery"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "reference": {
            "type": "string",
            "nullable": true,
            "description": "The support reference, e.g. 261017-ABCDEF12."
          },
          "status": {
            "$ref": "#/components/schemas/NoteStatus"
          },
          "format": {
            "type": "string",
            "enum": [
              "folded",
              "postcard",
              "letter",
              "flat"
            ],
            "nullable": true
          },
          "source": {
            "type": "string",
            "enum": [
              "api",
              "composer",
              "campaign"
            ],
            "description": "How the note was sent."
          },
          "client": {
            "type": "string",
            "nullable": true,
            "description": "The app that sent the note through this API, as the send's `client` gave it (e.g. `zapier`), or null. Always null for a note from the Note Composer or a campaign."
          },
          "recipient": {
            "$ref": "#/components/schemas/RecipientSummary"
          },
          "content_purged": {
            "type": "boolean",
            "description": "True once the note's content (message, recipient name and address, drawing files) was deleted, after mailing under the account's retention setting or on request with DELETE /api/v1/notes/{noteId}/content. The note keeps its id, status, dates and credits. While true, `recipient.first_name` and `recipient.last_name` are null."
          },
          "content_purged_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the content was deleted, or null while the note still has it."
          },
          "failure_code": {
            "type": "string",
            "nullable": true,
            "description": "Why a failed note failed; null unless `status` is `failed`, and null when no reason was given. `content_rejected`: the card was declined because of its content, by our print partner or by our review before printing; it can't be resent as is."
          },
          "refund": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Refund"
              }
            ],
            "nullable": true,
            "description": "The credits given back for this note, or null. A note sent through this API that fails before it is printed is refunded once, soon after it fails. So is a note our review declines before printing. A note our print partner declines for its content, or one that failed after it was printed, is not."
          },
          "card_back": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CardBackSummary"
              }
            ],
            "nullable": true,
            "description": "The card back the note was sent with, or null."
          },
          "letter_design": {
            "allOf": [
              {
                "$ref": "#/components/schemas/LetterDesignSummary"
              }
            ],
            "nullable": true,
            "description": "The stationery a letter was written on, by the name it had then, or null for any other format."
          },
          "qr_url": {
            "type": "string",
            "nullable": true,
            "maxLength": 120,
            "description": "The link the letter's QR code opens, as it was sent in `qr_url`. Null for anything but a letter sent with one."
          },
          "stylograph_back": {
            "type": "boolean",
            "nullable": true,
            "description": "True when the note prints the Stylograph back in place of card_back: decided when the card goes to the printer, by whether the account had an active subscription then. Null for a folded note that hasn't gone to the printer yet; false for a postcard or a letter."
          },
          "scheduled_for": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "The day the note goes to print (YYYY-MM-DD), or null when it went to print at once."
          },
          "cta": {
            "type": "object",
            "nullable": true,
            "required": [
              "type",
              "verbal_cue",
              "qr",
              "scans"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "referral",
                  "visit"
                ],
                "description": "`referral`: the account's referral QR code. `visit`: a link of your own, from the Note Composer or `cta.url`."
              },
              "verbal_cue": {
                "type": "string",
                "nullable": true,
                "description": "The line written beside the QR code, or null."
              },
              "qr": {
                "type": "boolean",
                "description": "Whether the note printed a QR code."
              },
              "scans": {
                "type": "integer",
                "minimum": 0,
                "description": "How many times the QR code was scanned since the note was sent."
              }
            },
            "description": "The call to action printed with the note, or null for none. Its link is never returned."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Pass the newest one you saw as `updated_since` to poll for changes."
          },
          "status_history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StatusChange"
            },
            "description": "Each change of status, oldest first."
          },
          "estimated_delivery": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EstimatedDelivery"
              }
            ],
            "nullable": true,
            "description": "Null before the first USPS scan and once delivered."
          }
        }
      },
      "NoteResponse": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Note"
          }
        }
      },
      "NoteDetailResponse": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/NoteDetail"
          }
        }
      },
      "NoteList": {
        "type": "object",
        "required": [
          "data",
          "next_cursor"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Note"
            }
          },
          "next_cursor": {
            "type": "string",
            "nullable": true,
            "description": "Pass as `cursor` for the next page; null on the last one."
          }
        }
      },
      "DryRun": {
        "type": "object",
        "required": [
          "dry_run",
          "format",
          "credits",
          "credit_balance",
          "recipient",
          "card_image_key",
          "default_cover",
          "letter_design",
          "letter_fit",
          "qr_url",
          "card_back",
          "default_card_back",
          "stylograph_back",
          "message",
          "closing",
          "return_address_on",
          "scheduled_for",
          "cta",
          "api_notes_remaining"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "format": {
            "type": "string",
            "enum": [
              "folded",
              "postcard",
              "letter",
              "flat"
            ]
          },
          "credits": {
            "type": "integer",
            "description": "What the send would charge."
          },
          "credit_balance": {
            "type": "integer"
          },
          "recipient": {
            "type": "object",
            "required": [
              "id",
              "first_name",
              "last_name",
              "in_address_book"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "first_name": {
                "type": "string"
              },
              "last_name": {
                "type": "string"
              },
              "in_address_book": {
                "type": "boolean",
                "description": "False: the send would add them."
              }
            }
          },
          "card_image_key": {
            "type": "string",
            "nullable": true,
            "description": "The cover the note would carry; null for a letter, which takes none."
          },
          "default_cover": {
            "type": "boolean",
            "description": "True when the request named no cover and got default_cover_key."
          },
          "letter_design": {
            "type": "object",
            "nullable": true,
            "required": [
              "id",
              "name",
              "version",
              "max_chars"
            ],
            "description": "The stationery a letter would be written on, or null for any other format.",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "integer",
                "description": "The design's version now. The letter keeps the version it is sent with."
              },
              "max_chars": {
                "type": "integer",
                "description": "The most characters a letter on this design may carry."
              }
            }
          },
          "qr_url": {
            "type": "string",
            "nullable": true,
            "maxLength": 120,
            "description": "The link the letter's QR code would open, as sent; null for no QR code."
          },
          "letter_fit": {
            "type": "object",
            "nullable": true,
            "required": [
              "x_height_mm",
              "floor_x_height_mm",
              "lines"
            ],
            "description": "How a letter would be written on its page, or null for any other format. A letter that would go under `floor_x_height_mm` is refused with 422 `MESSAGE_DOES_NOT_FIT`, so a dry run that answers this fits.",
            "properties": {
              "x_height_mm": {
                "type": "number",
                "nullable": true,
                "description": "The height of a lowercase letter as written, in millimetres."
              },
              "floor_x_height_mm": {
                "type": "number",
                "nullable": true,
                "description": "The smallest letter height the design allows."
              },
              "lines": {
                "type": "integer",
                "description": "The lines the message and its closing take."
              }
            }
          },
          "card_back": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CardBackSummary"
              }
            ],
            "nullable": true,
            "description": "The card back the note would carry, or null."
          },
          "default_card_back": {
            "type": "boolean",
            "description": "True when that back is the account's default, because the request left out `card_back_id`."
          },
          "stylograph_back": {
            "type": "boolean",
            "description": "True when the note would print the Stylograph back if it went to the printer now: a folded note from an account without an active subscription. The back is decided when the card goes to the printer, so this is a prediction. card_back is null then."
          },
          "message": {
            "type": "string",
            "description": "The message as it would print."
          },
          "closing": {
            "$ref": "#/components/schemas/Closing"
          },
          "return_address_on": {
            "type": "boolean"
          },
          "scheduled_for": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "The day the note would go to print, or null for as soon as possible."
          },
          "cta": {
            "type": "object",
            "nullable": true,
            "required": [
              "type",
              "verbal_cue",
              "qr",
              "link"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "referral",
                  "visit"
                ]
              },
              "verbal_cue": {
                "type": "string",
                "nullable": true,
                "description": "The line written beside the QR code, as it would print."
              },
              "qr": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "link": {
                "type": "string",
                "format": "uri",
                "description": "Where a scan of the QR code goes: the account's referral link, or the `url` you sent for `visit`."
              }
            },
            "description": "The call to action the note would print, or null for none."
          },
          "api_notes_remaining": {
            "type": "integer",
            "description": "How many more API notes can go in the next 24 hours: the smaller of the account's daily limit and this key's own cap, if it has one."
          }
        }
      },
      "DryRunResponse": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/DryRun"
          }
        }
      },
      "Writer": {
        "type": "object",
        "required": [
          "id",
          "name",
          "handwriting_profile_id",
          "is_key_member"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Pass as a send's `writer_id`."
          },
          "name": {
            "type": "string",
            "description": "The name the team knows the writer by."
          },
          "handwriting_profile_id": {
            "type": "string",
            "format": "uuid",
            "description": "The writer's current handwriting; pass it as `handwriting_profile_id` to refuse a send if it changes."
          },
          "is_key_member": {
            "type": "boolean",
            "description": "Whether this is the key's own member."
          }
        }
      },
      "WriterList": {
        "type": "object",
        "required": [
          "data",
          "can_choose"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Writer"
            }
          },
          "can_choose": {
            "type": "boolean",
            "description": "Whether the key's member is an Operator and may send in any writer listed."
          }
        }
      },
      "Template": {
        "type": "object",
        "required": [
          "id",
          "name",
          "category",
          "message",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "message": {
            "type": "string",
            "description": "The wording as the team saved it. A send checks it like any other message."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TemplateList": {
        "type": "object",
        "required": [
          "data",
          "has_more"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Template"
            }
          },
          "has_more": {
            "type": "boolean",
            "description": "The team has more than 100 templates; narrow with `category`."
          }
        }
      },
      "RecipientUpdate": {
        "type": "object",
        "additionalProperties": false,
        "description": "Only the fields to change. A name or an address line can be changed but not blanked. Changing an address line clears the stored address check, so the next send checks the new address; a note already sent keeps the address it was sent with.",
        "properties": {
          "honorific": {
            "type": "string",
            "maxLength": 20,
            "nullable": true
          },
          "first_name": {
            "type": "string",
            "maxLength": 100
          },
          "last_name": {
            "type": "string",
            "maxLength": 100
          },
          "company": {
            "type": "string",
            "maxLength": 100,
            "nullable": true,
            "description": "Written on the envelope under the name."
          },
          "address_line1": {
            "type": "string",
            "maxLength": 200
          },
          "address_line2": {
            "type": "string",
            "maxLength": 200,
            "nullable": true
          },
          "city": {
            "type": "string",
            "maxLength": 100
          },
          "state": {
            "type": "string",
            "pattern": "^[A-Za-z]{2}$",
            "description": "Two-letter state code."
          },
          "zip": {
            "type": "string",
            "pattern": "^\\d{5}(-\\d{4})?$"
          }
        },
        "minProperties": 1
      },
      "RecipientWritten": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Recipient"
          },
          "created": {
            "type": "boolean",
            "description": "On an add: true when the person was added, false when the address book already had them at that address (nothing was added)."
          }
        }
      },
      "ImportRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "rows"
        ],
        "properties": {
          "rows": {
            "type": "array",
            "minItems": 1,
            "maxItems": 500,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "first_name",
                "last_name",
                "address_line1",
                "city",
                "state",
                "zip"
              ],
              "description": "One person: the fields a send's `recipient` takes.",
              "properties": {
                "honorific": {
                  "type": "string",
                  "maxLength": 20,
                  "nullable": true
                },
                "first_name": {
                  "type": "string",
                  "maxLength": 100
                },
                "last_name": {
                  "type": "string",
                  "maxLength": 100
                },
                "company": {
                  "type": "string",
                  "maxLength": 100,
                  "nullable": true,
                  "description": "Written on the envelope under the name."
                },
                "address_line1": {
                  "type": "string",
                  "maxLength": 200
                },
                "address_line2": {
                  "type": "string",
                  "maxLength": 200,
                  "nullable": true
                },
                "city": {
                  "type": "string",
                  "maxLength": 100
                },
                "state": {
                  "type": "string",
                  "pattern": "^[A-Za-z]{2}$",
                  "description": "Two-letter state code."
                },
                "zip": {
                  "type": "string",
                  "pattern": "^\\d{5}(-\\d{4})?$"
                }
              }
            }
          },
          "dry_run": {
            "type": "boolean",
            "default": false,
            "description": "Answer what would happen and add nobody."
          }
        }
      },
      "ImportResult": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "dry_run",
              "added",
              "existing",
              "skipped",
              "recipient_ids"
            ],
            "properties": {
              "dry_run": {
                "type": "boolean"
              },
              "added": {
                "type": "integer",
                "description": "People added, or on a dry run who would be."
              },
              "existing": {
                "type": "integer",
                "description": "Rows that matched someone already in the address book (same name and address, ignoring case). They are left unchanged."
              },
              "skipped": {
                "type": "array",
                "description": "Rows that couldn't be added: 1 is the first row.",
                "items": {
                  "type": "object",
                  "required": [
                    "row",
                    "recipient",
                    "errors"
                  ],
                  "properties": {
                    "row": {
                      "type": "integer"
                    },
                    "recipient": {
                      "type": "string",
                      "nullable": true
                    },
                    "errors": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "recipient_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid"
                },
                "description": "Each distinct person the import names, added or already there, in the order they first appear. Empty on a dry run."
              }
            }
          }
        }
      }
    }
  }
}
