{
  "openapi": "3.1.0",
  "info": {
    "title": "Omono API",
    "version": "1.0.0-beta",
    "contact": {
      "name": "Omono support (in-app chat)",
      "url": "https://help.omono.co"
    },
    "description": "[Copy for LLM](/docs/reference/introduction.md?copy) · [View as Markdown](/docs/reference/introduction.md)\n\n> **Beta.** The Omono API is in beta. Until it becomes generally\n> available, any part of it can still change. A change takes effect when\n> the [changelog](/docs/changelog) lists it, with no notice in advance,\n> and that stays true after general availability. The\n> [compatibility policy](/docs/compatibility) explains what can change and\n> when a change takes effect. Changes you make through the API are real and\n> take effect straight away, so test your integration on a\n> [sandbox organisation](/docs/getting-started#sandbox) first.\n\nThe Omono API lets your software read and change the records your\norganisation keeps in Omono: companies with their contacts and addresses,\nquotes, sales orders and their dispatches, credit notes, purchase orders\nand their deliveries, stock items, tasks and documents. It also gives you\nthe reference lists, such as tax rates, currencies and statuses, that\nthose records point to.\n\nThe API is organised around REST. It has predictable, resource-oriented\nURLs, accepts JSON request bodies, returns JSON responses and uses standard\nHTTP status codes. Every path in this reference is relative to\n`https://<host>/api/v1`. The host depends on the Omono platform your\norganisation uses, as\n[Make your first request](/docs/getting-started#first-call) explains.\n\nAuthenticate every request with your API key, sent as a bearer token in\nthe `Authorization` header and never in a URL, as\n[Authenticate your requests](/docs/getting-started#authentication)\nexplains.\n\nLearn more in the [guides](/docs/guides):\n\n- [Getting started](/docs/getting-started): access, API keys and your first request.\n- [Recipes](/docs/recipes): common jobs, step by step.\n- [Reading data](/docs/reading): pagination, filters, sorting and related records.\n- [Writing data](/docs/writing): idempotency keys, ETags and line items.\n- [Dispatches and invoicing](/docs/workflow): moving, shipping and invoicing a sales order's dispatches.\n- [Errors](/docs/errors): the error format and the codes to handle.\n- [Rate limits](/docs/limits): the limits, and how heavy writes count.\n- [Keeping in sync](/docs/syncing): keeping a copy of your data up to date.\n- [Conventions](/docs/conventions): IDs, dates, text and money.\n- [Enums](/docs/enums): the values of each status and type.\n- [Client libraries](/docs/clients): generating a client in your language.\n- [Compatibility policy](/docs/compatibility): what can change, and when.\n- [Changelog](/docs/changelog): every change to the API.\n"
  },
  "servers": [
    {
      "url": "https://api.omono.co/api/v1",
      "description": "This environment (the same host as these docs)"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Companies",
      "description": "[Copy for LLM](/docs/reference/companies.md?copy) · [View as Markdown](/docs/reference/companies.md)\n\nA company is a business you sell to, buy from, or both. Each company has its own contacts and addresses, and one of its addresses is the accounts address, which Omono uses for invoicing. The API never shows or accepts a company's bank details.\n\nReading companies requires the `companies:read` or `companies:write` scope, and changing them requires `companies:write`.\n\n### The company object\n\n| Attribute | Description |\n| --- | --- |\n| `id`<br>string | Unique identifier for the company. |\n| `companyName`<br>string | The company's name. It's unique in your organisation, including archived companies, and capital letters don't make one name different from another. |\n| `accountNo`<br>string | The company's account number, a short code that identifies it in Omono. Like the name, it's unique in your organisation, including archived companies, and capital letters don't make one account number different from another. |\n| `isCustomer`<br>boolean | Whether you sell to this company. A company can be both a customer and a supplier, but it must be at least one of them. |\n| `isSupplier`<br>boolean | Whether you buy from this company. A company can be both a supplier and a customer, but it must be at least one of them. |\n| `currencyId`<br>string | The ID of the currency you trade with this company in. Every quote, sales order, credit note and purchase order for the company uses this currency. When you set it, it must be one of the currencies your organisation uses, which [List all currency rates](#tag/tax-and-currency) returns. Once the company has any of those documents, its currency is locked and can't change (see `currencyLocked`). |\n| `countryId`<br>string | The ID of the country the company is in. You set it when you create the company. After that, Omono copies it from the accounts address, so to change it, update the accounts address. Countries are listed by [List all countries](#tag/tax-and-currency). |\n| `accountManagerId`<br>nullable string | The ID of the user who manages this customer's account. Every customer has one, and the customer's quotes and sales orders carry it too. It's `null` if the company isn't a customer. Your users are listed by [List all users](#tag/organisation). |\n| `onStop`<br>boolean | Whether the customer is on stop. While a customer is on stop, its dispatches can't be shipped, although you can still raise quotes, sales orders and credit notes for it. Staff put a customer on stop, or take it off, in Omono, so you can't change this field through the API. If a customer on stop stops being a customer, Omono takes it off stop. |\n| `archived`<br>boolean | Whether the company is archived. Archived companies are left out of lists unless you ask for them, and you can't raise documents for them or change them until you unarchive them. To archive or unarchive a company, send `archived` in [Update a company](#tag/companies/PATCH/companies/{id}). [Archive and unarchive a record](/docs/writing#archiving) explains how. |\n\n<details><summary>More attributes</summary>\n\n| Attribute | Description |\n| --- | --- |\n| `externalRef`<br>nullable string | Your own reference for the company, such as its ID in your CRM or accounting system, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's companies, archived ones included, so you can find the company again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references). |\n| `created`<br>timestamp | The time the company was created. |\n| `updated`<br>timestamp | The time the company was last changed. It also changes when any of the company's contacts or addresses change, so you can use it to tell when to read them again. |\n| `website`<br>nullable string | The company's website, or `null` if none has been saved. |\n| `industryId`<br>string | The ID of the industry the company works in. Your industries are listed by [List all industries](#tag/sales-settings). |\n| `typeId`<br>string | The ID of the company's type. Your company types are listed by [List all company types](#tag/sales-settings). |\n| `currencyLocked`<br>boolean | Whether the company's currency is locked. It becomes `true` when the first quote, sales order, credit note or purchase order is created for the company, and it stays `true` even if that document is deleted later, including a Draft that the API removed after a failed create. While it's `true`, you can't change `currencyId`. |\n| `taxNo`<br>nullable string | The company's VAT number or other tax registration number, or `null` if none has been saved. |\n| `taxRateId`<br>string | The ID of the company's default tax rate. New line items on the company's documents use this rate unless you send another one. Your tax rates are listed by [List all tax rates](#tag/tax-and-currency). |\n| `postcode`<br>nullable string | The postcode of the company's accounts address. You can't set it here, because Omono copies it from the accounts address. To change it, update the accounts address. |\n| `telephone`<br>nullable string | The telephone number of the company's accounts address. You can't set it here, because Omono copies it from the accounts address. To change it, update the accounts address. |\n| `invoiceTermsType`<br>nullable enum | How Omono reads `invoiceTermsDays` to work out when this customer's invoices are due. The days can count from the invoice date or from the end of the invoice month, or they can name a day of the month the invoice is dated in or of the following month. It's `null` if the company isn't a customer. Possible values: `days_after_invoice`, `days_after_month_end`, `day_of_current_month`, `day_of_next_month`. |\n| `invoiceTermsDays`<br>nullable integer | The number that goes with `invoiceTermsType`, from 0 to 99. For example, `days_after_invoice` with 30 days means each invoice is due 30 days after its date. It's `null` if the company isn't a customer. |\n| `creditLimit`<br>nullable number | The credit limit you allow this customer, in the customer's currency. If your organisation has turned on Omono's credit limit check for Xero, Omono compares it with the customer's Xero balance when staff ship a dispatch in Omono. The API never runs this check, including when you ship a dispatch through the API. It's `null` if no limit has been set or the company isn't a customer. |\n| `salesDiscount`<br>nullable number | The customer's usual discount, as a percentage from 0 to 100. Staff see it filled in on new line items in Omono, but the API doesn't apply it to line items you send. It's `null` if none has been set or the company isn't a customer. |\n| `customerSegmentId`<br>nullable string | The ID of the customer segment this customer belongs to, which your organisation uses for reporting. It's `null` if the company isn't a customer. Your customer segments are listed by [List all customer segments](#tag/sales-settings). |\n| `commissionId`<br>nullable string | The ID of a referrer's commission scheme for this customer, or `null` if there isn't one. New quotes and sales orders for the customer use this commission unless you send another. Your commissions are listed by [List all commissions](#tag/sales-settings). |\n| `customerDivisionId`<br>nullable string | The ID of the division of your organisation that normally deals with this customer, or `null` if none has been set. New quotes, sales orders and credit notes for the customer use this division unless you send another. Your divisions are listed by [List all divisions](#tag/organisation). |\n| `invoicePaymentBankAccountId`<br>nullable string | The ID of your organisation's bank account that this customer's invoices ask to be paid into. Omono prints its details on the customer's invoices and proformas. It's always in the company's currency, and it's `null` if the company isn't a customer. Your bank accounts are listed by [List all bank accounts](#tag/organisation). |\n| `eoriNumber`<br>nullable string | The customer's EORI number, which is used on customs paperwork, up to 50 characters. It's free text, not the ID of one of your organisation's EORI numbers. It's `null` if none has been saved or the company isn't a customer. |\n| `billTermsType`<br>nullable enum | How Omono reads `billTermsDays` to work out when this supplier's bills are due. It takes the same values as `invoiceTermsType`. It's `null` if the company isn't a supplier. Possible values: `days_after_invoice`, `days_after_month_end`, `day_of_current_month`, `day_of_next_month`. |\n| `billTermsDays`<br>nullable integer | The number that goes with `billTermsType`, from 0 to 99. It's `null` if the company isn't a supplier. |\n| `supplierDivisionId`<br>nullable string | The ID of the division of your organisation that normally buys from this supplier, or `null` if none has been set. New purchase orders for the supplier use this division unless you send another. Your divisions are listed by [List all divisions](#tag/organisation). |\n| `rating`<br>nullable integer | The supplier's quality rating, from 1 to 5 stars, which staff set in Omono, or `null` if the supplier hasn't been rated. You can't change it through the API. Possible values: `1`, `2`, `3`, `4`, `5`. |\n| `ratedAt`<br>nullable timestamp | The time the supplier's rating was last set, or `null` if it hasn't been set. |\n| `isProforma`<br>boolean | Whether this is a proforma customer, who must pay for each dispatch before it can ship. It's `true` when `invoiceTermsType` is `days_after_invoice` and `invoiceTermsDays` is `0`, so to make a customer proforma, set those two fields to those values. |\n| `contacts`<br>array of objects | The company's contacts, including archived ones. This field is only present when you ask for it with `include=contacts`, and in the response when you create a company. |\n| `addresses`<br>array of objects | The company's addresses, including archived ones. This field is only present when you ask for it with `include=addresses`, and in the response when you create a company. |\n\n</details>\n"
    },
    {
      "name": "Contacts",
      "description": "[Copy for LLM](/docs/reference/contacts.md?copy) · [View as Markdown](/docs/reference/contacts.md)\n\nA contact is a person at one of your companies, such as a buyer or someone in their accounts team. Each contact belongs to one company, and your quotes, orders and other documents can name a contact at the company they're for.\n\nReading contacts requires the `companies:read` or `companies:write` scope, and changing them requires `companies:write`.\n\n### The contact object\n\n| Attribute | Description |\n| --- | --- |\n| `id`<br>string | Unique identifier for the contact. |\n| `companyId`<br>string | The ID of the company the contact works for. |\n| `firstName`<br>string | The contact's first name. |\n| `lastName`<br>string | The contact's last name. |\n| `email`<br>string | The contact's email address. Omono emails documents to it. It's a full address with a top-level domain, such as `.com` or `.co.uk`. |\n| `jobTitle`<br>nullable string | The contact's job title, or `null` if none has been saved. |\n| `telephone1`<br>nullable string | The contact's main telephone number, or `null` if none has been saved. |\n| `archived`<br>boolean | Whether the contact is archived. Archived contacts can't be chosen on new documents. A company must always have at least one contact that isn't archived, so you can't archive its last one. |\n\n<details><summary>More attributes</summary>\n\n| Attribute | Description |\n| --- | --- |\n| `externalRef`<br>nullable string | Your own reference for the contact, such as its ID in your CRM, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's contacts, archived ones included, so you can find the contact again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references). |\n| `fullName`<br>string | The contact's full name. You can't set it: Omono builds it from `firstName` and `lastName`. |\n| `departmentId`<br>nullable string | The ID of the contact's department, or `null` if none has been set. Your departments are listed by [List all departments](#tag/organisation). |\n| `telephone2`<br>nullable string | The contact's other telephone number, or `null` if none has been saved. |\n| `addressId`<br>nullable string | The ID of the company address that the contact is linked to, or `null` if there isn't one. On a purchase order, this address prints as the supplier's address. If it's `null`, the supplier's accounts address prints instead. |\n| `created`<br>timestamp | The time the contact was created. |\n| `updated`<br>timestamp | The time the contact was last changed. |\n\n</details>\n"
    },
    {
      "name": "Addresses",
      "description": "[Copy for LLM](/docs/reference/addresses.md?copy) · [View as Markdown](/docs/reference/addresses.md)\n\nAn address is one of a company's postal addresses, used for deliveries and invoices. Every company has exactly one accounts address (`accountsAddress` is `true`), and you can't archive it. Omono emails invoices to the accounts address's `accountsEmail`.\n\nReading addresses requires the `companies:read` or `companies:write` scope, and changing them requires `companies:write`.\n\n### The address object\n\n| Attribute | Description |\n| --- | --- |\n| `id`<br>string | Unique identifier for the address. |\n| `companyId`<br>string | The ID of the company the address belongs to. |\n| `accountsAddress`<br>boolean | Whether this is the company's accounts address, which is the address the company is invoiced at. Omono prints it as the invoice address and sends it to Xero with the company. Every company has exactly one accounts address, and it can't be archived. |\n| `line1`<br>string | The first line of the address. |\n| `city`<br>string | The town or city. |\n| `postcode`<br>nullable string | The postcode, or `null` if none has been saved. |\n| `countryId`<br>string | The ID of the country the address is in. Countries are listed by [List all countries](#tag/tax-and-currency). |\n| `accountsEmail`<br>nullable string | The email address that the company's invoices are sent to when this is the accounts address. Omono requires one on a new accounts address, but some older accounts addresses don't have one. It's `null` on an address that doesn't have one. To change an accounts address that has none, send `accountsEmail` with your change, or the request fails with a `422` error and the code `missing-required-field`. |\n\n<details><summary>More attributes</summary>\n\n| Attribute | Description |\n| --- | --- |\n| `externalRef`<br>nullable string | Your own reference for the address, such as its ID in your web shop or CRM, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's addresses, archived ones included, so you can find the address again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references). |\n| `companyName`<br>nullable string | The name printed as the first line of the address, on paperwork and on the company's page in Omono. It's usually the company's own name, but it can be different, for example when goods go to a site that trades under another name. |\n| `line2`<br>nullable string | The second line of the address, or `null` if there isn't one. |\n| `county`<br>nullable string | The county, or `null` if none has been saved. |\n| `telephone`<br>nullable string | The telephone number at this address, or `null` if none has been saved. On the accounts address, it's also the company's `telephone`. |\n| `eoriNumber`<br>nullable string | The customer's EORI number for deliveries to this address, which is used on customs paperwork. When it's set, it's used instead of the EORI number on the company. It's `null` if none has been saved. |\n| `archived`<br>boolean | Whether the address is archived. Archived addresses can't be chosen on new documents, but they stay on existing ones. The accounts address can't be archived. |\n| `created`<br>timestamp | The time the address was created. |\n| `updated`<br>timestamp | The time the address was last changed. |\n\n</details>\n"
    },
    {
      "name": "Customer prices",
      "description": "[Copy for LLM](/docs/reference/customer-prices.md?copy) · [View as Markdown](/docs/reference/customer-prices.md)\n\nA customer's price list holds the prices you give that customer for your stock items, each from a minimum quantity and in the customer's currency. A customer can have several price lists, each with the day it takes effect. Omono uses the price list in effect when you add a line to a quote or sales order, and the stock item's sell price when no price on it applies.\n\nReading prices requires the `pricing:read` scope. No other scope lets a key read prices, so a key with `companies:read` or `sales:write` can't.\n\n### The customer price object\n\n| Attribute | Description |\n| --- | --- |\n| `id`<br>string | Unique identifier for the price. |\n| `stockItemId`<br>string | The ID of the stock item this price is for. |\n| `minQuantity`<br>number | The smallest quantity this price applies to. On a line for this quantity or more, Omono uses this price unless the same price list has a higher minimum quantity that the line also reaches. |\n| `price`<br>number | The list price of one unit, in the customer's currency, before any discount. |\n| `effectiveDate`<br>date | The day the price list this price is on takes effect, in the format `YYYY-MM-DD`. It's the date your team chose in Omono, with no time and no time zone. |\n\n<details><summary>More attributes</summary>\n\n| Attribute | Description |\n| --- | --- |\n| `customerRef`<br>nullable string | The customer's own reference for the stock item, such as their part number, or `null` if there isn't one. |\n| `created`<br>nullable timestamp | When the price was added to the price list. The `created_gte` and `created_lte` filters work on it. It's `null` if none is saved. |\n| `updated`<br>nullable timestamp | When the price was last changed. |\n\n</details>\n"
    },
    {
      "name": "Quotes",
      "description": "[Copy for LLM](/docs/reference/quotes.md?copy) · [View as Markdown](/docs/reference/quotes.md)\n\nA quote is a price offer you make to a customer. Quotes you create through the API start as Drafts. Activating a Draft makes it Active, which is the step Omono takes when a quote is first emailed, downloaded or printed. You then mark an Active quote as won or lost, through the API or in Omono. Marking a quote as won creates a Draft sales order from it.\n\nA quote can have several revisions. A revision is a version of the quote with its own details and line items, which staff create in Omono when a quote changes after it has been sent. The API shows each quote's presented revision, which is the won revision of a won quote and the latest revision of any other quote. Your changes always go to the latest revision.\n\nReading quotes requires the `sales:read` or `sales:write` scope, and changing them requires `sales:write`.\n\n### The quote object\n\n| Attribute | Description |\n| --- | --- |\n| `id`<br>string | Unique identifier for the quote. |\n| `quoteNo`<br>string | The quote number, as a string and without the \"SQ-\" prefix. It stays the same on every revision of the quote. |\n| `companyId`<br>string | The ID of the customer the quote is for. You set it when you create the quote, and it can't change after that. |\n| `status`<br>enum | The quote's status, which is one of `draft`, `active`, `won` or `lost`. A quote starts as a Draft, becomes Active once it has been sent to the customer, and ends as Won or Lost. You can't set this field directly. To move a Draft quote to Active, activate it with `POST /quotes/{id}/activate`. Staff mark quotes as won or lost, and reactivate lost ones, in Omono. A quote also goes back to Draft when someone creates a new revision in Omono, and if your organisation closes old quotes automatically, an Active quote can become Lost without anyone changing it. |\n| `currencyId`<br>string | The ID of the quote's currency, which is always the customer's currency. You can't set it, because Omono copies it from the company. Currencies are listed by [List all currencies](#tag/tax-and-currency). |\n| `salesPersonId`<br>string | The ID of the user responsible for the quote, shown on it as the sales person. Your users are listed by [List all users](#tag/organisation). |\n| `totalValue`<br>number | The total value of the presented revision, before tax, in the quote's currency. You can't set it, because Omono works it out from the line items. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains. |\n| `salesOrderId`<br>nullable string | The ID of the [sales order](#tag/sales-orders) created when the quote was won. It's `null` if the quote hasn't been won, or if that sales order has since been deleted. |\n| `lineItems`<br>array of objects | The line items of the presented revision, in the order they appear on the quote. A single quote always includes them, but a list includes them only when you ask with `include=lineItems`. A new revision gives every line item a new ID, so replace a quote's line items as a whole each time you read it. Learn more about [mirroring rules](/docs/syncing#mirroring-rules). |\n\n<details><summary>More attributes</summary>\n\n| Attribute | Description |\n| --- | --- |\n| `externalRef`<br>nullable string | Your own reference for the quote, such as its ID in your CRM, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's quotes, archived ones included, and cancelled ones, so you can find the quote again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references). |\n| `contactId`<br>string | The ID of the contact at the customer who the quote is for. |\n| `addressId`<br>string | The ID of the customer's address that the goods would be delivered to. On a quote where the customer collects the goods, it's the customer's accounts address. |\n| `customerCollection`<br>boolean | Whether the customer collects the goods themselves. When it's `true`, the quote's paperwork prints \"Customer Collection\" instead of a delivery address, and the sales order created when the quote is won is a collection order too. That order takes the value from the revision that was won. |\n| `refNo`<br>nullable string | The customer's reference for their enquiry, or `null` if there isn't one. |\n| `delivery`<br>nullable string | Free-text delivery terms, for example \"4 weeks from order\", or `null` if there are none. |\n| `validityId`<br>string | The ID of the quote validity, which says how long the quote stands. Your quote validities are listed by [List all quote validities](#tag/sales-settings). |\n| `chaseBy`<br>nullable date | The date to follow the quote up with the customer, as `YYYY-MM-DD`, or `null` if there isn't one. If your organisation uses task automation, Omono creates a follow-up task due on this date, moves it when the date changes and cancels it when the date is cleared. Learn more about [dates](/docs/conventions#dates). |\n| `exchangeRate`<br>nullable number | The exchange rate for the quote: the number of units of the quote's currency that equal 1 unit of your base currency. If you send back the value you read in an update, the rate doesn't change. It's `null` only on some old quotes that were saved without a rate. Learn more about [money](/docs/conventions#money). |\n| `eoriNumberId`<br>nullable string | The ID of your organisation's EORI number to show on the quote, or `null` if there isn't one. An EORI number identifies your business to customs. Your EORI numbers are listed by [List all EORI numbers](#tag/purchasing-and-shipping). |\n| `incotermId`<br>nullable string | The ID of the quote's incoterm, or `null` if there isn't one. An incoterm is a standard trade term that says who pays for shipping the goods and who carries the risk on the way. Your incoterms are listed by [List all incoterms](#tag/purchasing-and-shipping). |\n| `incotermNamedPlace`<br>nullable string | The place named with the incoterm, for example a port, or `null` if there isn't one. |\n| `conversionProbabilityId`<br>nullable string | The ID of the conversion probability, which says how likely you are to win the quote, or `null` if there isn't one. Your conversion probabilities are listed by [List all conversion probabilities](#tag/sales-settings). |\n| `expectedAwardDate`<br>nullable date | The date you expect the customer to decide, as `YYYY-MM-DD`, or `null` if there isn't one. Omono uses it in quote forecasts and, if your organisation uses task automation, for a reminder task. If your organisation closes old quotes automatically, Omono counts the days from this date, and it never closes a quote that has no expected award date. |\n| `enquiryReceivedDate`<br>nullable date | The date the customer's enquiry arrived, as `YYYY-MM-DD`, or `null` if there isn't one. |\n| `commissionId`<br>nullable string | The ID of the commission for the quote, or `null` if there isn't one. A commission is a scheme set up in Omono with two parts, a referrer who earns commission on the sale and the rate they earn. Your commissions are listed by [List all commissions](#tag/sales-settings). |\n| `divisionId`<br>nullable string | The ID of the division the quote belongs to, or `null` if it has none. Your divisions are listed by [List all divisions](#tag/organisation). |\n| `totalValueBase`<br>nullable number | `totalValue` in your organisation's base currency, as Omono saved it, or `null` if the quote has none saved, as on some old records. Omono saves it each time it works out the total in the quote's currency, converted at the quote's exchange rate and rounded to 2 decimal places, so working it out yourself from the total and the `exchangeRate` can differ by 0.01. Learn more about [money](/docs/conventions#money). Like `totalValue`, it's the presented revision's. |\n| `lostReasonId`<br>nullable string | The ID of the reason the quote was lost. It's set only when the status is Lost, and it's `null` otherwise. Your lost-quote reasons are listed by [List all lost-quote reasons](#tag/sales-settings). |\n| `salesOrderNo`<br>nullable string | The number of the sales order in `salesOrderId`, or `null` if there isn't one. |\n| `revisions`<br>array of objects | A summary of every revision of the quote, oldest first. You can't create or change revisions through the API, because staff create them in Omono. |\n| `created`<br>timestamp | The time the quote was created. |\n| `updated`<br>timestamp | The time the quote was last changed. |\n\n</details>\n\n<details><summary>Child attributes of <code>revisions</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `revisions[].id`<br>string | Unique identifier for the revision. |\n| `revisions[].revisionNo`<br>integer | The revision's place in the sequence. The original version is `0`, the first revision is `1`, and so on. |\n| `revisions[].label`<br>string | The revision's name, as Omono shows it and prints it on the quote: \"Original\" for the first version, then \"A\", \"B\", \"C\" and so on. |\n| `revisions[].isLatest`<br>boolean | Whether this is the latest revision. The latest revision is the one that changes when you update the quote. |\n| `revisions[].isWon`<br>boolean | Whether the quote's sales order (`salesOrderId`) was created from this revision. It isn't always the latest revision, because staff can win a quote from an earlier one. If that sales order is deleted, no revision is marked as won, although the quote stays Won. |\n| `revisions[].totalValue`<br>number | The total value of this revision, before tax, in the quote's currency. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains. |\n| `revisions[].created`<br>timestamp | The time the revision was created. |\n\n</details>\n\n<details><summary>Child attributes of <code>lineItems</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `lineItems[].id`<br>string | Unique identifier for the line item. |\n| `lineItems[].externalRef`<br>nullable string | Your own reference for the line item, such as the line's ID in your system, or `null` if it has none. Only the API sets it. It's unique among the line items of its quote revision. Learn more about [external references](/docs/writing#external-references). |\n| `lineItems[].stockItemId`<br>string | The ID of the [stock item](#tag/stock-items) on this line item. It can't change after the line item is created. |\n| `lineItems[].description`<br>nullable string | The line item's description, as plain text, or `null` if there isn't one. |\n| `lineItems[].quantity`<br>number | The quantity quoted, with up to 4 decimal places. It can be zero, but it can't be negative. |\n| `lineItems[].unitPrice`<br>number | The net price of one unit, after the discount. It's normally `price` reduced by the `discount` percentage, rounded to your organisation's Unit Pricing precision. The line item's total is `quantity` multiplied by `unitPrice`, rounded to 2 decimal places, and the quote's totals are worked out from `unitPrice`. A price saved earlier can have more decimal places than your Unit Pricing setting, so don't assume a fixed number. Learn more about [money](/docs/conventions#money). |\n| `lineItems[].price`<br>number | The list price of one unit, before any discount. Omono rounds a price you send to your organisation's Unit Pricing precision, 2 or 4 decimal places, but a price saved earlier can have more, so don't assume a fixed number of decimal places. Learn more about [money](/docs/conventions#money). |\n| `lineItems[].discount`<br>number | The discount on this line item, as a percentage. It's `0` when there's no discount. A discount you send must be between 0 and 100, but Omono returns the value as it's stored, so a discount saved another way can be outside that range. |\n| `lineItems[].taxRateId`<br>nullable string | The ID of the line item's tax rate. Your tax rates are listed by [List all tax rates](#tag/tax-and-currency). It's `null` only on some old line items that were saved without a rate. To change such a line item, send a `taxRateId` with your change, because a line item can't be saved without a tax rate and `null` is refused. |\n| `lineItems[].salesAnalysisId`<br>string | The ID of the line item's sales analysis code, which groups your sales for reporting. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings). |\n| `lineItems[].tagNumber`<br>nullable string | An optional label for the line item, such as the customer's part reference or a machine number, or `null` if there isn't one. |\n| `lineItems[].lastCost`<br>nullable number | The cost of one unit, in the quote's currency, as the line item saved it, or `null` if none is saved. It's the **Last Cost** in the line item window in Omono. When the line item is added, Omono fills it in from the latest purchase order for the stock item that's on order, a call-off or complete (the highest `price` on it if it has several line items for the stock item), or from the stock item's `cost` if that changed after that order or there's no such order, converted into the quote's currency and rounded to your organisation's purchasing decimal places. For an assembly, it's the cost of each component multiplied by its quantity, added up. Staff can change it on the line item, and it doesn't follow later changes to the stock item's cost. When the API adds a line item and Omono finds no cost, because the stock item has no such purchase order and no `cost`, the line item saves a `lastCost` of 0, not `null`. A `lastCost` of 0 means no cost is known for the line item, and its `margin` is then `null`. Only a key that also has the `stock:read` scope gets it, and `stock:write` includes `stock:read`. For any other key the field is left out, not `null`. |\n| `lineItems[].margin`<br>nullable number | The line item's margin, as a percentage of its net price for one unit, as the line item saved it. It's the **Margin** in the line item window in Omono: (net price − `lastCost`) ÷ net price × 100, where the net price is `price` reduced by the `discount` percentage, with up to 2 decimal places. For example, a net price of 80 and a cost of 60 give `25`. It's `0` when the price is 0 or the `discount` is 100%, because the net price is then 0, and below 0 when the cost is more than a net price above 0. It's `null` when the line item has no cost, that is when `lastCost` is 0 or `null`, because a margin worked out against no cost means nothing. It's also `null` if none is saved. Omono saves it with the line item, and it stays as saved until the line item changes. Only a key that also has the `stock:read` scope gets it, and `stock:write` includes `stock:read`. For any other key the field is left out, not `null`. |\n| `lineItems[].leadTime`<br>nullable string | The lead time quoted for this line item, as free text, or `null` if there isn't one. When the quote is won, it's copied to the sales order line item as `quotedLeadTime`. |\n| `lineItems[].commodityCodeId`<br>nullable string | The ID of the line item's commodity code for customs paperwork, or `null` if there isn't one. Your commodity codes are listed by [List all commodity codes](#tag/purchasing-and-shipping). |\n| `lineItems[].countryOfOriginId`<br>nullable string | The ID of the country the goods were made in, for customs paperwork, or `null` if it isn't set. Countries are listed by [List all countries](#tag/tax-and-currency). |\n| `lineItems[].bomItems`<br>array of objects | The components of the line item's stock item, if it's an assembly, which is a stock item built from other stock items. This list is the assembly's bill of materials (BOM), and it's empty for any other stock item. Omono copies the BOM from the stock item when the line item is added, and staff can change it for this quote in Omono. You can't change it through the API. |\n| `lineItems[].bomItems[].id`<br>string | Unique identifier for the BOM item. |\n| `lineItems[].bomItems[].stockItemId`<br>string | The ID of the component's stock item. |\n| `lineItems[].bomItems[].quantity`<br>number | How many of this component go into one unit of the assembly, with up to 4 decimal places. |\n| `lineItems[].created`<br>timestamp | The time the line item was created. |\n| `lineItems[].updated`<br>timestamp | The time the line item was last changed. |\n\n</details>\n"
    },
    {
      "name": "Sales orders",
      "description": "[Copy for LLM](/docs/reference/sales-orders.md?copy) · [View as Markdown](/docs/reference/sales-orders.md)\n\nA sales order records what a customer has ordered from you. Orders you create through the API start as Drafts. An order ships in one or more dispatches, the shipments that send its goods to the customer, which you can create through the API or your staff create in Omono. Before you activate an order that isn't a call-off, its dispatches must cover all of its line items. Activating an order puts it on order, and its dispatches then move through your workflow: you can move them through the API, and your staff pick their goods in Omono. You can't cancel a sales order through the API.\n\nReading sales orders requires the `sales:read` or `sales:write` scope, and changing them requires `sales:write`.\n\n### The sales order object\n\n| Attribute | Description |\n| --- | --- |\n| `id`<br>string | Unique identifier for the sales order. |\n| `orderNo`<br>string | The order number, without the \"SO-\" prefix that Omono shows. Omono gives the order its number when it's created. |\n| `companyId`<br>string | The ID of the customer the order is for. You set it when you create the order, and it can't change after that. |\n| `status`<br>enum | The order's status, which is one of `draft`, `on_order`, `complete`, `cancelled`, `on_hold` or `on_order_call_off`. A new order is a Draft until you activate it. After that, it's On Order, or On Order - Call Off if it's a call-off order. An order is On Hold while any of its dispatches is on hold, and Complete once everything on it has shipped. You can't set the status directly. It changes when you activate the order, when its dispatches move through the workflow, and when you set or clear `callOff`. Learn more about [statuses](/docs/conventions#statuses). |\n| `currencyId`<br>string | The ID of the order's currency, which is always the customer's currency. You can't set it, because Omono copies it from the company. Currencies are listed by [List all currencies](#tag/tax-and-currency). |\n| `customerOrderNo`<br>nullable string | The customer's own reference for the order, such as their purchase order number, or `null` if there isn't one. Your organisation can make it required, which `salesOrders.customerOrderNoRequired` in [your settings](#tag/organisation/GET/settings) shows. If it does, a request that leaves it empty fails with a `422` error and the code `missing-required-field`. |\n| `totalValue`<br>number | The total value of the order, before tax, in the order's currency. You can't set it, because Omono works it out from the line items: each line item's quantity multiplied by its `unitPrice`, rounded to 2 decimal places, and then added up. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains. |\n| `lineItems`<br>array of objects | The order's line items, in order. When you retrieve a single order, they're always included. In a list of orders, they're included only if you ask for them with `include=lineItems`. |\n| `dispatches`<br>array of objects | The order's dispatches, sorted by `dispatchNo`. Each one lists the statuses it can move to in `legalTransitions`. They're included only if you ask for them with `include=dispatches`, but they're always included when you move a dispatch or mark a proforma dispatch as paid. |\n\n<details><summary>More attributes</summary>\n\n| Attribute | Description |\n| --- | --- |\n| `externalRef`<br>nullable string | Your own reference for the sales order, such as its ID in your web shop, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's sales orders, archived ones included, and cancelled ones, so you can find the sales order again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references). |\n| `contactId`<br>string | The ID of the customer's contact for this order. It's always a contact of the order's company. |\n| `addressId`<br>string | The ID of the address the goods go to. It's always one of the company's addresses. On a customer collection order, it's the company's accounts address. |\n| `salesPersonId`<br>string | The ID of the user who is the sales person for this order. Your users are listed by [List all users](#tag/organisation). |\n| `customerCollection`<br>boolean | Whether the customer collects the goods themselves instead of having them delivered. When it's `true`, the order's paperwork prints \"Customer Collection\" instead of a delivery address. It's `false` on older orders. |\n| `callOff`<br>boolean | Whether this is a call-off order: a standing order that the customer takes in several deliveries over a period. Setting it on an order that's On Order (`on_order`) changes the status to On Order - Call Off (`on_order_call_off`), and clearing it changes the status back to On Order. |\n| `exchangeRate`<br>nullable number | The exchange rate for the order: the number of units of the order's currency that equal 1 unit of your base currency. If you send back the value you read in an update, the rate doesn't change. It's `null` only on some old orders that were saved without a rate. Learn more about [money](/docs/conventions#money). |\n| `eoriNumberId`<br>nullable string | The ID of your organisation's EORI number that prints on the order, or `null` if there isn't one. An EORI number identifies your business to customs. Your EORI numbers are listed by [List all EORI numbers](#tag/purchasing-and-shipping). |\n| `incotermId`<br>nullable string | The ID of the order's incoterm, or `null` if there isn't one. An incoterm is a standard trade term that says who pays for shipping the goods and who carries the risk on the way. Your incoterms are listed by [List all incoterms](#tag/purchasing-and-shipping). |\n| `incotermNamedPlace`<br>nullable string | The place named with the incoterm, for example `Bristol, UK`, or `null` if there isn't one. |\n| `commissionId`<br>nullable string | The ID of the commission for the order, which the Sales Commission report uses, or `null` if there isn't one. Your commissions are listed by [List all commissions](#tag/sales-settings). |\n| `divisionId`<br>nullable string | The ID of the division of your organisation that the order belongs to, or `null` if there isn't one. Your divisions are listed by [List all divisions](#tag/organisation). |\n| `totalValueBase`<br>nullable number | `totalValue` in your organisation's base currency, as Omono saved it, or `null` if the order has none saved, as on some old records. Omono saves it each time it works out the total in the order's currency, converted at the order's exchange rate and rounded to 2 decimal places, so working it out yourself from the total and the `exchangeRate` can differ by 0.01. Learn more about [money](/docs/conventions#money). |\n| `quoteId`<br>nullable string | The ID of the quote this order was won from, or `null` if the order didn't come from a quote. |\n| `quoteRevisionId`<br>nullable string | The ID of the quote revision that was won to create this order, or `null` if the order didn't come from a quote. It matches one of the IDs in the quote's `revisions`. |\n| `quoteNo`<br>nullable string | The number of the quote this order was won from, without the \"SQ-\" prefix, or `null` if the order didn't come from a quote. |\n| `wentActiveAt`<br>nullable timestamp | The time the order was activated and stopped being a Draft, whether that happened in Omono or through the API. It's `null` if the order has never been active. |\n| `linkedPurchaseOrders`<br>array of objects | The purchase orders that staff raised from this order in Omono to buy the goods it needs. The list is empty if there aren't any. |\n| `invoices`<br>array of objects | The invoices raised on this order, one for each dispatch that has been invoiced. The list is empty until the first dispatch ships. |\n| `created`<br>timestamp | The time the order was created. |\n| `updated`<br>timestamp | The time the order was last changed. A change to any of its dispatches also changes this time. |\n\n</details>\n\n<details><summary>Child attributes of <code>linkedPurchaseOrders</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `linkedPurchaseOrders[].purchaseOrderId`<br>string | The ID of the purchase order. |\n| `linkedPurchaseOrders[].purchaseOrderNo`<br>string | The purchase order's number, without the \"PO-\" prefix that Omono shows. |\n\n</details>\n\n<details><summary>Child attributes of <code>invoices</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `invoices[].dispatchId`<br>string | The ID of the dispatch the invoice is for. |\n| `invoices[].invoiceNo`<br>string | The invoice number, without the \"INV-\" prefix that Omono shows. Invoice numbers come from a single sequence shared by your whole organisation. |\n| `invoices[].invoiceDate`<br>date | The date of the invoice, as `YYYY-MM-DD`. Learn more about [dates](/docs/conventions#dates). |\n\n</details>\n\n<details><summary>Child attributes of <code>lineItems</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `lineItems[].id`<br>string | Unique identifier for the line item. |\n| `lineItems[].externalRef`<br>nullable string | Your own reference for the line item, such as the line's ID in your system, or `null` if it has none. Only the API sets it. It's unique among the line items of the sales order. Learn more about [external references](/docs/writing#external-references). |\n| `lineItems[].stockItemId`<br>string | The ID of the stock item being sold. It can't change after the line item is created. |\n| `lineItems[].description`<br>nullable string | The line item's description, as plain text. Any formatting added in Omono isn't included. |\n| `lineItems[].quantity`<br>number | The quantity ordered. It's zero or more, with up to 4 decimal places. |\n| `lineItems[].unitPrice`<br>number | The net price of one unit, after the discount. It's `price` reduced by the `discount` percentage, rounded to your organisation's Unit Pricing precision. The line item's total is `quantity` multiplied by `unitPrice`, rounded to 2 decimal places, and the order's totals are worked out from `unitPrice` alone. A price saved earlier can have more decimal places than your Unit Pricing setting, so don't assume a fixed number. Learn more about [money](/docs/conventions#money). |\n| `lineItems[].price`<br>number | The list price of one unit, before any discount. Omono rounds a price you send to your organisation's Unit Pricing precision, 2 or 4 decimal places, but a price saved earlier can have more, so don't assume a fixed number of decimal places. Learn more about [money](/docs/conventions#money). |\n| `lineItems[].discount`<br>number | The discount on the line item, as a percentage. It's `0` when there's no discount. A discount you send must be between 0 and 100, but Omono returns the value as it's stored, so a discount saved another way can be outside that range. |\n| `lineItems[].taxRateId`<br>nullable string | The ID of the line item's tax rate. Your tax rates are listed by [List all tax rates](#tag/tax-and-currency). It's `null` only on some old line items that were saved without a rate. When you change one of those line items, send a `taxRateId` with your change, because a line item can't be saved without a tax rate. If you leave it out, the request fails with a `422` error and the code `missing-required-field`, and sending `null` fails with a `422` error too. |\n| `lineItems[].salesAnalysisId`<br>string | The ID of the line item's sales analysis code, which groups your sales for reporting. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings). |\n| `lineItems[].tagNumber`<br>nullable string | An optional label for the line item, such as the customer's part reference or a machine number, or `null` if there isn't one. It prints as \"Tag |\n| `lineItems[].lastCost`<br>nullable number | The cost of one unit, in the order's currency, as the line item saved it, or `null` if none is saved. It's the **Last Cost** in the line item window in Omono. When the line item is added, Omono fills it in from the latest purchase order for the stock item that's on order, a call-off or complete (the highest `price` on it if it has several line items for the stock item), or from the stock item's `cost` if that changed after that order or there's no such order, converted into the order's currency and rounded to your organisation's purchasing decimal places. For an assembly, it's the cost of each component multiplied by its quantity, added up. Staff can change it on the line item, and it doesn't follow later changes to the stock item's cost. When the API adds a line item and Omono finds no cost, because the stock item has no such purchase order and no `cost`, the line item saves a `lastCost` of 0, not `null`. A `lastCost` of 0 means no cost is known for the line item, and its `margin` is then `null`. Only a key that also has the `stock:read` scope gets it, and `stock:write` includes `stock:read`. For any other key the field is left out, not `null`. |\n| `lineItems[].margin`<br>nullable number | The line item's margin, as a percentage of its net price for one unit, as the line item saved it. It's the **Margin** in the line item window in Omono: (net price − `lastCost`) ÷ net price × 100, where the net price is `price` reduced by the `discount` percentage, with up to 2 decimal places. For example, a net price of 80 and a cost of 60 give `25`. It's `0` when the price is 0 or the `discount` is 100%, because the net price is then 0, and below 0 when the cost is more than a net price above 0. It's `null` when the line item has no cost, that is when `lastCost` is 0 or `null`, because a margin worked out against no cost means nothing. It's also `null` if none is saved. Omono saves it with the line item, and it stays as saved until the line item changes. Only a key that also has the `stock:read` scope gets it, and `stock:write` includes `stock:read`. For any other key the field is left out, not `null`. |\n| `lineItems[].quotedLeadTime`<br>nullable string | The lead time that was quoted for this line item, copied from the quote line item's `leadTime` when the quote was won. It's `null` if the order didn't come from a quote or no lead time was quoted. |\n| `lineItems[].commodityCodeId`<br>nullable string | The ID of the line item's commodity code for customs paperwork, or `null` if there isn't one. Your commodity codes are listed by [List all commodity codes](#tag/purchasing-and-shipping). |\n| `lineItems[].countryOfOriginId`<br>nullable string | The ID of the country the goods were made in, for customs paperwork, or `null` if it isn't set. Countries are listed by [List all countries](#tag/tax-and-currency). |\n| `lineItems[].bomItems`<br>array of objects | The components of the line item's stock item, if it's an assembly, which is a stock item built from other stock items. This list is the assembly's bill of materials (BOM), and it's empty for any other stock item. |\n| `lineItems[].bomItems[].id`<br>string | Unique identifier for the BOM item. |\n| `lineItems[].bomItems[].stockItemId`<br>string | The ID of the component's stock item. |\n| `lineItems[].bomItems[].quantity`<br>number | How many of this component go into one unit of the assembly, with up to 4 decimal places. |\n| `lineItems[].linkedPurchaseOrderId`<br>nullable string | The ID of the purchase order that staff raised in Omono for this line item, or `null` if there isn't one. For example, the supplier may ship the goods straight to your customer, which is called a drop shipment, or you may buy them in for this order alone, which is called back-to-back buying. |\n| `lineItems[].linkedPurchaseOrderNo`<br>nullable string | The number of the linked purchase order, without the \"PO-\" prefix that Omono shows, or `null` if there isn't one. |\n| `lineItems[].created`<br>timestamp | The time the line item was created. |\n| `lineItems[].updated`<br>timestamp | The time the line item was last changed. |\n\n</details>\n"
    },
    {
      "name": "Dispatches",
      "description": "[Copy for LLM](/docs/reference/dispatches.md?copy) · [View as Markdown](/docs/reference/dispatches.md)\n\nA dispatch is a planned shipment from a sales order, with its own date, its own share of the order's line items and, once it has shipped, its own invoice. Each dispatch moves through your organisation's workflow statuses, which are the steps your team uses to prepare a shipment. Moving a dispatch to the final status, which is the status whose type is `final`, ships it and raises its invoice. Through the API, you can create and change dispatches, delete a dispatch before its stock is allocated, read dispatches and their invoices, move them to another status, and mark a proforma dispatch as paid. Staff pick the goods in Omono. A proforma dispatch belongs to a customer who must pay before the goods ship.\n\nReading dispatches requires the `sales:read` or `sales:write` scope, and creating, changing, deleting or moving them requires `sales:write`. Learn more in [Dispatches and invoicing](/docs/workflow).\n\n### The dispatch object\n\n| Attribute | Description |\n| --- | --- |\n| `id`<br>string | Unique identifier for the dispatch. |\n| `dispatchNo`<br>integer | The dispatch's number within its sales order. Omono shows it after the order number, for example SO-1042-2 for the second dispatch on order 1042. |\n| `statusId`<br>string | The ID of the dispatch's current workflow status. Your workflow statuses are listed by [List all workflow statuses](#tag/sales-settings). |\n| `dispatchDate`<br>date | The date the dispatch is due to ship, as `YYYY-MM-DD`. When the dispatch ships, Omono changes it to the invoice date. Learn more about [dates](/docs/conventions#dates). |\n| `invoiceNo`<br>nullable string | The number of the dispatch's invoice, without the \"INV-\" prefix that Omono shows, or `null` if the dispatch hasn't been invoiced yet. Omono takes the next number from your organisation's invoice number sequence when the dispatch ships. |\n| `invoiceDate`<br>nullable date | The date of the dispatch's invoice, as `YYYY-MM-DD`, or `null` if the dispatch hasn't been invoiced yet. Learn more about [dates](/docs/conventions#dates). |\n| `totalWithTax`<br>number | The total value of the dispatch including tax, in the order's currency. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains. |\n| `legalTransitions`<br>array of objects | The workflow statuses this dispatch can move to right now. Choose one of these when you move the dispatch. The list is empty when the dispatch has already shipped, or when the order is a Draft or Cancelled. A dispatch has shipped once it's at the final status, the one whose type is `final`. |\n\n<details><summary>More attributes</summary>\n\n| Attribute | Description |\n| --- | --- |\n| `salesOrderId`<br>string | The ID of the sales order the dispatch belongs to. |\n| `salesOrderNo`<br>nullable string | The number of the sales order, without the \"SO-\" prefix that Omono shows. |\n| `customerOrderNo`<br>nullable string | The reference your customer gave for the order, or `null` if there isn't one. |\n| `companyId`<br>string | The ID of the customer, the sales order's company. |\n| `statusType`<br>nullable enum | The type of the dispatch's workflow status, or `null` if Omono can't find the status. Omono reserves stock for a whole dispatch, not for each line item: when the dispatch moves to a status of type `allocated`, Omono adds the full quantity of each of its line items to the stock item's `allocated`, even when there isn't enough in stock. A status of type `final` means the dispatch has shipped and been invoiced. Possible values: `unallocated`, `allocated`, `on_hold`, `final`. |\n| `courierId`<br>nullable string | The ID of the courier carrying the dispatch, or `null` if there isn't one. Staff set it in Omono, or you can send it when you ship the dispatch. Your couriers are listed by [List all couriers](#tag/purchasing-and-shipping). |\n| `trackingNo`<br>nullable string | The courier's tracking number for the dispatch, or `null` if there isn't one. The invoice email and the invoice PDF print it. Staff set it in Omono. Through the API, you can send it when you ship the dispatch with `POST /sales-orders/{id}/transitions`, and change it later with `PATCH /sales-orders/{id}/dispatches/{dispatchId}`. On both, Omono removes any spaces at the start and end of the value you send, and an empty value, or one of only spaces, clears the tracking number. A value can be up to 200 characters. |\n| `deliveryNotes`<br>nullable string | The dispatch's delivery notes, as plain text, or `null` if it has none. The delivery note prints them, so they're the place for instructions to the carrier or the customer, such as \"Deliver to the rear entrance\". Staff can add them in Omono, and you can send them when you create or change the dispatch. |\n| `invoiceDueDate`<br>nullable date | The date that payment of the invoice is due, as `YYYY-MM-DD`, or `null` if the dispatch hasn't been invoiced yet. Omono works it out from the customer's payment terms when the dispatch ships. |\n| `proformaPaid`<br>boolean | Whether a proforma customer has paid for this dispatch. A proforma customer pays before their goods ship, so their dispatch can ship only once this is `true`. It's `false` until someone marks the dispatch as paid. Staff set it in Omono, or you can mark the dispatch as paid through the API before it ships. |\n| `totalValue`<br>number | The total value of the dispatch, before tax, in the order's currency. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains. |\n| `totalTax`<br>number | The total tax on the dispatch, in the order's currency. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains. |\n| `totalValueBase`<br>nullable number | `totalValue` in your organisation's base currency, as Omono saved it, or `null` if the dispatch has none saved, as on some old records. Omono saves it each time it works out the total in the order's currency, converted at the order's exchange rate and rounded to 2 decimal places, so working it out yourself from the total and the `exchangeRate` can differ by 0.01. Learn more about [money](/docs/conventions#money). |\n| `totalTaxBase`<br>nullable number | `totalTax` in your organisation's base currency, as Omono saved it, or `null` if the dispatch has none saved. Omono converts it the same way as `totalValueBase`. Learn more about [money](/docs/conventions#money). |\n| `lineItems`<br>array of objects | The goods on the dispatch. Each entry says which of the order's line items it ships, and how many. |\n| `created`<br>timestamp | The time the dispatch was created. |\n| `updated`<br>timestamp | The time the dispatch was last changed. |\n\n</details>\n\n<details><summary>Child attributes of <code>lineItems</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `lineItems[].id`<br>string | Unique identifier for the dispatch line item. |\n| `lineItems[].salesOrderLineItemId`<br>string | The ID of the sales order line item that this dispatch line item ships. |\n| `lineItems[].stockItemId`<br>string | The ID of the stock item being shipped. |\n| `lineItems[].quantity`<br>number | The quantity this dispatch ships, with up to 4 decimal places. |\n| `lineItems[].pickedQuantity`<br>number | How much of `quantity` staff have picked and saved in Omono. A dispatch of stock items can ship once each of their lines is picked in full. It stays 0 on a line for an assembly, whose components are picked instead, and on a line for a never-diminishing item, which isn't picked. Whether the dispatch's stock is reserved is in the dispatch's `statusType`. |\n| `lineItems[].serialNumber`<br>nullable string | The serial numbers recorded for the goods on this line item, or `null` if there aren't any. A line item has one serial number field for all its units, so several numbers are stored together, usually separated by commas. |\n\n</details>\n\n<details><summary>Child attributes of <code>legalTransitions</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `legalTransitions[].statusId`<br>string | The ID of the workflow status. Send it as `statusId` when you move the dispatch. |\n| `legalTransitions[].name`<br>string | The status's name, as your organisation has set it up in Omono. |\n| `legalTransitions[].type`<br>enum | The type of a workflow status. Your organisation names its statuses as it likes, but each status has one of these types, so build your integration on the `type` rather than on the status `name`. The status whose type is `final` is called the final status, and moving a dispatch to it ships the dispatch and raises its invoice. Possible values: `unallocated`, `allocated`, `on_hold`, `final`. |\n| `legalTransitions[].blockedBy`<br>array of strings | The reasons a move to this status would be refused right now, in the order Omono checks them. The list is empty when nothing is in the way. Today, only the final status, which ships the dispatch, can be blocked. `dispatch-pick-not-saved` means the dispatch's picking is in progress in Omono, or it wasn't saved, so staff open the picking and press Save. `dispatch-not-fully-picked` means the goods aren't all picked in Omono yet. `blocking-tasks` means an open task linked to the order blocks shipping. `company-on-stop` means the customer is on stop, a hold that staff put on a customer's account in Omono. `proforma-not-paid` means a proforma customer hasn't paid yet. Omono can add new codes, so check whether the list is empty rather than looking for particular codes. A change to a task or to the customer doesn't change the order's `updated` time, so read this list again just before you ship. Learn more about [when a dispatch can't ship](/docs/workflow#when-a-dispatch-cannot-ship). |\n\n</details>\n"
    },
    {
      "name": "Credit notes",
      "description": "[Copy for LLM](/docs/reference/credit-notes.md?copy) · [View as Markdown](/docs/reference/credit-notes.md)\n\nA credit note reduces the amount a customer owes you. Credit notes you create through the API start as Drafts. Completing a credit note makes it final, and after that it can't change.\n\nReading credit notes requires the `sales:read` or `sales:write` scope, and changing them requires `sales:write`.\n\n### The credit note object\n\n| Attribute | Description |\n| --- | --- |\n| `id`<br>string | Unique identifier for the credit note. |\n| `creditNoteNo`<br>string | The credit note number, as a string and without the \"CN-\" prefix. |\n| `companyId`<br>string | The ID of the customer the credit note is for. You set it when you create the credit note, and it can't change after that. |\n| `status`<br>enum | The credit note's status, which is `draft` or `complete`. A new credit note is a Draft, which you can still change. Once it's completed, it's Complete, and it can't change or go back to Draft. You can't set this field directly: to complete a Draft credit note, use `POST /credit-notes/{id}/complete`. |\n| `currencyId`<br>string | The ID of the credit note's currency, which is always the customer's currency. You can't set it, because Omono copies it from the company. Currencies are listed by [List all currencies](#tag/tax-and-currency). |\n| `totalValue`<br>number | The total value of the credit note, before tax, in its currency. You can't set it, because Omono works it out from the line items. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains. |\n| `totalTax`<br>number | The total tax on the credit note, in its currency. You can't set it, because Omono works it out from the line items and their tax rates. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains. |\n| `lineItems`<br>array of objects | The credit note's line items, in order. A single credit note always includes them, but a list includes them only when you ask with `include=lineItems`. |\n\n<details><summary>More attributes</summary>\n\n| Attribute | Description |\n| --- | --- |\n| `externalRef`<br>nullable string | Your own reference for the credit note, such as its ID in your returns system, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's credit notes, archived ones included, and cancelled ones, so you can find the credit note again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references). |\n| `contactId`<br>string | The ID of the contact at the customer who the credit note is for. |\n| `raisedById`<br>string | The ID of the user who raised the credit note. Your users are listed by [List all users](#tag/organisation). |\n| `refNo`<br>nullable string | Your reference for the credit note, or `null` if there isn't one. It prints as \"Reference |\n| `exchangeRate`<br>nullable number | The exchange rate for the credit note: the number of units of its currency that equal 1 unit of your base currency. If you send back the value you read in an update, the rate doesn't change. It's `null` only on some old credit notes that were saved without a rate. Learn more about [money](/docs/conventions#money). |\n| `divisionId`<br>nullable string | The ID of the division the credit note belongs to, or `null` if it has none. Your divisions are listed by [List all divisions](#tag/organisation). |\n| `totalWithTax`<br>number | The total value of the credit note including tax, in its currency: `totalValue` plus `totalTax`. You can't set it. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains. |\n| `totalValueBase`<br>nullable number | `totalValue` in your organisation's base currency, as Omono saved it, or `null` if the credit note has none saved, as on some old records. Omono saves it each time it works out the total in the credit note's currency, converted at the credit note's exchange rate and rounded to 2 decimal places, so working it out yourself from the total and the `exchangeRate` can differ by 0.01. Learn more about [money](/docs/conventions#money). |\n| `totalTaxBase`<br>nullable number | `totalTax` in your organisation's base currency, as Omono saved it, or `null` if the credit note has none saved. Omono converts it the same way as `totalValueBase`. Learn more about [money](/docs/conventions#money). |\n| `xero`<br>nullable object | The state of the credit note's sync to Xero, or `null` if your organisation isn't connected to Xero. Omono counts your organisation as connected while Xero is connected on the **Connect** page of **Settings** in Omono, which is also what `GET /settings` reports in `xero.connected`. Disconnecting Xero makes this `null` on every record, although the record keeps its sync state for when you connect again. A sync changes the record's `updated`. |\n| `wentCompleteAt`<br>nullable timestamp | The time the credit note became Complete, or `null` while it's a Draft. |\n| `created`<br>timestamp | The time the credit note was created. Its PDF prints this as the credit note's date. |\n| `updated`<br>timestamp | The time the credit note was last changed. |\n\n</details>\n\n<details><summary>Child attributes of <code>xero</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `xero.status`<br>nullable enum | Where the document stands in the sync. It's `never` if Omono hasn't sent it yet. It's `null` only if Omono stores a status that this version of the API doesn't know. Possible values: `never`, `ok`, `warning`, `error`, `pending`, `skipped`. |\n| `xero.id`<br>nullable string | Xero's ID for the document: its `InvoiceID` for an invoice or a supplier bill, and its `CreditNoteID` for a credit note. It's `null` until the document is first synced. |\n| `xero.lastSyncedAt`<br>nullable timestamp | The time of the last sync, whether it worked or not, or `null` if there hasn't been one. |\n\n</details>\n\n<details><summary>Child attributes of <code>lineItems</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `lineItems[].id`<br>string | Unique identifier for the line item. |\n| `lineItems[].externalRef`<br>nullable string | Your own reference for the line item, such as the line's ID in your system, or `null` if it has none. Only the API sets it. It's unique among the line items of the credit note. Learn more about [external references](/docs/writing#external-references). |\n| `lineItems[].stockItemId`<br>string | The ID of the [stock item](#tag/stock-items) this line item credits. It can't change after the line item is created. |\n| `lineItems[].description`<br>nullable string | The line item's description, as plain text, or `null` if there isn't one. |\n| `lineItems[].quantity`<br>number | The quantity credited, with up to 4 decimal places. |\n| `lineItems[].price`<br>number | The price of one unit. The line item's total is `quantity` multiplied by `price`, rounded to 2 decimal places. Omono rounds a price you send to your organisation's Unit Pricing precision, 2 or 4 decimal places, but a price saved earlier can have more, so don't assume a fixed number of decimal places. Learn more about [money](/docs/conventions#money). |\n| `lineItems[].salesAnalysisId`<br>string | The ID of the line item's sales analysis code, which groups your sales for reporting. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings). |\n| `lineItems[].taxRateId`<br>string | The ID of the line item's tax rate. It's always the ID of a tax rate from [List all tax rates](#tag/tax-and-currency), and line items for tax-exempt stock show your organisation's exempt tax rate. |\n| `lineItems[].created`<br>timestamp | The time the line item was created. |\n| `lineItems[].updated`<br>timestamp | The time the line item was last changed. |\n\n</details>\n"
    },
    {
      "name": "Purchase orders",
      "description": "[Copy for LLM](/docs/reference/purchase-orders.md?copy) · [View as Markdown](/docs/reference/purchase-orders.md)\n\nA purchase order records what you've ordered from a supplier. Orders you create through the API start as Drafts. Issuing an order puts it On Order, and you can also cancel it. A purchase order's deliveries record the goods you expect from the supplier, and staff receive them in Omono when the goods arrive. Learn more in [Deliveries](#tag/deliveries).\n\nReading purchase orders requires the `purchasing:read` or `purchasing:write` scope, and changing them requires `purchasing:write`.\n\n### The purchase order object\n\n| Attribute | Description |\n| --- | --- |\n| `id`<br>string | Unique identifier for the purchase order. |\n| `purchaseOrderNo`<br>string | The purchase order's number. Omono shows it with a \"PO-\" prefix, for example PO-311, but this field holds only the number, such as `\"311\"`. |\n| `companyId`<br>string | The ID of the supplier you're buying from. You set it when you create the order, and it can't change after that. |\n| `status`<br>enum | The order's status, which is one of `draft`, `on_order`, `complete`, `cancelled`, `on_hold` or `on_order_call_off`. A Draft order is still being prepared and doesn't affect stock. An order is On Order once it's issued to the supplier, or On Order - Call Off if it's an issued call-off order. It's On Hold while at least one delivery is on hold, and Complete once every line item has been fully delivered and every delivery received. You can't set the status directly. It changes when you issue or cancel the order, and Omono recalculates it as deliveries are received and line items change. |\n| `currencyId`<br>string | The ID of the order's currency, which is always the supplier's currency. You can't set it, because Omono copies it from the company, and it can't change. Currencies are listed by [List all currencies](#tag/tax-and-currency). |\n| `buyerId`<br>string | The ID of the user in your organisation who is buying the goods. Your users are listed by [List all users](#tag/organisation). |\n| `totalValue`<br>number | The total value of the order, before tax, in the order's currency. You can't set it, because Omono works it out from the line items. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains. |\n| `lineItems`<br>array of objects | The order's line items, in order. A single purchase order always includes them, whether you retrieve, create, update, issue or cancel it. In a list, they're included only when you add `include=lineItems`. |\n| `deliveries`<br>array of objects | The order's deliveries, sorted by `deliveryNo`, then `id`. They're included only when you add `include=deliveries`, either to a list or when you retrieve a single order. |\n\n<details><summary>More attributes</summary>\n\n| Attribute | Description |\n| --- | --- |\n| `externalRef`<br>nullable string | Your own reference for the purchase order, such as its ID in your purchasing or planning system, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's purchase orders, archived ones included, and cancelled ones, so you can find the purchase order again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references). |\n| `contactId`<br>string | The ID of the person at the supplier who deals with this order. The contact always belongs to the supplier. |\n| `addressId`<br>string | The ID of the address the supplier delivers the goods to. It's one of your organisation's addresses, which [List all organisation addresses](#tag/organisation) returns. On a drop-ship order, it's one of the customer's addresses instead (see `dropShipCustomerCompanyId`). It's never the supplier's own address. |\n| `refNo`<br>nullable string | Your own reference for the order, for example a job number or the customer's order number. It prints on the purchase order, and Omono doesn't check that it's unique. |\n| `callOff`<br>boolean | Whether this is a call-off order: a blanket order that the supplier delivers in several parts over time. When you issue a call-off order, it moves to On Order - Call Off (`on_order_call_off`) instead of On Order (`on_order`). On an order in one of those two statuses, changing this field moves the order to the other one. |\n| `exchangeRate`<br>nullable number | The exchange rate for the order: the number of units of the order's currency that equal 1 unit of your base currency. If you send back the value you read in an update, the rate doesn't change. The rate is locked once any delivery on the order has been invoiced, and it's always 1 on an order in your base currency. It's `null` only on some old orders that were saved without a rate. Learn more about [money](/docs/conventions#money). |\n| `eoriNumberId`<br>nullable string | The ID of the EORI number shown on the order, or `null` if there isn't one. An EORI number identifies your business to customs. Your EORI numbers are listed by [List all EORI numbers](#tag/purchasing-and-shipping). |\n| `incotermId`<br>nullable string | The ID of the order's incoterm, or `null` if there isn't one. An incoterm is a standard trade term that says who pays for shipping the goods and who carries the risk on the way. Your incoterms are listed by [List all incoterms](#tag/purchasing-and-shipping). |\n| `incotermNamedPlace`<br>nullable string | The place named with the incoterm, for example `Düsseldorf, DE`, or `null` if there isn't one. |\n| `divisionId`<br>nullable string | The ID of the division of your organisation that the order belongs to, or `null` if there isn't one. Your divisions are listed by [List all divisions](#tag/organisation). |\n| `dropShipCustomerCompanyId`<br>nullable string | On a drop-ship order, the ID of the customer the supplier delivers to. A drop-ship order sends the goods straight from the supplier to your customer, so its `addressId` is one of the customer's addresses. This field is `null` on other orders. |\n| `totalValueBase`<br>nullable number | `totalValue` in your organisation's base currency, as Omono saved it, or `null` if the order has none saved, as on some old records. Omono saves it each time it works out the total in the order's currency, converted at the order's exchange rate and rounded to 2 decimal places, so working it out yourself from the total and the `exchangeRate` can differ by 0.01. Learn more about [money](/docs/conventions#money). |\n| `linkedSalesOrderId`<br>nullable string | If staff raised this order in Omono to buy the goods for a sales order, the ID of that sales order. Otherwise it's `null`. You can't set this field. |\n| `linkedSalesOrderNo`<br>nullable string | The number of the linked sales order, without its \"SO-\" prefix, or `null` if the order isn't linked to one. You can't set this field. |\n| `created`<br>timestamp | The time the purchase order was created. |\n| `updated`<br>timestamp | The time the purchase order was last changed. A change to one of its deliveries in Omono also updates this time. |\n\n</details>\n\n<details><summary>Child attributes of <code>lineItems</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `lineItems[].id`<br>string | Unique identifier for the line item. |\n| `lineItems[].externalRef`<br>nullable string | Your own reference for the line item, such as the line's ID in your system, or `null` if it has none. Only the API sets it. It's unique among the line items of the purchase order. Learn more about [external references](/docs/writing#external-references). |\n| `lineItems[].stockItemId`<br>string | The ID of the stock item you're buying. It must be an item you can buy, so it can't be an assembly. You set it when you add the line item, and it can't change after that. If the stock item is tax-exempt, the line item always uses your organisation's exempt tax rate. |\n| `lineItems[].description`<br>nullable string | The description of the goods on this line item, as plain text, or `null` if there isn't one. |\n| `lineItems[].quantity`<br>number | The quantity you're ordering, with up to 4 decimal places. |\n| `lineItems[].price`<br>number | The price of one unit, before tax, in the order's currency. The line item's total is `quantity` multiplied by `price`, rounded to 2 decimal places. Omono rounds a price you send to your organisation's Unit Pricing precision for purchasing, which is 2 or 4 decimal places, and the lock on invoiced line items compares prices at that precision. A price saved earlier can have more decimal places, so don't assume a fixed number. Learn more about [money](/docs/conventions#money). |\n| `lineItems[].discount`<br>number | You can't set this field. Purchase orders don't have discounts in Omono, and their totals ignore this field. |\n| `lineItems[].taxRateId`<br>nullable string | The ID of the line item's tax rate. Your tax rates are listed by [List all tax rates](#tag/tax-and-currency). It's `null` only on some old line items that were saved without a rate. When you change one of those, send a `taxRateId` with your change, because a line item can't be saved without a tax rate. If you leave it out, the request fails with a `422` error and the code `missing-required-field`, and sending `null` fails with a `422` error too. |\n| `lineItems[].purchaseAnalysisId`<br>string | The ID of the line item's purchase analysis code, which groups your purchases in reports. Your purchase analysis codes are listed by [List all purchase analysis codes](#tag/purchasing-and-shipping). |\n| `lineItems[].tagNumber`<br>nullable string | An optional label for the line item, up to 1,000 characters, or `null` if there isn't one. It prints under the description on the purchase order. |\n| `lineItems[].quantityOnDeliveries`<br>number | The quantity of this line item that's on deliveries, whatever their status, with up to 4 decimal places. It counts goods booked onto a delivery whether or not they've arrived, so it tells you how much is scheduled for delivery, not how much has been received. You can't set this field. |\n| `lineItems[].created`<br>timestamp | The time the line item was created. |\n| `lineItems[].updated`<br>timestamp | The time the line item was last changed. |\n\n</details>\n"
    },
    {
      "name": "Deliveries",
      "description": "[Copy for LLM](/docs/reference/deliveries.md?copy) · [View as Markdown](/docs/reference/deliveries.md)\n\nA delivery is a shipment you expect from a supplier against a purchase order, with its own date and its own share of the order's line items. Through the API, you can create, change and delete expected deliveries, and read them. Staff receive a delivery in Omono when the goods arrive, which adds them to stock. Once a delivery is received, it can't change through the API.\n\nA purchase order that isn't a call-off can be issued only when its deliveries cover all of its line items. Creating, changing or deleting a delivery never changes stock levels.\n\n[List all deliveries](#tag/deliveries/GET/deliveries) lists them across your purchase orders, with their supplier invoices.\n\nReading deliveries requires the `purchasing:read` or `purchasing:write` scope, and changing them requires `purchasing:write`.\n\n### The delivery object\n\n| Attribute | Description |\n| --- | --- |\n| `id`<br>string | Unique identifier for the delivery. |\n| `deliveryNo`<br>integer | The delivery's number within its purchase order, starting at 1. Omono shows it after the order's number, for example PO-311-1 for the first delivery on PO-311. |\n| `deliveryDate`<br>date | The date the goods are due to arrive, as `YYYY-MM-DD`. Learn more about [dates](/docs/conventions#dates). |\n| `status`<br>enum | The delivery's status. A delivery is `not_received` while the goods are expected but haven't arrived yet, `received` once the goods are in stock, and `on_hold` while it's paused. You can't change it through the API, because staff change it in Omono. |\n| `receivedDate`<br>nullable date | The date the goods were received, as `YYYY-MM-DD`, or `null` if the delivery hasn't been received. When staff mark the delivery as received, Omono sets it to that day in UTC, and staff can change it afterwards. It goes back to `null` if the delivery is moved back to `not_received` or put on hold. |\n| `invoiceNo`<br>nullable string | The number of the supplier's invoice for this delivery, or `null` if no invoice has been recorded. Staff record it once, in Omono, on a delivery that's been received. After that, the number, the delivery, its status and its line items can't change. |\n| `lineItems`<br>array of objects | The delivery's line items: which purchase order line items it brings, and how many of each. They follow the order of the purchase order's line items. |\n\n<details><summary>More attributes</summary>\n\n| Attribute | Description |\n| --- | --- |\n| `invoiceDate`<br>nullable date | The date of the supplier's invoice, as `YYYY-MM-DD`, as staff entered it when they recorded the invoice. It's `null` if no invoice has been recorded, or if staff marked the invoice as unavailable. |\n| `invoiceUnavailable`<br>boolean | Whether staff have recorded that the supplier won't send an invoice for this delivery, for example because the goods were a free replacement. |\n| `totalValue`<br>number | The value of the goods on this delivery, before tax, in the purchase order's currency. Omono works it out from the quantities on the delivery and the prices on the purchase order's line items. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains. |\n| `totalValueBase`<br>nullable number | `totalValue` in your organisation's base currency, as Omono saved it, or `null` if the delivery has none saved, as on some old records. Omono saves it each time it works out the total in the purchase order's currency, converted at the purchase order's exchange rate and rounded to 2 decimal places, so working it out yourself from the total and the `exchangeRate` can differ by 0.01. Learn more about [money](/docs/conventions#money). |\n| `xero`<br>nullable object | The state of the delivery's sync to Xero, where Omono sends it as a supplier bill, or `null` if your organisation isn't connected to Xero. Omono counts your organisation as connected while Xero is connected on the **Connect** page of **Settings** in Omono, which is also what `GET /settings` reports in `xero.connected`. Disconnecting Xero makes this `null` on every record, although the record keeps its sync state for when you connect again. A sync changes the record's `updated`. |\n| `created`<br>timestamp | The time the delivery was created. |\n| `updated`<br>timestamp | The time the delivery was last changed. |\n\n</details>\n\n<details><summary>Child attributes of <code>xero</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `xero.status`<br>nullable enum | Where the document stands in the sync. It's `never` if Omono hasn't sent it yet. It's `null` only if Omono stores a status that this version of the API doesn't know. Possible values: `never`, `ok`, `warning`, `error`, `pending`, `skipped`. |\n| `xero.id`<br>nullable string | Xero's ID for the document: its `InvoiceID` for an invoice or a supplier bill, and its `CreditNoteID` for a credit note. It's `null` until the document is first synced. |\n| `xero.lastSyncedAt`<br>nullable timestamp | The time of the last sync, whether it worked or not, or `null` if there hasn't been one. |\n\n</details>\n\n<details><summary>Child attributes of <code>lineItems</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `lineItems[].id`<br>string | Unique identifier for the delivery line item. |\n| `lineItems[].purchaseOrderLineItemId`<br>string | The ID of the purchase order line item that this delivery line item delivers. |\n| `lineItems[].stockItemId`<br>string | The ID of the stock item being delivered. |\n| `lineItems[].quantity`<br>number | The quantity on this delivery, with up to 4 decimal places. |\n| `lineItems[].serialNumber`<br>nullable string | The serial number that staff recorded for the goods on this line item, or `null` if there isn't one. |\n\n</details>\n"
    },
    {
      "name": "Stock items",
      "description": "[Copy for LLM](/docs/reference/stock-items.md?copy) · [View as Markdown](/docs/reference/stock-items.md)\n\nA stock item is anything you buy or sell, and every line item on a quote, sales order, purchase order or credit note refers to one. Stock levels, such as `inStock` and `allocated`, are read-only, because they change only through work done in Omono. You can create and change all three kinds of stock item through the API: normal items, assemblies with their bill of materials (BOM), and never-diminishing items. An assembly is built from other stock items, and a never-diminishing item, such as a service or carriage, has no stock level. An item's kind can't change once it's created.\n\nReading stock items requires the `stock:read` or `stock:write` scope, and changing them requires `stock:write`. A stock item's suppliers are purchasing data as well: reading them also needs `purchasing:read`, and changing them also needs `purchasing:write`.\n\n### The stock item object\n\n| Attribute | Description |\n| --- | --- |\n| `id`<br>string | Unique identifier for the stock item. |\n| `partNo`<br>string | Your part number for the item. It's unique in your organisation, including archived items. The check ignores capital letters but not accents, and a part number that's already taken fails with a `409` error and the code `duplicate-part-number`. |\n| `title`<br>string | The item's short name, as it appears on documents. |\n| `kind`<br>enum | The kind of stock item, as in Omono: `normal`, `assembly` (built from the stock items in its bill of materials, `bom`) or `never_diminishing` (bought and sold but not counted, such as a service or carriage, with no stock level). An item keeps its kind for life. |\n| `canBuy`<br>boolean | Whether you can buy the item on a purchase order. You can't set this field. An assembly is built, not bought, so its `canBuy` is always `false`. Every other item you create through the API has `canBuy: true`. |\n| `canSell`<br>boolean | Whether you can sell the item on quotes, sales orders and credit notes. When it's `true`, the item needs a `sellPrice` and a `salesAnalysisId`. When it's `false`, Omono clears the sales fields: `sellPrice` is 0, `marginWarningPercent` is `null`, and the item has no `salesAnalysisId` or `commodityCodeId`. |\n| `sellPrice`<br>number | Your standard selling price for one unit, in your base currency. It's 0 when the item can't be sold. |\n| `cost`<br>number | What one unit costs you, in your base currency. Omono rounds a cost you send to your organisation's Unit Pricing precision for purchasing, but a cost saved earlier can have more decimal places, so don't assume a fixed number. If you change the cost after the item's last purchase order, your cost replaces that order's price as the item's last cost, which Omono uses in stock valuation and for the cost of new line items. It stays that way until the next purchase order for the item is created. |\n| `inStock`<br>number | The quantity physically in stock, with up to 4 decimal places. You can't set this field: it changes as staff receive deliveries, pick dispatches and do stock takes in Omono. |\n| `allocated`<br>number | The quantity reserved for sales order dispatches that have been allocated but not yet picked, with up to 4 decimal places. To find how many are free for new orders, subtract `allocated` from `inStock`. You can't set this field. |\n\n<details><summary>More attributes</summary>\n\n| Attribute | Description |\n| --- | --- |\n| `externalRef`<br>nullable string | Your own reference for the stock item, such as its ID in your web shop or product information system, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's stock items, archived ones included, so you can find the stock item again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references). |\n| `archived`<br>boolean | Whether the item is archived. To archive or unarchive an item, send `archived` with its `kind` in [Update a stock item](#tag/stock-items/PATCH/stock-items/{id}). You can't change an archived item until you unarchive it. [Archive and unarchive a record](/docs/writing#archiving) explains how. |\n| `description`<br>nullable string | The item's full description, as plain text, or `null` if there isn't one. Omono uses it on quotes, sales orders, invoices and credit notes, and on purchase orders too unless the item has a separate purchasing description. |\n| `purchasingDescription`<br>nullable string | A separate description for purchase orders, as plain text, or `null` if there isn't one. New purchase order line items use it only while `dualDescriptionEnabled` is `true`, and use `description` otherwise. A purchase order line item raised in Omono from a sales order line item takes that line item's description instead. |\n| `dualDescriptionEnabled`<br>boolean | Whether the item has two descriptions: `description` for sales documents and `purchasingDescription` for purchase orders. While it's `false`, new purchase order line items, whether added in Omono or through the API, use `description` and ignore `purchasingDescription`. |\n| `location`<br>nullable string | Where the item is kept, for example a bin or shelf label, or `null` if it isn't set. |\n| `warehouseId`<br>nullable string | The ID of the warehouse the item is kept in, or `null` if it isn't set. Your warehouses are listed by [List all warehouses](#tag/organisation). |\n| `lastCostUpdatedAt`<br>nullable timestamp | The time `cost` was last changed by an update, or `null` if it has never changed. You can't set this field. |\n| `taxExempt`<br>boolean | Whether the item carries no tax. Line items for a tax-exempt item always use your organisation's exempt tax rate. |\n| `purchaseAnalysisId`<br>nullable string | The ID of the item's purchase analysis code, which groups your purchases in reports, or `null` if it isn't set. New purchase order line items take this code unless you send another. Your purchase analysis codes are listed by [List all purchase analysis codes](#tag/purchasing-and-shipping). |\n| `salesAnalysisId`<br>nullable string | The ID of the item's sales analysis code, which groups your sales in reports, or `null` if the item can't be sold. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings). |\n| `commodityCodeId`<br>nullable string | The ID of the item's commodity code, the customs tariff code for the goods, or `null` if it isn't set. Only items that can be sold have one. Your commodity codes are listed by [List all commodity codes](#tag/purchasing-and-shipping). |\n| `countryOfOriginId`<br>nullable string | The ID of the country the goods were made in, for customs paperwork, or `null` if it isn't set. Countries are listed by [List all countries](#tag/tax-and-currency). |\n| `productWebLink`<br>nullable string | A link to a web page about the product, or `null` if there isn't one. |\n| `minStockLevel`<br>number | The minimum stock level, with up to 4 decimal places. When `inStock` falls below it, Omono flags the item as short of stock (see `insufficientStock`) and suggests reordering it. |\n| `minOrderQuantity`<br>number | The smallest quantity you buy at a time, with up to 4 decimal places. Omono uses it when it suggests how many to order. |\n| `marginWarningPercent`<br>nullable number | The item's own minimum sales margin, as a percentage above 0 and up to 100, or `null` if the item uses the margin set on its sales analysis code. Omono shows it on the item as Minimum Sales Margin, and a line item whose margin is below it shows a warning. It's never 0: the value that means \"use the code's margin\" is `null`, when you read the item and when you write it. |\n| `onOrder`<br>number | The quantity you're expecting from issued purchase orders and haven't received yet, with up to 4 decimal places. You can't set this field. |\n| `insufficientStock`<br>boolean | Whether the item is short of stock, which means `inStock` is below `minStockLevel` or below `allocated`. You can't set this field: Omono keeps it up to date. |\n| `lastStockTake`<br>nullable date | The date of the item's last stock take, as `YYYY-MM-DD`, or `null` if it has never had one. A stock take sets `inStock` to the quantity that staff counted. |\n| `bom`<br>array of objects | The item's bill of materials (BOM): the stock items and quantities that go into one unit of an assembly. It's an empty list unless the item is an assembly. Change it with `bom` when you create or update the assembly. |\n| `suppliers`<br>array of objects | The companies you buy the item from, each with its part number, lead time and price, in the order Omono shows them. It's an empty list for an assembly, and for an item with no suppliers. This field is only present when you ask for it with `include=suppliers`, which needs the `purchasing:read` scope. Change the suppliers with [Add a supplier to a stock item](#tag/stock-items/POST/stock-items/{id}/suppliers) and the operations after it. |\n| `created`<br>timestamp | The time the stock item was created. |\n| `updated`<br>timestamp | The time the stock item was last changed. |\n\n</details>\n\n<details><summary>Child attributes of <code>bom</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `bom[].stockItemId`<br>string | The ID of the component's stock item. |\n| `bom[].quantity`<br>number | How many units of the component go into one unit of the assembly, with up to 4 decimal places. |\n\n</details>\n\n<details><summary>Child attributes of <code>suppliers</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `suppliers[].supplierId`<br>string | The ID of the supplier [company](#tag/companies). |\n| `suppliers[].partNo`<br>nullable string | The supplier's own part number for the item, or `null` if Omono has none saved. |\n| `suppliers[].leadTimeDays`<br>nullable number | How many days the supplier takes to deliver the item, or `null` if Omono has none saved. |\n| `suppliers[].price`<br>number | What one unit costs from this supplier, in the supplier's currency, which `currencyId` names. Omono rounds a price you send to your organisation's Unit Pricing precision for purchasing, but a price saved earlier can have more decimal places, so don't assume a fixed number. It's 0 if Omono has no price saved. |\n| `suppliers[].currencyId`<br>nullable string | The ID of the supplier company's currency, which `price` is in, or `null` if the company has no currency or isn't one of your companies any more. Currencies are listed by [List all currencies](#tag/tax-and-currency). |\n| `suppliers[].preferred`<br>boolean | Whether this is the item's preferred supplier. At most one row of an item is preferred. |\n\n</details>\n"
    },
    {
      "name": "Tasks",
      "description": "[Copy for LLM](/docs/reference/tasks.md?copy) · [View as Markdown](/docs/reference/tasks.md)\n\nA task is a piece of work for someone in your organisation, such as a call to make or a quote to follow up. A task can be linked to a record, such as a company or a sales order. Private tasks never appear in the API. You can create, change and complete tasks, but staff reopen them in Omono.\n\nReading tasks requires the `tasks:read` or `tasks:write` scope, and changing them requires `tasks:write`.\n\n### The task object\n\n| Attribute | Description |\n| --- | --- |\n| `id`<br>string | Unique identifier for the task. |\n| `subject`<br>string | What needs to be done, for example \"Chase quote SQ-0961 with Priya\". |\n| `taskStatusId`<br>string | The ID of the task's status. Your task statuses are listed by [List all task statuses](#tag/task-settings). A task is complete once its status is a closed status. To complete a task, use [Complete a task](#tag/tasks), not a change to its status: a change can't give a task a closed status, but sending a task's current status again is fine. A completed task can't be changed through the API, because tasks are reopened in Omono. |\n| `dueAt`<br>nullable timestamp | When a timed task is due, as a time in UTC. Use `timeZone` to show it in the task's local time. On an all-day task, Omono sets it to the end of `allDayDate` in UTC, which is the time the `dueAt_gte` and `dueAt_lte` filters compare. |\n| `ownerId`<br>string | The ID of the user who owns the task. Your users are listed by [List all users](#tag/organisation). |\n| `assignedUserIds`<br>array of strings | The IDs of the users assigned to the task. The list is empty if nobody is assigned. |\n| `linkedEntityType`<br>nullable enum | The type of record the task is linked to. It's `null`, or `general`, when the task isn't linked to a record. Possible values: `company`, `contact`, `quote`, `sales_order`, `credit_note`, `purchase_order`, `stock_item`, `general`. |\n| `linkedEntityId`<br>nullable string | The ID of the record the task is linked to. It always matches `linkedEntityType`: both are `null`, or the type is `general` and the ID is `null`, or the ID belongs to a record of that type. |\n\n<details><summary>More attributes</summary>\n\n| Attribute | Description |\n| --- | --- |\n| `externalRef`<br>nullable string | Your own reference for the task, such as the activity's ID in your CRM, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's tasks, completed ones included, so you can find the task again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references). |\n| `taskTypeId`<br>string | The ID of the task's type, such as a call or a follow-up. Your task types are listed by [List all task types](#tag/task-settings). |\n| `taskPriorityId`<br>string | The ID of the task's priority. Your task priorities are listed by [List all task priorities](#tag/task-settings). |\n| `allDayDate`<br>nullable date | The day an all-day task is due, as `YYYY-MM-DD`. It has no time zone. It's `null` on a timed task. |\n| `isAllDay`<br>boolean | Whether the task is due on a day rather than at a particular time. An all-day task uses `allDayDate`, and a timed task uses `dueAt` and `timeZone`. |\n| `timeZone`<br>nullable string | The time zone the task is scheduled in, as an IANA name such as `Europe/London`. A timed task always has one. |\n| `estimatedDuration`<br>nullable integer | How long the task is expected to take, in minutes. It's `null` if there's no estimate. |\n| `createdById`<br>string | The ID of the user who created the task. Tasks created through the API show your organisation's API user. |\n| `blocksShipping`<br>boolean | Whether the task stops the linked sales order from shipping. While the task is open, none of the order's dispatches can move to the final status (the one whose type is `final`), which ships and invoices them. Moves to other statuses aren't blocked. Only a task linked to a sales order can block shipping: on any other task, `true` makes the request fail with a `422` error and the code `validation-failed`. Learn more about [when a dispatch can't ship](/docs/workflow#when-a-dispatch-cannot-ship). |\n| `companyId`<br>nullable string | The ID of the company the task belongs to, which Omono sets from the link. It's the linked company, or the company of the linked quote, sales order, credit note, contact or purchase order. For a purchase order, that's the supplier. It's `null` when the task is linked to a stock item or to nothing. |\n| `isRecurring`<br>boolean | Whether the task repeats. A repeating task is a single task that moves on to its next date each time it's completed. |\n| `recurrenceConfig`<br>nullable object | How the task repeats, or `null` if it doesn't. |\n| `recurrenceRule`<br>nullable string | The task's repeat schedule as an iCalendar RRULE, which Omono builds for you. It doesn't show occurrences that someone deleted one at a time in Omono. |\n| `isAutomated`<br>boolean | Whether one of your organisation's automations created the task, for example a task to chase a quote on its chase date or its expected award date. Omono can move or close these tasks itself, without an API call. |\n| `completedAt`<br>nullable timestamp | The time the task was completed, or `null` if it isn't complete. |\n| `completedById`<br>nullable string | The ID of the user who completed the task, or `null` if it isn't complete. |\n| `previousTaskId`<br>nullable string | The ID of the task that this one was created as a follow-up to. It's `null` if there isn't one, or if that task is private. When that task is made private or public, this task's `updated` changes too, so `updated_since` returns it. |\n| `nextTaskId`<br>nullable string | The ID of the follow-up task created from this one. It's `null` if there isn't one, or if that task is private. When that task is made private or public, this task's `updated` changes too, so `updated_since` returns it. |\n| `created`<br>timestamp | The time the task was created. |\n| `updated`<br>timestamp | The time the task was last changed. |\n\n</details>\n\n<details><summary>Child attributes of <code>recurrenceConfig</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `recurrenceConfig.frequency`<br>enum | How often the task repeats: `DAILY`, `WEEKLY`, `MONTHLY` or `YEARLY`. |\n| `recurrenceConfig.interval`<br>integer | How many days, weeks, months or years pass between occurrences. For example, `2` with `WEEKLY` means every other week. It's `1` if it wasn't set. |\n| `recurrenceConfig.byDay`<br>array of strings | The days of the week the task repeats on, as two-letter codes from `MO` to `SU`. A weekly recurrence always has at least one day. |\n| `recurrenceConfig.byMonthDay`<br>value | The day of the month the task repeats on, from 1 to 31, or `-1` for the last day of the month. Some older tasks have a list of days here instead of a single day. |\n| `recurrenceConfig.byMonth`<br>array of integers | The months the task repeats in, from 1 for January to 12 for December. It appears only on some older tasks, and you can't send it. |\n| `recurrenceConfig.untilDate`<br>date | The last day the task can repeat on, as `YYYY-MM-DD`. |\n| `recurrenceConfig.count`<br>integer | The total number of occurrences in the series. |\n| `recurrenceConfig.bySetPos`<br>integer | Which occurrence of the `byDay` weekday in the month the task repeats on: 1 to 4 for the first to the fourth, or `-1` for the last. For example, `bySetPos: 2` with `byDay: [\"TU\"]` means the second Tuesday of the month. The values `-2` to `-4`, for the second-last to the fourth-last, appear only on some older tasks, and you can't send them. Possible values: `1`, `2`, `3`, `4`, `-1`, `-2`, `-3`, `-4`. |\n\n</details>\n"
    },
    {
      "name": "Notes",
      "description": "[Copy for LLM](/docs/reference/notes.md?copy) · [View as Markdown](/docs/reference/notes.md)\n\nA note is a line of history on a record: a company, quote, sales order, credit note, purchase order, stock item or task. People write notes in Omono, and Omono writes system notes itself when something happens to a record, such as a status change. A task's notes are only the ones people write: its history isn't part of them. Through the API you can read a record's notes, newest first, and add a plain-text note to it. Notes can't be changed or deleted through the API. A note doesn't change its record's `updated` time.\n\nReading a record's notes requires the record's own read or write scope, such as `sales:read` for a quote's notes, and adding a note requires its write scope, such as `sales:write`.\n\n### The note object\n\n| Attribute | Description |\n| --- | --- |\n| `id`<br>string | Unique identifier for the note. |\n| `kind`<br>enum | Who wrote the note. `user` is a note that a person wrote in Omono, or that an API key added. `system` is a note that Omono wrote itself to record a change, such as a new status or a changed date. A task's notes are always `user` notes. |\n| `text`<br>string | The note's text, as plain text, with a line break between lines. Formatting that staff added in Omono isn't included. It can differ from the text an API key sent: Omono removes spaces and line breaks from the start and end, and replaces a character that isn't valid Unicode. |\n| `authorName`<br>string | The name Omono shows as the note's author, as it was when the note was written. A note that an API key added shows `API · ` and the key's name, such as `API · Zapier`. It's an empty string when Omono has no name for the author. |\n| `created`<br>timestamp | The time the note was written. |\n\n<details><summary>More attributes</summary>\n\n| Attribute | Description |\n| --- | --- |\n| `userId`<br>nullable string | The ID of the user the note is recorded against, or `null` if there isn't one. For a note that an API key added, it's your organisation's API user, which is the same for every key. Your users are listed by [List all users](#tag/organisation). |\n| `apiKeyId`<br>nullable string | The ID of the API key that added the note, or `null` if no key added it. |\n\n</details>\n"
    },
    {
      "name": "Documents",
      "description": "[Copy for LLM](/docs/reference/documents.md?copy) · [View as Markdown](/docs/reference/documents.md)\n\nA document is a file attached to one record: a company, quote, sales order, credit note, purchase order or stock item. You can upload, download, rename, pin and archive documents. Learn more about [downloading files](/docs/reading#downloads).\n\nReading documents requires the `documents:read` or `documents:write` scope, and changing them requires `documents:write`.\n\n### The document object\n\n| Attribute | Description |\n| --- | --- |\n| `id`<br>string | Unique identifier for the document. |\n| `name`<br>string | The document's name, for example `drawing-rev-b.pdf`. You can rename a document by updating it. The names of files uploaded in Omono are kept exactly as they were uploaded, with any spaces at the start or end. |\n| `size`<br>integer | The size of the file in bytes. Omono measures it for a file uploaded through the API. For a file uploaded in Omono, it's the size the browser reported. |\n| `fileType`<br>nullable string | The file's MIME type, for example `application/pdf`. For a file uploaded through the API, Omono takes it from the extension of the uploaded file's name, then from the extension of `name`, then from the file part's `Content-Type`. If none of these gives a valid type, it's `application/octet-stream`. |\n| `pinned`<br>boolean | Whether the document is pinned to its record. In Omono, pinned documents sit at the top of a record's documents, and they're the ones shown by default on related records and in the list of email attachments. To change it, update the document with the value you want: it isn't a toggle. |\n| `archived`<br>boolean | Whether the document has been deleted, in Omono or through the API. A deleted document is archived rather than removed, so you can still read its details, but its `contentUrl` returns a `404` error. Archiving can't be undone: through the API you can't unarchive, rename or re-pin an archived document. Deleting a document doesn't write an event, so if you keep a copy, list documents with `archived=any` to see it. A `documents` event is written only when Omono removes a document for good, which happens when the quote, sales order, credit note or purchase order it's attached to is deleted. |\n| `contentUrl`<br>string | The URL to download the file from, relative to the API's host. It redirects you to the file. |\n\n<details><summary>More attributes</summary>\n\n| Attribute | Description |\n| --- | --- |\n| `salesOrderId`<br>nullable string | The ID of the sales order the document is attached to, or `null` if it's attached to another kind of record. |\n| `quoteId`<br>nullable string | The ID of the quote the document is attached to, or `null` if it's attached to another kind of record. |\n| `companyId`<br>nullable string | The ID of the company the document is attached to, or `null` if it's attached to another kind of record. |\n| `purchaseOrderId`<br>nullable string | The ID of the purchase order the document is attached to, or `null` if it's attached to another kind of record. |\n| `stockItemId`<br>nullable string | The ID of the stock item the document is attached to, or `null` if it's attached to another kind of record. |\n| `creditNoteId`<br>nullable string | The ID of the credit note the document is attached to, or `null` if it's attached to another kind of record. |\n| `uploaderUserId`<br>string | The ID of the user who uploaded the file. Files uploaded through the API show your organisation's API user. Your users are listed by [List all users](#tag/organisation). |\n| `created`<br>timestamp | The time the document was uploaded. |\n| `updated`<br>timestamp | The time the document was last changed. |\n\n</details>\n"
    },
    {
      "name": "Events",
      "description": "[Copy for LLM](/docs/reference/events.md?copy) · [View as Markdown](/docs/reference/events.md)\n\nAn event records that a record was deleted in Omono. Deleted records don't come back in the lists, so poll the event list as part of your sync, and delete your copy of the record named by each event whose `op` is `deleted`. Today, `deleted` is the only kind of event, and a new kind would reach you only if you asked for it with the `op` filter. Events are kept for 30 days. Learn more about [handling deletes](/docs/syncing#deletes).\n\nReading events requires any read or write scope, such as `companies:read`. You only see events for the kinds of record your key's scopes let it read, and a write scope lets it read its own kind of record.\n\n### The event object\n\n| Attribute | Description |\n| --- | --- |\n| `id`<br>string | Unique identifier for the event. If you receive the same event twice, use it to ignore the repeat. |\n| `sequence`<br>integer | The event's position in your organisation's list of events. Sequence numbers always increase, but they have gaps, because events your API key can't read are left out. |\n| `resource`<br>enum | The kind of record an event is about, such as `sales_orders` or `contacts`. See [Enums](/docs/enums#event-resource) for the values. |\n| `resourceId`<br>string | The ID of the record that was deleted. For `tasks`, it can also be a task that someone made private in Omono, which comes back if it's made public again. So for a `tasks` event, retrieve the task first, and delete your copy only if that returns a `404` error. Learn more about [handling deletes](/docs/syncing#deletes). |\n| `op`<br>enum | What happened to the record. Today it's always `deleted`. Act only on events whose `op` is `deleted`, and skip any other value. If Omono adds other kinds of event later, you'll get them only if you ask for them with the `op` filter, so the events you get without it never change. |\n| `at`<br>timestamp | The time the record was deleted. |\n\n<details><summary>More attributes</summary>\n\n| Attribute | Description |\n| --- | --- |\n| `parentId`<br>nullable string | The ID of the record that the deleted record belonged to. It's the sales order for `sales_order_line_items` and `dispatches`, the purchase order for `purchase_order_line_items` and `deliveries`, the credit note for `credit_note_line_items`, the quote for `quote_line_items`, and the company for `contacts` and `addresses`. It's `null` for every other resource. |\n\n</details>\n"
    },
    {
      "name": "API key",
      "description": "[Copy for LLM](/docs/reference/api-key.md?copy) · [View as Markdown](/docs/reference/api-key.md)\n\nRead the API key that makes the request: its scopes, its organisation and the rate limits it runs under. Use it to check a key when your integration starts.\n\nReading it requires any read or write scope.\n\n### The API key object\n\n| Attribute | Description |\n| --- | --- |\n| `id`<br>string | Unique identifier for the key. Your admins see it on the **API** page of **Settings**, next to the key's request log. |\n| `name`<br>string | The key's name, as your admin gave it. |\n| `scopes`<br>array of strings | The key's scopes, in alphabetical order. A write scope, such as `sales:write`, includes reading the same kind of record. |\n| `organisationId`<br>string | The ID of the organisation the key belongs to. |\n| `limits`<br>object | The rate limits this key runs under now, after any change Omono has made for your organisation. Learn more about [rate limits](/docs/limits). |\n\n<details><summary>More attributes</summary>\n\n| Attribute | Description |\n| --- | --- |\n| `last4`<br>string | The last 4 characters of the key, so you can tell your keys apart. |\n| `expiresAt`<br>nullable timestamp | When the key expires, or `null` if it doesn't. |\n| `created`<br>timestamp | When the key was created. |\n\n</details>\n\n<details><summary>Child attributes of <code>limits</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `limits.perMinute`<br>nullable integer | The key's requests a minute. |\n| `limits.perSecond`<br>nullable integer | The key's requests a second (the burst limit). |\n| `limits.inFlight`<br>nullable integer | How many of the key's requests can run at the same time. |\n| `limits.writesPerMinute`<br>nullable integer | The key's writes a minute. |\n| `limits.perDay`<br>nullable integer | The key's requests a day, in UTC. |\n| `limits.organisationPerMinute`<br>nullable integer | The requests a minute that all your organisation's keys share. |\n\n</details>\n"
    },
    {
      "name": "Dashboard",
      "description": "[Copy for LLM](/docs/reference/dashboard.md?copy) · [View as Markdown](/docs/reference/dashboard.md)\n\nThe dashboard figures are your organisation's sales and output for today, this month and this financial year, against your targets, as the dashboard in Omono shows them. Omono works them out when you ask, in your organisation's time zone. Learn more about [reading the dashboard figures](/docs/reading#dashboard).\n\nReading them requires the `sales:read` or `sales:write` scope.\n\n### The dashboard object\n\n| Attribute | Description |\n| --- | --- |\n| `date`<br>date | The day the figures are for: today in your organisation's time zone, when Omono answered. The month is the month of this day. |\n| `timeZone`<br>string | The time zone Omono used to decide what today and this month are: your organisation's time zone, as [Retrieve your organisation](#tag/organisation/GET/organisation) returns it. The dashboard in Omono uses the time zone of each person's browser, so near midnight the two can show different days. |\n| `financialYear`<br>string | The financial year the `year` figures are for, as Omono labels it: the year, such as `2026`, when your financial year matches the calendar year, otherwise the two years it spans, such as `2026/27`. |\n| `currencyId`<br>string | The ID of your base currency, the currency of every amount. It's the `baseCurrencyId` of [Retrieve your organisation](#tag/organisation/GET/organisation). |\n| `sales`<br>object | What you sold, net of tax: the total of the sales orders created in each period that aren't cancelled, Draft orders included, as Omono's own dashboard counts them, less the complete credit notes created in it. An order counts in the period of the day it was created. |\n| `output`<br>object | What you delivered, net of tax: the total of the dispatches at your final workflow status whose dispatch date is in each period, less the complete credit notes created in it. |\n\n<details><summary>Child attributes of <code>sales</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `sales.day`<br>object | Today's figures. |\n| `sales.day.actual`<br>number | The amount for today. It can be negative when the credit notes are worth more than the rest. |\n| `sales.day.target`<br>number | Today's target: this month's daily target from your settings when today is a working day that isn't a closed day, otherwise `0`. |\n| `sales.month`<br>object | This calendar month's figures, from the first day of the month. |\n| `sales.month.actual`<br>number | The amount so far in the period. It can be negative when the credit notes are worth more than the rest. |\n| `sales.month.target`<br>number | The target for the whole period: the daily target that your settings give each month, added up over the period's working days that aren't closed days. If your organisation started using Omono during the period, it counts from that day. |\n| `sales.month.pace`<br>number | The part of `target` up to and including today. When `actual` is at or above `pace`, you're on course to reach the target. |\n| `sales.year`<br>object | This financial year's figures, from its first day. The financial year runs on whole calendar days in UTC, as it does in Omono's dashboard, while today and the month use your organisation's time zone. |\n| `sales.year.actual`<br>number | The amount so far in the period. It can be negative when the credit notes are worth more than the rest. |\n| `sales.year.target`<br>number | The target for the whole period: the daily target that your settings give each month, added up over the period's working days that aren't closed days. If your organisation started using Omono during the period, it counts from that day. |\n| `sales.year.pace`<br>number | The part of `target` up to and including today. When `actual` is at or above `pace`, you're on course to reach the target. |\n\n</details>\n\n<details><summary>Child attributes of <code>output</code></summary>\n\n| Attribute | Description |\n| --- | --- |\n| `output.day`<br>object | Today's figures. |\n| `output.day.actual`<br>number | The amount for today. It can be negative when the credit notes are worth more than the rest. |\n| `output.day.target`<br>number | Today's target: this month's daily target from your settings when today is a working day that isn't a closed day, otherwise `0`. |\n| `output.month`<br>object | This calendar month's figures, from the first day of the month. |\n| `output.month.actual`<br>number | The amount so far in the period. It can be negative when the credit notes are worth more than the rest. |\n| `output.month.target`<br>number | The target for the whole period: the daily target that your settings give each month, added up over the period's working days that aren't closed days. If your organisation started using Omono during the period, it counts from that day. |\n| `output.month.pace`<br>number | The part of `target` up to and including today. When `actual` is at or above `pace`, you're on course to reach the target. |\n| `output.year`<br>object | This financial year's figures, from its first day. The financial year runs on whole calendar days in UTC, as it does in Omono's dashboard, while today and the month use your organisation's time zone. |\n| `output.year.actual`<br>number | The amount so far in the period. It can be negative when the credit notes are worth more than the rest. |\n| `output.year.target`<br>number | The target for the whole period: the daily target that your settings give each month, added up over the period's working days that aren't closed days. If your organisation started using Omono during the period, it counts from that day. |\n| `output.year.pace`<br>number | The part of `target` up to and including today. When `actual` is at or above `pace`, you're on course to reach the target. |\n\n</details>\n"
    },
    {
      "name": "Organisation",
      "description": "[Copy for LLM](/docs/reference/organisation.md?copy) · [View as Markdown](/docs/reference/organisation.md)\n\nThese lists describe your own organisation: its details, the settings that change what the API accepts, its closed days, its addresses and bank accounts, and its users, divisions, departments and warehouses. Records throughout the API refer to them by ID. For example, a sales order's `salesPersonId` is the ID of one of your users.\n\nReading these lists requires the `reference:read` scope.\n"
    },
    {
      "name": "Tax and currency",
      "description": "[Copy for LLM](/docs/reference/tax-and-currency.md?copy) · [View as Markdown](/docs/reference/tax-and-currency.md)\n\nThese lists hold the tax rates, currencies, currency rates and countries that your records refer to. Your currency rates are your organisation's standing exchange rates, so use them when you set a document's `exchangeRate`.\n\nReading these lists requires the `reference:read` scope.\n"
    },
    {
      "name": "Sales settings",
      "description": "[Copy for LLM](/docs/reference/sales-settings.md?copy) · [View as Markdown](/docs/reference/sales-settings.md)\n\nThese lists hold the settings your sales records refer to: sales analysis codes, commissions, customer segments, industries, company types, quote validities, conversion probabilities, lost-quote reasons and workflow statuses. Sales analysis codes group the line items you sell for reports and for your accounts. Workflow statuses are the steps a dispatch moves through on its way to being shipped and invoiced.\n\nReading these lists requires the `reference:read` scope.\n"
    },
    {
      "name": "Purchasing and shipping",
      "description": "[Copy for LLM](/docs/reference/purchasing-and-shipping.md?copy) · [View as Markdown](/docs/reference/purchasing-and-shipping.md)\n\nThese lists hold the settings your purchasing and shipping records refer to: purchase analysis codes, couriers, incoterms, commodity codes and EORI numbers. Incoterms are the standard trade terms that say who arranges and pays for each part of a shipment. Commodity codes classify goods for customs, and an EORI number identifies your business to customs.\n\nReading these lists requires the `reference:read` scope.\n"
    },
    {
      "name": "Task settings",
      "description": "[Copy for LLM](/docs/reference/task-settings.md?copy) · [View as Markdown](/docs/reference/task-settings.md)\n\nThese lists hold the statuses, priorities and types you can give a task. Your organisation sets them up in Omono.\n\nReading these lists requires the `reference:read` scope.\n"
    }
  ],
  "paths": {
    "/companies": {
      "get": {
        "operationId": "listCompanies",
        "x-stability": "stable",
        "tags": [
          "Companies"
        ],
        "summary": "List all companies",
        "description": "Returns a list of your companies. The newest companies come first unless you choose another order with `sort`, which can also sort them by `companyName`.\n\nArchived companies are left out unless you ask for them with `archived`. To get each company's contacts, addresses or both in the same response, add them to `include`, for example `include=contacts,addresses`.\n\nTo find companies by part of their name, account number or postcode, send `search`, as the Companies search in Omono does. `search=acm` finds Acme Engineering Ltd, because each word of your text matches the start of a word. The best matches come first, and the answer has no cursor. Learn more about [search](/docs/reading#search).\n\nTo find the customers that have a price list, send `hasPriceList=true`.\n\nLearn more about [pagination](/docs/reading#pagination), [filters](/docs/reading#filters), [sorting](/docs/reading#sorting) and [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `companies:read` or `companies:write` scope. With `hasPriceList`, your API key also needs the `pricing:read` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 403 | `insufficient-scope` | You sent `hasPriceList`, and your API key doesn't have the `pricing:read` scope. |\n| 409 | `document-too-large` | You asked for the companies' contacts or addresses, and the first company on the page has more than 10,000 of them, or comes to more than 32 MB of JSON with them. Leave out `include` to page past it, and read that company in Omono. |\n| 422 | `validation-failed` | You sent `search` with `cursor`, `sort`, `updated_since`, `ids`, `created_gte`, `created_lte`, `companyName`, `accountNo`, `externalRef` or `hasPriceList`, or your `search` text is shorter than 2 characters. |\n| 422 | `validation-failed` | You sent `hasPriceList`, and more than 10,000 of your customers have a price list. Read each customer's price list instead. |\n| 503 | `temporarily-unavailable` | You sent `search`, and Omono's search isn't available just now. Retry after the `Retry-After` delay, or list your companies without `search`. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/SortCompanies"
          },
          {
            "$ref": "#/components/parameters/IncludeCompany"
          },
          {
            "$ref": "#/components/parameters/Archived"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/ExternalRef"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "isCustomer",
            "in": "query",
            "description": "Pass `true` to return only customers, or `false` to return only companies that aren't customers.\n",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "isSupplier",
            "in": "query",
            "description": "Pass `true` to return only suppliers, or `false` to return only companies that aren't suppliers.\n",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "hasPriceList",
            "in": "query",
            "description": "Pass `true` to return only the companies that have a price list, or `false` to return only those that don't. A company has a price list when it has at least one price, at any effective date: the prices that [List a customer's prices](#tag/customer-prices/GET/companies/{id}/price-list) returns with `effectiveDate=all`. Your API key also needs the `pricing:read` scope. You can't send it with `search`.\n",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "companyName",
            "in": "query",
            "description": "Only return companies with exactly this name. The match ignores capital letters. Send one name only: this filter doesn't take a comma-separated list, because company names can contain commas. To check whether a name is free before you create a company, add `archived=any`, because archived companies keep their names.\n",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "accountNo",
            "in": "query",
            "description": "Only return companies with exactly this account number. The match ignores capital letters. Send one account number only: this filter doesn't take a comma-separated list.\n",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Only return the companies whose name, account number or postcode matches this text, best matches first. The text is a phrase: each word matches the start of a word, ignoring capital letters, and the words must be next to each other and in the same order, so `acm eng` finds Acme Engineering Ltd, but `acme ltd` doesn't. Send 2 to 100 characters. You can combine it with `archived`, `isCustomer`, `isSupplier`, `include` and `limit`. A search has no cursor: `hasMore` is `true` when more records match than the page holds, and to see them, send a longer text or a larger `limit`, up to 200. Learn more about [search](/docs/reading#search).\n",
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of companies.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyList"
                },
                "example": {
                  "data": [
                    {
                      "id": "b2FpLmNvbXBhbnkQQ",
                      "externalRef": null,
                      "companyName": "Acme Engineering Ltd",
                      "accountNo": "ACME01",
                      "website": "https://acme-engineering.example",
                      "industryId": "indAerospace9Wz3P",
                      "typeId": "ctpLimitedCo4Qk8Z",
                      "countryId": "ctyUnitedKingdom1",
                      "currencyId": "curGBPqk2j9x4mWpT",
                      "currencyLocked": true,
                      "taxNo": "GB123456789",
                      "taxRateId": "trx20pcVATkQ9m3Zd",
                      "postcode": "BS1 4DJ",
                      "telephone": "+44 117 496 0102",
                      "isCustomer": true,
                      "isSupplier": false,
                      "accountManagerId": "usrJaneDoe4Kq9mWt",
                      "invoiceTermsType": "days_after_invoice",
                      "invoiceTermsDays": 30,
                      "creditLimit": 25000,
                      "salesDiscount": 5,
                      "customerSegmentId": "csgKeyAccounts5Xw",
                      "commissionId": null,
                      "customerDivisionId": "divNorthOffice3Qz",
                      "invoicePaymentBankAccountId": "bnkGBPCurrent4Kq9m",
                      "eoriNumber": "GB123456789000",
                      "onStop": false,
                      "billTermsType": null,
                      "billTermsDays": null,
                      "supplierDivisionId": null,
                      "rating": null,
                      "ratedAt": null,
                      "isProforma": false,
                      "archived": false,
                      "created": "2026-02-11T10:22:31.000Z",
                      "updated": "2026-08-14T15:02:10.000Z"
                    }
                  ],
                  "hasMore": true,
                  "nextCursor": "eyJ2IjoxLCJzIjpbIjIwMjYtMDItMTFUMTA6MjI6MzFaIl19"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:read"
            ]
          },
          {
            "bearerAuth": [
              "companies:write"
            ]
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createCompany",
        "x-stability": "beta",
        "tags": [
          "Companies"
        ],
        "summary": "Create a company",
        "description": "Creates a company, together with its first contact and its accounts address. The accounts address is the address the company is invoiced at: Omono prints it on the company's invoices and emails invoices to its `accountsEmail`.\n\nSet `isCustomer`, `isSupplier` or both to `true`. Send customer fields only when the company is a customer, and supplier fields only when it's a supplier. A customer needs an `accountManagerId`, `invoiceTermsDays` and a customer segment, and a supplier needs `billTermsDays`. If you leave out the customer segment or the invoice bank account, Omono fills it in for you when your organisation has only one to choose from.\n\nThe `address` you send becomes the accounts address, and Omono links the new contact to it. The response includes the new company's `contacts` and `addresses`, so you have their IDs without making another request. If your organisation is connected to Xero, the new company is queued to sync to Xero.\n\nCompany names and account numbers must be unique in your organisation, and archived companies count. If the request fails with a `500` error, the company may already be saved. Retry it with the same `Idempotency-Key`: if the company was saved, the retry fails with a `409` error and the code `duplicate-name`, and `conflictingId` gives the company's ID, so you can finish that company instead of creating another. Learn more about [duplicates](/docs/writing#duplicates) and [what to do if a create fails](/docs/writing#if-a-create-fails).\n\nRequires the `companies:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `duplicate-name` | Another company already has this name. It may be an archived company. |\n| 409 | `duplicate-account-number` | Another company already has this account number. It may be an archived company. |\n| 422 | `validation-failed` | Neither `isCustomer` nor `isSupplier` is `true`, you sent a field that doesn't fit the company's role, such as a supplier field on a company that is only a customer, or `address.accountsAddress` is `false`. |\n| 422 | `missing-required-field` | A field that the company's role needs is missing, such as `accountManagerId` on a customer, or the address has no `accountsEmail`. |\n| 422 | `bank-currency-mismatch` | The invoice bank account you chose isn't in the company's currency, or your organisation has no bank account in that currency. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "The company to create, with its first contact and its accounts address.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyCreate"
              },
              "example": {
                "companyName": "Bristol Hydraulics Ltd",
                "accountNo": "BRIHYD01",
                "industryId": "indAerospace9Wz3P",
                "typeId": "ctpLimitedCo4Qk8Z",
                "countryId": "ctyUnitedKingdom1",
                "currencyId": "curGBPqk2j9x4mWpT",
                "taxRateId": "trx20pcVATkQ9m3Zd",
                "isCustomer": true,
                "isSupplier": false,
                "accountManagerId": "usrJaneDoe4Kq9mWt",
                "invoiceTermsType": "days_after_invoice",
                "invoiceTermsDays": 30,
                "contact": {
                  "firstName": "Priya",
                  "lastName": "Shah",
                  "email": "priya.shah@bristol-hydraulics.example"
                },
                "address": {
                  "accountsAddress": true,
                  "line1": "4 Harbourside Way",
                  "city": "Bristol",
                  "postcode": "BS1 5DB",
                  "countryId": "ctyUnitedKingdom1",
                  "accountsEmail": "accounts@bristol-hydraulics.example"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new company, including its `contacts` and `addresses`.",
            "headers": {
              "Location": {
                "$ref": "#/components/headers/Location"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Company"
                },
                "example": {
                  "id": "cmpBriHyd7Kq2mXw9",
                  "externalRef": null,
                  "companyName": "Bristol Hydraulics Ltd",
                  "accountNo": "BRIHYD01",
                  "website": null,
                  "industryId": "indAerospace9Wz3P",
                  "typeId": "ctpLimitedCo4Qk8Z",
                  "countryId": "ctyUnitedKingdom1",
                  "currencyId": "curGBPqk2j9x4mWpT",
                  "currencyLocked": false,
                  "taxNo": null,
                  "taxRateId": "trx20pcVATkQ9m3Zd",
                  "postcode": "BS1 5DB",
                  "telephone": null,
                  "isCustomer": true,
                  "isSupplier": false,
                  "accountManagerId": "usrJaneDoe4Kq9mWt",
                  "invoiceTermsType": "days_after_invoice",
                  "invoiceTermsDays": 30,
                  "creditLimit": null,
                  "salesDiscount": null,
                  "customerSegmentId": "csgKeyAccounts5Xw",
                  "commissionId": null,
                  "customerDivisionId": null,
                  "invoicePaymentBankAccountId": "bnkGBPCurrent4Kq9m",
                  "eoriNumber": null,
                  "onStop": false,
                  "billTermsType": null,
                  "billTermsDays": null,
                  "supplierDivisionId": null,
                  "rating": null,
                  "ratedAt": null,
                  "isProforma": false,
                  "archived": false,
                  "contacts": [
                    {
                      "id": "cntPriyaBriHyd3Xq",
                      "externalRef": null,
                      "companyId": "cmpBriHyd7Kq2mXw9",
                      "firstName": "Priya",
                      "lastName": "Shah",
                      "fullName": "Priya Shah",
                      "email": "priya.shah@bristol-hydraulics.example",
                      "jobTitle": null,
                      "departmentId": null,
                      "telephone1": null,
                      "telephone2": null,
                      "addressId": "adrBriHydHarbour5",
                      "archived": false,
                      "created": "2026-08-19T15:40:12.000Z",
                      "updated": "2026-08-19T15:40:12.000Z"
                    }
                  ],
                  "addresses": [
                    {
                      "id": "adrBriHydHarbour5",
                      "externalRef": null,
                      "companyId": "cmpBriHyd7Kq2mXw9",
                      "accountsAddress": true,
                      "companyName": "Bristol Hydraulics Ltd",
                      "line1": "4 Harbourside Way",
                      "line2": null,
                      "city": "Bristol",
                      "county": null,
                      "postcode": "BS1 5DB",
                      "countryId": "ctyUnitedKingdom1",
                      "telephone": null,
                      "accountsEmail": "accounts@bristol-hydraulics.example",
                      "eoriNumber": null,
                      "archived": false,
                      "created": "2026-08-19T15:40:12.000Z",
                      "updated": "2026-08-19T15:40:12.000Z"
                    }
                  ],
                  "created": "2026-08-19T15:40:12.000Z",
                  "updated": "2026-08-19T15:40:12.000Z"
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/companies/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "getCompany",
        "x-stability": "stable",
        "tags": [
          "Companies"
        ],
        "summary": "Retrieve a company",
        "description": "Retrieves a company. To get its contacts, addresses or both in the same response, add them to `include`, for example `include=contacts,addresses`.\n\nRequires the `companies:read` or `companies:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `document-too-large` | You asked for the company's contacts or addresses, and it has more than 10,000 of them, or comes to more than 32 MB of JSON with them. Leave out `include`, or read the company in Omono. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          },
          {
            "$ref": "#/components/parameters/IncludeCompany"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the company.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Company"
                },
                "example": {
                  "id": "b2FpLmNvbXBhbnkQQ",
                  "externalRef": null,
                  "companyName": "Acme Engineering Ltd",
                  "accountNo": "ACME01",
                  "website": "https://acme-engineering.example",
                  "industryId": "indAerospace9Wz3P",
                  "typeId": "ctpLimitedCo4Qk8Z",
                  "countryId": "ctyUnitedKingdom1",
                  "currencyId": "curGBPqk2j9x4mWpT",
                  "currencyLocked": true,
                  "taxNo": "GB123456789",
                  "taxRateId": "trx20pcVATkQ9m3Zd",
                  "postcode": "BS1 4DJ",
                  "telephone": "+44 117 496 0102",
                  "isCustomer": true,
                  "isSupplier": false,
                  "accountManagerId": "usrJaneDoe4Kq9mWt",
                  "invoiceTermsType": "days_after_invoice",
                  "invoiceTermsDays": 30,
                  "creditLimit": 25000,
                  "salesDiscount": 5,
                  "customerSegmentId": "csgKeyAccounts5Xw",
                  "commissionId": null,
                  "customerDivisionId": "divNorthOffice3Qz",
                  "invoicePaymentBankAccountId": "bnkGBPCurrent4Kq9m",
                  "eoriNumber": "GB123456789000",
                  "onStop": false,
                  "billTermsType": null,
                  "billTermsDays": null,
                  "supplierDivisionId": null,
                  "rating": null,
                  "ratedAt": null,
                  "isProforma": false,
                  "archived": false,
                  "created": "2026-02-11T10:22:31.000Z",
                  "updated": "2026-08-14T15:02:10.000Z"
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:read"
            ]
          },
          {
            "bearerAuth": [
              "companies:write"
            ]
          }
        ]
      },
      "patch": {
        "operationId": "updateCompany",
        "x-stability": "beta",
        "tags": [
          "Companies"
        ],
        "summary": "Update a company",
        "description": "Updates a company. Any fields you leave out stay as they are. If your request doesn't change anything, for example because it sends back values the company already has, Omono doesn't save the company, so its `updated` time and ETag stay the same.\n\nOmono checks the company as a whole after your changes, with the same rules as when you create one. For example, if you set `isCustomer` to `true` on a supplier that has no account manager, you must send an `accountManagerId` too. Setting `isCustomer` to `false` clears every customer field, and setting `isSupplier` to `false` clears every supplier field.\n\nSome changes reach beyond the company itself:\n\n- **Account manager.** If you change `accountManagerId`, Omono moves every quote and sales order for this company to the new account manager, whatever its status, so reports by account manager change for past periods too. Those quotes and sales orders get a new `updated` time and ETag. Setting `isCustomer` to `false` also gives them a new `updated` time and ETag, even though nothing you can see on them changes.\n- **Name.** If you rename the company, Omono shows the new name on its contacts, quotes, sales orders, dispatches and purchase orders, and on every address in your organisation that showed the old name. Each of those gets a new `updated` time, and so does any other company that owns one of those addresses, so a list you poll with `updated_since` can return many records after one rename. Credit notes keep the old name.\n- **Xero.** If your organisation is connected to Xero, every change queues the company to sync to Xero again. A request that changes nothing doesn't.\n\nTo archive or unarchive the company, send `archived`. You can't change an archived company until you unarchive it: send `archived: false`, on its own or together with your other changes. If a request that unarchives the company and changes other fields fails after Omono unarchived it, because someone changed the company at the same moment or because of a server error, the company stays unarchived: read it again before you retry. The response always shows the company as it is now, which can differ from what you asked for if someone else changed `archived` at the same moment. While a company is archived, you can't add contacts or addresses to it or create documents for it, but you can still update its contacts and addresses. You can't put a company on stop through the API: staff do that in Omono. To change the company's country, telephone or postcode, update its accounts address. Learn more about [the rules for every write](/docs/writing#the-rules-for-every-write).\n\nRequires the `companies:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `company-archived` | You changed a field on a company that is archived and stays archived. The error's `field` names the first field you changed. Send `archived: false` to unarchive the company. |\n| 409 | `currency-locked` | You changed `currencyId`, but the company already has a quote, sales order, credit note or purchase order. |\n| 409 | `duplicate-name` | Another company already has this name. It may be an archived company. |\n| 409 | `duplicate-account-number` | Another company already has this account number. It may be an archived company. |\n| 422 | `validation-failed` | You sent a field that doesn't fit the company's role, such as a supplier field on a company that is only a customer. |\n| 422 | `missing-required-field` | After your changes, the company is missing a field that its role needs, such as `accountManagerId` on a customer. |\n| 422 | `bank-currency-mismatch` | The invoice bank account isn't in the company's currency, or your organisation has no bank account in that currency. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "description": "The fields to change. Any fields you leave out stay as they are.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyUpdate"
              },
              "example": {
                "creditLimit": 40000,
                "accountManagerId": "usrJaneDoe4Kq9mWt"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns the updated company.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Company"
                },
                "example": {
                  "id": "b2FpLmNvbXBhbnkQQ",
                  "externalRef": null,
                  "companyName": "Acme Engineering Ltd",
                  "accountNo": "ACME01",
                  "website": "https://acme-engineering.example",
                  "industryId": "indAerospace9Wz3P",
                  "typeId": "ctpLimitedCo4Qk8Z",
                  "countryId": "ctyUnitedKingdom1",
                  "currencyId": "curGBPqk2j9x4mWpT",
                  "currencyLocked": true,
                  "taxNo": "GB123456789",
                  "taxRateId": "trx20pcVATkQ9m3Zd",
                  "postcode": "BS1 4DJ",
                  "telephone": "+44 117 496 0102",
                  "isCustomer": true,
                  "isSupplier": false,
                  "accountManagerId": "usrJaneDoe4Kq9mWt",
                  "invoiceTermsType": "days_after_invoice",
                  "invoiceTermsDays": 30,
                  "creditLimit": 40000,
                  "salesDiscount": 5,
                  "customerSegmentId": "csgKeyAccounts5Xw",
                  "commissionId": null,
                  "customerDivisionId": "divNorthOffice3Qz",
                  "invoicePaymentBankAccountId": "bnkGBPCurrent4Kq9m",
                  "eoriNumber": "GB123456789000",
                  "onStop": false,
                  "billTermsType": null,
                  "billTermsDays": null,
                  "supplierDivisionId": null,
                  "rating": null,
                  "ratedAt": null,
                  "isProforma": false,
                  "archived": false,
                  "created": "2026-02-11T10:22:31.000Z",
                  "updated": "2026-08-19T16:01:44.000Z"
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/companies/{id}/contacts": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "listCompanyContacts",
        "x-stability": "stable",
        "tags": [
          "Contacts"
        ],
        "summary": "List a company's contacts",
        "description": "Returns a list of a company's contacts. The newest contacts come first. This list has no `sort` parameter, and `include=contacts` on a company returns the contacts in the same order.\n\nThis list has no `updated_since` filter. To keep a copy of all your contacts up to date, poll [List contacts](#tag/contacts/GET/contacts) with `updated_since`. Any change to a contact also gives its company a new `updated` time. Learn more about [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `companies:read` or `companies:write` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/ExternalRef"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of contacts.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactList"
                },
                "example": {
                  "data": [
                    {
                      "id": "cnt4Kj9mQdPw2XhTe",
                      "externalRef": null,
                      "companyId": "b2FpLmNvbXBhbnkQQ",
                      "firstName": "Priya",
                      "lastName": "Shah",
                      "fullName": "Priya Shah",
                      "email": "priya.shah@acme-engineering.example",
                      "jobTitle": "Procurement Manager",
                      "departmentId": "dptEngineering7Kq",
                      "telephone1": "+44 117 496 0102",
                      "telephone2": null,
                      "addressId": "adr7Np3kWqYz5RvBc",
                      "archived": false,
                      "created": "2026-02-11T10:22:31.000Z",
                      "updated": "2026-06-02T08:15:09.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:read"
            ]
          },
          {
            "bearerAuth": [
              "companies:write"
            ]
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createCompanyContact",
        "x-stability": "beta",
        "tags": [
          "Contacts"
        ],
        "summary": "Create a contact",
        "description": "Adds a contact to a company. You must send the contact's `firstName`, `lastName` and `email`. To link the contact to one of the company's addresses, send its `addressId`.\n\nRequires the `companies:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `company-archived` | The company is archived. Unarchive it first by sending `archived: false` in a [`PATCH` of the company](#tag/companies/PATCH/companies/{id}). |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "The contact to add.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactCreate"
              },
              "example": {
                "firstName": "Marcus",
                "lastName": "Webb",
                "email": "marcus.webb@acme-engineering.example",
                "jobTitle": "Goods In Supervisor",
                "telephone1": "+44 117 496 0177"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new contact.",
            "headers": {
              "Location": {
                "$ref": "#/components/headers/Location"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "id": "cntMarcusWebb8Zq2",
                  "externalRef": null,
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "firstName": "Marcus",
                  "lastName": "Webb",
                  "fullName": "Marcus Webb",
                  "email": "marcus.webb@acme-engineering.example",
                  "jobTitle": "Goods In Supervisor",
                  "departmentId": null,
                  "telephone1": "+44 117 496 0177",
                  "telephone2": null,
                  "addressId": null,
                  "archived": false,
                  "created": "2026-08-19T16:05:00.000Z",
                  "updated": "2026-08-19T16:05:00.000Z"
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/companies/{id}/contacts/{contactId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        },
        {
          "name": "contactId",
          "in": "path",
          "required": true,
          "description": "The ID of the contact.",
          "schema": {
            "type": "string",
            "maxLength": 64
          }
        }
      ],
      "get": {
        "operationId": "getCompanyContact",
        "x-stability": "stable",
        "tags": [
          "Contacts"
        ],
        "summary": "Retrieve a contact",
        "description": "Retrieves one of a company's contacts. If the contact belongs to a different company, the request fails with a `404` error.\n\nRequires the `companies:read` or `companies:write` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the contact.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "id": "cnt4Kj9mQdPw2XhTe",
                  "externalRef": null,
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "firstName": "Priya",
                  "lastName": "Shah",
                  "fullName": "Priya Shah",
                  "email": "priya.shah@acme-engineering.example",
                  "jobTitle": "Procurement Manager",
                  "departmentId": "dptEngineering7Kq",
                  "telephone1": "+44 117 496 0102",
                  "telephone2": null,
                  "addressId": "adr7Np3kWqYz5RvBc",
                  "archived": false,
                  "created": "2026-02-11T10:22:31.000Z",
                  "updated": "2026-06-02T08:15:09.000Z"
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:read"
            ]
          },
          {
            "bearerAuth": [
              "companies:write"
            ]
          }
        ]
      },
      "patch": {
        "operationId": "updateCompanyContact",
        "x-stability": "beta",
        "tags": [
          "Contacts"
        ],
        "summary": "Update a contact",
        "description": "Updates a contact. Any fields you leave out stay as they are. If your request doesn't change anything, for example because it sends back values the contact already has, Omono doesn't save the contact, so its `updated` time and ETag stay the same. You can update a company's contacts even while the company is archived.\n\nYou can't change an archived contact until you unarchive it. Send `archived: false`, on its own or together with your other changes. Every company needs at least one contact that isn't archived, so you can't archive its last one.\n\nIf any of these checks fails, Omono changes nothing.\n\nRequires the `companies:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `last-contact` | You tried to archive the company's last contact that isn't archived. |\n| 409 | `contact-archived` | You changed a field on a contact that is archived and stays archived. The error's `field` names the first field you changed. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "description": "The fields to change. Any fields you leave out stay as they are.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactUpdate"
              },
              "example": {
                "jobTitle": "Head of Procurement"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns the updated contact.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "id": "cnt4Kj9mQdPw2XhTe",
                  "externalRef": null,
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "firstName": "Priya",
                  "lastName": "Shah",
                  "fullName": "Priya Shah",
                  "email": "priya.shah@acme-engineering.example",
                  "jobTitle": "Head of Procurement",
                  "departmentId": "dptEngineering7Kq",
                  "telephone1": "+44 117 496 0102",
                  "telephone2": null,
                  "addressId": "adr7Np3kWqYz5RvBc",
                  "archived": false,
                  "created": "2026-02-11T10:22:31.000Z",
                  "updated": "2026-08-19T16:06:12.000Z"
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/companies/{id}/addresses": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "listCompanyAddresses",
        "x-stability": "stable",
        "tags": [
          "Addresses"
        ],
        "summary": "List all addresses",
        "description": "Returns a list of a company's addresses. The newest addresses come first. This list has no `sort` parameter, and `include=addresses` on a company returns the addresses in the same order.\n\nEvery company has exactly one accounts address, which is the address the company is invoiced at. Your organisation's own addresses aren't in this list: you'll find them under [Organisation](#tag/organisation).\n\nAddresses have no `updated_since` filter. Instead, any change to an address gives its company a new `updated` time, so to keep a copy up to date, watch for changed companies and read their addresses again. Learn more about [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `companies:read` or `companies:write` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/ExternalRef"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of addresses.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddressList"
                },
                "example": {
                  "data": [
                    {
                      "id": "adr7Np3kWqYz5RvBc",
                      "externalRef": null,
                      "companyId": "b2FpLmNvbXBhbnkQQ",
                      "accountsAddress": true,
                      "companyName": "Acme Engineering Ltd",
                      "line1": "Unit 12, Avonmouth Trading Estate",
                      "line2": "St Andrews Road",
                      "city": "Bristol",
                      "county": null,
                      "postcode": "BS11 9YQ",
                      "countryId": "ctyUnitedKingdom1",
                      "telephone": "+44 117 496 0102",
                      "accountsEmail": "accounts@acme-engineering.example",
                      "eoriNumber": null,
                      "archived": false,
                      "created": "2026-02-11T10:22:31.000Z",
                      "updated": "2026-02-11T10:22:31.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:read"
            ]
          },
          {
            "bearerAuth": [
              "companies:write"
            ]
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createCompanyAddress",
        "x-stability": "beta",
        "tags": [
          "Addresses"
        ],
        "summary": "Create an address",
        "description": "Adds an address to a company.\n\nTo make the new address the company's accounts address, set `accountsAddress` to `true` and send an `accountsEmail`, because invoices are emailed to it. The old accounts address becomes an ordinary address, and the company's telephone, postcode and country change to match the new one.\n\nIf you leave out `companyName`, the address uses the company's name.\n\nRequires the `companies:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `company-archived` | The company is archived. Unarchive it first by sending `archived: false` in a [`PATCH` of the company](#tag/companies/PATCH/companies/{id}). |\n| 422 | `missing-required-field` | You set `accountsAddress` to `true` but didn't send an `accountsEmail`. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "The address to add.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddressCreate"
              },
              "example": {
                "accountsAddress": false,
                "line1": "Goods In, Gate 3",
                "city": "Bristol",
                "postcode": "BS11 9YQ",
                "countryId": "ctyUnitedKingdom1"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new address.",
            "headers": {
              "Location": {
                "$ref": "#/components/headers/Location"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Address"
                },
                "example": {
                  "id": "adrGoodsInGate3Xq",
                  "externalRef": null,
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "accountsAddress": false,
                  "companyName": "Acme Engineering Ltd",
                  "line1": "Goods In, Gate 3",
                  "line2": null,
                  "city": "Bristol",
                  "county": null,
                  "postcode": "BS11 9YQ",
                  "countryId": "ctyUnitedKingdom1",
                  "telephone": null,
                  "accountsEmail": null,
                  "eoriNumber": null,
                  "archived": false,
                  "created": "2026-08-19T16:08:41.000Z",
                  "updated": "2026-08-19T16:08:41.000Z"
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/companies/{id}/addresses/{addressId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        },
        {
          "name": "addressId",
          "in": "path",
          "required": true,
          "description": "The ID of the address.",
          "schema": {
            "type": "string",
            "maxLength": 64
          }
        }
      ],
      "get": {
        "operationId": "getCompanyAddress",
        "x-stability": "stable",
        "tags": [
          "Addresses"
        ],
        "summary": "Retrieve an address",
        "description": "Retrieves one of a company's addresses. If the address belongs to a different company, the request fails with a `404` error.\n\nRequires the `companies:read` or `companies:write` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the address.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Address"
                },
                "example": {
                  "id": "adr7Np3kWqYz5RvBc",
                  "externalRef": null,
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "accountsAddress": true,
                  "companyName": "Acme Engineering Ltd",
                  "line1": "Unit 12, Avonmouth Trading Estate",
                  "line2": "St Andrews Road",
                  "city": "Bristol",
                  "county": null,
                  "postcode": "BS11 9YQ",
                  "countryId": "ctyUnitedKingdom1",
                  "telephone": "+44 117 496 0102",
                  "accountsEmail": "accounts@acme-engineering.example",
                  "eoriNumber": null,
                  "archived": false,
                  "created": "2026-02-11T10:22:31.000Z",
                  "updated": "2026-02-11T10:22:31.000Z"
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:read"
            ]
          },
          {
            "bearerAuth": [
              "companies:write"
            ]
          }
        ]
      },
      "patch": {
        "operationId": "updateCompanyAddress",
        "x-stability": "beta",
        "tags": [
          "Addresses"
        ],
        "summary": "Update an address",
        "description": "Updates an address. Any fields you leave out stay as they are. If your request doesn't change anything, for example because it sends back values the address already has, Omono doesn't save the address, so its `updated` time and ETag stay the same. You can update a company's addresses even while the company is archived.\n\nEvery company keeps exactly one accounts address. To move it, set `accountsAddress` to `true` on another address: that address becomes the accounts address, and the old one becomes an ordinary address. The accounts address always needs an `accountsEmail`. Whenever you change the accounts address, the company's telephone, postcode and country change to match it.\n\nYou can't change an archived address until you unarchive it. Send `archived: false`, on its own or together with your other changes. To make an archived address the accounts address, unarchive it in one request and set `accountsAddress` in the next.\n\nIf any of these checks fails, Omono changes nothing.\n\nRequires the `companies:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `accounts-address-protected` | You tried to archive the accounts address, set `accountsAddress` to `false` on it, or make an archived address the accounts address. |\n| 409 | `address-archived` | You changed a field on an address that is archived and stays archived. The error's `field` names the first field you changed. |\n| 422 | `missing-required-field` | The address is, or is becoming, the accounts address, and it has no `accountsEmail`. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "description": "The fields to change. Any fields you leave out stay as they are.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddressUpdate"
              },
              "example": {
                "telephone": "+44 117 496 0200"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns the updated address.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Address"
                },
                "example": {
                  "id": "adr7Np3kWqYz5RvBc",
                  "externalRef": null,
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "accountsAddress": true,
                  "companyName": "Acme Engineering Ltd",
                  "line1": "Unit 12, Avonmouth Trading Estate",
                  "line2": "St Andrews Road",
                  "city": "Bristol",
                  "county": null,
                  "postcode": "BS11 9YQ",
                  "countryId": "ctyUnitedKingdom1",
                  "telephone": "+44 117 496 0200",
                  "accountsEmail": "accounts@acme-engineering.example",
                  "eoriNumber": null,
                  "archived": false,
                  "created": "2026-02-11T10:22:31.000Z",
                  "updated": "2026-08-19T16:09:30.000Z"
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/companies/{id}/price-list": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "listCompanyPrices",
        "x-stability": "beta",
        "tags": [
          "Customer prices"
        ],
        "summary": "List a customer's prices",
        "description": "Returns the prices on a customer's price list. Each price is for a stock item from a minimum quantity, and every price is in the customer's currency, which the response names as `currencyId`. A customer can have several price lists, each with the day it takes effect.\n\nBy default, you get the price list in effect today: the one with the latest effective date that isn't after today, in UTC. Send a date as `effectiveDate` to read the price list that takes effect that day, such as one that starts next month, or `all` to read every price list. The date must be one of the days in `effectiveDates`: another date returns an empty page, not the price list in force on it. The response's `effectiveDates` lists the days the customer's price lists take effect. A company with no price list, or none in effect today, returns an empty list.\n\nA `cursor` from the default list belongs to the price list in effect when you got it. When another price list takes effect, at 00:00 UTC on its day, that cursor fails with a `422` error and the code `validation-failed`: start the list again without a cursor.\n\nTo get the one price Omono fills in on a line, call [Retrieve the price for a line](#tag/customer-prices/GET/companies/{id}/price) instead, so your integration uses the same rule as Omono. To find which customers have a price list, call [List all companies](#tag/companies/GET/companies) with `hasPriceList=true`. Changes to a price list don't appear in `GET /events`, so read the list again when you need it. Each price has `created`, the time it was added, which the `created_gte` and `created_lte` filters work on.\n\nRequires the `pricing:read` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 404 | `not-found` | There is no company with this ID. |\n| 422 | `validation-failed` | Your `cursor` came from the default list, and another price list has taken effect since. Start the list again without a cursor. |\n| 422 | `validation-failed` | `effectiveDate` isn't `all` or a date in the format `YYYY-MM-DD`, or is a date that doesn't exist, such as `2026-02-30`. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "effectiveDate",
            "in": "query",
            "description": "Which price list to read: a date in the format `YYYY-MM-DD` for the price list that takes effect that day, or `all` for every price list. Leave it out to read the price list in effect today. A date must be a day a price list takes effect, one of the `effectiveDates` in the response: any other date returns an empty page. To read the price list in force on a date, send the latest of `effectiveDates` that isn't after that date.\n",
            "schema": {
              "type": "string",
              "maxLength": 10,
              "pattern": "^(?:\\d{4}-\\d{2}-\\d{2}|all)$",
              "minLength": 1
            },
            "example": "2026-11-01"
          },
          {
            "name": "stockItemId",
            "in": "query",
            "description": "Only return the prices for this stock item.",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of prices.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerPriceList"
                },
                "example": {
                  "data": [
                    {
                      "id": "cplR4mW9kQx2Ht7Lp",
                      "stockItemId": "stk8Hq2WnR4kLp7Zx",
                      "minQuantity": 1,
                      "price": 12.5,
                      "customerRef": "ACME-VALVE-20",
                      "effectiveDate": "2026-11-01",
                      "created": "2026-10-28T14:02:11.000Z",
                      "updated": "2026-10-28T14:02:11.000Z"
                    },
                    {
                      "id": "cplT8nZ3pWq6Kx2Rm",
                      "stockItemId": "stk8Hq2WnR4kLp7Zx",
                      "minQuantity": 100,
                      "price": 11.25,
                      "customerRef": "ACME-VALVE-20",
                      "effectiveDate": "2026-11-01",
                      "created": "2026-10-28T14:02:40.000Z",
                      "updated": "2026-10-28T14:02:40.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null,
                  "currencyId": "curEURq7Wm2Kx9PzT",
                  "effectiveDates": [
                    "2026-01-01",
                    "2026-11-01",
                    "2027-01-01"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "pricing:read"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ],
        "x-group-parameters": true
      }
    },
    "/companies/{id}/price": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "getCompanyPrice",
        "x-stability": "beta",
        "tags": [
          "Customer prices"
        ],
        "summary": "Retrieve the price for a line",
        "description": "Retrieves the price Omono fills in when you add a stock item to a quote or sales order for this customer, for a quantity. Omono takes the customer's price list in effect today, which is the one with the latest effective date that isn't after today, in UTC. On it, Omono takes the stock item's price with the highest minimum quantity that isn't above `quantity`. If the price list has no such price, or the customer has no price list in effect, Omono uses the stock item's sell price. The price list used is always the one in effect today, whatever the date of the quote or sales order you name.\n\nIf the stock item has no sell price, or can't be sold, `price` is `0` with `source` `stock-sell-price`, as Omono fills in on a new line. A price of 0 on the price list is used as it is. A `price` of 0 means Omono holds no price for the item, so don't send a line at 0 unless you mean it to be free.\n\n`source` says which it is, and `currencyId` says which currency `price` is in. A price-list price is in the customer's currency. A sell price is in your organisation's base currency.\n\nTo get the price to send on a line, name the quote or sales order the line is for in `quoteId` or `salesOrderId`. `linePrice` is then the price in that document's currency, converted and rounded as Omono does it, and `lineCurrencyId` is that currency. Send `linePrice` as the line's `price`, and `discount` as its `discount`. `discount` is always returned: it's 0 for a price-list price, and the customer's sales discount for a sell price. Without a document, `linePrice` and `lineCurrencyId` are `null`. Learn more about [pricing a line](/docs/writing#pricing-a-line).\n\nA quote or sales order in any status can be named: the request only reads it. An archived company or stock item, or a company that isn't a customer, is priced the same way as any other.\n\nRequires the `pricing:read` scope. With `quoteId` or `salesOrderId`, your API key also needs the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 403 | `insufficient-scope` | You sent `quoteId` or `salesOrderId`, and your API key doesn't have the `sales:read` or `sales:write` scope. |\n| 404 | `not-found` | There is no company with this ID, no stock item with the ID in `stockItemId`, or no quote or sales order with the ID in `quoteId` or `salesOrderId`. |\n| 422 | `validation-failed` | `quantity` isn't a number above 0 and up to 1,000,000,000, or has more than 4 decimal places. You sent both `quoteId` and `salesOrderId`. Or the quote or sales order is for another company. |\n",
        "parameters": [
          {
            "name": "stockItemId",
            "in": "query",
            "required": true,
            "description": "The ID of the stock item to price.",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "minLength": 1
            }
          },
          {
            "name": "quantity",
            "in": "query",
            "required": true,
            "description": "The quantity on the line, above 0 and up to 1,000,000,000, with up to 4 decimal places.\n",
            "schema": {
              "type": "number",
              "exclusiveMinimum": 0,
              "maximum": 1000000000
            },
            "example": 10
          },
          {
            "name": "quoteId",
            "in": "query",
            "required": false,
            "description": "The ID of the quote the line is for. The response then has `linePrice` in the quote's currency. Don't send it with `salesOrderId`.\n",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "minLength": 1
            }
          },
          {
            "name": "salesOrderId",
            "in": "query",
            "required": false,
            "description": "The ID of the sales order the line is for. The response then has `linePrice` in the order's currency. Don't send it with `quoteId`.\n",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the price.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinePrice"
                },
                "examples": {
                  "customerPriceList": {
                    "summary": "A price from the customer's price list",
                    "value": {
                      "price": 11.25,
                      "source": "customer-price-list",
                      "currencyId": "curEURq7Wm2Kx9PzT",
                      "effectiveDate": "2026-11-01",
                      "minQuantity": 100,
                      "discount": 0,
                      "linePrice": null,
                      "lineCurrencyId": null
                    }
                  },
                  "stockSellPriceForQuote": {
                    "summary": "The stock item's sell price, for a quote in euros",
                    "value": {
                      "price": 14,
                      "source": "stock-sell-price",
                      "currencyId": "curGBPw3Rk8Nq2XmP",
                      "effectiveDate": null,
                      "minQuantity": null,
                      "discount": 5,
                      "linePrice": 16.28,
                      "lineCurrencyId": "curEURq7Wm2Kx9PzT"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "pricing:read"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/companies/{id}/notes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "listCompanyNotes",
        "x-stability": "beta",
        "tags": [
          "Notes"
        ],
        "summary": "List a company's notes",
        "description": "Returns the notes on a company, newest first. The list has user notes, which people write in Omono or which an API key adds, and system notes, which are the history that Omono writes itself, such as a status change or a changed delivery date. Each note's `kind` says which it is, and the `kind` filter returns one of them. A system note is the record's history as staff see it in Omono, and it can name other records, such as an order number on a stock item.\n\nA new note doesn't change the company's `updated` time. To keep a copy of the notes up to date, read this list again with `created_gte` set to the `created` time of the newest note you have, and skip the notes whose `id` you already have. Learn more about [notes](/docs/reading#notes).\n\nRequires the `companies:read` or `companies:write` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "kind",
            "in": "query",
            "description": "Pass `user` to return only the notes that people wrote or that an API key added, or `system` to return only the notes that Omono wrote itself.\n",
            "schema": {
              "type": "string",
              "enum": [
                "user",
                "system"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of notes.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NoteList"
                },
                "example": {
                  "data": [
                    {
                      "id": "nte8Rq2LmXw4KpZt7",
                      "kind": "user",
                      "text": "Called Priya Shah: the customer wants delivery before 12 December.",
                      "authorName": "API · CRM sync",
                      "userId": "usrApi4Wn8Kq2Lp5X",
                      "apiKeyId": "key7Tz3Mq9Wb2Xc4V",
                      "created": "2026-11-30T14:05:12.000Z"
                    },
                    {
                      "id": "nte5Bc9TyUw1QsVn3",
                      "kind": "system",
                      "text": "Status changed from Draft to Active",
                      "authorName": "Hannah Okafor",
                      "userId": "usr2Pq8Lm4Xw7Kz9R",
                      "apiKeyId": null,
                      "created": "2026-11-28T09:41:37.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:read"
            ]
          },
          {
            "bearerAuth": [
              "companies:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createCompanyNote",
        "x-stability": "beta",
        "tags": [
          "Notes"
        ],
        "summary": "Add a note to a company",
        "description": "Adds a plain-text note to a company. The note appears in the company's notes in Omono, as if someone had written it there. The note's author is the API key, shown as `API · ` and the key's name. You can add a note to a company in any state, archived, closed or cancelled ones included, as staff can in Omono. A note can't be changed or deleted through the API, so check the text before you send it. The returned `text` can differ from the text you sent in two ways: Omono removes spaces and line breaks from the start and end, and replaces a character that isn't valid Unicode. One record can take about 50 notes through the API in any 24 hours: Omono checks the count before it adds the note, so notes sent at the same moment can pass it by a few.\n\nA new note doesn't change the company's `updated` time. Learn more about [adding notes](/docs/writing#notes).\n\nRequires the `companies:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 422 | `validation-failed` | `text` is blank, is longer than 2,000 characters, has more than 50 lines, or contains a control character other than a tab or a line break. |\n| 429 | `rate-limited` | The record already has about 50 notes added through the API in the last 24 hours. This is a daily cap on the record, not a request limit: `Retry-After` gives the seconds until it can take another, which can be many hours. |\n| 429 | `rate-limited` | Your organisation has stored its daily limit of descriptions and notes. `Retry-After` gives the seconds until 00:00 UTC. Learn more about [limits](/docs/limits#stored-descriptions). |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "The note to add.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NoteCreate"
              },
              "example": {
                "text": "Called Priya Shah: the customer wants delivery before 12 December."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new note.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Note"
                },
                "example": {
                  "id": "nte8Rq2LmXw4KpZt7",
                  "kind": "user",
                  "text": "Called Priya Shah: the customer wants delivery before 12 December.",
                  "authorName": "API · CRM sync",
                  "userId": "usrApi4Wn8Kq2Lp5X",
                  "apiKeyId": "key7Tz3Mq9Wb2Xc4V",
                  "created": "2026-11-30T14:05:12.000Z"
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/contacts": {
      "get": {
        "operationId": "listContacts",
        "x-stability": "beta",
        "tags": [
          "Contacts"
        ],
        "summary": "List contacts",
        "description": "Returns a list of the contacts of all your companies. The newest contacts come first unless you choose another order with `sort`.\n\nTo find a person before you create a contact, send `email` or `externalRef`. The email match ignores capital letters and spaces at the start and end of the address. Several contacts can share an address, for example a person who buys for two companies, so the answer is still a list. To list the contacts of some companies, send `companyId`.\n\nTo find people by part of their name, send `search`, as the quick search in Omono does: `search=pri sh` finds Priya Shah. If your text contains `@`, it matches any part of the email address instead, so `search=@acme-engineering.example` finds everyone at that domain. The best matches come first, and the answer has no cursor. Learn more about [search](/docs/reading#search).\n\nTo keep a copy of your contacts, poll this list with `updated_since` and `archived=any`. Learn more about [pagination](/docs/reading#pagination), [filters](/docs/reading#filters), [sorting](/docs/reading#sorting) and [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `companies:read` or `companies:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 422 | `validation-failed` | You sent `search` with `cursor`, `sort`, `updated_since`, `ids`, `created_gte`, `created_lte`, `email` or `externalRef`, or your `search` text is shorter than 2 characters. |\n| 503 | `temporarily-unavailable` | You sent `search`, and Omono's search isn't available just now. Retry after the `Retry-After` delay, or list your contacts without `search`. |\n",
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "required": false,
            "description": "Only return the contacts with this email address. Send one address only. The match ignores capital letters and spaces at the start and end of the address.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 254
            }
          },
          {
            "name": "companyId",
            "in": "query",
            "description": "Only return the contacts of these companies. Send up to 100 company IDs, separated by commas. You can also repeat the parameter, as in `companyId=a&companyId=b`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/SortStandard"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/ExternalRef"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "$ref": "#/components/parameters/Archived"
          },
          {
            "name": "search",
            "in": "query",
            "description": "Only return the contacts whose name matches this text, best matches first. Each word of your text matches the start of a word of the name, ignoring capital letters. The words must be in the same order, with a gap of up to two words between them, so `pri sh` finds Priya Shah and Priya Anne Shah. A text that contains `@` matches any part of the email address instead, ignoring capital letters, and counts as 3 requests against your organisation's limit. Send 2 to 100 characters. You can combine it with `archived`, `companyId` and `limit`. A search has no cursor: `hasMore` is `true` when more records match than the page holds, and to see them, send a longer text or a larger `limit`, up to 200. Learn more about [search](/docs/reading#search).\n",
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of contacts. The page is empty when no contact matches your filters.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactList"
                },
                "example": {
                  "data": [
                    {
                      "id": "cnt4Kj9mQdPw2XhTe",
                      "externalRef": null,
                      "companyId": "b2FpLmNvbXBhbnkQQ",
                      "firstName": "Priya",
                      "lastName": "Shah",
                      "fullName": "Priya Shah",
                      "email": "priya.shah@acme-engineering.example",
                      "jobTitle": "Procurement Manager",
                      "departmentId": "dptEngineering7Kq",
                      "telephone1": "+44 117 496 0102",
                      "telephone2": null,
                      "addressId": "adr7Np3kWqYz5RvBc",
                      "archived": false,
                      "created": "2026-02-11T10:22:31.000Z",
                      "updated": "2026-06-02T08:15:09.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:read"
            ]
          },
          {
            "bearerAuth": [
              "companies:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ],
        "x-group-parameters": true
      }
    },
    "/quotes": {
      "get": {
        "operationId": "listQuotes",
        "x-stability": "stable",
        "tags": [
          "Quotes"
        ],
        "summary": "List all quotes",
        "description": "Returns a list of your quotes. The newest quotes come first unless you choose another order with `sort`.\n\nA quote can have several revisions. Each revision is a version of the quote with its own details and line items, and staff create a new one in Omono when a quote changes after it has been sent. Each quote in the list shows the details of its presented revision: the revision the customer accepted if the quote is won and turned into a sales order, and otherwise the latest revision. To get each quote's line items in the same response, add `include=lineItems`.\n\nQuotes can't be archived, so this list has no `archived` filter.\n\nLearn more about [pagination](/docs/reading#pagination), [filters](/docs/reading#filters), [sorting](/docs/reading#sorting), [including related records](/docs/reading#include) and [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `document-too-large` | You asked for line items, and the first quote on the page has more than 10,000 line items and BOM items, or comes to more than 32 MB of JSON with them. Leave out `include` to page past it, and read that quote in Omono. |\n| 422 | `validation-failed` | Your `quoteNo` starts with \"SQ-\", in any case. Send the number without the prefix, such as `1042` for quote SQ-1042. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/SortStandard"
          },
          {
            "$ref": "#/components/parameters/IncludeLineItems"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/ExternalRef"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "status",
            "in": "query",
            "description": "Only return quotes with these statuses. Send one or more statuses, separated by commas: `draft`, `active`, `won` or `lost`. For example, `status=draft,active` returns the quotes that are still open. You can also repeat the parameter, as in `status=draft&status=active`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "$ref": "#/components/schemas/KnownQuoteStatus"
              },
              "minItems": 1
            }
          },
          {
            "name": "companyId",
            "in": "query",
            "description": "Only return quotes for these customers. Send up to 100 company IDs, separated by commas. You can also repeat the parameter, as in `companyId=a&companyId=b`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "quoteNo",
            "in": "query",
            "description": "Only return the quote with exactly this number. Send one number only, without the \"SQ-\" prefix that Omono shows, exactly as it appears in `quoteNo`. A number that starts with \"SQ-\", in any case, fails with a `422` error and the code `validation-failed` on the field `quoteNo`.\n",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of quotes.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuoteList"
                },
                "example": {
                  "data": [
                    {
                      "id": "qteWn8kP4mXz2JhRv",
                      "externalRef": null,
                      "quoteNo": "0961",
                      "companyId": "b2FpLmNvbXBhbnkQQ",
                      "currencyId": "curGBPqk2j9x4mWpT",
                      "status": "active",
                      "salesPersonId": "usrJaneDoe4Kq9mWt",
                      "contactId": "cnt4Kj9mQdPw2XhTe",
                      "addressId": "adr7Np3kWqYz5RvBc",
                      "customerCollection": false,
                      "refNo": "RFQ-2288",
                      "delivery": "4 weeks from order",
                      "validityId": "vld30DaysStandard",
                      "chaseBy": "2026-08-28",
                      "exchangeRate": 1,
                      "eoriNumberId": null,
                      "incotermId": null,
                      "incotermNamedPlace": null,
                      "conversionProbabilityId": "cvp75PctLikely9Qz",
                      "expectedAwardDate": "2026-09-15",
                      "enquiryReceivedDate": "2026-08-01",
                      "commissionId": null,
                      "divisionId": "divNorthOffice3Qz",
                      "totalValue": 4180,
                      "totalValueBase": 4180,
                      "lostReasonId": null,
                      "salesOrderId": null,
                      "salesOrderNo": null,
                      "revisions": [
                        {
                          "id": "rev2Xk9mQpWz4NhTb",
                          "revisionNo": 0,
                          "label": "Original",
                          "isLatest": false,
                          "isWon": false,
                          "totalValue": 3950,
                          "created": "2026-08-04T11:20:05.000Z"
                        },
                        {
                          "id": "revB7kQ2mXw9PzRj4",
                          "revisionNo": 1,
                          "label": "A",
                          "isLatest": true,
                          "isWon": false,
                          "totalValue": 4180,
                          "created": "2026-08-12T09:31:47.000Z"
                        }
                      ],
                      "created": "2026-08-04T11:20:05.000Z",
                      "updated": "2026-08-12T09:31:47.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createQuote",
        "x-stability": "beta",
        "tags": [
          "Quotes"
        ],
        "summary": "Create a quote",
        "description": "Creates a quote. The new quote starts as a Draft, and you can send its line items in `lineItems` in the same request.\n\nThe new quote has one revision, its original version. A revision is a version of the quote with its own details and line items, and staff add new revisions in Omono when a quote changes after it has been sent.\n\nThe company must be a customer with an account manager, which is the user who looks after the customer's account. You can't change the company later. If the customer collects the goods (`customerCollection` is `true`), leave out `addressId` or send the customer's accounts address. Your organisation's settings can make `chaseBy` and `expectedAwardDate` required. Each new line item needs a stock item that you sell and that isn't archived.\n\nOmono fills in fields you leave out, as its own forms do. For example, the division and commission come from the customer, and `enquiryReceivedDate` is today. Every line item is checked before anything is saved, so if a check fails, you get an error that names the line item, nothing is saved and no quote number is used.\n\nThe new quote stays a Draft until you activate it with `POST /quotes/{id}/activate`. If your organisation uses task automation, Omono also creates the quote's chase-date and award-date tasks, as it does for quotes created in Omono.\n\nLearn more about [creating a document with line items](/docs/writing#creating-a-document-with-lines), [prefilled fields](/docs/writing#prefilled-fields), [what to do if a create fails](/docs/writing#if-a-create-fails) and [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 404 | `not-found` | Someone deleted the new Draft in Omono while your request was still saving it. This is rare. Retry with the same `Idempotency-Key`. |\n| 409 | `company-archived` | The customer is archived. |\n| 409 | `create-incomplete` | You retried a create with the same `Idempotency-Key`, and the Draft that the first attempt left has been changed since. Finish the Draft that `keptDocument` names instead of creating it again. |\n| 422 | `invalid-reference` | The company isn't a customer, or a contact, address, user, stock item or other ID you sent can't be used, for example because it's archived. A line item's stock item that you don't sell causes this error too. |\n| 422 | `missing-required-field` | You left out a required field, such as `addressId` on a quote that isn't for customer collection. You also get this error if the customer has no account manager, when the error names `companyId`, or if a field your organisation requires is missing, such as `chaseBy`. |\n| 422 | `missing-exempt-tax-rate` | A line item's stock item is tax-exempt, but your organisation has no exempt tax rate. |\n| 422 | `validation-failed` | A date is out of range, for example `chaseBy` is before today. Or your line items and the BOM items their assemblies bring add up to more than 1,000. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteCreate"
              },
              "example": {
                "companyId": "b2FpLmNvbXBhbnkQQ",
                "contactId": "cnt4Kj9mQdPw2XhTe",
                "addressId": "adr7Np3kWqYz5RvBc",
                "salesPersonId": "usrJaneDoe4Kq9mWt",
                "validityId": "vld30DaysStandard",
                "refNo": "RFQ-2301",
                "delivery": "6 weeks from order",
                "chaseBy": "2030-01-15",
                "exchangeRate": 1,
                "conversionProbabilityId": "cvp75PctLikely9Qz",
                "expectedAwardDate": "2030-02-01",
                "enquiryReceivedDate": "2026-08-18",
                "divisionId": "divNorthOffice3Qz",
                "lineItems": [
                  {
                    "stockItemId": "stkFlangeDN50PN16",
                    "quantity": 20,
                    "price": 209,
                    "leadTime": "4 weeks",
                    "commodityCodeId": "cmc84818059000Xk2",
                    "countryOfOriginId": "ctyUnitedKingdom1"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new quote, including its line items. It also includes `createdLineItems`, which gives the ID of the line item created from each entry in your `lineItems` array.\n",
            "headers": {
              "Location": {
                "$ref": "#/components/headers/Location"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuoteCreated"
                },
                "example": {
                  "id": "qteNew5Tk8wQz2MvX",
                  "externalRef": null,
                  "quoteNo": "0972",
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "currencyId": "curGBPqk2j9x4mWpT",
                  "status": "draft",
                  "salesPersonId": "usrJaneDoe4Kq9mWt",
                  "contactId": "cnt4Kj9mQdPw2XhTe",
                  "addressId": "adr7Np3kWqYz5RvBc",
                  "customerCollection": false,
                  "refNo": "RFQ-2301",
                  "delivery": "6 weeks from order",
                  "validityId": "vld30DaysStandard",
                  "chaseBy": "2030-01-15",
                  "exchangeRate": 1,
                  "eoriNumberId": "eorGB123456789000",
                  "incotermId": null,
                  "incotermNamedPlace": null,
                  "conversionProbabilityId": "cvp75PctLikely9Qz",
                  "expectedAwardDate": "2030-02-01",
                  "enquiryReceivedDate": "2026-08-18",
                  "commissionId": null,
                  "divisionId": "divNorthOffice3Qz",
                  "totalValue": 4180,
                  "totalValueBase": 4180,
                  "lostReasonId": null,
                  "salesOrderId": null,
                  "salesOrderNo": null,
                  "revisions": [
                    {
                      "id": "revNew8Qk3mWz7PtX",
                      "revisionNo": 0,
                      "label": "Original",
                      "isLatest": true,
                      "isWon": false,
                      "totalValue": 4180,
                      "created": "2026-08-19T16:12:03.000Z"
                    }
                  ],
                  "lineItems": [
                    {
                      "id": "qliNewQuoteLine5Kq",
                      "externalRef": null,
                      "stockItemId": "stkFlangeDN50PN16",
                      "description": "Flange DN50 PN16, 316L stainless",
                      "quantity": 20,
                      "unitPrice": 209,
                      "price": 209,
                      "discount": 0,
                      "taxRateId": "trx20pcVATkQ9m3Zd",
                      "salesAnalysisId": "sac5MachinedParts",
                      "tagNumber": null,
                      "lastCost": 125.4,
                      "margin": 40,
                      "leadTime": "4 weeks",
                      "commodityCodeId": "cmc84818059000Xk2",
                      "countryOfOriginId": "ctyUnitedKingdom1",
                      "bomItems": [],
                      "created": "2026-08-19T16:12:03.187Z",
                      "updated": "2026-08-19T16:12:03.187Z"
                    }
                  ],
                  "created": "2026-08-19T16:12:03.000Z",
                  "updated": "2026-08-19T16:12:03.187Z",
                  "createdLineItems": [
                    {
                      "index": 0,
                      "id": "qliNewQuoteLine5Kq"
                    }
                  ]
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/quotes/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "getQuote",
        "x-stability": "stable",
        "tags": [
          "Quotes"
        ],
        "summary": "Retrieve a quote",
        "description": "Retrieves a quote, including the line items of its presented revision.\n\nA quote can have several revisions. Each revision is a version of the quote with its own details and line items, and staff create a new one in Omono when a quote changes after it has been sent. The quote's fields and line items come from its presented revision: the revision the customer accepted if the quote is won and turned into a sales order, and otherwise the latest revision. `revisions` lists every revision.\n\nThe response always includes `lineItems`, so you don't need to ask for them. You can send `include=lineItems`, but it makes no difference here.\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `document-too-large` | The quote has more than 10,000 line items and BOM items, or comes to more than 32 MB of JSON with them, which is more than one response can carry. Read it in Omono instead. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          },
          {
            "$ref": "#/components/parameters/IncludeLineItems"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the quote, including the details and line items of its presented revision.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuoteWithLineItems"
                },
                "example": {
                  "id": "qteWn8kP4mXz2JhRv",
                  "externalRef": null,
                  "quoteNo": "0961",
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "currencyId": "curGBPqk2j9x4mWpT",
                  "status": "active",
                  "salesPersonId": "usrJaneDoe4Kq9mWt",
                  "contactId": "cnt4Kj9mQdPw2XhTe",
                  "addressId": "adr7Np3kWqYz5RvBc",
                  "customerCollection": false,
                  "refNo": "RFQ-2288",
                  "delivery": "4 weeks from order",
                  "validityId": "vld30DaysStandard",
                  "chaseBy": "2026-08-28",
                  "exchangeRate": 1,
                  "eoriNumberId": null,
                  "incotermId": null,
                  "incotermNamedPlace": null,
                  "conversionProbabilityId": "cvp75PctLikely9Qz",
                  "expectedAwardDate": "2026-09-15",
                  "enquiryReceivedDate": "2026-08-01",
                  "commissionId": null,
                  "divisionId": "divNorthOffice3Qz",
                  "totalValue": 4180,
                  "totalValueBase": 4180,
                  "lostReasonId": null,
                  "salesOrderId": null,
                  "salesOrderNo": null,
                  "revisions": [
                    {
                      "id": "rev2Xk9mQpWz4NhTb",
                      "revisionNo": 0,
                      "label": "Original",
                      "isLatest": false,
                      "isWon": false,
                      "totalValue": 3950,
                      "created": "2026-08-04T11:20:05.000Z"
                    },
                    {
                      "id": "revB7kQ2mXw9PzRj4",
                      "revisionNo": 1,
                      "label": "A",
                      "isLatest": true,
                      "isWon": false,
                      "totalValue": 4180,
                      "created": "2026-08-12T09:31:47.000Z"
                    }
                  ],
                  "lineItems": [
                    {
                      "id": "qliFlange50x8Kq2M",
                      "externalRef": null,
                      "stockItemId": "stkFlangeDN50PN16",
                      "description": "Flange DN50 PN16, 316L stainless",
                      "quantity": 20,
                      "unitPrice": 209,
                      "price": 209,
                      "discount": 0,
                      "taxRateId": "trx20pcVATkQ9m3Zd",
                      "salesAnalysisId": "sac5MachinedParts",
                      "tagNumber": null,
                      "lastCost": 125.4,
                      "margin": 40,
                      "leadTime": "4 weeks",
                      "commodityCodeId": "cmc84818059000Xk2",
                      "countryOfOriginId": "ctyUnitedKingdom1",
                      "bomItems": [],
                      "created": "2026-08-04T11:24:40.000Z",
                      "updated": "2026-08-12T09:31:47.000Z"
                    }
                  ],
                  "created": "2026-08-04T11:20:05.000Z",
                  "updated": "2026-08-12T09:31:47.000Z"
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ]
      },
      "patch": {
        "operationId": "updateQuote",
        "x-stability": "beta",
        "tags": [
          "Quotes"
        ],
        "summary": "Update a quote",
        "description": "Updates a quote. Any fields you leave out stay as they are.\n\nA quote can have several revisions, each a version of the quote with its own details and line items. An update always changes the latest revision. You can't create a new revision through the API, because staff do that in Omono. You also can't change the quote's company, and Won and Lost quotes are locked.\n\nTo change line items, send `lineItems` as a list of changes, and send the ETag from your last read in the `If-Match` header. Every line item is checked before any is saved. Omono fills in new line items as it does on a create, and each new line item needs a stock item that you sell. Existing line items aren't checked again. The list never changes the order of the line items: a line item you change keeps its place, and new line items go at the end. To reorder the line items, send `lineItemOrder` with every line item's ID in the order you want, together with `If-Match`.\n\nIf you change a date, the new date must be within its allowed range, which each field describes. You can always send back a date that's already stored, even if it's now out of range. A request that changes nothing, such as an empty body (`{}`) or the quote's current values sent back, returns the quote unchanged, even when it's Won or Lost. If your request doesn't change anything, for example because it sends back values the quote already has, Omono doesn't save the quote, so its `updated` time and ETag stay the same.\n\nLearn more about [changing line items](/docs/writing#line-changes), [the rules for every write](/docs/writing#the-rules-for-every-write) and [prefilled fields](/docs/writing#prefilled-fields).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `quote-locked` | The quote is Won or Lost, and your request would change it. A request that changes nothing, such as the quote's current values sent back, succeeds. |\n| 409 | `quote-revision-stale` | Someone created a new revision in Omono while your request was running. Read the quote again and apply your change to its latest revision. |\n| 409 | `immutable-field` | You tried to change the stock item of an existing line item. |\n| 409 | `document-too-large` | The quote would have more than 10,000 line items and BOM items, counting the new line items in your `lineItems` and the BOM items that new assembly line items bring. That's more than one response can carry, so nothing changes. Change the quote in Omono instead. |\n| 422 | `invalid-reference` | A new line item's stock item isn't one you sell, or the customer collects the goods and the address you sent isn't the customer's accounts address. You also get this error if an ID in `lineItems` or `lineItemOrder` isn't one of the latest revision's line items. |\n| 422 | `missing-required-field` | Your organisation requires `chaseBy` or `expectedAwardDate`, and the quote would be left without it. That happens when you clear it, or when you send any field except `lineItems`, `lineItemOrder` and `externalRef`, even an unchanged one, to a quote that doesn't have it. Send the date in the same request. |\n| 422 | `missing-exempt-tax-rate` | A line item's stock item is tax-exempt, but your organisation has no exempt tax rate. |\n| 422 | `unknown-field` | You sent `companyId`. The customer can't change. |\n| 422 | `validation-failed` | A date you changed is out of range, or you sent `lineItems` or `lineItemOrder` for a quote that already has more than 250 line items. You can still change the quote's other fields, and staff can edit its line items in Omono. You also get this error if your line items and the BOM items their assemblies bring add up to more than 1,000, or if `lineItemOrder` leaves out a line item, names one twice or names one you delete. |\n| 503 | `temporarily-unavailable` | You sent `lineItems` or `lineItemOrder`, and another request is still changing this quote's line items, or marking it won or lost, after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteUpdate"
              },
              "example": {
                "chaseBy": "2030-01-22",
                "lineItems": [
                  {
                    "id": "qliFlange50x8Kq2M",
                    "stockItemId": "stkFlangeDN50PN16",
                    "description": "Flange DN50 PN16, 316L stainless",
                    "quantity": 25,
                    "unitPrice": 205,
                    "price": 205,
                    "discount": 0,
                    "taxRateId": "trx20pcVATkQ9m3Zd",
                    "salesAnalysisId": "sac5MachinedParts",
                    "leadTime": "4 weeks"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns the updated quote, including its line items. If you sent `lineItems`, the response also includes `createdLineItems`, which gives the ID of each line item you added.\n",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuoteUpdated"
                },
                "example": {
                  "id": "qteWn8kP4mXz2JhRv",
                  "externalRef": null,
                  "quoteNo": "0961",
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "currencyId": "curGBPqk2j9x4mWpT",
                  "status": "active",
                  "salesPersonId": "usrJaneDoe4Kq9mWt",
                  "contactId": "cnt4Kj9mQdPw2XhTe",
                  "addressId": "adr7Np3kWqYz5RvBc",
                  "customerCollection": false,
                  "refNo": "RFQ-2288",
                  "delivery": "4 weeks from order",
                  "validityId": "vld30DaysStandard",
                  "chaseBy": "2030-01-22",
                  "exchangeRate": 1,
                  "eoriNumberId": null,
                  "incotermId": null,
                  "incotermNamedPlace": null,
                  "conversionProbabilityId": "cvp75PctLikely9Qz",
                  "expectedAwardDate": "2026-09-15",
                  "enquiryReceivedDate": "2026-08-01",
                  "commissionId": null,
                  "divisionId": "divNorthOffice3Qz",
                  "totalValue": 5125,
                  "totalValueBase": 5125,
                  "lostReasonId": null,
                  "salesOrderId": null,
                  "salesOrderNo": null,
                  "revisions": [
                    {
                      "id": "rev2Xk9mQpWz4NhTb",
                      "revisionNo": 0,
                      "label": "Original",
                      "isLatest": false,
                      "isWon": false,
                      "totalValue": 3950,
                      "created": "2026-08-04T11:20:05.000Z"
                    },
                    {
                      "id": "revB7kQ2mXw9PzRj4",
                      "revisionNo": 1,
                      "label": "A",
                      "isLatest": true,
                      "isWon": false,
                      "totalValue": 5125,
                      "created": "2026-08-12T09:31:47.000Z"
                    }
                  ],
                  "lineItems": [
                    {
                      "id": "qliFlange50x8Kq2M",
                      "externalRef": null,
                      "stockItemId": "stkFlangeDN50PN16",
                      "description": "Flange DN50 PN16, 316L stainless",
                      "quantity": 25,
                      "unitPrice": 205,
                      "price": 205,
                      "discount": 0,
                      "taxRateId": "trx20pcVATkQ9m3Zd",
                      "salesAnalysisId": "sac5MachinedParts",
                      "tagNumber": null,
                      "lastCost": 123,
                      "margin": 40,
                      "leadTime": "4 weeks",
                      "commodityCodeId": "cmc84818059000Xk2",
                      "countryOfOriginId": "ctyUnitedKingdom1",
                      "bomItems": [],
                      "created": "2026-08-04T11:24:40.000Z",
                      "updated": "2026-08-19T16:15:27.000Z"
                    }
                  ],
                  "created": "2026-08-04T11:20:05.000Z",
                  "updated": "2026-08-19T16:15:27.000Z",
                  "createdLineItems": []
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "428": {
            "$ref": "#/components/responses/PreconditionRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      },
      "delete": {
        "operationId": "deleteQuote",
        "x-stability": "beta",
        "tags": [
          "Quotes"
        ],
        "summary": "Delete a draft quote",
        "description": "Deletes a Draft quote, as deleting it in Omono does. Its line items, notes and files go with it, and so do the tasks linked to it. You can delete a quote only while it's a Draft with one revision. Omono doesn't use its number again.\n\nSend the quote's `ETag` in `If-Match`, so that you never delete a quote that someone changed after you read it. Don't send `If-Match: *`. The response has no body. A quote that's already deleted returns `404`, so a retry after a lost response is safe. The deleted records appear in [`GET /events`](/docs/syncing#deletes).\n\nOmono deletes every line item of the quote, with their BOM items. So against your rate limits, a delete counts as one write for every 10 of those line items and BOM items, rounded up. A delete refused by its checks counts as 1. Learn more about [deleting](/docs/writing#deleting) and [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `not-a-draft` | The quote isn't a Draft. |\n| 409 | `quote-has-revisions` | The quote is a Draft with more than one revision. |\n| 412 | `precondition-failed` | The quote has changed since you read it. Nothing was deleted. |\n| 428 | `precondition-required` | You didn't send `If-Match`. |\n| 503 | `temporarily-unavailable` | Another request is still changing this quote's line items, marking it won or lost, reactivating it or deleting it, after 5 seconds. Or other saves in Omono kept changing the quote while Omono tried to delete it. Nothing was deleted. Read the quote again, and retry with its new `ETag` after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfMatchDelete"
          }
        ],
        "responses": {
          "204": {
            "description": "The quote is deleted.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "428": {
            "$ref": "#/components/responses/PreconditionRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/quotes/{id}/activate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "operationId": "activateQuote",
        "x-stability": "beta",
        "tags": [
          "Quotes"
        ],
        "summary": "Activate a quote",
        "description": "Activates a Draft quote, which moves it to Active.\n\nQuotes you create through the API start as Drafts. In Omono, a quote becomes Active when someone emails, downloads or prints it. This request does the same without producing a PDF, and it doesn't send an email. Once the quote is Active, you can mark it as won or lost, through the API or in Omono.\n\nOmono adds an entry to the activity feed that starts \"created SQ-\" and the quote number. If staff have revised the quote in Omono, so that it has more than one revision, the entry starts \"revised SQ-\" instead. The entry shows your API key as the one who made the change.\n\nThe quote's latest revision must have at least one line item. Send the request without a body. Omono ignores any body you send. If the quote is already Active, nothing changes and the response has `\"applied\": false`, so it's safe to retry.\n\nLearn more about [lifecycle actions](/docs/writing#lifecycle-actions) and [how your changes appear in Omono](/docs/getting-started#how-your-changes-appear-in-omono).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `quote-locked` | The quote is Won or Lost. |\n| 409 | `no-line-items` | The quote's latest revision has no line items. The error names `lineItems`. |\n| 409 | `document-too-large` | The quote has more than 10,000 line items and BOM items, which is more than one response can carry, so nothing changes. Activate the quote in Omono instead. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns `applied` and the quote as it is now. `applied` is `false` if the quote was already Active.\n",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuoteActionResult"
                },
                "example": {
                  "applied": true,
                  "quote": {
                    "id": "qteNew5Tk8wQz2MvX",
                    "externalRef": null,
                    "quoteNo": "0972",
                    "companyId": "b2FpLmNvbXBhbnkQQ",
                    "currencyId": "curGBPqk2j9x4mWpT",
                    "status": "active",
                    "salesPersonId": "usrJaneDoe4Kq9mWt",
                    "contactId": "cnt4Kj9mQdPw2XhTe",
                    "addressId": "adr7Np3kWqYz5RvBc",
                    "customerCollection": false,
                    "refNo": "RFQ-2301",
                    "delivery": "6 weeks from order",
                    "validityId": "vld30DaysStandard",
                    "chaseBy": "2030-01-15",
                    "exchangeRate": 1,
                    "eoriNumberId": "eorGB123456789000",
                    "incotermId": null,
                    "incotermNamedPlace": null,
                    "conversionProbabilityId": "cvp75PctLikely9Qz",
                    "expectedAwardDate": "2030-02-01",
                    "enquiryReceivedDate": "2026-08-18",
                    "commissionId": null,
                    "divisionId": "divNorthOffice3Qz",
                    "totalValue": 4180,
                    "totalValueBase": 4180,
                    "lostReasonId": null,
                    "salesOrderId": null,
                    "salesOrderNo": null,
                    "revisions": [
                      {
                        "id": "revNew8Qk3mWz7PtX",
                        "revisionNo": 0,
                        "label": "Original",
                        "isLatest": true,
                        "isWon": false,
                        "totalValue": 4180,
                        "created": "2026-08-19T16:12:03.000Z"
                      }
                    ],
                    "lineItems": [
                      {
                        "id": "qliNewQuoteLine5Kq",
                        "externalRef": null,
                        "stockItemId": "stkFlangeDN50PN16",
                        "description": "Flange DN50 PN16, 316L stainless",
                        "quantity": 20,
                        "unitPrice": 209,
                        "price": 209,
                        "discount": 0,
                        "taxRateId": "trx20pcVATkQ9m3Zd",
                        "salesAnalysisId": "sac5MachinedParts",
                        "tagNumber": null,
                        "lastCost": 125.4,
                        "margin": 40,
                        "leadTime": "4 weeks",
                        "commodityCodeId": "cmc84818059000Xk2",
                        "countryOfOriginId": "ctyUnitedKingdom1",
                        "bomItems": [],
                        "created": "2026-08-19T16:12:03.187Z",
                        "updated": "2026-08-19T16:12:03.187Z"
                      }
                    ],
                    "created": "2026-08-19T16:12:03.000Z",
                    "updated": "2026-08-19T17:05:10.000Z"
                  }
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/quotes/{id}/mark-won": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "operationId": "markQuoteWon",
        "x-stability": "beta",
        "tags": [
          "Quotes"
        ],
        "summary": "Mark a quote as won",
        "description": "Marks an Active quote as won, as the **Won** action does in Omono. Omono creates a sales order from the quote, with the quote's line items, BOM items and prices, and the quote's status becomes `won`. The new order is a Draft, and the quote's `salesOrderId` names it.\n\nTo use a revision other than the latest, send its ID as `revisionId`. Any revision of the quote can be won. Send `customerOrderNo` to give the order the customer's own reference. It's required if your organisation's settings say so.\n\nThe new order has no dispatches. Before you activate it, add dispatches that cover every line item with [Create a dispatch](#tag/dispatches), as Omono requires. Learn more in [Push orders into Omono](/docs/recipes#1-push-orders-in-for-example-from-a-web-shop).\n\nOmono adds notes to the quote and the order, closes the quote's automatic follow-up tasks, and adds an entry to the activity feed.\n\nIt's safe to retry. If the quote is already won and has its sales order, nothing changes and the response has `\"applied\": false`. If the quote is won but has no sales order, Omono creates the order and the response has `\"applied\": true`. This happens when an earlier request failed part of the way through, or when someone deleted the order in Omono. In this case Omono doesn't check `If-Match`, because the request that failed has already changed the quote's ETag. If the failed request got as far as creating a sales order, that Draft order stays in Omono. Its `quoteId` names the quote, but the quote's `salesOrderId` doesn't name it. You can delete it in Omono.\n\nLearn more about [lifecycle actions](/docs/writing#lifecycle-actions).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `quote-not-active` | The quote is a Draft. Activate it first. |\n| 409 | `quote-locked` | The quote is Lost. |\n| 409 | `no-line-items` | The revision you're marking as won has no line items, so Omono can't make a sales order from it. The error names `lineItems`. Add line items with a `PATCH`, or name another revision. |\n| 409 | `document-too-large` | The quote has more than 10,000 line items and BOM items, which is more than one response can carry, so nothing changes. Mark the quote as won in Omono instead. |\n| 422 | `invalid-reference` | `revisionId` isn't a revision of this quote. |\n| 422 | `missing-required-field` | Your organisation's settings require a customer order reference, and you didn't send `customerOrderNo`. |\n| 503 | `temporarily-unavailable` | Another request is changing this quote. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteMarkWon"
              },
              "example": {
                "customerOrderNo": "PO-88231"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns `applied` and the quote as it is now, with `salesOrderId` naming the new sales order. `applied` is `false` if the quote was already won and had its sales order.\n",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuoteActionResult"
                },
                "example": {
                  "applied": true,
                  "quote": {
                    "id": "qteNew5Tk8wQz2MvX",
                    "externalRef": null,
                    "quoteNo": "0972",
                    "companyId": "b2FpLmNvbXBhbnkQQ",
                    "currencyId": "curGBPqk2j9x4mWpT",
                    "status": "won",
                    "salesPersonId": "usrJaneDoe4Kq9mWt",
                    "contactId": "cnt4Kj9mQdPw2XhTe",
                    "addressId": "adr7Np3kWqYz5RvBc",
                    "customerCollection": false,
                    "refNo": "RFQ-2301",
                    "delivery": "6 weeks from order",
                    "validityId": "vld30DaysStandard",
                    "chaseBy": "2030-01-15",
                    "exchangeRate": 1,
                    "eoriNumberId": "eorGB123456789000",
                    "incotermId": null,
                    "incotermNamedPlace": null,
                    "conversionProbabilityId": "cvp75PctLikely9Qz",
                    "expectedAwardDate": "2030-02-01",
                    "enquiryReceivedDate": "2026-08-18",
                    "commissionId": null,
                    "divisionId": "divNorthOffice3Qz",
                    "totalValue": 4180,
                    "totalValueBase": 4180,
                    "lostReasonId": null,
                    "salesOrderId": "ord5Rk8WnQp2JxLmT",
                    "salesOrderNo": "1043",
                    "revisions": [
                      {
                        "id": "revNew8Qk3mWz7PtX",
                        "revisionNo": 0,
                        "label": "Original",
                        "isLatest": true,
                        "isWon": true,
                        "totalValue": 4180,
                        "created": "2026-08-19T16:12:03.000Z"
                      }
                    ],
                    "lineItems": [
                      {
                        "id": "qliNewQuoteLine5Kq",
                        "externalRef": null,
                        "stockItemId": "stkFlangeDN50PN16",
                        "description": "Flange DN50 PN16, 316L stainless",
                        "quantity": 20,
                        "unitPrice": 209,
                        "price": 209,
                        "discount": 0,
                        "taxRateId": "trx20pcVATkQ9m3Zd",
                        "salesAnalysisId": "sac5MachinedParts",
                        "tagNumber": null,
                        "lastCost": 125.4,
                        "margin": 40,
                        "leadTime": "4 weeks",
                        "commodityCodeId": "cmc84818059000Xk2",
                        "countryOfOriginId": "ctyUnitedKingdom1",
                        "bomItems": [],
                        "created": "2026-08-19T16:12:03.187Z",
                        "updated": "2026-08-19T16:12:03.187Z"
                      }
                    ],
                    "created": "2026-08-19T16:12:03.000Z",
                    "updated": "2026-08-19T17:05:10.000Z"
                  }
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/quotes/{id}/mark-lost": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "operationId": "markQuoteLost",
        "x-stability": "beta",
        "tags": [
          "Quotes"
        ],
        "summary": "Mark a quote as lost",
        "description": "Marks an Active quote as lost, as the **Lost** action does in Omono. Send the reason the customer gave as `lostReasonId`, one of your reasons from [List all lost-quote reasons](#tag/sales-settings). The quote's status becomes `lost`, and its `lostReasonId` is the reason you sent.\n\nOmono adds a note to the quote, closes the quote's automatic follow-up tasks, and adds an entry to the activity feed. If the quote is already lost, nothing changes and the response has `\"applied\": false`, so it's safe to retry. The reason stays as it was: to change it, [reactivate the quote](#tag/quotes/POST/quotes/{id}/reactivate), then mark it as lost again with the new reason.\n\nLearn more about [lifecycle actions](/docs/writing#lifecycle-actions).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `quote-not-active` | The quote is a Draft. Activate it first. |\n| 409 | `quote-locked` | The quote is Won. |\n| 409 | `document-too-large` | The quote has more than 10,000 line items and BOM items, which is more than one response can carry, so nothing changes. Mark the quote as lost in Omono instead. |\n| 422 | `invalid-reference` | `lostReasonId` isn't one of your lost-quote reasons, or the reason is archived. |\n| 503 | `temporarily-unavailable` | Another request is changing this quote. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteMarkLost"
              },
              "example": {
                "lostReasonId": "lqrPriceTooHigh4Kq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns `applied` and the quote as it is now. `applied` is `false` if the quote was already lost.\n",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuoteActionResult"
                },
                "example": {
                  "applied": true,
                  "quote": {
                    "id": "qteNew5Tk8wQz2MvX",
                    "externalRef": null,
                    "quoteNo": "0972",
                    "companyId": "b2FpLmNvbXBhbnkQQ",
                    "currencyId": "curGBPqk2j9x4mWpT",
                    "status": "lost",
                    "salesPersonId": "usrJaneDoe4Kq9mWt",
                    "contactId": "cnt4Kj9mQdPw2XhTe",
                    "addressId": "adr7Np3kWqYz5RvBc",
                    "customerCollection": false,
                    "refNo": "RFQ-2301",
                    "delivery": "6 weeks from order",
                    "validityId": "vld30DaysStandard",
                    "chaseBy": "2030-01-15",
                    "exchangeRate": 1,
                    "eoriNumberId": "eorGB123456789000",
                    "incotermId": null,
                    "incotermNamedPlace": null,
                    "conversionProbabilityId": "cvp75PctLikely9Qz",
                    "expectedAwardDate": "2030-02-01",
                    "enquiryReceivedDate": "2026-08-18",
                    "commissionId": null,
                    "divisionId": "divNorthOffice3Qz",
                    "totalValue": 4180,
                    "totalValueBase": 4180,
                    "lostReasonId": "lqrPriceTooHigh4Kq",
                    "salesOrderId": null,
                    "salesOrderNo": null,
                    "revisions": [
                      {
                        "id": "revNew8Qk3mWz7PtX",
                        "revisionNo": 0,
                        "label": "Original",
                        "isLatest": true,
                        "isWon": false,
                        "totalValue": 4180,
                        "created": "2026-08-19T16:12:03.000Z"
                      }
                    ],
                    "lineItems": [
                      {
                        "id": "qliNewQuoteLine5Kq",
                        "externalRef": null,
                        "stockItemId": "stkFlangeDN50PN16",
                        "description": "Flange DN50 PN16, 316L stainless",
                        "quantity": 20,
                        "unitPrice": 209,
                        "price": 209,
                        "discount": 0,
                        "taxRateId": "trx20pcVATkQ9m3Zd",
                        "salesAnalysisId": "sac5MachinedParts",
                        "tagNumber": null,
                        "lastCost": 125.4,
                        "margin": 40,
                        "leadTime": "4 weeks",
                        "commodityCodeId": "cmc84818059000Xk2",
                        "countryOfOriginId": "ctyUnitedKingdom1",
                        "bomItems": [],
                        "created": "2026-08-19T16:12:03.187Z",
                        "updated": "2026-08-19T16:12:03.187Z"
                      }
                    ],
                    "created": "2026-08-19T16:12:03.000Z",
                    "updated": "2026-08-19T17:05:10.000Z"
                  }
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/quotes/{id}/reactivate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "operationId": "reactivateQuote",
        "x-stability": "beta",
        "tags": [
          "Quotes"
        ],
        "summary": "Reactivate a lost quote",
        "description": "Reactivates a Lost quote, as the **Reactivate** action does in Omono. The quote's status becomes `active` and its `lostReasonId` becomes `null`, so you can mark it as won, or mark it as lost again with a different reason. Nothing else on the quote changes.\n\nOmono adds a note to the quote that says your API key reactivated it, and adds an entry to the activity feed. The automatic follow-up tasks that Omono closed when the quote was marked as lost stay closed: Omono doesn't create them again, as in the app. If your organisation's settings close quotes automatically, Omono's nightly job can close a reactivated quote again.\n\nSend the request without a body. Omono ignores any body you send. If the quote is already Active, nothing changes and the response has `\"applied\": false`, so it's safe to retry.\n\nLearn more about [lifecycle actions](/docs/writing#lifecycle-actions).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `quote-not-lost` | The quote is a Draft or Won. Only a Lost quote can be reactivated. |\n| 409 | `quote-locked` | The quote is Lost but has a sales order, so it can't be reactivated. |\n| 409 | `document-too-large` | The quote has more than 10,000 line items and BOM items, which is more than one response can carry, so nothing changes. Reactivate the quote in Omono instead. |\n| 503 | `temporarily-unavailable` | Another request is changing this quote, or someone in Omono changed it while the API was reactivating it. Nothing changed. Read the quote again, then retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns `applied` and the quote as it is now. `applied` is `false` if the quote was already Active.\n",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuoteActionResult"
                },
                "example": {
                  "applied": true,
                  "quote": {
                    "id": "qteNew5Tk8wQz2MvX",
                    "externalRef": null,
                    "quoteNo": "0972",
                    "companyId": "b2FpLmNvbXBhbnkQQ",
                    "currencyId": "curGBPqk2j9x4mWpT",
                    "status": "active",
                    "salesPersonId": "usrJaneDoe4Kq9mWt",
                    "contactId": "cnt4Kj9mQdPw2XhTe",
                    "addressId": "adr7Np3kWqYz5RvBc",
                    "customerCollection": false,
                    "refNo": "RFQ-2301",
                    "delivery": "6 weeks from order",
                    "validityId": "vld30DaysStandard",
                    "chaseBy": "2030-01-15",
                    "exchangeRate": 1,
                    "eoriNumberId": "eorGB123456789000",
                    "incotermId": null,
                    "incotermNamedPlace": null,
                    "conversionProbabilityId": "cvp75PctLikely9Qz",
                    "expectedAwardDate": "2030-02-01",
                    "enquiryReceivedDate": "2026-08-18",
                    "commissionId": null,
                    "divisionId": "divNorthOffice3Qz",
                    "totalValue": 4180,
                    "totalValueBase": 4180,
                    "lostReasonId": null,
                    "salesOrderId": null,
                    "salesOrderNo": null,
                    "revisions": [
                      {
                        "id": "revNew8Qk3mWz7PtX",
                        "revisionNo": 0,
                        "label": "Original",
                        "isLatest": true,
                        "isWon": false,
                        "totalValue": 4180,
                        "created": "2026-08-19T16:12:03.000Z"
                      }
                    ],
                    "lineItems": [
                      {
                        "id": "qliNewQuoteLine5Kq",
                        "externalRef": null,
                        "stockItemId": "stkFlangeDN50PN16",
                        "description": "Flange DN50 PN16, 316L stainless",
                        "quantity": 20,
                        "unitPrice": 209,
                        "price": 209,
                        "discount": 0,
                        "taxRateId": "trx20pcVATkQ9m3Zd",
                        "salesAnalysisId": "sac5MachinedParts",
                        "tagNumber": null,
                        "lastCost": 125.4,
                        "margin": 40,
                        "leadTime": "4 weeks",
                        "commodityCodeId": "cmc84818059000Xk2",
                        "countryOfOriginId": "ctyUnitedKingdom1",
                        "bomItems": [],
                        "created": "2026-08-19T16:12:03.187Z",
                        "updated": "2026-08-19T16:12:03.187Z"
                      }
                    ],
                    "created": "2026-08-19T16:12:03.000Z",
                    "updated": "2026-08-19T17:05:10.000Z"
                  }
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/quotes/{id}/pdf": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "getQuotePdf",
        "x-stability": "beta",
        "tags": [
          "Quotes"
        ],
        "summary": "Download a quote PDF",
        "description": "Downloads the quote as a PDF, the document you send to your customer. It's the PDF that Omono's **Print** and **Download** buttons create, with your logo, the customer's address and the revision's line items. The file name has the quote number and, for a later revision, its letter, such as `SQ-1003-A.pdf`.\n\nOmono prints the revision that [Retrieve a quote](#tag/quotes/GET/quotes/{id}) shows. To print another revision, send its ID in `revisionId`. A Draft quote prints without a \"DRAFT\" mark, as it does from **Print** in Omono.\n\nAgainst your rate limits, a PDF counts as 5 requests on your organisation's per-minute limit, because Omono creates the file for you. A request that its checks refuse counts as 1. Learn more about [heavy requests](/docs/limits#pdfs).\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 404 | `not-found` | No quote has this ID, or the quote has no revision with the ID in `revisionId`. |\n| 409 | `no-line-items` | The revision has no line items, so it has nothing to print. The error's `field` is `lineItems`. |\n| 409 | `document-too-large` | The PDF is bigger than the API can return, which is rare. Download it in Omono instead. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/RevisionId"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Pdf"
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/quotes/{id}/proforma-pdf": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "getQuoteProformaPdf",
        "x-stability": "beta",
        "tags": [
          "Quotes"
        ],
        "summary": "Download a quote proforma PDF",
        "description": "Downloads a proforma invoice for the quote, as a PDF. A proforma asks the customer to pay before you supply the goods, so send it when a customer pays in advance. It's the **Proforma** document in the quote's **Documents** in Omono, and its file name is like `PRO-SQ-1003.pdf`.\n\nOmono prints the revision that [Retrieve a quote](#tag/quotes/GET/quotes/{id}) shows. To print another revision, send its ID in `revisionId`.\n\nAgainst your rate limits, a PDF counts as 5 requests on your organisation's per-minute limit, because Omono creates the file for you. A request that its checks refuse counts as 1. Learn more about [heavy requests](/docs/limits#pdfs).\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 404 | `not-found` | No quote has this ID, or the quote has no revision with the ID in `revisionId`. |\n| 409 | `no-line-items` | The revision has no line items, so it has nothing to print. The error's `field` is `lineItems`. |\n| 409 | `document-too-large` | The PDF is bigger than the API can return, which is rare. Download it in Omono instead. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/RevisionId"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Pdf"
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/quotes/{id}/notes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "listQuoteNotes",
        "x-stability": "beta",
        "tags": [
          "Notes"
        ],
        "summary": "List a quote's notes",
        "description": "Returns the notes on a quote, newest first. The list has user notes, which people write in Omono or which an API key adds, and system notes, which are the history that Omono writes itself, such as a status change or a changed delivery date. Each note's `kind` says which it is, and the `kind` filter returns one of them. A system note is the record's history as staff see it in Omono, and it can name other records, such as an order number on a stock item.\n\nA new note doesn't change the quote's `updated` time. To keep a copy of the notes up to date, read this list again with `created_gte` set to the `created` time of the newest note you have, and skip the notes whose `id` you already have. Learn more about [notes](/docs/reading#notes).\n\nRequires the `sales:read` or `sales:write` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "kind",
            "in": "query",
            "description": "Pass `user` to return only the notes that people wrote or that an API key added, or `system` to return only the notes that Omono wrote itself.\n",
            "schema": {
              "type": "string",
              "enum": [
                "user",
                "system"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of notes.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NoteList"
                },
                "example": {
                  "data": [
                    {
                      "id": "nte8Rq2LmXw4KpZt7",
                      "kind": "user",
                      "text": "Called Priya Shah: the customer wants delivery before 12 December.",
                      "authorName": "API · CRM sync",
                      "userId": "usrApi4Wn8Kq2Lp5X",
                      "apiKeyId": "key7Tz3Mq9Wb2Xc4V",
                      "created": "2026-11-30T14:05:12.000Z"
                    },
                    {
                      "id": "nte5Bc9TyUw1QsVn3",
                      "kind": "system",
                      "text": "Status changed from Draft to Active",
                      "authorName": "Hannah Okafor",
                      "userId": "usr2Pq8Lm4Xw7Kz9R",
                      "apiKeyId": null,
                      "created": "2026-11-28T09:41:37.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createQuoteNote",
        "x-stability": "beta",
        "tags": [
          "Notes"
        ],
        "summary": "Add a note to a quote",
        "description": "Adds a plain-text note to a quote. The note appears in the quote's notes in Omono, as if someone had written it there. The note's author is the API key, shown as `API · ` and the key's name. You can add a note to a quote in any state, archived, closed or cancelled ones included, as staff can in Omono. A note can't be changed or deleted through the API, so check the text before you send it. The returned `text` can differ from the text you sent in two ways: Omono removes spaces and line breaks from the start and end, and replaces a character that isn't valid Unicode. One record can take about 50 notes through the API in any 24 hours: Omono checks the count before it adds the note, so notes sent at the same moment can pass it by a few.\n\nA new note doesn't change the quote's `updated` time. Learn more about [adding notes](/docs/writing#notes).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 422 | `validation-failed` | `text` is blank, is longer than 2,000 characters, has more than 50 lines, or contains a control character other than a tab or a line break. |\n| 429 | `rate-limited` | The record already has about 50 notes added through the API in the last 24 hours. This is a daily cap on the record, not a request limit: `Retry-After` gives the seconds until it can take another, which can be many hours. |\n| 429 | `rate-limited` | Your organisation has stored its daily limit of descriptions and notes. `Retry-After` gives the seconds until 00:00 UTC. Learn more about [limits](/docs/limits#stored-descriptions). |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "The note to add.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NoteCreate"
              },
              "example": {
                "text": "Called Priya Shah: the customer wants delivery before 12 December."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new note.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Note"
                },
                "example": {
                  "id": "nte8Rq2LmXw4KpZt7",
                  "kind": "user",
                  "text": "Called Priya Shah: the customer wants delivery before 12 December.",
                  "authorName": "API · CRM sync",
                  "userId": "usrApi4Wn8Kq2Lp5X",
                  "apiKeyId": "key7Tz3Mq9Wb2Xc4V",
                  "created": "2026-11-30T14:05:12.000Z"
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/sales-orders": {
      "get": {
        "operationId": "listSalesOrders",
        "x-stability": "stable",
        "tags": [
          "Sales orders"
        ],
        "summary": "List all sales orders",
        "description": "Returns a list of your sales orders. The newest sales orders come first unless you choose another order with `sort`.\n\nTo get each order's line items, dispatches or both in the same response, add them to `include`, for example `include=lineItems,dispatches`.\n\nLearn more about [pagination](/docs/reading#pagination), [filters](/docs/reading#filters), [sorting](/docs/reading#sorting), [including related records](/docs/reading#include) and [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `document-too-large` | You included related records, and the first sales order on the page has more than 10,000 of them, or comes to more than 32 MB of JSON with them. Leave out `include` to page past it, and read that order in Omono. |\n| 422 | `validation-failed` | Your `orderNo` starts with \"SO-\", in any case. Send the number without the prefix, such as `1042` for sales order SO-1042. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/SortStandard"
          },
          {
            "$ref": "#/components/parameters/IncludeSalesOrder"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/ExternalRef"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "status",
            "in": "query",
            "description": "Only return sales orders with these statuses. Send one or more statuses, separated by commas: `draft`, `on_order`, `complete`, `cancelled`, `on_hold` or `on_order_call_off`. For example, `status=draft,on_order` returns orders that are Draft or On Order. You can also repeat the parameter, as in `status=draft&status=on_order`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "$ref": "#/components/schemas/KnownOrderStatus"
              },
              "minItems": 1
            }
          },
          {
            "name": "companyId",
            "in": "query",
            "description": "Only return sales orders for these customers. Send up to 100 company IDs, separated by commas. You can also repeat the parameter, as in `companyId=a&companyId=b`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "orderNo",
            "in": "query",
            "description": "Only return the sales order with exactly this number. Send one number only, without the \"SO-\" prefix that Omono shows, for example `1042` for SO-1042. A number that starts with \"SO-\", in any case, fails with a `422` error and the code `validation-failed` on the field `orderNo`. This filter doesn't take a comma-separated list.\n",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "customerOrderNo",
            "in": "query",
            "description": "Only return sales orders with exactly this customer order reference. The match ignores capital letters, and spaces at the start and end of the value. Several orders can share a reference, so add `companyId` if you want the orders of one customer only. This filter doesn't take a comma-separated list.\n",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of sales orders.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesOrderList"
                },
                "example": {
                  "data": [
                    {
                      "id": "vShvOSNvvpFsuxKgN",
                      "externalRef": null,
                      "orderNo": "1042",
                      "companyId": "b2FpLmNvbXBhbnkQQ",
                      "currencyId": "curGBPqk2j9x4mWpT",
                      "status": "on_order",
                      "contactId": "cnt4Kj9mQdPw2XhTe",
                      "addressId": "adr7Np3kWqYz5RvBc",
                      "customerCollection": false,
                      "salesPersonId": "usrJaneDoe4Kq9mWt",
                      "customerOrderNo": "PO-88231",
                      "callOff": false,
                      "exchangeRate": 1,
                      "eoriNumberId": null,
                      "incotermId": "incFCA2020Rules9x",
                      "incotermNamedPlace": "Bristol, UK",
                      "commissionId": null,
                      "divisionId": "divNorthOffice3Qz",
                      "totalValue": 1250,
                      "totalValueBase": 1250,
                      "quoteId": "qteWonEarlier4Kq2",
                      "quoteRevisionId": "revWonEarlier8Zq2",
                      "quoteNo": "0899",
                      "wentActiveAt": "2026-07-30T09:14:02.000Z",
                      "linkedPurchaseOrders": [
                        {
                          "purchaseOrderId": "aK3nMh2PqXwYbTzVc",
                          "purchaseOrderNo": "311"
                        }
                      ],
                      "invoices": [
                        {
                          "dispatchId": "dsp6Tq2mNkXw9PzRj",
                          "invoiceNo": "2107",
                          "invoiceDate": "2026-08-14"
                        }
                      ],
                      "created": "2026-07-30T09:12:44.000Z",
                      "updated": "2026-08-14T15:02:10.000Z"
                    }
                  ],
                  "hasMore": true,
                  "nextCursor": "eyJ2IjoxLCJzIjpbIjIwMjYtMDctMzBUMDk6MTI6NDRaIl19"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createSalesOrder",
        "x-stability": "beta",
        "tags": [
          "Sales orders"
        ],
        "summary": "Create a sales order",
        "description": "Creates a sales order. The new order starts as a Draft, which means it's saved in Omono but isn't on order yet, and its dispatches can't move. When the order is ready, activate it with `POST /sales-orders/{id}/activate`.\n\nYou can send the order's line items in `lineItems`, in the order you want them, or add them later. Omono checks every line item before it saves anything, so a refused request doesn't use up an order number. Any header or line item field you leave out is filled in the way Omono's own order form fills it.\n\nOmono doesn't warn you if another order already has the same `customerOrderNo`. To check first, list the orders with `companyId` and `customerOrderNo`, and treat any order whose `status` isn't `cancelled` as a duplicate. Check for `cancelled` rather than for a list of the other statuses, so that an order with a status Omono adds later still counts, as [Push web orders](/docs/recipes/push-orders) explains.\n\nLearn more about [creating a document with line items](/docs/writing#creating-a-document-with-lines), [prefilled fields](/docs/writing#prefilled-fields), [what to do if a create fails](/docs/writing#if-a-create-fails) and [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 404 | `not-found` | Someone deleted the new Draft in Omono while your request was still saving it. This is rare. Retry with the same `Idempotency-Key`. |\n| 409 | `company-archived` | The customer is archived. |\n| 409 | `create-incomplete` | You retried a create with the same `Idempotency-Key`, and the Draft that the first attempt left has been changed since. Finish the Draft that `keptDocument` names instead of creating it again. |\n| 422 | `invalid-reference` | The company isn't a customer, or another ID you sent isn't one you can use. For example, the contact or address belongs to another company, or a new line item's stock item is archived or can't be sold. The error's `field` names the field, such as `lineItems[2].stockItemId`. |\n| 422 | `missing-required-field` | You left out a required field, such as `addressId` on an order that isn't a customer collection order. You also get this error if the customer has no account manager, or if your organisation requires a customer order number and you didn't send one. |\n| 422 | `validation-failed` | A line item's quantity isn't a whole number for an assembly, or its `unitPrice` differs from the value Omono works out from `price` and `discount` by more than one unit in the last decimal place. You also get this error if your line items and the BOM items their assemblies bring add up to more than 1,000. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SalesOrderCreate"
              },
              "example": {
                "companyId": "b2FpLmNvbXBhbnkQQ",
                "contactId": "cnt4Kj9mQdPw2XhTe",
                "addressId": "adr7Np3kWqYz5RvBc",
                "salesPersonId": "usrJaneDoe4Kq9mWt",
                "customerOrderNo": "PO-88412",
                "exchangeRate": 1,
                "divisionId": "divNorthOffice3Qz",
                "lineItems": [
                  {
                    "stockItemId": "stkBearingHousing",
                    "quantity": 10,
                    "price": 125,
                    "commodityCodeId": "cmc84818059000Xk2",
                    "countryOfOriginId": "ctyUnitedKingdom1"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new sales order, including its line items. It also includes `createdLineItems`, which gives the ID of the line item created from each entry in your `lineItems` array.\n",
            "headers": {
              "Location": {
                "$ref": "#/components/headers/Location"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesOrderCreated"
                },
                "example": {
                  "id": "soNew7Qk2mXw9PzRj",
                  "externalRef": null,
                  "orderNo": "1057",
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "currencyId": "curGBPqk2j9x4mWpT",
                  "status": "draft",
                  "contactId": "cnt4Kj9mQdPw2XhTe",
                  "addressId": "adr7Np3kWqYz5RvBc",
                  "customerCollection": false,
                  "salesPersonId": "usrJaneDoe4Kq9mWt",
                  "customerOrderNo": "PO-88412",
                  "callOff": false,
                  "exchangeRate": 1,
                  "eoriNumberId": "eorGB123456789000",
                  "incotermId": null,
                  "incotermNamedPlace": null,
                  "commissionId": null,
                  "divisionId": "divNorthOffice3Qz",
                  "totalValue": 1250,
                  "totalValueBase": 1250,
                  "quoteId": null,
                  "quoteRevisionId": null,
                  "quoteNo": null,
                  "wentActiveAt": null,
                  "linkedPurchaseOrders": [],
                  "invoices": [],
                  "lineItems": [
                    {
                      "id": "oliNewOrderLine7Kq",
                      "externalRef": null,
                      "stockItemId": "stkBearingHousing",
                      "description": "Bearing housing, cast iron, machined",
                      "quantity": 10,
                      "unitPrice": 125,
                      "price": 125,
                      "discount": 0,
                      "taxRateId": "trx20pcVATkQ9m3Zd",
                      "salesAnalysisId": "sac5MachinedParts",
                      "tagNumber": null,
                      "lastCost": 75,
                      "margin": 40,
                      "quotedLeadTime": null,
                      "commodityCodeId": "cmc84818059000Xk2",
                      "countryOfOriginId": "ctyUnitedKingdom1",
                      "bomItems": [],
                      "linkedPurchaseOrderId": null,
                      "linkedPurchaseOrderNo": null,
                      "created": "2026-08-19T16:20:11.204Z",
                      "updated": "2026-08-19T16:20:11.204Z"
                    }
                  ],
                  "created": "2026-08-19T16:20:11.000Z",
                  "updated": "2026-08-19T16:20:11.204Z",
                  "createdLineItems": [
                    {
                      "index": 0,
                      "id": "oliNewOrderLine7Kq"
                    }
                  ]
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/sales-orders/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "getSalesOrder",
        "x-stability": "stable",
        "tags": [
          "Sales orders"
        ],
        "summary": "Retrieve a sales order",
        "description": "Retrieves a sales order, including its line items. If a line item's stock item is an assembly, the line item also lists the parts it's made from, in `bomItems`.\n\nTo get the order's dispatches as well, add `include=dispatches`. A dispatch is one shipment of goods from the order, and an order can ship in several. Each dispatch moves through your workflow statuses on its own, so the progress of the goods is recorded on each dispatch rather than on the order. Each dispatch also lists the statuses it can move to next, in `legalTransitions`.\n\nA request with `include=dispatches` never gets `304 Not Modified`, even when `If-None-Match` has the order's current `ETag`. A dispatch's `legalTransitions` and their `blockedBy` can change while the order itself doesn't, for example when someone adds a task that blocks shipping, so you always get the current values. The response still has the order's `ETag`, which you can send in `If-Match`.\n\nLearn more about [including related records](/docs/reading#include) and [moving a dispatch](/docs/workflow#moving-a-dispatch).\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `document-too-large` | The order has more than 10,000 related records to return, counting its line items, their BOM items and any dispatches you include with their line items, or comes to more than 32 MB of JSON with them. Leave out `include=dispatches`, or read the order in Omono. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          },
          {
            "$ref": "#/components/parameters/IncludeSalesOrder"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the sales order, including its line items.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesOrderWithLineItems"
                },
                "example": {
                  "id": "vShvOSNvvpFsuxKgN",
                  "externalRef": null,
                  "orderNo": "1042",
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "currencyId": "curGBPqk2j9x4mWpT",
                  "status": "on_order",
                  "contactId": "cnt4Kj9mQdPw2XhTe",
                  "addressId": "adr7Np3kWqYz5RvBc",
                  "customerCollection": false,
                  "salesPersonId": "usrJaneDoe4Kq9mWt",
                  "customerOrderNo": "PO-88231",
                  "callOff": false,
                  "exchangeRate": 1,
                  "eoriNumberId": null,
                  "incotermId": "incFCA2020Rules9x",
                  "incotermNamedPlace": "Bristol, UK",
                  "commissionId": null,
                  "divisionId": "divNorthOffice3Qz",
                  "totalValue": 1250,
                  "totalValueBase": 1250,
                  "quoteId": "qteWonEarlier4Kq2",
                  "quoteRevisionId": "revWonEarlier8Zq2",
                  "quoteNo": "0899",
                  "wentActiveAt": "2026-07-30T09:14:02.000Z",
                  "linkedPurchaseOrders": [
                    {
                      "purchaseOrderId": "aK3nMh2PqXwYbTzVc",
                      "purchaseOrderNo": "311"
                    }
                  ],
                  "invoices": [
                    {
                      "dispatchId": "dsp6Tq2mNkXw9PzRj",
                      "invoiceNo": "2107",
                      "invoiceDate": "2026-08-14"
                    }
                  ],
                  "lineItems": [
                    {
                      "id": "oliBearingHous4Kq",
                      "externalRef": null,
                      "stockItemId": "stkBearingHousing",
                      "description": "Bearing housing, cast iron, machined",
                      "quantity": 10,
                      "unitPrice": 125,
                      "price": 125,
                      "discount": 0,
                      "taxRateId": "trx20pcVATkQ9m3Zd",
                      "salesAnalysisId": "sac5MachinedParts",
                      "tagNumber": "TAG-0114",
                      "lastCost": 75,
                      "margin": 40,
                      "quotedLeadTime": "4 weeks",
                      "commodityCodeId": "cmc84818059000Xk2",
                      "countryOfOriginId": "ctyUnitedKingdom1",
                      "bomItems": [],
                      "linkedPurchaseOrderId": "aK3nMh2PqXwYbTzVc",
                      "linkedPurchaseOrderNo": "311",
                      "created": "2026-07-30T09:12:44.000Z",
                      "updated": "2026-08-14T15:02:10.000Z"
                    }
                  ],
                  "created": "2026-07-30T09:12:44.000Z",
                  "updated": "2026-08-14T15:02:10.000Z"
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ]
      },
      "patch": {
        "operationId": "updateSalesOrder",
        "x-stability": "beta",
        "tags": [
          "Sales orders"
        ],
        "summary": "Update a sales order",
        "description": "Updates a sales order. Any fields you leave out stay as they are. You can change the order's header fields, its line items, or both in one request. If your request doesn't change anything, for example because it sends back values the order already has, Omono doesn't save the order, so its `updated` time and ETag stay the same.\n\nTo change line items, send `lineItems` as a list of changes, and send the ETag from your last read in the `If-Match` header. The list doesn't replace the order's line items. To change a line item, send its `id` with the fields you want to change. To delete one, send `{ \"id\": \"…\", \"delete\": true }`. To add one, send an item without an `id`. Line items you leave out stay as they are, and Omono checks every change before it saves any of them. The list never changes the order of the line items: a line item you change keeps its place, and new line items go at the end. To reorder the line items, send `lineItemOrder` with every line item's ID in the order you want, together with `If-Match`. Once the order has a dispatch, the order of its line items is fixed.\n\nYou can't set `status` here. An order's status changes only through actions, such as activating the order and moving its dispatches.\n\nLearn more about [changing line items](/docs/writing#line-changes) and [statuses](/docs/conventions#statuses).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `sales-order-locked` | The order is Complete or Cancelled, and your request would change it. A request that changes nothing, such as the order's current values or its current `lineItemOrder` sent back, succeeds. |\n| 409 | `line-order-fixed` | The order has a dispatch, and your `lineItemOrder` would change the order of its line items. |\n| 409 | `exchange-rate-locked` | You changed `exchangeRate` after one of the order's dispatches was invoiced. |\n| 409 | `line-item-allocated` | You lowered a line item's quantity below the quantity already on its dispatches, or tried to delete a line item that's on a dispatch. |\n| 409 | `line-item-on-invoiced-dispatch` | You changed a field other than `quantity` on a line item that's on an invoiced dispatch. |\n| 409 | `immutable-field` | You tried to change the stock item of an existing line item. |\n| 409 | `document-too-large` | The order would have more than 10,000 line items and BOM items, counting the new line items in your `lineItems` and the BOM items that new assembly line items bring. That's more than one response can carry, so nothing changes. Change the order in Omono instead. |\n| 422 | `invalid-reference` | An ID you sent isn't one you can use. For example, a new line item's stock item is archived or can't be sold, or an ID in `lineItems` or `lineItemOrder` belongs to another order's line item. |\n| 422 | `missing-required-field` | Your organisation requires a customer order number, and the order would be left without one. That happens when you clear `customerOrderNo`, or when you send any field except `lineItems`, `lineItemOrder` and `externalRef`, even an unchanged one, to an order that doesn't have one. Send `customerOrderNo` in the same request. |\n| 422 | `unknown-field` | You sent `companyId`. The customer can't change. |\n| 422 | `validation-failed` | You sent `lineItems` or `lineItemOrder` for an order that already has more than 250 line items. You can still change its header fields, but its line items must be changed in Omono. You also get this error if your line items and the BOM items their assemblies bring add up to more than 1,000, or if `lineItemOrder` leaves out a line item, names one twice or names one you delete. |\n| 503 | `temporarily-unavailable` | You sent `lineItems` or `lineItemOrder`, and another request, or a save in Omono, is still changing this order's dispatches or line items, or activating or cancelling it, after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SalesOrderUpdate"
              },
              "example": {
                "customerOrderNo": "PO-88231-A"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns the updated sales order, including its line items. If you sent `lineItems`, the response also includes `createdLineItems`, which gives the ID of each line item you added.\n",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesOrderUpdated"
                },
                "example": {
                  "id": "vShvOSNvvpFsuxKgN",
                  "externalRef": null,
                  "orderNo": "1042",
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "currencyId": "curGBPqk2j9x4mWpT",
                  "status": "on_order",
                  "contactId": "cnt4Kj9mQdPw2XhTe",
                  "addressId": "adr7Np3kWqYz5RvBc",
                  "customerCollection": false,
                  "salesPersonId": "usrJaneDoe4Kq9mWt",
                  "customerOrderNo": "PO-88231-A",
                  "callOff": false,
                  "exchangeRate": 1,
                  "eoriNumberId": null,
                  "incotermId": "incFCA2020Rules9x",
                  "incotermNamedPlace": "Bristol, UK",
                  "commissionId": null,
                  "divisionId": "divNorthOffice3Qz",
                  "totalValue": 1250,
                  "totalValueBase": 1250,
                  "quoteId": "qteWonEarlier4Kq2",
                  "quoteRevisionId": "revWonEarlier8Zq2",
                  "quoteNo": "0899",
                  "wentActiveAt": "2026-07-30T09:14:02.000Z",
                  "linkedPurchaseOrders": [
                    {
                      "purchaseOrderId": "aK3nMh2PqXwYbTzVc",
                      "purchaseOrderNo": "311"
                    }
                  ],
                  "invoices": [
                    {
                      "dispatchId": "dsp6Tq2mNkXw9PzRj",
                      "invoiceNo": "2107",
                      "invoiceDate": "2026-08-14"
                    }
                  ],
                  "lineItems": [
                    {
                      "id": "oliBearingHous4Kq",
                      "externalRef": null,
                      "stockItemId": "stkBearingHousing",
                      "description": "Bearing housing, cast iron, machined",
                      "quantity": 10,
                      "unitPrice": 125,
                      "price": 125,
                      "discount": 0,
                      "taxRateId": "trx20pcVATkQ9m3Zd",
                      "salesAnalysisId": "sac5MachinedParts",
                      "tagNumber": "TAG-0114",
                      "lastCost": 75,
                      "margin": 40,
                      "quotedLeadTime": "4 weeks",
                      "commodityCodeId": "cmc84818059000Xk2",
                      "countryOfOriginId": "ctyUnitedKingdom1",
                      "bomItems": [],
                      "linkedPurchaseOrderId": "aK3nMh2PqXwYbTzVc",
                      "linkedPurchaseOrderNo": "311",
                      "created": "2026-07-30T09:12:44.000Z",
                      "updated": "2026-08-14T15:02:10.000Z"
                    }
                  ],
                  "created": "2026-07-30T09:12:44.000Z",
                  "updated": "2026-08-19T16:24:52.000Z"
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "428": {
            "$ref": "#/components/responses/PreconditionRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      },
      "delete": {
        "operationId": "deleteSalesOrder",
        "x-stability": "beta",
        "tags": [
          "Sales orders"
        ],
        "summary": "Delete a draft sales order",
        "description": "Deletes a Draft sales order, as deleting it in Omono does. Its line items, dispatches, notes and files go with it, and so do the tasks linked to it. You can delete an order only while it's a Draft. Omono doesn't use its number again.\n\nIf the order came from a won quote, the quote stays Won, and Omono adds a note to it. Marking the quote as won again with `POST /quotes/{id}/mark-won` then creates a new order. A purchase order raised from this order loses its link to it, and Omono adds a note to the purchase order.\n\nSend the sales order's `ETag` in `If-Match`, so that you never delete a sales order that someone changed after you read it. Don't send `If-Match: *`. The response has no body. A sales order that's already deleted returns `404`, so a retry after a lost response is safe. The deleted records appear in [`GET /events`](/docs/syncing#deletes).\n\nOmono deletes every line item of the order and of its dispatches, with their BOM items. So against your rate limits, a delete counts as one write for every 10 of those line items and BOM items, rounded up. A delete refused by its checks counts as 1. Learn more about [deleting](/docs/writing#deleting) and [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `not-a-draft` | The order isn't a Draft. |\n| 412 | `precondition-failed` | The order has changed since you read it. Nothing was deleted. |\n| 428 | `precondition-required` | You didn't send `If-Match`. |\n| 503 | `temporarily-unavailable` | Another request, or a save in Omono, is still changing this order's dispatches or line items, or activating it or deleting it, after 5 seconds. Or other saves in Omono kept changing the order while Omono tried to delete it. Nothing was deleted. Read the order again, and retry with its new `ETag` after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfMatchDelete"
          }
        ],
        "responses": {
          "204": {
            "description": "The sales order is deleted.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "428": {
            "$ref": "#/components/responses/PreconditionRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/sales-orders/{id}/dispatches": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "listSalesOrderDispatches",
        "x-stability": "stable",
        "tags": [
          "Dispatches"
        ],
        "summary": "List all dispatches",
        "description": "Returns a list of the dispatches on a sales order. A dispatch is one shipment of goods from the order, carrying some or all of the order's line items. Through the API, you can create dispatches, read them, move them from one workflow status to another, and mark a proforma dispatch as paid. Staff pick the goods in Omono.\n\nThe dispatches are sorted by `dispatchNo`, then by `id`, and you can't choose another order. The line items on each dispatch follow the order of the sales order's line items. Each dispatch shows its `statusType` and each line item its `pickedQuantity`. The list doesn't show the operators assigned to a dispatch.\n\nA page can hold fewer dispatches than your `limit` even when more are on the way, because it ends early once the line items on its dispatches add up to more than 2,000. So always check `hasMore` before you stop. Learn more about [pagination](/docs/reading#pagination).\n\nEach dispatch lists the statuses it can move to right now, in `legalTransitions`. Read them again just before you move a dispatch, because they can change at any time. Any change to a dispatch also changes its sales order's `updated` time, so you find changed dispatches by syncing sales orders.\n\nLearn more about [what the API can do with dispatches](/docs/workflow#what-the-api-does-and-does-not-do), [moving a dispatch](/docs/workflow#moving-a-dispatch) and [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `document-too-large` | The first dispatch on the page has more than 10,000 line items, or comes to more than 32 MB of JSON with them, which is more than one response can carry. Read the dispatch in Omono instead. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of dispatches.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DispatchList"
                },
                "example": {
                  "data": [
                    {
                      "id": "dsp6Tq2mNkXw9PzRj",
                      "salesOrderId": "soW3kdnR8LqP2xVaT",
                      "salesOrderNo": "1042",
                      "customerOrderNo": null,
                      "companyId": "b2FpLmNvbXBhbnkQQ",
                      "dispatchNo": 1,
                      "statusId": "wfsShipped9Kq4mTz",
                      "statusType": "final",
                      "dispatchDate": "2026-08-14",
                      "courierId": "crrDHLExpressUK1x",
                      "trackingNo": "JD014600003GB",
                      "deliveryNotes": null,
                      "invoiceNo": "2107",
                      "invoiceDate": "2026-08-14",
                      "invoiceDueDate": "2026-09-13",
                      "proformaPaid": false,
                      "totalValue": 1250,
                      "totalTax": 250,
                      "totalWithTax": 1500,
                      "totalValueBase": 1250,
                      "totalTaxBase": 250,
                      "lineItems": [
                        {
                          "id": "dliBearingHous8Zq",
                          "salesOrderLineItemId": "oliBearingHous4Kq",
                          "stockItemId": "stkBearingHousing",
                          "quantity": 10,
                          "pickedQuantity": 10,
                          "serialNumber": null
                        }
                      ],
                      "legalTransitions": [],
                      "created": "2026-08-12T14:40:19.000Z",
                      "updated": "2026-08-14T15:02:10.000Z"
                    },
                    {
                      "id": "dsp9Wm4kQz2XpTn7R",
                      "salesOrderId": "soW3kdnR8LqP2xVaT",
                      "salesOrderNo": "1042",
                      "customerOrderNo": null,
                      "companyId": "b2FpLmNvbXBhbnkQQ",
                      "dispatchNo": 2,
                      "statusId": "wfsAllocated7Kq2M",
                      "statusType": "allocated",
                      "dispatchDate": "2026-08-21",
                      "courierId": null,
                      "trackingNo": null,
                      "deliveryNotes": null,
                      "invoiceNo": null,
                      "invoiceDate": null,
                      "invoiceDueDate": null,
                      "proformaPaid": false,
                      "totalValue": 220,
                      "totalTax": 44,
                      "totalWithTax": 264,
                      "totalValueBase": 220,
                      "totalTaxBase": 44,
                      "lineItems": [
                        {
                          "id": "dliGasketSet2Wq7",
                          "salesOrderLineItemId": "oliGasketSet7Wq3",
                          "stockItemId": "stkGasketDN50EPDM",
                          "quantity": 50,
                          "pickedQuantity": 20,
                          "serialNumber": null
                        }
                      ],
                      "legalTransitions": [
                        {
                          "statusId": "wfsUnalloc2Kq8mWz",
                          "name": "Awaiting Allocation",
                          "type": "unallocated",
                          "blockedBy": []
                        },
                        {
                          "statusId": "wfsOnHold3Qk8mWzX",
                          "name": "On Hold",
                          "type": "on_hold",
                          "blockedBy": []
                        },
                        {
                          "statusId": "wfsShipped9Kq4mTz",
                          "name": "Shipped",
                          "type": "final",
                          "blockedBy": [
                            "dispatch-not-fully-picked"
                          ]
                        }
                      ],
                      "created": "2026-08-19T09:02:44.000Z",
                      "updated": "2026-08-19T09:02:44.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createSalesOrderDispatch",
        "x-stability": "beta",
        "tags": [
          "Dispatches"
        ],
        "summary": "Create a dispatch",
        "description": "Adds a dispatch to a sales order, with the quantity of each line item it will ship. You can add dispatches to a Draft order, and you must: a Draft order that isn't a call-off can only be activated once all of its line items are on dispatches. You can also add dispatches to an active order, for example to split a shipment.\n\nOmono creates the dispatch in the first status of your workflow, with no stock allocated, so creating a dispatch never changes stock levels. Stock is allocated when you [move the dispatch](/docs/workflow#moving-a-dispatch) to an allocated status, and staff pick its goods in Omono. Omono adds the BOM items of an assembly line item for you, and it works out the dispatch's totals from the line items' prices. To print instructions for the carrier or the customer on the delivery note, such as a gate code from your checkout, send them in `deliveryNotes`.\n\nThe response's `ETag` is the sales order's new `ETag`, because a new dispatch changes the order. Use it for your next change to the order or its dispatches.\n\nAgainst your rate limits, a new dispatch counts as one write for every 10 entries in `lineItems`, rounded up, so a dispatch with 250 line items counts as 25. Learn more about [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `sales-order-locked` | The sales order is complete or cancelled. |\n| 409 | `quantity-exceeds-remaining` | A quantity is more than is left of its line item, after its other dispatches. The error's `field` names the entry, and its message says how many are left. |\n| 422 | `invalid-reference` | A `salesOrderLineItemId` isn't a line item of this sales order. The error's `field` names the entry, such as `lineItems[1].salesOrderLineItemId`. |\n| 422 | `validation-failed` | A quantity has more than 4 decimal places, the same line item is named twice, or `deliveryNotes` has too many lines to store. The error's `field` names the entry or the field. |\n| 503 | `temporarily-unavailable` | Another request, or a save in Omono, is still changing this order's dispatches or line items, or activating or cancelling it, after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "The dispatch to add.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DispatchCreate"
              },
              "example": {
                "dispatchDate": "2026-08-21",
                "deliveryNotes": "Deliver to the rear entrance.",
                "lineItems": [
                  {
                    "salesOrderLineItemId": "oliBearingHous4Kq",
                    "quantity": 10
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new dispatch.",
            "headers": {
              "Location": {
                "$ref": "#/components/headers/Location"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dispatch"
                },
                "example": {
                  "id": "dsp3Rk8wQm2ZtNv5P",
                  "salesOrderId": "soW3kdnR8LqP2xVaT",
                  "salesOrderNo": "1042",
                  "customerOrderNo": null,
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "dispatchNo": 1,
                  "statusId": "wfsUnalloc2Kq8mWz",
                  "statusType": "unallocated",
                  "dispatchDate": "2026-08-21",
                  "courierId": null,
                  "trackingNo": null,
                  "deliveryNotes": "Deliver to the rear entrance.",
                  "invoiceNo": null,
                  "invoiceDate": null,
                  "invoiceDueDate": null,
                  "proformaPaid": false,
                  "totalValue": 1250,
                  "totalTax": 250,
                  "totalWithTax": 1500,
                  "totalValueBase": 1250,
                  "totalTaxBase": 250,
                  "lineItems": [
                    {
                      "id": "dliBearingHous3Rk",
                      "salesOrderLineItemId": "oliBearingHous4Kq",
                      "stockItemId": "stkBearingHousing",
                      "quantity": 10,
                      "pickedQuantity": 0,
                      "serialNumber": null
                    }
                  ],
                  "legalTransitions": [],
                  "created": "2026-08-19T10:12:03.000Z",
                  "updated": "2026-08-19T10:12:03.000Z"
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/sales-orders/{id}/dispatches/{dispatchId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        },
        {
          "name": "dispatchId",
          "in": "path",
          "required": true,
          "description": "The ID of the dispatch. It must be a dispatch on the sales order in the path.",
          "schema": {
            "type": "string",
            "maxLength": 64
          }
        }
      ],
      "get": {
        "operationId": "getSalesOrderDispatch",
        "x-stability": "beta",
        "tags": [
          "Dispatches"
        ],
        "summary": "Retrieve a dispatch",
        "description": "Retrieves one dispatch of a sales order, with its line items and the statuses it can move to right now, in `legalTransitions`. If the dispatch belongs to a different sales order, the request fails with a `404` error. When you create a dispatch, the `Location` header of the response is this URL.\n\nA dispatch has no `ETag` of its own, so the response's `ETag` is the sales order's. Send it in `If-Match` when you change, delete or move the dispatch. This request never gets `304 Not Modified`: a dispatch's `legalTransitions` and their `blockedBy` can change while the order doesn't, for example when someone adds a task that blocks shipping, so you always get the current values.\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `document-too-large` | The dispatch has more than 10,000 line items, or comes to more than 32 MB of JSON with them, which is more than one response can carry. Read the dispatch in Omono instead. |\n",
        "responses": {
          "200": {
            "description": "Returns the dispatch.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dispatch"
                },
                "example": {
                  "id": "dsp9Wm4kQz2XpTn7R",
                  "salesOrderId": "soW3kdnR8LqP2xVaT",
                  "salesOrderNo": "1042",
                  "customerOrderNo": null,
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "dispatchNo": 2,
                  "statusId": "wfsAllocated7Kq2M",
                  "statusType": "allocated",
                  "dispatchDate": "2026-08-21",
                  "courierId": null,
                  "trackingNo": null,
                  "deliveryNotes": null,
                  "invoiceNo": null,
                  "invoiceDate": null,
                  "invoiceDueDate": null,
                  "proformaPaid": false,
                  "totalValue": 220,
                  "totalTax": 44,
                  "totalWithTax": 264,
                  "totalValueBase": 220,
                  "totalTaxBase": 44,
                  "lineItems": [
                    {
                      "id": "dliGasketSet2Wq7",
                      "salesOrderLineItemId": "oliGasketSet7Wq3",
                      "stockItemId": "stkGasketDN50EPDM",
                      "quantity": 50,
                      "pickedQuantity": 0,
                      "serialNumber": null
                    }
                  ],
                  "legalTransitions": [
                    {
                      "statusId": "wfsUnalloc2Kq8mWz",
                      "name": "Awaiting Allocation",
                      "type": "unallocated",
                      "blockedBy": []
                    },
                    {
                      "statusId": "wfsOnHold3Qk8mWzX",
                      "name": "On Hold",
                      "type": "on_hold",
                      "blockedBy": []
                    },
                    {
                      "statusId": "wfsShipped9Kq4mTz",
                      "name": "Shipped",
                      "type": "final",
                      "blockedBy": [
                        "dispatch-not-fully-picked"
                      ]
                    }
                  ],
                  "created": "2026-08-19T09:02:44.000Z",
                  "updated": "2026-08-19T09:02:44.000Z"
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      },
      "patch": {
        "operationId": "updateSalesOrderDispatch",
        "x-stability": "beta",
        "tags": [
          "Dispatches"
        ],
        "summary": "Update a dispatch",
        "description": "Changes a dispatch's date, courier, tracking number, delivery notes, line items or serial numbers. Send only what you want to change. A request that changes nothing changes nothing in Omono either, and the `ETag` stays the same. To clear the tracking number, send an empty `trackingNo`, and to remove the delivery notes, send `deliveryNotes: null`.\n\nYou can change line item quantities only while the dispatch is in the first, unallocated stage of your workflow, so changing a dispatch never changes stock levels. To change an allocated dispatch's line items, [move it](/docs/workflow#moving-a-dispatch) back to an unallocated status first, which releases its stock. You can't remove a line item that has picked goods, or lower its quantity below what's been picked. If any of an assembly's components have been picked, you can't remove the assembly or lower its quantity at all.\n\nSend the sales order's `ETag` in `If-Match` when you send `lineItems`. The response's `ETag` is the order's new `ETag`.\n\nOmono saves every line item of the dispatch again with each change. So against your rate limits, a change counts as one write for every 10 of the dispatch's line items, including any you add, rounded up, even when you only change the date. A request that changes nothing counts as 1. Learn more about [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `sales-order-locked` | The sales order is cancelled. |\n| 409 | `dispatch-shipped` | The dispatch has shipped, and you sent a new date or line item changes. |\n| 409 | `dispatch-allocated` | The dispatch is past the unallocated stage, and you sent line item changes. |\n| 409 | `dispatch-picked` | A line item you removed or lowered has picked goods, or is an assembly with picked components. |\n| 409 | `quantity-exceeds-remaining` | A quantity is more than is left of its line item, after its other dispatches. The error's `field` names the entry, and its message says how many are left. |\n| 409 | `tracking-too-early` | You sent a new `courierId` or `trackingNo` before the dispatch has shipped, or before it's allocated when early tracking entry is on. The error's `field` names it. |\n| 422 | `invalid-reference` | A line item isn't on this sales order, or `courierId` isn't a courier you can use. |\n| 422 | `validation-failed` | The same line item is named twice, the change would leave the dispatch with no line items, or `deliveryNotes` has too many lines to store. The error's `field` names it. |\n| 428 | `precondition-required` | You sent `lineItems` without `If-Match`. |\n| 503 | `temporarily-unavailable` | Another request, or a save in Omono, is still changing this order's dispatches or line items, or activating or cancelling it, after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "description": "The changes to make.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DispatchUpdate"
              },
              "example": {
                "dispatchDate": "2026-08-24",
                "lineItems": [
                  {
                    "salesOrderLineItemId": "oliBearingHous4Kq",
                    "quantity": 7
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns the dispatch as it is now.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dispatch"
                },
                "example": {
                  "id": "dsp3Rk8wQm2ZtNv5P",
                  "salesOrderId": "soW3kdnR8LqP2xVaT",
                  "salesOrderNo": "1042",
                  "customerOrderNo": null,
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "dispatchNo": 1,
                  "statusId": "wfsUnalloc2Kq8mWz",
                  "statusType": "unallocated",
                  "dispatchDate": "2026-08-24",
                  "courierId": null,
                  "trackingNo": null,
                  "deliveryNotes": null,
                  "invoiceNo": null,
                  "invoiceDate": null,
                  "invoiceDueDate": null,
                  "proformaPaid": false,
                  "totalValue": 875,
                  "totalTax": 175,
                  "totalWithTax": 1050,
                  "totalValueBase": 875,
                  "totalTaxBase": 175,
                  "lineItems": [
                    {
                      "id": "dliBearingHous3Rk",
                      "salesOrderLineItemId": "oliBearingHous4Kq",
                      "stockItemId": "stkBearingHousing",
                      "quantity": 7,
                      "pickedQuantity": 0,
                      "serialNumber": null
                    }
                  ],
                  "legalTransitions": [],
                  "created": "2026-08-19T10:12:03.000Z",
                  "updated": "2026-08-19T11:40:22.000Z"
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "428": {
            "$ref": "#/components/responses/PreconditionRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      },
      "delete": {
        "operationId": "deleteSalesOrderDispatch",
        "x-stability": "beta",
        "tags": [
          "Dispatches"
        ],
        "summary": "Delete a dispatch",
        "description": "Deletes a dispatch that's in the first, unallocated stage of your workflow and has no picked goods, as Omono allows. Its line items go back to being undispatched on the order. Deleting a dispatch never changes stock levels.\n\nSend the sales order's `ETag` in `If-Match`. The response has no body, and its `ETag` is the order's new `ETag`. A dispatch that's already deleted returns `404`, so a retry after a lost response is safe.\n\nOmono deletes every line item of the dispatch. So against your rate limits, a delete counts as one write for every 10 of the dispatch's line items, rounded up. A delete that's refused counts as 1. Learn more about [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `sales-order-locked` | The sales order is cancelled. |\n| 409 | `dispatch-shipped` | The dispatch has shipped. |\n| 409 | `dispatch-allocated` | The dispatch is past the unallocated stage. Move it back to an unallocated status first. |\n| 409 | `dispatch-picked` | The dispatch has picked goods. |\n| 428 | `precondition-required` | You didn't send `If-Match`. |\n| 503 | `temporarily-unavailable` | Another request, or a save in Omono, is still changing this order's dispatches or line items, or activating or cancelling it, after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "responses": {
          "204": {
            "description": "The dispatch is deleted.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "428": {
            "$ref": "#/components/responses/PreconditionRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/sales-orders/{id}/dispatches/{dispatchId}/proforma-paid": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        },
        {
          "name": "dispatchId",
          "in": "path",
          "required": true,
          "description": "The ID of the dispatch. It must be a dispatch on the sales order in the path.",
          "schema": {
            "type": "string",
            "maxLength": 64
          }
        }
      ],
      "post": {
        "operationId": "setDispatchProformaPaid",
        "x-stability": "beta",
        "tags": [
          "Dispatches"
        ],
        "summary": "Mark a proforma dispatch as paid",
        "description": "Marks a proforma dispatch as paid, or as awaiting payment. A proforma customer pays before their goods ship, so Omono won't ship their dispatch until it's marked as paid. Send `{ \"paid\": true }` when the payment arrives, or `{ \"paid\": false }` to mark the dispatch as awaiting payment again.\n\nA customer is a proforma customer when their invoice payment terms are 0 days after the invoice date, and the company's `isProforma` field is then true. You can send `false` for any dispatch, but `true` only for a proforma customer's dispatch.\n\nA dispatch has no `ETag` of its own, so send the sales order's `ETag` in `If-Match`. The response carries the order's new `ETag`. Omono adds a note to the order about the change. While the dispatch is marked as paid, its invoice PDF prints \"PAID\" instead of the due date and bank details.\n\nIf the dispatch already has the value you send, nothing changes and the response has `\"applied\": false`. This holds even after the dispatch has shipped, so a retry is always safe.\n\nLearn more about [when a dispatch can't ship](/docs/workflow#when-a-dispatch-cannot-ship).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 404 | `not-found` | The dispatch isn't on this sales order. |\n| 409 | `sales-order-locked` | The sales order is Cancelled. |\n| 409 | `dispatch-shipped` | The dispatch has already shipped, so its payment status can't change. |\n| 409 | `document-too-large` | The order has more than 10,000 related records to return, counting its line items, their BOM items, its dispatches and their line items. That's more than one response can carry, so nothing changes. Mark the dispatch as paid in Omono instead. |\n| 422 | `validation-failed` | You sent `true`, but the customer isn't a proforma customer. The error's `field` is `paid`. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProformaPaidRequest"
              },
              "example": {
                "paid": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns `applied` and the sales order as it is now, including its line items and dispatches. `applied` is `false` if the dispatch already had the value you sent.\n",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProformaPaidResult"
                },
                "example": {
                  "applied": true,
                  "salesOrder": {
                    "id": "soProforma3Kq8mWz",
                    "externalRef": null,
                    "orderNo": "1063",
                    "companyId": "cmpProformaCo2Wq7",
                    "currencyId": "curGBPqk2j9x4mWpT",
                    "status": "on_order",
                    "contactId": "cntProformaCo8Kq3",
                    "addressId": "adrProformaCo5Zx1",
                    "customerCollection": false,
                    "salesPersonId": "usrJaneDoe4Kq9mWt",
                    "customerOrderNo": "WEB-20931",
                    "callOff": false,
                    "exchangeRate": 1,
                    "eoriNumberId": null,
                    "incotermId": null,
                    "incotermNamedPlace": null,
                    "commissionId": null,
                    "divisionId": null,
                    "totalValue": 418,
                    "totalValueBase": 418,
                    "quoteId": null,
                    "quoteRevisionId": null,
                    "quoteNo": null,
                    "wentActiveAt": "2026-09-22T10:04:51.000Z",
                    "linkedPurchaseOrders": [],
                    "invoices": [],
                    "lineItems": [
                      {
                        "id": "oliProformaLine4Wq",
                        "externalRef": null,
                        "stockItemId": "stkFlangeDN50PN16",
                        "description": "Flange DN50 PN16, 316L stainless",
                        "quantity": 2,
                        "unitPrice": 209,
                        "price": 209,
                        "discount": 0,
                        "taxRateId": "trx20pcVATkQ9m3Zd",
                        "salesAnalysisId": "sac5MachinedParts",
                        "tagNumber": null,
                        "lastCost": 125.4,
                        "margin": 40,
                        "quotedLeadTime": null,
                        "commodityCodeId": "cmc84818059000Xk2",
                        "countryOfOriginId": "ctyUnitedKingdom1",
                        "bomItems": [],
                        "linkedPurchaseOrderId": null,
                        "linkedPurchaseOrderNo": null,
                        "created": "2026-09-22T10:03:12.000Z",
                        "updated": "2026-09-22T10:03:12.000Z"
                      }
                    ],
                    "dispatches": [
                      {
                        "id": "dspProforma7Wq2mX",
                        "salesOrderId": "soProforma3Kq8mWz",
                        "salesOrderNo": "1063",
                        "customerOrderNo": "WEB-20931",
                        "companyId": "cmpProformaCo2Wq7",
                        "dispatchNo": 1,
                        "statusId": "wfsAllocated7Kq2M",
                        "statusType": "allocated",
                        "dispatchDate": "2026-09-25",
                        "courierId": null,
                        "trackingNo": null,
                        "deliveryNotes": null,
                        "invoiceNo": null,
                        "invoiceDate": null,
                        "invoiceDueDate": null,
                        "proformaPaid": true,
                        "totalValue": 418,
                        "totalTax": 83.6,
                        "totalWithTax": 501.6,
                        "totalValueBase": 418,
                        "totalTaxBase": 83.6,
                        "lineItems": [
                          {
                            "id": "dliProformaLine9Kq",
                            "salesOrderLineItemId": "oliProformaLine4Wq",
                            "stockItemId": "stkFlangeDN50PN16",
                            "quantity": 2,
                            "pickedQuantity": 0,
                            "serialNumber": null
                          }
                        ],
                        "legalTransitions": [
                          {
                            "statusId": "wfsUnalloc2Kq8mWz",
                            "name": "Awaiting Allocation",
                            "type": "unallocated",
                            "blockedBy": []
                          },
                          {
                            "statusId": "wfsOnHold3Qk8mWzX",
                            "name": "On Hold",
                            "type": "on_hold",
                            "blockedBy": []
                          },
                          {
                            "statusId": "wfsShipped9Kq4mTz",
                            "name": "Shipped",
                            "type": "final",
                            "blockedBy": []
                          }
                        ],
                        "created": "2026-09-22T10:05:30.000Z",
                        "updated": "2026-09-24T09:12:40.000Z"
                      }
                    ],
                    "created": "2026-09-22T10:02:44.000Z",
                    "updated": "2026-09-24T09:12:40.000Z"
                  }
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "description": "The request failed validation, for example because you sent `{ \"paid\": true }` for a customer who isn't on proforma terms. Nothing was saved.\n",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "example": {
                  "type": "https://api.omono.co/docs/errors/validation-failed",
                  "code": "validation-failed",
                  "title": "Validation failed",
                  "status": 422,
                  "detail": "paid: the customer is not on proforma terms.",
                  "requestId": "req_9Jc4TqX2mBv7RkLpW",
                  "errors": [
                    {
                      "field": "paid",
                      "message": "the customer is not on proforma terms"
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/sales-orders/{id}/dispatches/{dispatchId}/delivery-note-pdf": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        },
        {
          "name": "dispatchId",
          "in": "path",
          "required": true,
          "description": "The ID of the dispatch. It must be a dispatch on the sales order in the path.",
          "schema": {
            "type": "string",
            "maxLength": 64
          }
        }
      ],
      "get": {
        "operationId": "getDeliveryNotePdf",
        "x-stability": "beta",
        "tags": [
          "Dispatches"
        ],
        "summary": "Download a delivery note PDF",
        "description": "Downloads the dispatch's delivery note as a PDF. The delivery note goes with the goods, and lists what the dispatch ships, its delivery address and its `deliveryNotes`. Its file name has the order and dispatch numbers, such as `DEL-2045-1.pdf`.\n\nEvery dispatch has a delivery note, at every stage, so you can print it before or after the dispatch ships.\n\nAgainst your rate limits, a PDF counts as 5 requests on your organisation's per-minute limit, because Omono creates the file for you. A request that its checks refuse counts as 1. Learn more about [heavy requests](/docs/limits#pdfs).\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 404 | `not-found` | No sales order has this ID, or the order has no dispatch with this `dispatchId`. |\n| 409 | `document-too-large` | The PDF is bigger than the API can return, which is rare. Download it in Omono instead. |\n",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Pdf"
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/sales-orders/{id}/dispatches/{dispatchId}/picking-list-pdf": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        },
        {
          "name": "dispatchId",
          "in": "path",
          "required": true,
          "description": "The ID of the dispatch. It must be a dispatch on the sales order in the path.",
          "schema": {
            "type": "string",
            "maxLength": 64
          }
        }
      ],
      "get": {
        "operationId": "getPickingListPdf",
        "x-stability": "beta",
        "tags": [
          "Dispatches"
        ],
        "summary": "Download a picking list PDF",
        "description": "Downloads the dispatch's picking list as a PDF. The picking list tells your warehouse what to pick for the dispatch, including the parts of any kit or assembly. Its file name has the order and dispatch numbers, such as `PKL-2045-1.pdf`.\n\nIt's the sheet staff print from the picking screen in Omono while they pick: each line's **Quantity** is what they've entered on that screen and not saved yet, and **Available** is the stock in Omono with that quantity added back. So until someone is picking the dispatch, every quantity is 0. To tell a warehouse what to pick, send it the dispatch's line items, or its delivery note.\n\nAgainst your rate limits, a PDF counts as 5 requests on your organisation's per-minute limit, because Omono creates the file for you. A request that its checks refuse counts as 1. Learn more about [heavy requests](/docs/limits#pdfs).\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 404 | `not-found` | No sales order has this ID, or the order has no dispatch with this `dispatchId`. |\n| 409 | `document-too-large` | The PDF is bigger than the API can return, which is rare. Download it in Omono instead. |\n",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Pdf"
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/sales-orders/{id}/dispatches/{dispatchId}/proforma-pdf": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        },
        {
          "name": "dispatchId",
          "in": "path",
          "required": true,
          "description": "The ID of the dispatch. It must be a dispatch on the sales order in the path.",
          "schema": {
            "type": "string",
            "maxLength": 64
          }
        }
      ],
      "get": {
        "operationId": "getDispatchProformaPdf",
        "x-stability": "beta",
        "tags": [
          "Dispatches"
        ],
        "summary": "Download a dispatch proforma PDF",
        "description": "Downloads the dispatch's proforma invoice as a PDF. A proforma customer pays before their goods ship, so you send them the proforma to ask for payment. Its file name has the order and dispatch numbers, such as `PRO-2045-1.pdf`. When the payment arrives, [mark the dispatch as paid](#tag/dispatches/POST/sales-orders/{id}/dispatches/{dispatchId}/proforma-paid).\n\nOnly a proforma customer's dispatches have a proforma, as in Omono. A customer is a proforma customer when the company's `isProforma` field is `true`.\n\nAgainst your rate limits, a PDF counts as 5 requests on your organisation's per-minute limit, because Omono creates the file for you. A request that its checks refuse counts as 1. Learn more about [heavy requests](/docs/limits#pdfs).\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 404 | `not-found` | No sales order has this ID, the order has no dispatch with this `dispatchId`, or the customer isn't a proforma customer, so the dispatch has no proforma. |\n| 409 | `document-too-large` | The PDF is bigger than the API can return, which is rare. Download it in Omono instead. |\n",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Pdf"
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/sales-orders/{id}/transitions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "operationId": "transitionSalesOrder",
        "x-stability": "beta",
        "tags": [
          "Dispatches"
        ],
        "summary": "Move a dispatch to a new status",
        "description": "Moves a dispatch to another workflow status. Workflow statuses are the steps a dispatch goes through in Omono, such as Awaiting Allocation, Allocated and Shipped. Your organisation names its own statuses, but each one has a `type`, which today is `unallocated`, `allocated`, `on_hold` or `final`. Moving a dispatch to a status whose type is `allocated` reserves its stock, and moving it back to a status whose type is `unallocated` unpicks its goods and releases that stock. Moving a dispatch to the final status (the one whose type is `final`) ships it and raises its invoice, and this can't be undone.\n\nSend the dispatch's `dispatchId` and the `statusId` to move it to. Take the `statusId` from the dispatch's `legalTransitions`, which lists every status the dispatch can move to right now. If a status's `blockedBy` list isn't empty, you can't use that status yet: each code in the list names something that has to be fixed first. A dispatch has no `ETag` of its own, so send the sales order's `ETag` in `If-Match`.\n\nWhen you ship a dispatch by moving it to the final status, you can also send `invoiceDate`, `courierId`, `trackingNo` and `suppressCustomerEmail`. Any other move ignores them. Omono checks these fields before it changes anything, so a refused request doesn't use up an invoice number. The checks that stop a dispatch shipping, which the `blockedBy` codes describe, run last, after `If-Match` is compared. Today, Omono doesn't run your organisation's credit check when you ship through the API, so check the customer's balance yourself if you need to.\n\nIf the dispatch is already at the status you send, nothing runs again and the response has `\"applied\": false`. The one exception is a retry of a ship that failed part-way: the retry finishes the invoicing and returns `\"applied\": true`.\n\nEvery move also clears the dispatch's traffic light, the marker staff use in Omono to show that work on a dispatch is in progress or has a problem. If your organisation has chosen to remove assigned operators whenever the status changes, the move removes them too.\n\nThe API makes one change at a time to an order's dispatches. While a dispatch moves, another request that creates, changes, deletes or moves a dispatch of the same order waits for up to 5 seconds.\n\nAgainst your rate limits, a move that allocates stock, releases it or ships the dispatch counts as one write for every 10 of the dispatch's line items and BOM items, rounded up. Any other move counts as 1, and so does a request that its checks refuse or that finds the dispatch already at that status. Two exceptions count in full: a repeated move to a shipped status that finishes a ship whose invoicing failed, because it does the ship's work, and a request that passes its checks and then loses a race to another change.\n\nLearn more about [moving a dispatch](/docs/workflow#moving-a-dispatch), [shipping](/docs/workflow#shipping-the-final-status), [when a dispatch can't ship](/docs/workflow#when-a-dispatch-cannot-ship), [other refusals](/docs/workflow#other-refusals), [what to do if a ship fails](/docs/workflow#if-a-ship-fails) and [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `dispatch-order-mismatch` | The dispatch belongs to another sales order. |\n| 409 | `order-not-active` | The sales order is a Draft or Cancelled. Activate a Draft order first. |\n| 409 | `dispatch-shipped` | The dispatch has already shipped, so its status can't change. |\n| 409 | `dispatch-state-changed` | Another request changed the dispatch at the same time, or is still shipping it. Read the order again and decide whether to retry. |\n| 409 | `dispatch-pick-not-saved` | You tried to ship a dispatch whose picking is in progress in Omono, or whose picking wasn't saved. In Omono the dispatch can look picked. |\n| 409 | `dispatch-not-fully-picked` | You tried to ship a dispatch that isn't fully picked in Omono. |\n| 409 | `blocking-tasks` | You tried to ship a dispatch, but an open task linked to the order blocks shipping. |\n| 409 | `company-on-stop` | You tried to ship a dispatch, but the customer is on stop, a hold that staff put on a customer's account in Omono. |\n| 409 | `proforma-not-paid` | You tried to ship a proforma customer's dispatch before it was marked as paid. |\n| 409 | `document-too-large` | The order has more than 10,000 related records to return, counting its line items, their BOM items, its dispatches and their line items. That's more than one response can carry, so nothing changes. Move the dispatch in Omono instead. |\n| 422 | `invalid-transition-target` | The status doesn't exist in your organisation, or it's archived. |\n| 422 | `validation-failed` | `invoiceDate` is in the future, or more than 31 days in the past, counting in your organisation's time zone. |\n| 422 | `invalid-reference` | `dispatchId` isn't a dispatch in your organisation, or `courierId` isn't a courier your organisation can use. |\n| 503 | `temporarily-unavailable` | Another request, or a save in Omono, is still changing this order's dispatches or line items, or activating or cancelling it, after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransitionRequest"
              },
              "examples": {
                "moveToOnHold": {
                  "summary": "Move a dispatch between two statuses that aren't final",
                  "value": {
                    "dispatchId": "dsp6Tq2mNkXw9PzRj",
                    "statusId": "wfsOnHold3Qk8mWzX"
                  }
                },
                "ship": {
                  "summary": "Ship a dispatch by moving it to the final status",
                  "description": "Ships a dispatch by moving it to the final status. This uses up an invoice number, and the dispatch must already be picked in Omono. `courierId` and `trackingNo` are saved with the new status, so the invoice email and PDF show them.\n",
                  "value": {
                    "dispatchId": "dsp6Tq2mNkXw9PzRj",
                    "statusId": "wfsShipped9Kq4mTz",
                    "invoiceDate": "2026-09-18",
                    "courierId": "crrDHLExpressUK1x",
                    "trackingNo": "4471093826"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns `applied` and the sales order as it is now, including its line items and dispatches, so you can see the dispatch's new status without another request. `applied` is `false` if the dispatch was already at that status, but a retry that finishes a failed ship returns `true`.\n",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransitionResult"
                },
                "example": {
                  "applied": true,
                  "salesOrder": {
                    "id": "vShvOSNvvpFsuxKgN",
                    "externalRef": null,
                    "orderNo": "1042",
                    "companyId": "b2FpLmNvbXBhbnkQQ",
                    "currencyId": "curGBPqk2j9x4mWpT",
                    "status": "complete",
                    "contactId": "cnt4Kj9mQdPw2XhTe",
                    "addressId": "adr7Np3kWqYz5RvBc",
                    "customerCollection": false,
                    "salesPersonId": "usrJaneDoe4Kq9mWt",
                    "customerOrderNo": "PO-88231",
                    "callOff": false,
                    "exchangeRate": 1,
                    "eoriNumberId": null,
                    "incotermId": "incFCA2020Rules9x",
                    "incotermNamedPlace": "Bristol, UK",
                    "commissionId": null,
                    "divisionId": "divNorthOffice3Qz",
                    "totalValue": 1250,
                    "totalValueBase": 1250,
                    "quoteId": "qteWonEarlier4Kq2",
                    "quoteRevisionId": "revWonEarlier8Zq2",
                    "quoteNo": "0899",
                    "wentActiveAt": "2026-07-30T09:14:02.000Z",
                    "linkedPurchaseOrders": [
                      {
                        "purchaseOrderId": "aK3nMh2PqXwYbTzVc",
                        "purchaseOrderNo": "311"
                      }
                    ],
                    "invoices": [
                      {
                        "dispatchId": "dsp6Tq2mNkXw9PzRj",
                        "invoiceNo": "2107",
                        "invoiceDate": "2026-08-14"
                      }
                    ],
                    "lineItems": [
                      {
                        "id": "oliBearingHous4Kq",
                        "externalRef": null,
                        "stockItemId": "stkBearingHousing",
                        "description": "Bearing housing, cast iron, machined",
                        "quantity": 10,
                        "unitPrice": 125,
                        "price": 125,
                        "discount": 0,
                        "taxRateId": "trx20pcVATkQ9m3Zd",
                        "salesAnalysisId": "sac5MachinedParts",
                        "tagNumber": "TAG-0114",
                        "lastCost": 75,
                        "margin": 40,
                        "quotedLeadTime": "4 weeks",
                        "commodityCodeId": "cmc84818059000Xk2",
                        "countryOfOriginId": "ctyUnitedKingdom1",
                        "bomItems": [],
                        "linkedPurchaseOrderId": "aK3nMh2PqXwYbTzVc",
                        "linkedPurchaseOrderNo": "311",
                        "created": "2026-07-30T09:12:44.000Z",
                        "updated": "2026-08-14T15:02:10.000Z"
                      }
                    ],
                    "dispatches": [
                      {
                        "id": "dsp6Tq2mNkXw9PzRj",
                        "salesOrderId": "vShvOSNvvpFsuxKgN",
                        "salesOrderNo": "1042",
                        "customerOrderNo": "PO-88231",
                        "companyId": "b2FpLmNvbXBhbnkQQ",
                        "dispatchNo": 1,
                        "statusId": "wfsShipped9Kq4mTz",
                        "statusType": "final",
                        "dispatchDate": "2026-08-14",
                        "courierId": "crrDHLExpressUK1x",
                        "trackingNo": "4471093826",
                        "deliveryNotes": null,
                        "invoiceNo": "2107",
                        "invoiceDate": "2026-08-14",
                        "invoiceDueDate": "2026-09-13",
                        "proformaPaid": false,
                        "totalValue": 1250,
                        "totalTax": 250,
                        "totalWithTax": 1500,
                        "totalValueBase": 1250,
                        "totalTaxBase": 250,
                        "lineItems": [
                          {
                            "id": "dliBearingHous7Wq",
                            "salesOrderLineItemId": "oliBearingHous4Kq",
                            "stockItemId": "stkBearingHousing",
                            "quantity": 10,
                            "pickedQuantity": 10,
                            "serialNumber": null
                          }
                        ],
                        "legalTransitions": [],
                        "created": "2026-07-30T10:02:11.000Z",
                        "updated": "2026-08-19T16:30:08.000Z"
                      }
                    ],
                    "created": "2026-07-30T09:12:44.000Z",
                    "updated": "2026-08-19T16:30:08.000Z"
                  }
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/sales-orders/{id}/activate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "operationId": "activateSalesOrder",
        "x-stability": "beta",
        "tags": [
          "Sales orders"
        ],
        "summary": "Activate a sales order",
        "description": "Activates a Draft sales order, which puts it on order. Its status changes from Draft to On Order, or to On Order - Call Off if `callOff` is `true`. A call-off order is a standing order that the customer takes in several deliveries over a period. Send the request without a body. Omono ignores any body you send, so set `callOff` when you create the order, or with a `PATCH`, before you activate it.\n\nAn order that isn't a call-off needs all of its line items on dispatches before it can be activated, as in Omono: for each line item, the quantities on its dispatches must add up to the line item's quantity. [Create the dispatches](#tag/dispatches/POST/sales-orders/{id}/dispatches) first. A call-off order can be activated without dispatches. You need to activate an order before you can move its dispatches.\n\nIf the order is already active (On Order, On Hold or On Order - Call Off), nothing changes and the response has `\"applied\": false`. An order that's on hold stays on hold. If two requests activate the same order at the same time, only one of them does the work, and the other returns `\"applied\": false`.\n\nYou can't cancel an order through the API. Staff cancel orders in Omono.\n\nAgainst your rate limits, an activation counts as one write for every 10 of the order's line items, rounded up. A request that its checks refuse, or that finds the order already active, counts as 1.\n\nLearn more about [lifecycle actions](/docs/writing#lifecycle-actions) and [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `sales-order-locked` | The order is Complete or Cancelled. |\n| 409 | `no-line-items` | The order has no line items. The error's `field` is `lineItems`. |\n| 409 | `document-too-large` | The order has more than 10,000 line items and BOM items, which is more than one response can carry, so nothing changes. Activate the order in Omono instead. |\n| 409 | `dispatches-incomplete` | The order isn't a call-off, and the quantities on its dispatches don't add up to its line items' quantities. Each entry in `errors` names one line item and says how much of it is on dispatches. |\n| 503 | `temporarily-unavailable` | Another request, or a save in Omono, is still changing this order's dispatches or line items, or cancelling it, after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns `applied` and the sales order as it is now, including its line items. `applied` is `false` if the order was already active.\n",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesOrderActionResult"
                },
                "example": {
                  "applied": true,
                  "salesOrder": {
                    "id": "soNew7Qk2mXw9PzRj",
                    "externalRef": null,
                    "orderNo": "1057",
                    "companyId": "b2FpLmNvbXBhbnkQQ",
                    "currencyId": "curGBPqk2j9x4mWpT",
                    "status": "on_order",
                    "contactId": "cnt4Kj9mQdPw2XhTe",
                    "addressId": "adr7Np3kWqYz5RvBc",
                    "customerCollection": false,
                    "salesPersonId": "usrJaneDoe4Kq9mWt",
                    "customerOrderNo": "PO-88412",
                    "callOff": false,
                    "exchangeRate": 1,
                    "eoriNumberId": "eorGB123456789000",
                    "incotermId": null,
                    "incotermNamedPlace": null,
                    "commissionId": null,
                    "divisionId": "divNorthOffice3Qz",
                    "totalValue": 1250,
                    "totalValueBase": 1250,
                    "quoteId": null,
                    "quoteRevisionId": null,
                    "quoteNo": null,
                    "wentActiveAt": "2026-08-19T17:10:44.000Z",
                    "linkedPurchaseOrders": [],
                    "invoices": [],
                    "lineItems": [
                      {
                        "id": "oliNewOrderLine7Kq",
                        "externalRef": null,
                        "stockItemId": "stkBearingHousing",
                        "description": "Bearing housing, cast iron, machined",
                        "quantity": 10,
                        "unitPrice": 125,
                        "price": 125,
                        "discount": 0,
                        "taxRateId": "trx20pcVATkQ9m3Zd",
                        "salesAnalysisId": "sac5MachinedParts",
                        "tagNumber": null,
                        "lastCost": 75,
                        "margin": 40,
                        "quotedLeadTime": null,
                        "commodityCodeId": "cmc84818059000Xk2",
                        "countryOfOriginId": "ctyUnitedKingdom1",
                        "bomItems": [],
                        "linkedPurchaseOrderId": null,
                        "linkedPurchaseOrderNo": null,
                        "created": "2026-08-19T16:20:11.204Z",
                        "updated": "2026-08-19T16:20:11.204Z"
                      }
                    ],
                    "created": "2026-08-19T16:20:11.000Z",
                    "updated": "2026-08-19T17:10:44.000Z"
                  }
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/dispatches": {
      "get": {
        "operationId": "listDispatches",
        "x-stability": "beta",
        "tags": [
          "Dispatches"
        ],
        "summary": "List all dispatches",
        "description": "Returns a list of your dispatches across all your sales orders, each with its line items and `legalTransitions`. The newest dispatches come first unless you choose another order with `sort`.\n\nA warehouse or third-party logistics (3PL) system can use it to find the work it has to do. Keep a copy by polling with `updated_since` and `sort=updated`, without a status filter, and pick the dispatches released to you from your copy, by their `statusId` or `statusType`: a dispatch that moves to another status still comes back in your poll. A filter suits a one-off read, such as `statusType=allocated` for every dispatch whose stock is reserved now. Each line item shows how much staff have picked, in `pickedQuantity`. Learn more about [pagination](/docs/reading#pagination), [filters](/docs/reading#filters) and [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `document-too-large` | The first dispatch on the page has more than 10,000 line items, or comes to more than 32 MB of JSON with them, which is more than one response can carry. Read the dispatch in Omono instead. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/SortStandard"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "statusId",
            "in": "query",
            "description": "Only return dispatches at these workflow statuses. Send up to 100 workflow status IDs, separated by commas. You can also repeat the parameter, as in `statusId=a&statusId=b`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "statusType",
            "in": "query",
            "description": "Only return dispatches at a workflow status of these types, `unallocated`, `allocated`, `on_hold` or `final`, separated by commas. Together with `statusId`, a dispatch must match both.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 4,
              "items": {
                "$ref": "#/components/schemas/KnownWorkflowStatusType"
              },
              "minItems": 1
            }
          },
          {
            "name": "salesOrderId",
            "in": "query",
            "description": "Only return dispatches of these sales orders. Send up to 100 sales order IDs, separated by commas. You can also repeat the parameter, as in `salesOrderId=a&salesOrderId=b`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "companyId",
            "in": "query",
            "description": "Only return dispatches for these customers. Send up to 100 company IDs, separated by commas. You can also repeat the parameter, as in `companyId=a&companyId=b`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "dispatchNo",
            "in": "query",
            "description": "Only return the dispatches with these numbers on the orders in `salesOrderId`, which you must send with it. A dispatch's number counts within its sales order, so SO-1042-2 has `dispatchNo` 2. Without `salesOrderId`, the request fails with a `422` error and the code `validation-failed` on the field `salesOrderId`. Send up to 100 numbers, separated by commas. You can also repeat the parameter, as in `dispatchNo=1&dispatchNo=2`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100000
              },
              "minItems": 1
            }
          },
          {
            "name": "trackingNo",
            "in": "query",
            "description": "Only return dispatches with these tracking numbers. Omono matches each value exactly against the whole tracking number saved on the dispatch, after removing spaces from the start and end of the value you send: capital letters, and any spaces inside the number, must be as stored, so `JD0146 0000 3GB` doesn't find `JD014600003GB`. Staff can type anything in the tracking number, so if they saved two numbers in one dispatch's tracking number, send the whole text to match it. A value that contains a comma can't be matched. Send up to 100 values, separated by commas. You can also repeat the parameter, as in `trackingNo=JD014600003GB&trackingNo=JD014600004GB`. A tracking number that no dispatch has is left out, so the page can be empty.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200,
                "pattern": "\\S"
              },
              "minItems": 1
            }
          },
          {
            "name": "invoiced",
            "in": "query",
            "description": "Send `true` for only the dispatches that have been invoiced (shipped), or `false` for only the ones that haven't.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of dispatches.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DispatchList"
                },
                "example": {
                  "data": [
                    {
                      "id": "dsp6Tq2mNkXw9PzRj",
                      "salesOrderId": "soW3kdnR8LqP2xVaT",
                      "salesOrderNo": "1042",
                      "customerOrderNo": null,
                      "companyId": "b2FpLmNvbXBhbnkQQ",
                      "dispatchNo": 1,
                      "statusId": "wfsShipped9Kq4mTz",
                      "statusType": "final",
                      "dispatchDate": "2026-08-14",
                      "courierId": "crrDHLExpressUK1x",
                      "trackingNo": "JD014600003GB",
                      "deliveryNotes": null,
                      "invoiceNo": "2107",
                      "invoiceDate": "2026-08-14",
                      "invoiceDueDate": "2026-09-13",
                      "proformaPaid": false,
                      "totalValue": 1250,
                      "totalTax": 250,
                      "totalWithTax": 1500,
                      "totalValueBase": 1250,
                      "totalTaxBase": 250,
                      "lineItems": [
                        {
                          "id": "dliBearingHous8Zq",
                          "salesOrderLineItemId": "oliBearingHous4Kq",
                          "stockItemId": "stkBearingHousing",
                          "quantity": 10,
                          "pickedQuantity": 10,
                          "serialNumber": null
                        }
                      ],
                      "legalTransitions": [],
                      "created": "2026-08-12T14:40:19.000Z",
                      "updated": "2026-08-14T15:02:10.000Z"
                    },
                    {
                      "id": "dsp9Wm4kQz2XpTn7R",
                      "salesOrderId": "soW3kdnR8LqP2xVaT",
                      "salesOrderNo": "1042",
                      "customerOrderNo": null,
                      "companyId": "b2FpLmNvbXBhbnkQQ",
                      "dispatchNo": 2,
                      "statusId": "wfsAllocated7Kq2M",
                      "statusType": "allocated",
                      "dispatchDate": "2026-08-21",
                      "courierId": null,
                      "trackingNo": null,
                      "deliveryNotes": null,
                      "invoiceNo": null,
                      "invoiceDate": null,
                      "invoiceDueDate": null,
                      "proformaPaid": false,
                      "totalValue": 220,
                      "totalTax": 44,
                      "totalWithTax": 264,
                      "totalValueBase": 220,
                      "totalTaxBase": 44,
                      "lineItems": [
                        {
                          "id": "dliGasketSet2Wq7",
                          "salesOrderLineItemId": "oliGasketSet7Wq3",
                          "stockItemId": "stkGasketDN50EPDM",
                          "quantity": 50,
                          "pickedQuantity": 20,
                          "serialNumber": null
                        }
                      ],
                      "legalTransitions": [
                        {
                          "statusId": "wfsUnalloc2Kq8mWz",
                          "name": "Awaiting Allocation",
                          "type": "unallocated",
                          "blockedBy": []
                        },
                        {
                          "statusId": "wfsOnHold3Qk8mWzX",
                          "name": "On Hold",
                          "type": "on_hold",
                          "blockedBy": []
                        },
                        {
                          "statusId": "wfsShipped9Kq4mTz",
                          "name": "Shipped",
                          "type": "final",
                          "blockedBy": [
                            "dispatch-not-fully-picked"
                          ]
                        }
                      ],
                      "created": "2026-08-19T09:02:44.000Z",
                      "updated": "2026-08-19T09:02:44.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ],
        "x-group-parameters": true
      }
    },
    "/sales-order-lines": {
      "get": {
        "operationId": "listSalesOrderLines",
        "x-stability": "beta",
        "tags": [
          "Sales orders"
        ],
        "summary": "List all sales order lines",
        "description": "Returns a list of the line items on all your sales orders, one row for each line item, with the number, customer, status, creation time, currency and exchange rate of the order it's on. A line item's prices and costs are in its order's currency. Line items of Draft and Cancelled orders are in the list too: `orderStatus` tells you which. The newest line items come first unless you choose another order with `sort`. Use it for reports, such as what you've sold of a stock item, without reading every order.\n\nA line item that staff remove from an order isn't in this list any more, and nothing in [List all events](#tag/events/GET/events) tells you it went: only the order's `updated` time moves. So don't keep a copy of your orders from this list. Keep your sales orders in step with [List all sales orders](#tag/sales-orders/GET/sales-orders) and `updated_since`, which returns each changed order with its line items. A line item's `created`, `updated` and `updated_since` are the line item's own, not its order's. Learn more about [pagination](/docs/reading#pagination) and [filters](/docs/reading#filters).\n\nThere's no `companyId` filter, because a line item doesn't store its customer. To list one customer's line items, filter by `salesOrderId`, or list the customer's orders with `include=lineItems`.\n\nRequires the `sales:read` or `sales:write` scope. A line item's `lastCost` and `margin` are included only when your key also has the `stock:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/SortStandard"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "salesOrderId",
            "in": "query",
            "description": "Only return the line items on these sales orders. Send up to 100 sales order IDs, separated by commas. You can also repeat the parameter, as in `salesOrderId=a&salesOrderId=b`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "stockItemId",
            "in": "query",
            "description": "Only return the line items for these stock items. Send up to 100 stock item IDs, separated by commas. You can also repeat the parameter, as in `stockItemId=a&stockItemId=b`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of sales order line items.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesOrderLineList"
                },
                "example": {
                  "data": [
                    {
                      "id": "oli9Wm2kQx7Tz4RpV",
                      "salesOrderId": "soGearbox8Kq3Wn",
                      "orderNo": "1042",
                      "companyId": "cmpAcme5Rt8Lq2",
                      "orderStatus": "on_order",
                      "orderCreated": "2026-09-14T08:12:40.000Z",
                      "currencyId": "curGBP4Lw9Zq",
                      "exchangeRate": 1,
                      "externalRef": null,
                      "stockItemId": "stkGearbox20Kw",
                      "description": "Gearbox, 20 kW",
                      "quantity": 4,
                      "unitPrice": 1140,
                      "price": 1200,
                      "discount": 5,
                      "taxRateId": "txrStandard20",
                      "salesAnalysisId": "saGearboxes",
                      "tagNumber": null,
                      "lastCost": 820,
                      "margin": 28.07,
                      "quotedLeadTime": "3 weeks",
                      "commodityCodeId": null,
                      "countryOfOriginId": null,
                      "linkedPurchaseOrderId": null,
                      "linkedPurchaseOrderNo": null,
                      "created": "2026-09-14T08:13:05.000Z",
                      "updated": "2026-09-15T10:02:11.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ],
        "x-group-parameters": true
      }
    },
    "/sales-orders/{id}/pdf": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "getSalesOrderPdf",
        "x-stability": "beta",
        "tags": [
          "Sales orders"
        ],
        "summary": "Download a sales order PDF",
        "description": "Downloads the sales order as a PDF, the order confirmation you send to your customer. It's the PDF that Omono's **Print** and **Download** buttons create, and its file name is like `SO-2045.pdf`.\n\nAs in Omono, an order has a PDF once it has line items and, unless it's a call-off order (`callOff` is `true`), all of its line items are on dispatches. A Draft order that meets these rules prints without a \"DRAFT\" mark.\n\nAgainst your rate limits, a PDF counts as 5 requests on your organisation's per-minute limit, because Omono creates the file for you. A request that its checks refuse counts as 1. Learn more about [heavy requests](/docs/limits#pdfs).\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 404 | `not-found` | No sales order has this ID. |\n| 409 | `no-line-items` | The order has no line items, so it has nothing to print. The error's `field` is `lineItems`. |\n| 409 | `dispatches-incomplete` | The order isn't a call-off, and some of its line items aren't on dispatches yet. Each entry in `errors` names a line item and how much of it is on dispatches. [Add a dispatch](#tag/dispatches/POST/sales-orders/{id}/dispatches) for the rest, then retry. |\n| 409 | `document-too-large` | The PDF is bigger than the API can return, which is rare. Download it in Omono instead. |\n",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Pdf"
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/sales-orders/{id}/notes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "listSalesOrderNotes",
        "x-stability": "beta",
        "tags": [
          "Notes"
        ],
        "summary": "List a sales order's notes",
        "description": "Returns the notes on a sales order, newest first. The list has user notes, which people write in Omono or which an API key adds, and system notes, which are the history that Omono writes itself, such as a status change or a changed delivery date. Each note's `kind` says which it is, and the `kind` filter returns one of them. A system note is the record's history as staff see it in Omono, and it can name other records, such as an order number on a stock item.\n\nA new note doesn't change the sales order's `updated` time. To keep a copy of the notes up to date, read this list again with `created_gte` set to the `created` time of the newest note you have, and skip the notes whose `id` you already have. Learn more about [notes](/docs/reading#notes).\n\nRequires the `sales:read` or `sales:write` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "kind",
            "in": "query",
            "description": "Pass `user` to return only the notes that people wrote or that an API key added, or `system` to return only the notes that Omono wrote itself.\n",
            "schema": {
              "type": "string",
              "enum": [
                "user",
                "system"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of notes.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NoteList"
                },
                "example": {
                  "data": [
                    {
                      "id": "nte8Rq2LmXw4KpZt7",
                      "kind": "user",
                      "text": "Called Priya Shah: the customer wants delivery before 12 December.",
                      "authorName": "API · CRM sync",
                      "userId": "usrApi4Wn8Kq2Lp5X",
                      "apiKeyId": "key7Tz3Mq9Wb2Xc4V",
                      "created": "2026-11-30T14:05:12.000Z"
                    },
                    {
                      "id": "nte5Bc9TyUw1QsVn3",
                      "kind": "system",
                      "text": "Status changed from Draft to Active",
                      "authorName": "Hannah Okafor",
                      "userId": "usr2Pq8Lm4Xw7Kz9R",
                      "apiKeyId": null,
                      "created": "2026-11-28T09:41:37.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createSalesOrderNote",
        "x-stability": "beta",
        "tags": [
          "Notes"
        ],
        "summary": "Add a note to a sales order",
        "description": "Adds a plain-text note to a sales order. The note appears in the sales order's notes in Omono, as if someone had written it there. The note's author is the API key, shown as `API · ` and the key's name. You can add a note to a sales order in any state, archived, closed or cancelled ones included, as staff can in Omono. A note can't be changed or deleted through the API, so check the text before you send it. The returned `text` can differ from the text you sent in two ways: Omono removes spaces and line breaks from the start and end, and replaces a character that isn't valid Unicode. One record can take about 50 notes through the API in any 24 hours: Omono checks the count before it adds the note, so notes sent at the same moment can pass it by a few.\n\nA new note doesn't change the sales order's `updated` time. Learn more about [adding notes](/docs/writing#notes).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 422 | `validation-failed` | `text` is blank, is longer than 2,000 characters, has more than 50 lines, or contains a control character other than a tab or a line break. |\n| 429 | `rate-limited` | The record already has about 50 notes added through the API in the last 24 hours. This is a daily cap on the record, not a request limit: `Retry-After` gives the seconds until it can take another, which can be many hours. |\n| 429 | `rate-limited` | Your organisation has stored its daily limit of descriptions and notes. `Retry-After` gives the seconds until 00:00 UTC. Learn more about [limits](/docs/limits#stored-descriptions). |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "The note to add.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NoteCreate"
              },
              "example": {
                "text": "Called Priya Shah: the customer wants delivery before 12 December."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new note.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Note"
                },
                "example": {
                  "id": "nte8Rq2LmXw4KpZt7",
                  "kind": "user",
                  "text": "Called Priya Shah: the customer wants delivery before 12 December.",
                  "authorName": "API · CRM sync",
                  "userId": "usrApi4Wn8Kq2Lp5X",
                  "apiKeyId": "key7Tz3Mq9Wb2Xc4V",
                  "created": "2026-11-30T14:05:12.000Z"
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/invoices": {
      "get": {
        "operationId": "listInvoices",
        "x-stability": "beta",
        "tags": [
          "Dispatches"
        ],
        "summary": "List all invoices",
        "description": "Returns a list of your invoices. Omono raises an invoice when a dispatch ships, so each invoice is an invoiced dispatch. The newest invoices come first unless you choose another order with `sort`.\n\nTo find invoices by their numbers, send `invoiceNo`. To copy new invoices into an accounts system, poll this list with `updated_since`. Learn more about [pagination](/docs/reading#pagination), [filters](/docs/reading#filters), [sorting](/docs/reading#sorting) and [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 422 | `validation-failed` | A number in `invoiceNo` starts with \"INV-\", in any case. Send the number without the prefix, such as `20417` for invoice INV-20417. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/SortStandard"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "companyId",
            "in": "query",
            "description": "Only return invoices for these customers. Send up to 100 company IDs, separated by commas. You can also repeat the parameter, as in `companyId=a&companyId=b`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "invoiceNo",
            "in": "query",
            "description": "Only return the invoices with these numbers. Leave out the \"INV-\" prefix that Omono shows, so send `invoiceNo=20417` for invoice INV-20417. A number that starts with \"INV-\", in any case, fails with a `422` error and the code `validation-failed` on the field `invoiceNo`. Send up to 100 numbers, separated by commas. You can also repeat the parameter, as in `invoiceNo=20417&invoiceNo=20418`. A number that doesn't exist is left out, so the page can be empty.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 32
              },
              "minItems": 1
            }
          },
          {
            "name": "salesOrderId",
            "in": "query",
            "description": "Only return invoices for these sales orders. Send up to 100 sales order IDs, separated by commas. You can also repeat the parameter, as in `salesOrderId=a&salesOrderId=b`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of invoices.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceList"
                },
                "example": {
                  "data": [
                    {
                      "id": "dsp8Hq2LmVx4TzKcR",
                      "dispatchId": "dsp8Hq2LmVx4TzKcR",
                      "invoiceNo": "20417",
                      "invoiceDate": "2026-06-04",
                      "invoiceDueDate": "2026-07-04",
                      "salesOrderId": "ord5Rk8WnQp2JxLmT",
                      "orderNo": "1042",
                      "customerOrderNo": "PO-88231",
                      "dispatchNo": 1,
                      "companyId": "b2FpLmNvbXBhbnkQQ",
                      "currencyId": "curGBPqk2j9x4mWpT",
                      "exchangeRate": 1,
                      "totalValue": 1250,
                      "totalTax": 250,
                      "totalWithTax": 1500,
                      "totalValueBase": 1250,
                      "totalTaxBase": 250,
                      "costOfGoodsSold": 775,
                      "grossProfit": 475,
                      "grossMargin": 38,
                      "costOfGoodsSoldBase": 775,
                      "grossProfitBase": 475,
                      "xero": {
                        "status": "ok",
                        "id": "c3b9f1a2-6d4e-4f7b-9a1c-2e8d5f0b7a64",
                        "lastSyncedAt": "2026-06-04T15:40:02.000Z"
                      },
                      "created": "2026-05-28T09:12:44.000Z",
                      "updated": "2026-06-04T15:40:02.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ],
        "x-group-parameters": true
      }
    },
    "/invoices/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "getInvoice",
        "x-stability": "beta",
        "tags": [
          "Dispatches"
        ],
        "summary": "Retrieve an invoice",
        "description": "Retrieves one invoice. An invoice's ID is the ID of the dispatch it invoices, as [List all invoices](#tag/dispatches/GET/invoices) returns it. To get the goods on the invoice, read its sales order with `include=lineItems,dispatches`, and to get the PDF, use [Download an invoice PDF](#tag/dispatches/GET/invoices/{id}/pdf).\n\nA dispatch that hasn't shipped has no invoice yet, so its ID returns a `404` error.\n\nRequires the `sales:read` or `sales:write` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the invoice.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                },
                "example": {
                  "id": "dsp8Hq2LmVx4TzKcR",
                  "dispatchId": "dsp8Hq2LmVx4TzKcR",
                  "invoiceNo": "20417",
                  "invoiceDate": "2026-06-04",
                  "invoiceDueDate": "2026-07-04",
                  "salesOrderId": "ord5Rk8WnQp2JxLmT",
                  "orderNo": "1042",
                  "customerOrderNo": "PO-88231",
                  "dispatchNo": 1,
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "currencyId": "curGBPqk2j9x4mWpT",
                  "exchangeRate": 1,
                  "totalValue": 1250,
                  "totalTax": 250,
                  "totalWithTax": 1500,
                  "totalValueBase": 1250,
                  "totalTaxBase": 250,
                  "costOfGoodsSold": 775,
                  "grossProfit": 475,
                  "grossMargin": 38,
                  "costOfGoodsSoldBase": 775,
                  "grossProfitBase": 475,
                  "xero": {
                    "status": "ok",
                    "id": "c3b9f1a2-6d4e-4f7b-9a1c-2e8d5f0b7a64",
                    "lastSyncedAt": "2026-06-04T15:40:02.000Z"
                  },
                  "created": "2026-05-28T09:12:44.000Z",
                  "updated": "2026-06-04T15:40:02.000Z"
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/invoices/{id}/pdf": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "getInvoicePdf",
        "x-stability": "beta",
        "tags": [
          "Dispatches"
        ],
        "summary": "Download an invoice PDF",
        "description": "Downloads an invoice as a PDF, the invoice you send to your customer. It's the PDF that Omono's **Invoice** document creates, and its file name has the invoice number, such as `INV-1042.pdf`. Use the `id` from [List all invoices](#tag/dispatches/GET/invoices). An invoice's ID is the ID of the dispatch that it invoices.\n\nOmono raises an invoice when a dispatch ships, so a dispatch that hasn't shipped has no invoice yet. A proforma dispatch that's marked as paid prints \"PAID\" in place of the due date and the bank details.\n\nAgainst your rate limits, a PDF counts as 5 requests on your organisation's per-minute limit, because Omono creates the file for you. A request that its checks refuse counts as 1. Learn more about [heavy requests](/docs/limits#pdfs).\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 404 | `not-found` | No invoice has this ID. A dispatch that hasn't shipped yet has no invoice. |\n| 409 | `document-too-large` | The PDF is bigger than the API can return, which is rare. Download it in Omono instead. |\n",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Pdf"
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/credit-notes": {
      "get": {
        "operationId": "listCreditNotes",
        "x-stability": "stable",
        "tags": [
          "Credit notes"
        ],
        "summary": "List all credit notes",
        "description": "Returns a list of your credit notes. The newest credit notes come first unless you choose another order with `sort`.\n\nTo get each credit note's line items in the same response, add `include=lineItems`.\n\nLearn more about [pagination](/docs/reading#pagination), [filters](/docs/reading#filters), [sorting](/docs/reading#sorting), [including related records](/docs/reading#include) and [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `document-too-large` | You asked for line items, and the first credit note on the page has more than 10,000 of them, or comes to more than 32 MB of JSON with them. Leave out `include` to page past it, and read that credit note in Omono. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/SortStandard"
          },
          {
            "$ref": "#/components/parameters/IncludeLineItems"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/ExternalRef"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "status",
            "in": "query",
            "description": "Only return credit notes with these statuses. Send one or both of `draft` and `complete`, separated by a comma. You can also repeat the parameter, as in `status=draft&status=complete`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "$ref": "#/components/schemas/KnownCreditNoteStatus"
              },
              "minItems": 1
            }
          },
          {
            "name": "companyId",
            "in": "query",
            "description": "Only return credit notes for these customers. Send up to 100 company IDs, separated by commas. You can also repeat the parameter, as in `companyId=a&companyId=b`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "creditNoteNo",
            "in": "query",
            "description": "Only return the credit note with exactly this number. Send one number only, in digits and without the \"CN-\" prefix that Omono shows. Any other value fails with a `422` error.\n",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "maxLength": 15,
              "minLength": 1
            },
            "example": "87"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of credit notes.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditNoteList"
                },
                "example": {
                  "data": [
                    {
                      "id": "cnq5Rt8wMkPz3JvXb",
                      "externalRef": null,
                      "creditNoteNo": "87",
                      "companyId": "b2FpLmNvbXBhbnkQQ",
                      "contactId": "cnt4Kj9mQdPw2XhTe",
                      "raisedById": "usrJaneDoe4Kq9mWt",
                      "refNo": "INV-2107",
                      "currencyId": "curGBPqk2j9x4mWpT",
                      "status": "draft",
                      "exchangeRate": 1,
                      "divisionId": "divNorthOffice3Qz",
                      "totalValue": 250,
                      "totalTax": 50,
                      "totalWithTax": 300,
                      "totalValueBase": 250,
                      "totalTaxBase": 50,
                      "xero": {
                        "status": "never",
                        "id": null,
                        "lastSyncedAt": null
                      },
                      "wentCompleteAt": null,
                      "created": "2026-08-18T10:02:33.000Z",
                      "updated": "2026-08-18T10:05:41.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createCreditNote",
        "x-stability": "beta",
        "tags": [
          "Credit notes"
        ],
        "summary": "Create a credit note",
        "description": "Creates a credit note. The new credit note starts as a Draft, and you can send its line items in `lineItems` in the same request.\n\nThe company must be a customer with an account manager, which is the user who looks after the customer's account. You can't change the company later. Each new line item needs a stock item that you sell and that isn't archived. Every line item must also end up with a tax rate: the one you send, or else the customer's usual rate. Line items for tax-exempt stock always get your organisation's exempt tax rate, whatever you send.\n\nOmono fills in fields you leave out, as its own forms do. For example, the division comes from the customer, and each line item's description and sales analysis code come from its stock item. Every line item is checked before anything is saved, so if a check fails, you get an error that names the line item, nothing is saved and no credit note number is used.\n\nThe new credit note stays a Draft until you complete it with `POST /credit-notes/{id}/complete`.\n\nLearn more about [creating a document with line items](/docs/writing#creating-a-document-with-lines), [prefilled fields](/docs/writing#prefilled-fields), [what to do if a create fails](/docs/writing#if-a-create-fails) and [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 404 | `not-found` | Someone deleted the new Draft in Omono while your request was still saving it. This is rare. Retry with the same `Idempotency-Key`. |\n| 409 | `company-archived` | The customer is archived. |\n| 409 | `create-incomplete` | You retried a create with the same `Idempotency-Key`, and the Draft that the first attempt left has been changed since. Finish the Draft that `keptDocument` names instead of creating it again. |\n| 422 | `invalid-reference` | The company isn't a customer, or a contact, user, division, stock item or other ID you sent can't be used, for example because it's archived. A line item's stock item that you don't sell causes this error too. |\n| 422 | `missing-required-field` | You left out a required field, such as `raisedById`. You also get this error if the customer has no account manager, when the error names `companyId`, or if a line item has no tax rate or sales analysis code, because you didn't send one and Omono had none to fill in. |\n| 422 | `missing-exempt-tax-rate` | A line item's stock item is tax-exempt, but your organisation has no exempt tax rate. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreditNoteCreate"
              },
              "example": {
                "companyId": "b2FpLmNvbXBhbnkQQ",
                "contactId": "cnt4Kj9mQdPw2XhTe",
                "raisedById": "usrJaneDoe4Kq9mWt",
                "exchangeRate": 1,
                "refNo": "INV-2107",
                "divisionId": "divNorthOffice3Qz",
                "lineItems": [
                  {
                    "stockItemId": "stkBearingHousing",
                    "description": "Return of 2 damaged bearing housings",
                    "quantity": 2,
                    "price": 125
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new credit note, including its line items. It also includes `createdLineItems`, which gives the ID of the line item created from each entry in your `lineItems` array.\n",
            "headers": {
              "Location": {
                "$ref": "#/components/headers/Location"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditNoteCreated"
                },
                "example": {
                  "id": "cnqNew2Xk7mQw4PzT",
                  "externalRef": null,
                  "creditNoteNo": "88",
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "contactId": "cnt4Kj9mQdPw2XhTe",
                  "raisedById": "usrJaneDoe4Kq9mWt",
                  "refNo": "INV-2107",
                  "currencyId": "curGBPqk2j9x4mWpT",
                  "status": "draft",
                  "exchangeRate": 1,
                  "divisionId": "divNorthOffice3Qz",
                  "totalValue": 250,
                  "totalTax": 50,
                  "totalWithTax": 300,
                  "totalValueBase": 250,
                  "totalTaxBase": 50,
                  "xero": {
                    "status": "never",
                    "id": null,
                    "lastSyncedAt": null
                  },
                  "wentCompleteAt": null,
                  "lineItems": [
                    {
                      "id": "cliNewReturn2Kq8M",
                      "externalRef": null,
                      "stockItemId": "stkBearingHousing",
                      "description": "Return of 2 damaged bearing housings",
                      "quantity": 2,
                      "price": 125,
                      "salesAnalysisId": "sac5MachinedParts",
                      "taxRateId": "trx20pcVATkQ9m3Zd",
                      "created": "2026-08-19T16:33:20.161Z",
                      "updated": "2026-08-19T16:33:20.161Z"
                    }
                  ],
                  "created": "2026-08-19T16:33:20.000Z",
                  "updated": "2026-08-19T16:33:20.161Z",
                  "createdLineItems": [
                    {
                      "index": 0,
                      "id": "cliNewReturn2Kq8M"
                    }
                  ]
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/credit-notes/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "getCreditNote",
        "x-stability": "stable",
        "tags": [
          "Credit notes"
        ],
        "summary": "Retrieve a credit note",
        "description": "Retrieves a credit note, including its line items.\n\nThe response always includes `lineItems`, so you don't need to ask for them. You can send `include=lineItems`, but it makes no difference here. Each line item's `taxRateId` is always the ID of a tax rate, and line items for tax-exempt stock show your organisation's exempt tax rate.\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `document-too-large` | The credit note has more than 10,000 line items, or comes to more than 32 MB of JSON with them, which is more than one response can carry. Read it in Omono instead. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          },
          {
            "$ref": "#/components/parameters/IncludeLineItems"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the credit note, including its line items.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditNoteWithLineItems"
                },
                "example": {
                  "id": "cnq5Rt8wMkPz3JvXb",
                  "externalRef": null,
                  "creditNoteNo": "87",
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "contactId": "cnt4Kj9mQdPw2XhTe",
                  "raisedById": "usrJaneDoe4Kq9mWt",
                  "refNo": "INV-2107",
                  "currencyId": "curGBPqk2j9x4mWpT",
                  "status": "draft",
                  "exchangeRate": 1,
                  "divisionId": "divNorthOffice3Qz",
                  "totalValue": 250,
                  "totalTax": 50,
                  "totalWithTax": 300,
                  "totalValueBase": 250,
                  "totalTaxBase": 50,
                  "xero": {
                    "status": "never",
                    "id": null,
                    "lastSyncedAt": null
                  },
                  "wentCompleteAt": null,
                  "lineItems": [
                    {
                      "id": "cliReturn10Units2",
                      "externalRef": null,
                      "stockItemId": "stkBearingHousing",
                      "description": "Return of 2 damaged bearing housings",
                      "quantity": 2,
                      "price": 125,
                      "salesAnalysisId": "sac5MachinedParts",
                      "taxRateId": "trx20pcVATkQ9m3Zd",
                      "created": "2026-08-18T10:05:41.000Z",
                      "updated": "2026-08-18T10:05:41.000Z"
                    }
                  ],
                  "created": "2026-08-18T10:02:33.000Z",
                  "updated": "2026-08-18T10:05:41.000Z"
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ]
      },
      "patch": {
        "operationId": "updateCreditNote",
        "x-stability": "beta",
        "tags": [
          "Credit notes"
        ],
        "summary": "Update a credit note",
        "description": "Updates a credit note. Any fields you leave out stay as they are.\n\nYou can change a credit note only while it's a Draft: once it's Complete, it's final. You also can't change the credit note's company.\n\nTo change line items, send `lineItems` as a list of changes, and send the ETag from your last read in the `If-Match` header. Every line item is checked before any is saved. Omono fills in new line items as it does on a create, and each new line item needs a stock item that you sell, with `canSell` set to `true`. Existing line items aren't checked again. Line items for tax-exempt stock always get your organisation's exempt tax rate. The list never changes the order of the line items: a line item you change keeps its place, and new line items go at the end. To reorder the line items, send `lineItemOrder` with every line item's ID in the order you want, together with `If-Match`.\n\nA request that changes nothing, such as an empty body (`{}`) or the credit note's current values sent back, returns the credit note unchanged, even when it's Complete. If your request doesn't change anything, for example because it sends back values the credit note already has, Omono doesn't save the credit note, so its `updated` time and ETag stay the same.\n\nLearn more about [changing line items](/docs/writing#line-changes), [the rules for every write](/docs/writing#the-rules-for-every-write) and [prefilled fields](/docs/writing#prefilled-fields).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `credit-note-complete` | The credit note is Complete, and your request would change it. A request that changes nothing, such as the credit note's current values sent back, succeeds. |\n| 409 | `immutable-field` | You tried to change the stock item of an existing line item. |\n| 409 | `document-too-large` | The credit note would have more than 10,000 line items, counting the new line items in your `lineItems`. That's more than one response can carry, so nothing changes. Change the credit note in Omono instead. |\n| 422 | `invalid-reference` | A new line item's stock item isn't one you sell, or an ID in `lineItems` or `lineItemOrder` isn't one of the credit note's line items. |\n| 422 | `missing-exempt-tax-rate` | A line item's stock item is tax-exempt, but your organisation has no exempt tax rate. |\n| 422 | `unknown-field` | You sent `companyId`. The customer can't change. |\n| 422 | `validation-failed` | You sent `lineItems` or `lineItemOrder`, but the credit note already has more than 250 line items. You can still change its other fields, and staff can edit its line items in Omono. You also get this error if `lineItemOrder` leaves out a line item, names one twice or names one you delete. |\n| 503 | `temporarily-unavailable` | You sent `lineItems` or `lineItemOrder`, and another request is still changing this credit note's line items, or completing it, after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreditNoteUpdate"
              },
              "example": {
                "lineItems": [
                  {
                    "id": "cliReturn10Units2",
                    "stockItemId": "stkBearingHousing",
                    "description": "Return of 3 damaged bearing housings",
                    "quantity": 3,
                    "price": 125,
                    "salesAnalysisId": "sac5MachinedParts"
                  },
                  {
                    "stockItemId": "stkBearingHousing",
                    "description": "Return of 1 bearing housing, wrong bore",
                    "quantity": 1,
                    "price": 125
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns the updated credit note, including its line items. If you sent `lineItems`, the response also includes `createdLineItems`, which gives the ID of each line item you added.\n",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditNoteUpdated"
                },
                "example": {
                  "id": "cnq5Rt8wMkPz3JvXb",
                  "externalRef": null,
                  "creditNoteNo": "87",
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "contactId": "cnt4Kj9mQdPw2XhTe",
                  "raisedById": "usrJaneDoe4Kq9mWt",
                  "refNo": "INV-2107",
                  "currencyId": "curGBPqk2j9x4mWpT",
                  "status": "draft",
                  "exchangeRate": 1,
                  "divisionId": "divNorthOffice3Qz",
                  "totalValue": 500,
                  "totalTax": 100,
                  "totalWithTax": 600,
                  "totalValueBase": 500,
                  "totalTaxBase": 100,
                  "xero": {
                    "status": "never",
                    "id": null,
                    "lastSyncedAt": null
                  },
                  "wentCompleteAt": null,
                  "lineItems": [
                    {
                      "id": "cliReturn10Units2",
                      "externalRef": null,
                      "stockItemId": "stkBearingHousing",
                      "description": "Return of 3 damaged bearing housings",
                      "quantity": 3,
                      "price": 125,
                      "salesAnalysisId": "sac5MachinedParts",
                      "taxRateId": "trx20pcVATkQ9m3Zd",
                      "created": "2026-08-18T10:05:41.000Z",
                      "updated": "2026-08-19T16:36:02.000Z"
                    },
                    {
                      "id": "cliWrongBore4Kq9m",
                      "externalRef": null,
                      "stockItemId": "stkBearingHousing",
                      "description": "Return of 1 bearing housing, wrong bore",
                      "quantity": 1,
                      "price": 125,
                      "salesAnalysisId": "sac5MachinedParts",
                      "taxRateId": "trx20pcVATkQ9m3Zd",
                      "created": "2026-08-19T16:36:02.000Z",
                      "updated": "2026-08-19T16:36:02.000Z"
                    }
                  ],
                  "created": "2026-08-18T10:02:33.000Z",
                  "updated": "2026-08-19T16:36:02.000Z",
                  "createdLineItems": [
                    {
                      "index": 1,
                      "id": "cliWrongBore4Kq9m"
                    }
                  ]
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "428": {
            "$ref": "#/components/responses/PreconditionRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      },
      "delete": {
        "operationId": "deleteCreditNote",
        "x-stability": "beta",
        "tags": [
          "Credit notes"
        ],
        "summary": "Delete a draft credit note",
        "description": "Deletes a Draft credit note, as deleting it in Omono does. Its line items, notes and files go with it, and so do the tasks linked to it. You can delete a credit note only while it's a Draft. Omono doesn't use its number again.\n\nSend the credit note's `ETag` in `If-Match`, so that you never delete a credit note that someone changed after you read it. Don't send `If-Match: *`. The response has no body. A credit note that's already deleted returns `404`, so a retry after a lost response is safe. The deleted records appear in [`GET /events`](/docs/syncing#deletes).\n\nOmono deletes every line item of the credit note. So against your rate limits, a delete counts as one write for every 10 of the credit note's line items, rounded up. A delete refused by its checks counts as 1. Learn more about [deleting](/docs/writing#deleting) and [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `not-a-draft` | The credit note isn't a Draft. |\n| 412 | `precondition-failed` | The credit note has changed since you read it. Nothing was deleted. |\n| 428 | `precondition-required` | You didn't send `If-Match`. |\n| 503 | `temporarily-unavailable` | Another request is still changing this credit note's line items, completing it or deleting it, after 5 seconds. Or other saves in Omono kept changing the credit note while Omono tried to delete it. Nothing was deleted. Read the credit note again, and retry with its new `ETag` after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfMatchDelete"
          }
        ],
        "responses": {
          "204": {
            "description": "The credit note is deleted.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "428": {
            "$ref": "#/components/responses/PreconditionRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/credit-notes/{id}/complete": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "operationId": "completeCreditNote",
        "x-stability": "beta",
        "tags": [
          "Credit notes"
        ],
        "summary": "Complete a credit note",
        "description": "Completes a Draft credit note. Completing is final: once a credit note is Complete, nobody can change it or reopen it, in Omono or through the API.\n\nCredit notes you create through the API start as Drafts, and this is the only way to complete one through the API. In Omono, a credit note is completed when someone emails, downloads or prints it. This request does the same without producing a PDF, and it doesn't send an email. Omono adds a note to the credit note and an entry to the activity feed, and if your organisation uses the Xero integration, Omono sends the credit note to Xero on its next sync.\n\nThe credit note must have at least one line item. Send the request without a body. Omono ignores any body you send. If the credit note is already Complete, nothing changes and the response has `\"applied\": false`, so it's safe to retry.\n\nAgainst your rate limits, completing a credit note counts as one write for every 10 of its line items, rounded up. A request that its checks refuse, or that finds the credit note already Complete, counts as 1.\n\nLearn more about [lifecycle actions](/docs/writing#lifecycle-actions) and [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `no-line-items` | The credit note has no line items. The error names `lineItems`. |\n| 409 | `document-too-large` | The credit note has more than 10,000 line items, which is more than one response can carry, so nothing changes. Complete the credit note in Omono instead. |\n| 503 | `temporarily-unavailable` | Another request is still changing this credit note's line items, or completing it, after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns `applied` and the credit note as it is now. `applied` is `false` if the credit note was already Complete.\n",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditNoteActionResult"
                },
                "example": {
                  "applied": true,
                  "creditNote": {
                    "id": "cnq5Rt8wMkPz3JvXb",
                    "externalRef": null,
                    "creditNoteNo": "87",
                    "companyId": "b2FpLmNvbXBhbnkQQ",
                    "contactId": "cnt4Kj9mQdPw2XhTe",
                    "raisedById": "usrJaneDoe4Kq9mWt",
                    "refNo": "INV-2107",
                    "currencyId": "curGBPqk2j9x4mWpT",
                    "status": "complete",
                    "exchangeRate": 1,
                    "divisionId": "divNorthOffice3Qz",
                    "totalValue": 250,
                    "totalTax": 50,
                    "totalWithTax": 300,
                    "totalValueBase": 250,
                    "totalTaxBase": 50,
                    "xero": {
                      "status": "never",
                      "id": null,
                      "lastSyncedAt": null
                    },
                    "wentCompleteAt": "2026-08-19T17:14:31.000Z",
                    "lineItems": [
                      {
                        "id": "cliReturn10Units2",
                        "externalRef": null,
                        "stockItemId": "stkBearingHousing",
                        "description": "Return of 2 damaged bearing housings",
                        "quantity": 2,
                        "price": 125,
                        "salesAnalysisId": "sac5MachinedParts",
                        "taxRateId": "trx20pcVATkQ9m3Zd",
                        "created": "2026-08-18T10:05:41.000Z",
                        "updated": "2026-08-18T10:05:41.000Z"
                      }
                    ],
                    "created": "2026-08-18T10:02:33.000Z",
                    "updated": "2026-08-19T17:14:31.000Z"
                  }
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/credit-notes/{id}/pdf": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "getCreditNotePdf",
        "x-stability": "beta",
        "tags": [
          "Credit notes"
        ],
        "summary": "Download a credit note PDF",
        "description": "Downloads the credit note as a PDF, the document you send to your customer. It's the PDF that Omono's **Print** and **Download** buttons create, and its file name has the credit note number, such as `CN-87.pdf`.\n\nA Draft credit note prints without a \"DRAFT\" mark, as it does from **Print** in Omono.\n\nAgainst your rate limits, a PDF counts as 5 requests on your organisation's per-minute limit, because Omono creates the file for you. A request that its checks refuse counts as 1. Learn more about [heavy requests](/docs/limits#pdfs).\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 404 | `not-found` | No credit note has this ID. |\n| 409 | `no-line-items` | The credit note has no line items, so it has nothing to print. The error's `field` is `lineItems`. |\n| 409 | `document-too-large` | The PDF is bigger than the API can return, which is rare. Download it in Omono instead. |\n",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Pdf"
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/credit-notes/{id}/notes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "listCreditNoteNotes",
        "x-stability": "beta",
        "tags": [
          "Notes"
        ],
        "summary": "List a credit note's notes",
        "description": "Returns the notes on a credit note, newest first. The list has user notes, which people write in Omono or which an API key adds, and system notes, which are the history that Omono writes itself, such as a status change or a changed delivery date. Each note's `kind` says which it is, and the `kind` filter returns one of them. A system note is the record's history as staff see it in Omono, and it can name other records, such as an order number on a stock item.\n\nA new note doesn't change the credit note's `updated` time. To keep a copy of the notes up to date, read this list again with `created_gte` set to the `created` time of the newest note you have, and skip the notes whose `id` you already have. Learn more about [notes](/docs/reading#notes).\n\nRequires the `sales:read` or `sales:write` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "kind",
            "in": "query",
            "description": "Pass `user` to return only the notes that people wrote or that an API key added, or `system` to return only the notes that Omono wrote itself.\n",
            "schema": {
              "type": "string",
              "enum": [
                "user",
                "system"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of notes.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NoteList"
                },
                "example": {
                  "data": [
                    {
                      "id": "nte8Rq2LmXw4KpZt7",
                      "kind": "user",
                      "text": "Called Priya Shah: the customer wants delivery before 12 December.",
                      "authorName": "API · CRM sync",
                      "userId": "usrApi4Wn8Kq2Lp5X",
                      "apiKeyId": "key7Tz3Mq9Wb2Xc4V",
                      "created": "2026-11-30T14:05:12.000Z"
                    },
                    {
                      "id": "nte5Bc9TyUw1QsVn3",
                      "kind": "system",
                      "text": "Status changed from Draft to Active",
                      "authorName": "Hannah Okafor",
                      "userId": "usr2Pq8Lm4Xw7Kz9R",
                      "apiKeyId": null,
                      "created": "2026-11-28T09:41:37.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createCreditNoteNote",
        "x-stability": "beta",
        "tags": [
          "Notes"
        ],
        "summary": "Add a note to a credit note",
        "description": "Adds a plain-text note to a credit note. The note appears in the credit note's notes in Omono, as if someone had written it there. The note's author is the API key, shown as `API · ` and the key's name. You can add a note to a credit note in any state, archived, closed or cancelled ones included, as staff can in Omono. A note can't be changed or deleted through the API, so check the text before you send it. The returned `text` can differ from the text you sent in two ways: Omono removes spaces and line breaks from the start and end, and replaces a character that isn't valid Unicode. One record can take about 50 notes through the API in any 24 hours: Omono checks the count before it adds the note, so notes sent at the same moment can pass it by a few.\n\nA new note doesn't change the credit note's `updated` time. Learn more about [adding notes](/docs/writing#notes).\n\nRequires the `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 422 | `validation-failed` | `text` is blank, is longer than 2,000 characters, has more than 50 lines, or contains a control character other than a tab or a line break. |\n| 429 | `rate-limited` | The record already has about 50 notes added through the API in the last 24 hours. This is a daily cap on the record, not a request limit: `Retry-After` gives the seconds until it can take another, which can be many hours. |\n| 429 | `rate-limited` | Your organisation has stored its daily limit of descriptions and notes. `Retry-After` gives the seconds until 00:00 UTC. Learn more about [limits](/docs/limits#stored-descriptions). |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "The note to add.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NoteCreate"
              },
              "example": {
                "text": "Called Priya Shah: the customer wants delivery before 12 December."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new note.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Note"
                },
                "example": {
                  "id": "nte8Rq2LmXw4KpZt7",
                  "kind": "user",
                  "text": "Called Priya Shah: the customer wants delivery before 12 December.",
                  "authorName": "API · CRM sync",
                  "userId": "usrApi4Wn8Kq2Lp5X",
                  "apiKeyId": "key7Tz3Mq9Wb2Xc4V",
                  "created": "2026-11-30T14:05:12.000Z"
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/purchase-orders": {
      "get": {
        "operationId": "listPurchaseOrders",
        "x-stability": "stable",
        "tags": [
          "Purchase orders"
        ],
        "summary": "List all purchase orders",
        "description": "Returns a list of your purchase orders. The newest purchase orders come first unless you choose another order with `sort`.\n\nTo get each order's line items, deliveries or both in the same response, add them to `include`, for example `include=lineItems,deliveries`.\n\nLearn more about [pagination](/docs/reading#pagination), [filters](/docs/reading#filters), [sorting](/docs/reading#sorting), [including related records](/docs/reading#include) and [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `purchasing:read` or `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `document-too-large` | You included related records, and the first purchase order on the page has more than 10,000 of them, or comes to more than 32 MB of JSON with them. Leave out `include` to page past it, and read that order in Omono. |\n| 422 | `validation-failed` | Your `purchaseOrderNo` starts with \"PO-\", in any case. Send the number without the prefix, such as `311` for purchase order PO-311. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/SortStandard"
          },
          {
            "$ref": "#/components/parameters/IncludePurchaseOrder"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/ExternalRef"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "status",
            "in": "query",
            "description": "Only return purchase orders with these statuses. Send one or more statuses, separated by commas: `draft`, `on_order`, `complete`, `cancelled`, `on_hold` or `on_order_call_off`. You can also repeat the parameter, as in `status=draft&status=on_order`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "$ref": "#/components/schemas/KnownOrderStatus"
              },
              "minItems": 1
            }
          },
          {
            "name": "companyId",
            "in": "query",
            "description": "Only return purchase orders from these suppliers. Send up to 100 company IDs, separated by commas. You can also repeat the parameter, as in `companyId=a&companyId=b`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "purchaseOrderNo",
            "in": "query",
            "description": "Only return the purchase order with exactly this number. Send one number only, without the \"PO-\" prefix that Omono shows, for example `311` for PO-311. A number that starts with \"PO-\", in any case, fails with a `422` error and the code `validation-failed` on the field `purchaseOrderNo`.\n",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of purchase orders.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrderList"
                },
                "example": {
                  "data": [
                    {
                      "id": "aK3nMh2PqXwYbTzVc",
                      "externalRef": null,
                      "purchaseOrderNo": "311",
                      "companyId": "cmpRheinmetallDE1",
                      "contactId": "cntKlausBauer7Wq2",
                      "addressId": "adrDusseldorfWrk4",
                      "refNo": "SO-1042 components",
                      "buyerId": "usrTomSmith8Zp2Qk",
                      "callOff": false,
                      "status": "on_order",
                      "currencyId": "curEURqk2j9x4mWpZ",
                      "exchangeRate": 1.1682,
                      "eoriNumberId": "eorGB123456789000",
                      "incotermId": "incFCA2020Rules9x",
                      "incotermNamedPlace": "Düsseldorf, DE",
                      "divisionId": null,
                      "dropShipCustomerCompanyId": null,
                      "totalValue": 8620,
                      "totalValueBase": 7378.87,
                      "linkedSalesOrderId": "vShvOSNvvpFsuxKgN",
                      "linkedSalesOrderNo": "1042",
                      "created": "2026-07-30T10:01:12.000Z",
                      "updated": "2026-08-11T13:44:56.000Z"
                    }
                  ],
                  "hasMore": true,
                  "nextCursor": "eyJ2IjoxLCJzIjpbIjIwMjYtMDctMzBUMTA6MDE6MTJaIl19"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "purchasing:read"
            ]
          },
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createPurchaseOrder",
        "x-stability": "beta",
        "tags": [
          "Purchase orders"
        ],
        "summary": "Create a purchase order",
        "description": "Creates a purchase order. The new order starts as a Draft, and you can send its line items in `lineItems` in the same request.\n\nThe supplier you name in `companyId` must be a company you buy from. Take care with `addressId`: it's where the supplier delivers the goods, so it's one of your own addresses, or your customer's address on a drop-ship order. It's never the supplier's address.\n\nIf you leave out the order's `divisionId` or `eoriNumberId`, or a line item's `taxRateId`, `purchaseAnalysisId` or `description`, Omono fills it in for you. Omono checks the supplier and every line item before it gives the order a number, so a refused request never uses up a purchase order number.\n\nA Draft order doesn't change your stock levels. When the order is ready, issue it with `POST /purchase-orders/{id}/issue`. This moves it to On Order and adds its quantities to each stock item's `onOrder` quantity.\n\nLearn more about [creating a document with line items](/docs/writing#creating-a-document-with-lines), [prefilled fields](/docs/writing#prefilled-fields), [what to do if a create fails](/docs/writing#if-a-create-fails) and [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 404 | `not-found` | Someone deleted the new Draft in Omono while your request was still saving it. This is rare. Retry with the same `Idempotency-Key`. |\n| 409 | `company-archived` | The supplier is archived. |\n| 409 | `create-incomplete` | You retried a create with the same `Idempotency-Key`, and the Draft that the first attempt left has been changed since. Finish the Draft that `keptDocument` names instead of creating it again. |\n| 409 | `stock-not-buyable` | A line item's stock item can't be bought, for example because it's an assembly. |\n| 422 | `invalid-reference` | A company, contact or address doesn't fit the order. For example, the contact belongs to another company, or the address isn't one of yours. Each field's description gives its rule. |\n| 422 | `missing-exempt-tax-rate` | A line item's stock item is tax-exempt, but your organisation has no exempt tax rate. |\n| 422 | `missing-required-field` | You left out a required field, such as `refNo` or a line item's `price`. You also get this error if Omono couldn't fill in a new line item's tax rate or purchase analysis code, because the supplier or the stock item doesn't have one. |\n| 422 | `validation-failed` | A value breaks a rule its field describes, for example `refNo` is empty, or a line item's `taxRateId` is `null`. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "The purchase order to create.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseOrderCreate"
              },
              "example": {
                "companyId": "cmpRheinmetallDE1",
                "contactId": "cntKlausBauer7Wq2",
                "addressId": "adrDusseldorfWrk4",
                "refNo": "Stock replenishment",
                "buyerId": "usrTomSmith8Zp2Qk",
                "callOff": false,
                "exchangeRate": 1.1682,
                "incotermId": "incFCA2020Rules9x",
                "incotermNamedPlace": "Düsseldorf, DE",
                "lineItems": [
                  {
                    "stockItemId": "stkCastIronBlank7",
                    "quantity": 40,
                    "price": 215.5
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new purchase order, including its line items. It also includes `createdLineItems`, which gives the ID of the line item created from each entry in your `lineItems` array.\n",
            "headers": {
              "Location": {
                "$ref": "#/components/headers/Location"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrderCreated"
                },
                "example": {
                  "id": "poNew9Wk2mQz7XtRv",
                  "externalRef": null,
                  "purchaseOrderNo": "318",
                  "companyId": "cmpRheinmetallDE1",
                  "contactId": "cntKlausBauer7Wq2",
                  "addressId": "adrDusseldorfWrk4",
                  "refNo": "Stock replenishment",
                  "buyerId": "usrTomSmith8Zp2Qk",
                  "callOff": false,
                  "status": "draft",
                  "currencyId": "curEURqk2j9x4mWpZ",
                  "exchangeRate": 1.1682,
                  "eoriNumberId": "eorGB123456789000",
                  "incotermId": "incFCA2020Rules9x",
                  "incotermNamedPlace": "Düsseldorf, DE",
                  "divisionId": null,
                  "dropShipCustomerCompanyId": null,
                  "totalValue": 8620,
                  "totalValueBase": 7378.87,
                  "linkedSalesOrderId": null,
                  "linkedSalesOrderNo": null,
                  "lineItems": [
                    {
                      "id": "pliNewPoLine3Qz8X",
                      "externalRef": null,
                      "stockItemId": "stkCastIronBlank7",
                      "description": "Cast iron blank, housing pattern H-7",
                      "quantity": 40,
                      "price": 215.5,
                      "discount": 0,
                      "taxRateId": "trxZeroRatedEU9Xk",
                      "purchaseAnalysisId": "pacRawMaterials4Q",
                      "tagNumber": null,
                      "quantityOnDeliveries": 0,
                      "created": "2026-08-19T16:40:27.236Z",
                      "updated": "2026-08-19T16:40:27.236Z"
                    }
                  ],
                  "created": "2026-08-19T16:40:27.000Z",
                  "updated": "2026-08-19T16:40:27.236Z",
                  "createdLineItems": [
                    {
                      "index": 0,
                      "id": "pliNewPoLine3Qz8X"
                    }
                  ]
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/purchase-orders/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "getPurchaseOrder",
        "x-stability": "stable",
        "tags": [
          "Purchase orders"
        ],
        "summary": "Retrieve a purchase order",
        "description": "Retrieves a purchase order, including its line items. Each line item shows `quantityOnDeliveries`, the quantity that's already booked onto deliveries. To get the deliveries themselves in the same response, add `include=deliveries`.\n\nRequires the `purchasing:read` or `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `document-too-large` | The order has more than 10,000 related records to return, counting its line items and any deliveries you include with their line items, or comes to more than 32 MB of JSON with them. Leave out `include=deliveries`, or read the order in Omono. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          },
          {
            "$ref": "#/components/parameters/IncludePurchaseOrder"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the purchase order, including its line items.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrderWithLineItems"
                },
                "example": {
                  "id": "aK3nMh2PqXwYbTzVc",
                  "externalRef": null,
                  "purchaseOrderNo": "311",
                  "companyId": "cmpRheinmetallDE1",
                  "contactId": "cntKlausBauer7Wq2",
                  "addressId": "adrDusseldorfWrk4",
                  "refNo": "SO-1042 components",
                  "buyerId": "usrTomSmith8Zp2Qk",
                  "callOff": false,
                  "status": "on_order",
                  "currencyId": "curEURqk2j9x4mWpZ",
                  "exchangeRate": 1.1682,
                  "eoriNumberId": "eorGB123456789000",
                  "incotermId": "incFCA2020Rules9x",
                  "incotermNamedPlace": "Düsseldorf, DE",
                  "divisionId": null,
                  "dropShipCustomerCompanyId": null,
                  "totalValue": 8620,
                  "totalValueBase": 7378.87,
                  "linkedSalesOrderId": "vShvOSNvvpFsuxKgN",
                  "linkedSalesOrderNo": "1042",
                  "lineItems": [
                    {
                      "id": "pliCastBlank4Kq9M",
                      "externalRef": null,
                      "stockItemId": "stkCastIronBlank7",
                      "description": "Cast iron blank, housing pattern H-7",
                      "quantity": 40,
                      "price": 215.5,
                      "discount": 0,
                      "taxRateId": "trxZeroRatedEU9Xk",
                      "purchaseAnalysisId": "pacRawMaterials4Q",
                      "tagNumber": null,
                      "quantityOnDeliveries": 25,
                      "created": "2026-07-30T10:01:12.000Z",
                      "updated": "2026-08-11T13:44:56.000Z"
                    }
                  ],
                  "created": "2026-07-30T10:01:12.000Z",
                  "updated": "2026-08-11T13:44:56.000Z"
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "purchasing:read"
            ]
          },
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          }
        ]
      },
      "patch": {
        "operationId": "updatePurchaseOrder",
        "x-stability": "beta",
        "tags": [
          "Purchase orders"
        ],
        "summary": "Update a purchase order",
        "description": "Updates a purchase order. Any fields you leave out stay as they are. You can change the order's header fields, its line items, or both in one request. If your request doesn't change anything, for example because it sends back values the order already has, Omono doesn't save the order, so its `updated` time and ETag stay the same.\n\nYou can't change the supplier (`companyId`). To buy the same goods from another supplier, create a new purchase order.\n\nSome changes have side effects. Changing `callOff` on an order that's On Order or On Order - Call Off moves it between those two statuses. Changing `exchangeRate` recalculates the value of the order and every delivery in your base currency. On an issued order, adding, changing or deleting line items updates each stock item's `onOrder` quantity straight away, and adding a line item to a Complete order moves it back to On Order, or to On Order - Call Off if `callOff` is set.\n\nTo change line items, send `lineItems` as a list of changes, and send the ETag from your last read in the `If-Match` header. The list never changes the order of the line items: a line item you change keeps its place, and new line items go at the end. To reorder the line items, send `lineItemOrder` with every line item's ID in the order you want, together with `If-Match`. Once the order has a delivery, the order of its line items is fixed. Learn more about [changing line items](/docs/writing#line-changes) and [avoiding overwrites with ETags](/docs/writing#etags).\n\nRequires the `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `purchase-order-cancelled` | The order is cancelled, and you tried to change its header fields, add, change or delete a line item, or change the order of its line items. A request that changes nothing, such as the order's current values sent back, succeeds. |\n| 409 | `purchase-order-locked` | You tried to change or delete a line item on an order where every delivery is invoiced and every line item has been fully received. |\n| 409 | `line-order-fixed` | The order has a delivery, and your `lineItemOrder` would change the order of its line items. |\n| 409 | `exchange-rate-locked` | You changed `exchangeRate` after one of the order's deliveries was invoiced. |\n| 409 | `line-item-invoiced-locked` | You tried to change the price, tax rate, purchase analysis code, tag number or description of a line item that's on an invoiced delivery. Only its quantity can still change. |\n| 409 | `below-delivered-quantity` | You tried to reduce a line item's quantity below the quantity that's already on deliveries. |\n| 409 | `line-item-allocated` | You tried to delete a line item that's on a delivery. |\n| 409 | `immutable-field` | You tried to change the stock item of an existing line item. |\n| 409 | `stock-not-buyable` | A new line item's stock item can't be bought, for example because it's an assembly. |\n| 409 | `document-too-large` | The order would have more than 10,000 line items, counting the new line items in your `lineItems`. That's more than one response can carry, so nothing changes. Change the order in Omono instead. |\n| 422 | `missing-exempt-tax-rate` | A line item's stock item is tax-exempt, but your organisation has no exempt tax rate. |\n| 422 | `invalid-reference` | An ID in `lineItems` or `lineItemOrder` isn't one of the order's line items. |\n| 422 | `unknown-field` | You sent `companyId`. The supplier can't change. |\n| 422 | `validation-failed` | Your `lineItemOrder` leaves out one of the order's line items, names one twice, or names one your `lineItems` deletes. |\n| 503 | `temporarily-unavailable` | You sent `lineItems` or `lineItemOrder`, and another request, or a save in Omono, is still changing this order's line items or deliveries, or issuing or cancelling it, after 5 seconds. Or other saves in Omono kept changing the stock items or line items that your changes to existing line items write, or that adding or deleting line items writes on an order that isn't a Draft. Then nothing changed, but the order's `ETag` did: read the order again and retry with its new `ETag`. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "description": "The fields to change. Any fields you leave out stay as they are.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseOrderUpdate"
              },
              "example": {
                "refNo": "SO-1042 components (expedited)"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns the updated purchase order, including its line items. If you sent `lineItems`, the response also includes `createdLineItems`, which gives the ID of each line item you added.\n",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrderUpdated"
                },
                "example": {
                  "id": "aK3nMh2PqXwYbTzVc",
                  "externalRef": null,
                  "purchaseOrderNo": "311",
                  "companyId": "cmpRheinmetallDE1",
                  "contactId": "cntKlausBauer7Wq2",
                  "addressId": "adrDusseldorfWrk4",
                  "refNo": "SO-1042 components (expedited)",
                  "buyerId": "usrTomSmith8Zp2Qk",
                  "callOff": false,
                  "status": "on_order",
                  "currencyId": "curEURqk2j9x4mWpZ",
                  "exchangeRate": 1.1682,
                  "eoriNumberId": "eorGB123456789000",
                  "incotermId": "incFCA2020Rules9x",
                  "incotermNamedPlace": "Düsseldorf, DE",
                  "divisionId": null,
                  "dropShipCustomerCompanyId": null,
                  "totalValue": 8620,
                  "totalValueBase": 7378.87,
                  "linkedSalesOrderId": "vShvOSNvvpFsuxKgN",
                  "linkedSalesOrderNo": "1042",
                  "lineItems": [
                    {
                      "id": "pliCastBlank4Kq9M",
                      "externalRef": null,
                      "stockItemId": "stkCastIronBlank7",
                      "description": "Cast iron blank, housing pattern H-7",
                      "quantity": 40,
                      "price": 215.5,
                      "discount": 0,
                      "taxRateId": "trxZeroRatedEU9Xk",
                      "purchaseAnalysisId": "pacRawMaterials4Q",
                      "tagNumber": null,
                      "quantityOnDeliveries": 25,
                      "created": "2026-07-30T10:01:12.000Z",
                      "updated": "2026-08-11T13:44:56.000Z"
                    }
                  ],
                  "created": "2026-07-30T10:01:12.000Z",
                  "updated": "2026-08-19T16:44:03.000Z"
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "428": {
            "$ref": "#/components/responses/PreconditionRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      },
      "delete": {
        "operationId": "deletePurchaseOrder",
        "x-stability": "beta",
        "tags": [
          "Purchase orders"
        ],
        "summary": "Delete a draft purchase order",
        "description": "Deletes a Draft purchase order, as deleting it in Omono does. Its line items, deliveries, notes and files go with it, and so do the tasks linked to it. You can delete a purchase order only while it's a Draft. Omono doesn't use its number again.\n\nSales orders that link to it lose the link. If it was raised from a sales order, Omono adds a note to that sales order.\n\nSend the purchase order's `ETag` in `If-Match`, so that you never delete a purchase order that someone changed after you read it. Don't send `If-Match: *`. The response has no body. A purchase order that's already deleted returns `404`, so a retry after a lost response is safe. The deleted records appear in [`GET /events`](/docs/syncing#deletes).\n\nOmono deletes every line item of the purchase order and of its deliveries. So against your rate limits, a delete counts as one write for every 10 of those line items, rounded up. A delete refused by its checks counts as 1. Learn more about [deleting](/docs/writing#deleting) and [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `not-a-draft` | The purchase order isn't a Draft. |\n| 412 | `precondition-failed` | The purchase order has changed since you read it. Nothing was deleted. |\n| 428 | `precondition-required` | You didn't send `If-Match`. |\n| 503 | `temporarily-unavailable` | Another request, or a save in Omono, is still changing this purchase order's deliveries or line items, or issuing, cancelling or deleting it, after 5 seconds. Or other saves in Omono kept changing the purchase order while Omono tried to delete it. Nothing was deleted. Read the purchase order again, and retry with its new `ETag` after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfMatchDelete"
          }
        ],
        "responses": {
          "204": {
            "description": "The purchase order is deleted.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "428": {
            "$ref": "#/components/responses/PreconditionRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/purchase-orders/{id}/issue": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "operationId": "issuePurchaseOrder",
        "x-stability": "beta",
        "tags": [
          "Purchase orders"
        ],
        "summary": "Issue a purchase order",
        "description": "Issues a Draft purchase order. This moves the order from Draft to On Order (`on_order`), or to On Order - Call Off (`on_order_call_off`) if `callOff` is `true`. A call-off order is a blanket order that the supplier delivers in several parts over time. It also adds each line item's quantity to its stock item's `onOrder` quantity. If two requests issue the same order at the same time, from the API or in Omono, the quantities are added only once.\n\nAn order that isn't a call-off needs all of its line items on deliveries before it can be issued, as in Omono: for each line item, the quantities on its deliveries must add up to the line item's quantity. [Create the deliveries](#tag/deliveries/POST/purchase-orders/{id}/deliveries) first. A call-off order can be issued without deliveries.\n\nIssuing doesn't send anything to the supplier: the API doesn't email or print the order.\n\nSend the request without a body. Omono ignores any body you send. If the order is already past Draft, nothing changes and the response has `\"applied\": false`, so it's safe to retry.\n\nAgainst your rate limits, issuing an order counts as one write for every 10 of its line items, rounded up. A request that its checks refuse, or that finds the order already past Draft, counts as 1. Learn more about [lifecycle actions](/docs/writing#lifecycle-actions) and [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `purchase-order-cancelled` | The order has been cancelled. |\n| 409 | `no-line-items` | The order has no line items. The error names the field `lineItems`. |\n| 409 | `document-too-large` | The order has more than 10,000 line items, which is more than one response can carry, so nothing changes. Issue the order in Omono instead. |\n| 409 | `deliveries-incomplete` | The order isn't a call-off, and the quantities on its deliveries don't add up to its line items' quantities. Each entry in `errors` names one line item and says how much of it is on deliveries. |\n| 503 | `temporarily-unavailable` | Another request, or a save in Omono, is still changing this order's line items or deliveries, or cancelling it, after 5 seconds. Or, while Omono tried to issue the order, saves in Omono kept changing its line items, or saves in Omono or your other requests kept changing the stock items of its line items. The order isn't issued and nothing changes, but those saves can give the order a new `ETag`. Read the order again, then retry with its current `ETag` after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns `applied` and the purchase order as it is now. `applied` is `false` if the order was already past Draft.\n",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrderActionResult"
                },
                "example": {
                  "applied": true,
                  "purchaseOrder": {
                    "id": "poNew9Wk2mQz7XtRv",
                    "externalRef": null,
                    "purchaseOrderNo": "318",
                    "companyId": "cmpRheinmetallDE1",
                    "contactId": "cntKlausBauer7Wq2",
                    "addressId": "adrDusseldorfWrk4",
                    "refNo": "Stock replenishment",
                    "buyerId": "usrTomSmith8Zp2Qk",
                    "callOff": false,
                    "status": "on_order",
                    "currencyId": "curEURqk2j9x4mWpZ",
                    "exchangeRate": 1.1682,
                    "eoriNumberId": "eorGB123456789000",
                    "incotermId": "incFCA2020Rules9x",
                    "incotermNamedPlace": "Düsseldorf, DE",
                    "divisionId": null,
                    "dropShipCustomerCompanyId": null,
                    "totalValue": 8620,
                    "totalValueBase": 7378.87,
                    "linkedSalesOrderId": null,
                    "linkedSalesOrderNo": null,
                    "lineItems": [
                      {
                        "id": "pliNewPoLine3Qz8X",
                        "externalRef": null,
                        "stockItemId": "stkCastIronBlank7",
                        "description": "Cast iron blank, housing pattern H-7",
                        "quantity": 40,
                        "price": 215.5,
                        "discount": 0,
                        "taxRateId": "trxZeroRatedEU9Xk",
                        "purchaseAnalysisId": "pacRawMaterials4Q",
                        "tagNumber": null,
                        "quantityOnDeliveries": 0,
                        "created": "2026-08-19T16:40:27.236Z",
                        "updated": "2026-08-19T16:40:27.236Z"
                      }
                    ],
                    "created": "2026-08-19T16:40:27.000Z",
                    "updated": "2026-08-19T17:20:05.000Z"
                  }
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/purchase-orders/{id}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "operationId": "cancelPurchaseOrder",
        "x-stability": "beta",
        "tags": [
          "Purchase orders"
        ],
        "summary": "Cancel a purchase order",
        "description": "Cancels a purchase order. If the order had been issued, its line item quantities come off each stock item's `onOrder` quantity. You can't cancel an order once any of its deliveries has been received, and you can't reopen a cancelled order.\n\nSend the request without a body. Omono ignores any body you send. If the order is already cancelled, nothing changes and the response has `\"applied\": false`, so it's safe to retry.\n\nAgainst your rate limits, cancelling an order counts as one write for every 10 of its line items, rounded up. A request that its checks refuse, or that finds the order already cancelled, counts as 1. Learn more about [lifecycle actions](/docs/writing#lifecycle-actions) and [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `purchase-order-has-received-deliveries` | At least one of the order's deliveries has been received. |\n| 409 | `document-too-large` | The order has more than 10,000 line items, which is more than one response can carry, so nothing changes. Cancel the order in Omono instead. |\n| 503 | `temporarily-unavailable` | Another request, or a save in Omono, is still changing this order's line items or deliveries, or issuing or cancelling it, after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns `applied` and the purchase order as it is now. `applied` is `false` if the order was already cancelled.\n",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseOrderActionResult"
                },
                "example": {
                  "applied": true,
                  "purchaseOrder": {
                    "id": "poNew9Wk2mQz7XtRv",
                    "externalRef": null,
                    "purchaseOrderNo": "318",
                    "companyId": "cmpRheinmetallDE1",
                    "contactId": "cntKlausBauer7Wq2",
                    "addressId": "adrDusseldorfWrk4",
                    "refNo": "Stock replenishment",
                    "buyerId": "usrTomSmith8Zp2Qk",
                    "callOff": false,
                    "status": "cancelled",
                    "currencyId": "curEURqk2j9x4mWpZ",
                    "exchangeRate": 1.1682,
                    "eoriNumberId": "eorGB123456789000",
                    "incotermId": "incFCA2020Rules9x",
                    "incotermNamedPlace": "Düsseldorf, DE",
                    "divisionId": null,
                    "dropShipCustomerCompanyId": null,
                    "totalValue": 8620,
                    "totalValueBase": 7378.87,
                    "linkedSalesOrderId": null,
                    "linkedSalesOrderNo": null,
                    "lineItems": [
                      {
                        "id": "pliNewPoLine3Qz8X",
                        "externalRef": null,
                        "stockItemId": "stkCastIronBlank7",
                        "description": "Cast iron blank, housing pattern H-7",
                        "quantity": 40,
                        "price": 215.5,
                        "discount": 0,
                        "taxRateId": "trxZeroRatedEU9Xk",
                        "purchaseAnalysisId": "pacRawMaterials4Q",
                        "tagNumber": null,
                        "quantityOnDeliveries": 0,
                        "created": "2026-08-19T16:40:27.236Z",
                        "updated": "2026-08-19T16:40:27.236Z"
                      }
                    ],
                    "created": "2026-08-19T16:40:27.000Z",
                    "updated": "2026-08-19T17:21:40.000Z"
                  }
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/purchase-orders/{id}/pdf": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "getPurchaseOrderPdf",
        "x-stability": "beta",
        "tags": [
          "Purchase orders"
        ],
        "summary": "Download a purchase order PDF",
        "description": "Downloads the purchase order as a PDF, the order you send to your supplier. It's the PDF that Omono's **Print** and **Download** buttons create, and its file name is like `PO-3301.pdf`.\n\nAs in Omono, a purchase order has a PDF once it has line items and, unless it's a call-off order (`callOff` is `true`), all of its line items are on deliveries. A Draft purchase order that meets these rules prints without a \"DRAFT\" mark.\n\nAgainst your rate limits, a PDF counts as 5 requests on your organisation's per-minute limit, because Omono creates the file for you. A request that its checks refuse counts as 1. Learn more about [heavy requests](/docs/limits#pdfs).\n\nRequires the `purchasing:read` or `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 404 | `not-found` | No purchase order has this ID. |\n| 409 | `no-line-items` | The purchase order has no line items, so it has nothing to print. The error's `field` is `lineItems`. |\n| 409 | `deliveries-incomplete` | The purchase order isn't a call-off, and some of its line items aren't on deliveries yet. Each entry in `errors` names a line item and how much of it is on deliveries. [Add a delivery](#tag/deliveries/POST/purchase-orders/{id}/deliveries) for the rest, then retry. |\n| 409 | `document-too-large` | The PDF is bigger than the API can return, which is rare. Download it in Omono instead. |\n",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Pdf"
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "purchasing:read"
            ]
          },
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/purchase-orders/{id}/deliveries": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "listPurchaseOrderDeliveries",
        "x-stability": "stable",
        "tags": [
          "Deliveries"
        ],
        "summary": "List all deliveries",
        "description": "Returns a list of a purchase order's deliveries. A delivery records goods the supplier sends against the order: a delivery is created for the goods expected, then marked as received when the goods arrive, which adds them to stock. Through the API, you can read deliveries and create, change and delete expected ones. Staff receive them in Omono.\n\nDeliveries are sorted by `deliveryNo`, then `id`, and you can't sort them another way. The line items of each delivery follow the order of the purchase order's line items. A page can hold fewer deliveries than your `limit` even when more are on the way, because it ends early once the line items on its deliveries add up to more than 2,000. So always check `hasMore` before you stop.\n\nAny change to a delivery in Omono, including marking its supplier invoice as unavailable, also changes the purchase order's `updated` time. So to keep deliveries in sync, poll [List all deliveries](#tag/deliveries/GET/deliveries) with `updated_since`, re-read the deliveries of every purchase order that your sync finds has changed, or list the changed orders with `include=deliveries`. Learn more about [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `purchasing:read` or `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `document-too-large` | The first delivery on the page has more than 10,000 line items, or comes to more than 32 MB of JSON with them, which is more than one response can carry. Read the delivery in Omono instead. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of deliveries.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryList"
                },
                "example": {
                  "data": [
                    {
                      "id": "dlv8Km4qTpZw3XnVs",
                      "deliveryNo": 1,
                      "deliveryDate": "2026-08-11",
                      "receivedDate": "2026-08-11",
                      "status": "received",
                      "invoiceNo": "RE-2026-4471",
                      "invoiceDate": "2026-08-12",
                      "invoiceUnavailable": false,
                      "totalValue": 5387.5,
                      "totalValueBase": 4611.8,
                      "xero": {
                        "status": "ok",
                        "id": "5e1a9c07-3f6b-4d28-8e4c-a0b7d2f96c13",
                        "lastSyncedAt": "2026-08-12T09:10:55.000Z"
                      },
                      "lineItems": [
                        {
                          "id": "dlx2Qk7mWz9PtRj4X",
                          "purchaseOrderLineItemId": "pliCastBlank4Kq9M",
                          "stockItemId": "stkCastIronBlank7",
                          "quantity": 25,
                          "serialNumber": null
                        }
                      ],
                      "created": "2026-08-11T13:40:02.000Z",
                      "updated": "2026-08-12T09:10:55.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "purchasing:read"
            ]
          },
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createPurchaseOrderDelivery",
        "x-stability": "beta",
        "tags": [
          "Deliveries"
        ],
        "summary": "Create a delivery",
        "description": "Adds an expected delivery to a purchase order, with the quantity of each line item it will bring. You can add deliveries to a Draft purchase order, and you must: a Draft order that isn't a call-off can only be issued once all of its line items are on deliveries. You can also add deliveries to an issued order, for example when a supplier splits a shipment.\n\nOmono creates the delivery as `not_received`, so creating a delivery never changes stock levels. Staff receive the delivery in Omono when the goods arrive, and that adds the stock.\n\nThe response's `ETag` is the purchase order's new `ETag`, because a new delivery changes the order. Use it for your next change to the order.\n\nAgainst your rate limits, a new delivery counts as one write for every 10 entries in `lineItems`, rounded up, so a delivery with 250 line items counts as 25. Learn more about [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `purchase-order-cancelled` | The purchase order is cancelled. |\n| 409 | `purchase-order-locked` | The purchase order is complete. |\n| 409 | `quantity-exceeds-remaining` | A quantity is more than is left of its line item, after its other deliveries. The error's `field` names the entry, and its message says how many are left. |\n| 422 | `invalid-reference` | A `purchaseOrderLineItemId` isn't a line item of this purchase order. The error's `field` names the entry, such as `lineItems[1].purchaseOrderLineItemId`. |\n| 422 | `validation-failed` | A quantity has more than 4 decimal places, or the same line item is named twice. The error's `field` names the entry. |\n| 503 | `temporarily-unavailable` | Another request, or a save in Omono, is still changing this order's line items or deliveries, or issuing or cancelling it, after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "The delivery to add.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeliveryCreate"
              },
              "example": {
                "deliveryDate": "2026-09-04",
                "lineItems": [
                  {
                    "purchaseOrderLineItemId": "pliCastBlank4Kq9M",
                    "quantity": 40
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new delivery.",
            "headers": {
              "Location": {
                "$ref": "#/components/headers/Location"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Delivery"
                },
                "example": {
                  "id": "dlv5Wq2kTz8MnRp3X",
                  "deliveryNo": 2,
                  "deliveryDate": "2026-09-04",
                  "receivedDate": null,
                  "status": "not_received",
                  "invoiceNo": null,
                  "invoiceDate": null,
                  "invoiceUnavailable": false,
                  "totalValue": 8620,
                  "totalValueBase": 7378.87,
                  "xero": {
                    "status": "never",
                    "id": null,
                    "lastSyncedAt": null
                  },
                  "lineItems": [
                    {
                      "id": "dlx7Rk3mQz5WtPn2Y",
                      "purchaseOrderLineItemId": "pliCastBlank4Kq9M",
                      "stockItemId": "stkCastIronBlank7",
                      "quantity": 40,
                      "serialNumber": null
                    }
                  ],
                  "created": "2026-08-19T10:20:41.000Z",
                  "updated": "2026-08-19T10:20:41.000Z"
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/purchase-orders/{id}/deliveries/{deliveryId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        },
        {
          "name": "deliveryId",
          "in": "path",
          "required": true,
          "description": "The ID of the delivery. It must be a delivery on the purchase order in the path.",
          "schema": {
            "type": "string",
            "maxLength": 64
          }
        }
      ],
      "get": {
        "operationId": "getPurchaseOrderDelivery",
        "x-stability": "beta",
        "tags": [
          "Deliveries"
        ],
        "summary": "Retrieve a delivery",
        "description": "Retrieves one delivery of a purchase order, with its line items. If the delivery belongs to a different purchase order, the request fails with a `404` error. When you create a delivery, the `Location` header of the response is this URL.\n\nA delivery has no `ETag` of its own, so the response's `ETag` is the purchase order's. Send it in `If-Match` when you change or delete the delivery. Any change to a delivery changes the purchase order's `updated` time, so with `If-None-Match` you get `304 Not Modified` until the order or one of its deliveries changes.\n\nRequires the `purchasing:read` or `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `document-too-large` | The delivery has more than 10,000 line items, or comes to more than 32 MB of JSON with them, which is more than one response can carry. Read the delivery in Omono instead. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the delivery.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Delivery"
                },
                "example": {
                  "id": "dlv5Wq2kTz8MnRp3X",
                  "deliveryNo": 2,
                  "deliveryDate": "2026-09-11",
                  "receivedDate": null,
                  "status": "not_received",
                  "invoiceNo": null,
                  "invoiceDate": null,
                  "invoiceUnavailable": false,
                  "totalValue": 6465,
                  "totalValueBase": 5534.16,
                  "xero": {
                    "status": "never",
                    "id": null,
                    "lastSyncedAt": null
                  },
                  "lineItems": [
                    {
                      "id": "dlx7Rk3mQz5WtPn2Y",
                      "purchaseOrderLineItemId": "pliCastBlank4Kq9M",
                      "stockItemId": "stkCastIronBlank7",
                      "quantity": 30,
                      "serialNumber": null
                    }
                  ],
                  "created": "2026-08-19T10:20:41.000Z",
                  "updated": "2026-08-19T12:02:17.000Z"
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "purchasing:read"
            ]
          },
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      },
      "patch": {
        "operationId": "updatePurchaseOrderDelivery",
        "x-stability": "beta",
        "tags": [
          "Deliveries"
        ],
        "summary": "Update a delivery",
        "description": "Changes an expected delivery's date, line items or serial numbers. Send only what you want to change. A request that changes nothing changes nothing in Omono either, and the `ETag` stays the same.\n\nYou can change a delivery only until it's received, so changing a delivery never changes stock levels. Staff change received deliveries in Omono. After a change, Omono works out the purchase order's `status` again from its deliveries.\n\nSend the purchase order's `ETag` in `If-Match` when you send `lineItems`. The response's `ETag` is the order's new `ETag`.\n\nOmono saves every line item of the delivery again with each change. So against your rate limits, a change counts as one write for every 10 of the delivery's line items, including any you add, rounded up, even when you only change the date. A request that changes nothing counts as 1. Learn more about [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `purchase-order-cancelled` | The purchase order is cancelled. |\n| 409 | `purchase-order-locked` | The purchase order is locked: every delivery is invoiced and everything has been received. |\n| 409 | `delivery-received` | The delivery has been received. |\n| 409 | `quantity-exceeds-remaining` | A quantity is more than is left of its line item, after its other deliveries. The error's `field` names the entry, and its message says how many are left. |\n| 422 | `invalid-reference` | A line item isn't on this purchase order. |\n| 422 | `validation-failed` | The same line item is named twice, or the change would leave the delivery with no line items. The error's `field` names it. |\n| 428 | `precondition-required` | You sent `lineItems` without `If-Match`. |\n| 503 | `temporarily-unavailable` | Another request, or a save in Omono, is still changing this order's line items or deliveries, or issuing or cancelling it, after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "description": "The changes to make.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeliveryUpdate"
              },
              "example": {
                "deliveryDate": "2026-09-11",
                "lineItems": [
                  {
                    "purchaseOrderLineItemId": "pliCastBlank4Kq9M",
                    "quantity": 30
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns the delivery as it is now.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Delivery"
                },
                "example": {
                  "id": "dlv5Wq2kTz8MnRp3X",
                  "deliveryNo": 2,
                  "deliveryDate": "2026-09-11",
                  "receivedDate": null,
                  "status": "not_received",
                  "invoiceNo": null,
                  "invoiceDate": null,
                  "invoiceUnavailable": false,
                  "totalValue": 6465,
                  "totalValueBase": 5534.16,
                  "xero": {
                    "status": "never",
                    "id": null,
                    "lastSyncedAt": null
                  },
                  "lineItems": [
                    {
                      "id": "dlx7Rk3mQz5WtPn2Y",
                      "purchaseOrderLineItemId": "pliCastBlank4Kq9M",
                      "stockItemId": "stkCastIronBlank7",
                      "quantity": 30,
                      "serialNumber": null
                    }
                  ],
                  "created": "2026-08-19T10:20:41.000Z",
                  "updated": "2026-08-19T12:02:17.000Z"
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "428": {
            "$ref": "#/components/responses/PreconditionRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      },
      "delete": {
        "operationId": "deletePurchaseOrderDelivery",
        "x-stability": "beta",
        "tags": [
          "Deliveries"
        ],
        "summary": "Delete a delivery",
        "description": "Deletes an expected delivery that hasn't been received. Its line items go back to being undelivered on the order, and Omono works out the order's `status` again. So when you delete the only delivery that's on hold, an `on_hold` order goes back to `on_order`, or `on_order_call_off` for a call-off order. Deleting a delivery never changes stock levels.\n\nSend the purchase order's `ETag` in `If-Match`. The response has no body, and its `ETag` is the order's new `ETag`. A delivery that's already deleted returns `404`, so a retry after a lost response is safe.\n\nOmono deletes every line item of the delivery. So against your rate limits, a delete counts as one write for every 10 of the delivery's line items, rounded up. A delete that's refused counts as 1. Learn more about [heavy writes](/docs/limits#heavy-writes).\n\nRequires the `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `purchase-order-cancelled` | The purchase order is cancelled. |\n| 409 | `purchase-order-locked` | The purchase order is locked: every delivery is invoiced and everything has been received. |\n| 409 | `delivery-received` | The delivery has been received. |\n| 428 | `precondition-required` | You didn't send `If-Match`. |\n| 503 | `temporarily-unavailable` | Another request, or a save in Omono, is still changing this order's line items or deliveries, or issuing or cancelling it, after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "responses": {
          "204": {
            "description": "The delivery is deleted.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "428": {
            "$ref": "#/components/responses/PreconditionRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/purchase-orders/{id}/notes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "listPurchaseOrderNotes",
        "x-stability": "beta",
        "tags": [
          "Notes"
        ],
        "summary": "List a purchase order's notes",
        "description": "Returns the notes on a purchase order, newest first. The list has user notes, which people write in Omono or which an API key adds, and system notes, which are the history that Omono writes itself, such as a status change or a changed delivery date. Each note's `kind` says which it is, and the `kind` filter returns one of them. A system note is the record's history as staff see it in Omono, and it can name other records, such as an order number on a stock item.\n\nA new note doesn't change the purchase order's `updated` time. To keep a copy of the notes up to date, read this list again with `created_gte` set to the `created` time of the newest note you have, and skip the notes whose `id` you already have. Learn more about [notes](/docs/reading#notes).\n\nRequires the `purchasing:read` or `purchasing:write` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "kind",
            "in": "query",
            "description": "Pass `user` to return only the notes that people wrote or that an API key added, or `system` to return only the notes that Omono wrote itself.\n",
            "schema": {
              "type": "string",
              "enum": [
                "user",
                "system"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of notes.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NoteList"
                },
                "example": {
                  "data": [
                    {
                      "id": "nte8Rq2LmXw4KpZt7",
                      "kind": "user",
                      "text": "Called Priya Shah: the customer wants delivery before 12 December.",
                      "authorName": "API · CRM sync",
                      "userId": "usrApi4Wn8Kq2Lp5X",
                      "apiKeyId": "key7Tz3Mq9Wb2Xc4V",
                      "created": "2026-11-30T14:05:12.000Z"
                    },
                    {
                      "id": "nte5Bc9TyUw1QsVn3",
                      "kind": "system",
                      "text": "Status changed from Draft to Active",
                      "authorName": "Hannah Okafor",
                      "userId": "usr2Pq8Lm4Xw7Kz9R",
                      "apiKeyId": null,
                      "created": "2026-11-28T09:41:37.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "purchasing:read"
            ]
          },
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createPurchaseOrderNote",
        "x-stability": "beta",
        "tags": [
          "Notes"
        ],
        "summary": "Add a note to a purchase order",
        "description": "Adds a plain-text note to a purchase order. The note appears in the purchase order's notes in Omono, as if someone had written it there. The note's author is the API key, shown as `API · ` and the key's name. You can add a note to a purchase order in any state, archived, closed or cancelled ones included, as staff can in Omono. A note can't be changed or deleted through the API, so check the text before you send it. The returned `text` can differ from the text you sent in two ways: Omono removes spaces and line breaks from the start and end, and replaces a character that isn't valid Unicode. One record can take about 50 notes through the API in any 24 hours: Omono checks the count before it adds the note, so notes sent at the same moment can pass it by a few.\n\nA new note doesn't change the purchase order's `updated` time. Learn more about [adding notes](/docs/writing#notes).\n\nRequires the `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 422 | `validation-failed` | `text` is blank, is longer than 2,000 characters, has more than 50 lines, or contains a control character other than a tab or a line break. |\n| 429 | `rate-limited` | The record already has about 50 notes added through the API in the last 24 hours. This is a daily cap on the record, not a request limit: `Retry-After` gives the seconds until it can take another, which can be many hours. |\n| 429 | `rate-limited` | Your organisation has stored its daily limit of descriptions and notes. `Retry-After` gives the seconds until 00:00 UTC. Learn more about [limits](/docs/limits#stored-descriptions). |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "The note to add.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NoteCreate"
              },
              "example": {
                "text": "Called Priya Shah: the customer wants delivery before 12 December."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new note.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Note"
                },
                "example": {
                  "id": "nte8Rq2LmXw4KpZt7",
                  "kind": "user",
                  "text": "Called Priya Shah: the customer wants delivery before 12 December.",
                  "authorName": "API · CRM sync",
                  "userId": "usrApi4Wn8Kq2Lp5X",
                  "apiKeyId": "key7Tz3Mq9Wb2Xc4V",
                  "created": "2026-11-30T14:05:12.000Z"
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/deliveries": {
      "get": {
        "operationId": "listDeliveries",
        "x-stability": "beta",
        "tags": [
          "Deliveries"
        ],
        "summary": "List all deliveries",
        "description": "Returns a list of your deliveries across all your purchase orders, each with its line items, its purchase order, the order's currency and exchange rate, and its supplier. A delivery has no tax. The newest deliveries come first unless you choose another order with `sort`.\n\nA delivery holds the supplier's invoice once staff record it, so `invoiced=true` lists your supplier invoices, and `invoiceNo` finds one by its number. Keep a copy by polling with `updated_since` and `sort=updated`. The line items of each delivery follow the order of its purchase order's line items. A page can hold fewer deliveries than your `limit` even when more are on the way, because it ends early once the line items on its deliveries add up to more than 2,000. So always check `hasMore` before you stop. Learn more about [pagination](/docs/reading#pagination), [filters](/docs/reading#filters) and [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `purchasing:read` or `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `document-too-large` | The first delivery on the page has more than 10,000 line items, or comes to more than 32 MB of JSON with them, which is more than one response can carry. Read the delivery in Omono instead. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/SortStandard"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "purchaseOrderId",
            "in": "query",
            "description": "Only return deliveries of these purchase orders. Send up to 100 purchase order IDs, separated by commas. You can also repeat the parameter, as in `purchaseOrderId=a&purchaseOrderId=b`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "companyId",
            "in": "query",
            "description": "Only return deliveries from these suppliers. Send up to 100 company IDs, separated by commas. You can also repeat the parameter, as in `companyId=a&companyId=b`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Only return deliveries with these statuses, `not_received`, `received` or `on_hold`, separated by commas.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 3,
              "items": {
                "$ref": "#/components/schemas/KnownDeliveryStatus"
              },
              "minItems": 1
            }
          },
          {
            "name": "invoiced",
            "in": "query",
            "description": "Send `true` for only the deliveries whose supplier invoice staff have recorded, or `false` for only the ones without one. A delivery whose invoice staff marked as unavailable has no invoice.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "invoiceNo",
            "in": "query",
            "description": "Only return the deliveries with these supplier invoice numbers. Omono matches each number exactly as staff typed it, capital letters and spaces included. A number that contains a comma can't be matched. Send up to 100 numbers of up to 100 characters each, separated by commas. You can also repeat the parameter, as in `invoiceNo=RE-2026-4471&invoiceNo=RE-2026-4472`. A number that no delivery has is left out, so the page can be empty.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "minItems": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of deliveries.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryWithPurchaseOrderList"
                },
                "example": {
                  "data": [
                    {
                      "id": "dlv8Km4qTpZw3XnVs",
                      "purchaseOrderId": "poCastings7Kq2Mw",
                      "purchaseOrderNo": "311",
                      "companyId": "cmpFoundry4Wq9Zt",
                      "currencyId": "curEUR8Rk2Vn",
                      "exchangeRate": 1.17,
                      "deliveryNo": 1,
                      "deliveryDate": "2026-08-11",
                      "receivedDate": "2026-08-11",
                      "status": "received",
                      "invoiceNo": "RE-2026-4471",
                      "invoiceDate": "2026-08-12",
                      "invoiceUnavailable": false,
                      "totalValue": 5387.5,
                      "totalValueBase": 4611.8,
                      "xero": {
                        "status": "ok",
                        "id": "5e1a9c07-3f6b-4d28-8e4c-a0b7d2f96c13",
                        "lastSyncedAt": "2026-08-12T09:10:55.000Z"
                      },
                      "lineItems": [
                        {
                          "id": "dlx2Qk7mWz9PtRj4X",
                          "purchaseOrderLineItemId": "pliCastBlank4Kq9M",
                          "stockItemId": "stkCastIronBlank7",
                          "quantity": 25,
                          "serialNumber": null
                        }
                      ],
                      "created": "2026-08-11T13:40:02.000Z",
                      "updated": "2026-08-12T09:10:55.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "purchasing:read"
            ]
          },
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ],
        "x-group-parameters": true
      }
    },
    "/stock-items": {
      "get": {
        "operationId": "listStockItems",
        "x-stability": "stable",
        "tags": [
          "Stock items"
        ],
        "summary": "List all stock items",
        "description": "Returns a list of your stock items. The newest stock items come first unless you choose another order with `sort`, which can also sort them by `partNo`. Archived stock items are left out unless you ask for them with `archived`.\n\nTo find the stock item that matches one of your own products, filter by `partNo`.\n\nTo find stock items by part of their part number or title, send `search`, as the Filter box on the Stock screen in Omono does. Each word of your text matches the start of a word in the part number or the title. It doesn't search the description. To search your suppliers' part numbers, send `supplierPartNo`, as the Supplier Part No filter on the Stock screen does. The matches come in part number order, and you page through them with `cursor`, as through the list. Learn more about [search](/docs/reading#search).\n\nTo find the stock items a supplier supplies, filter by `supplierId`. To get each item's suppliers with it, send `include=suppliers`. These three parameters need the `purchasing:read` scope as well.\n\nLearn more about [pagination](/docs/reading#pagination), [filters](/docs/reading#filters), [sorting](/docs/reading#sorting) and [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `stock:read` or `stock:write` scope. With `include=suppliers`, `supplierId` or `supplierPartNo`, your API key also needs the `purchasing:read` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 403 | `insufficient-scope` | You sent `include=suppliers`, `supplierId` or `supplierPartNo`, and your API key doesn't have the `purchasing:read` scope. |\n| 422 | `validation-failed` | You sent `search` or `supplierPartNo` with `sort`, `updated_since`, `ids`, `created_gte`, `created_lte`, `partNo` or `externalRef`, or your `search` text is shorter than 2 characters, or your `supplierPartNo` text is empty. |\n| 503 | `temporarily-unavailable` | You sent `search` or `supplierPartNo`, and Omono's search isn't available just now. Retry after the `Retry-After` delay, or list your stock items without them. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/SortStockItems"
          },
          {
            "$ref": "#/components/parameters/Archived"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/ExternalRef"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "$ref": "#/components/parameters/IncludeStockItem"
          },
          {
            "name": "canSell",
            "in": "query",
            "description": "Pass `true` to return only stock items you can sell, or `false` to return only those you can't.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "canBuy",
            "in": "query",
            "description": "Pass `true` to return only stock items you can buy on a purchase order, or `false` to return only those you can't.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "insufficientStock",
            "in": "query",
            "description": "Pass `true` to return only the stock items that are short, whose `insufficientStock` is `true`, or `false` to return only those that aren't.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "description": "Only return stock items of these kinds: `normal`, `assembly` or `never_diminishing`, separated by commas if you send more than one. For example, `kind=normal,assembly` leaves out never-diminishing items. You can also repeat the parameter, as in `kind=normal&kind=assembly`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "$ref": "#/components/schemas/KnownStockKind"
              },
              "minItems": 1
            }
          },
          {
            "name": "warehouseId",
            "in": "query",
            "description": "Only return stock items kept in these warehouses. Send up to 100 warehouse IDs, separated by commas. You can also repeat the parameter, as in `warehouseId=a&warehouseId=b`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "partNo",
            "in": "query",
            "description": "Only return the stock items with exactly these part numbers. The match ignores capital letters but not accents, so `abc-1` finds `ABC-1` but not `ábc-1`. Spaces at the start and end of each value are ignored, as they are when a part number is written. Because part numbers are unique, this is the best way to match your own products to stock items in Omono. To look up several part numbers in one request, repeat the parameter, as in `partNo=ABC-1&partNo=ABC-2`, up to 100 times. A comma isn't a separator, because a part number can contain one: `partNo=A,B` finds the one part number `A,B`. A part number that no stock item has is left out, so the page can be empty.\n",
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "supplierId",
            "in": "query",
            "description": "Only return the stock items that these suppliers supply: the items that have one of these companies among their `suppliers`. Send up to 100 company IDs, separated by commas. You can also repeat the parameter, as in `supplierId=a&supplierId=b`. Your API key also needs the `purchasing:read` scope. With `supplierPartNo`, both must match on the same supplier: the items that one of these suppliers sells under that part number.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Only return the stock items whose part number or title matches this text, in part number order. The text is a phrase: each word matches the start of a word, ignoring capital letters, and the words must be next to each other and in the same order. Send 2 to 100 characters. You can combine it with `archived`, `canSell`, `canBuy`, `insufficientStock`, `kind`, `warehouseId`, `supplierId`, `supplierPartNo`, `include`, `limit` and `cursor`. A search pages like the list: while `hasMore` is `true`, send `nextCursor` as `cursor` with the same `search` and filters to get the next matches. Learn more about [search](/docs/reading#search).\n",
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 100
            }
          },
          {
            "name": "supplierPartNo",
            "in": "query",
            "description": "Only return the stock items that a supplier sells under a part number that matches this text, as the Supplier Part No filter on the Stock screen in Omono does. It matches as `search` does: each word matches the start of a word of a supplier's part number, ignoring capital letters. Only spaces separate words, so `FS-DN` finds the part number `FS-DN50-316`, but `DN50` doesn't. It's a search, so the matches come in part number order and page with `cursor`, and it takes the same parameters as `search`. You can send it on its own or with `search`, and then an item must match both. With `supplierId`, the part number must be that supplier's. Send 1 to 100 characters. Your API key also needs the `purchasing:read` scope. Learn more about [search](/docs/reading#search).\n",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of stock items.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockItemList"
                },
                "example": {
                  "data": [
                    {
                      "id": "stkFlangeDN50PN16",
                      "externalRef": null,
                      "partNo": "FLG-DN50-PN16-316",
                      "title": "Flange DN50 PN16 316L",
                      "kind": "normal",
                      "archived": false,
                      "canBuy": true,
                      "canSell": true,
                      "description": "Flange DN50 PN16, 316L stainless",
                      "purchasingDescription": "Flange DN50 PN16, 316L, EN 1092-1",
                      "dualDescriptionEnabled": true,
                      "location": "A3-12",
                      "warehouseId": "whsMainWarehouse1",
                      "cost": 96.5,
                      "sellPrice": 209,
                      "lastCostUpdatedAt": "2026-08-11T13:44:56.000Z",
                      "taxExempt": false,
                      "purchaseAnalysisId": "pacRawMaterials4Q",
                      "salesAnalysisId": "sac5MachinedParts",
                      "commodityCodeId": "cmc84818059000Xk2",
                      "countryOfOriginId": "ctyUnitedKingdom1",
                      "productWebLink": null,
                      "minStockLevel": 10,
                      "minOrderQuantity": 5,
                      "marginWarningPercent": 35,
                      "inStock": 42,
                      "allocated": 20,
                      "onOrder": 15,
                      "insufficientStock": false,
                      "lastStockTake": "2026-06-30",
                      "bom": [],
                      "created": "2025-11-03T09:00:00.000Z",
                      "updated": "2026-08-11T13:44:56.000Z"
                    }
                  ],
                  "hasMore": true,
                  "nextCursor": "eyJ2IjoxLCJzIjpbIjIwMjUtMTEtMDNUMDk6MDA6MDBaIl19"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "stock:read"
            ]
          },
          {
            "bearerAuth": [
              "stock:write"
            ]
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createStockItem",
        "x-stability": "beta",
        "tags": [
          "Stock items"
        ],
        "summary": "Create a stock item",
        "description": "Creates a stock item of one of the three kinds in Omono, which you choose in `kind`: a `normal` item, an `assembly`, which Omono builds from the components in its bill of materials (`bom`), or a `never_diminishing` item, such as a service or carriage, which has no stock level. The request body shows the fields each kind takes, and which of them you must send. Creating an item never changes a stock level.\n\nA normal or never-diminishing item can be bought, so its `canBuy` is always `true`. An assembly is built, not bought, so its `canBuy` is `false`, and it's always for sale. If the item can be sold (`canSell` is `true`), you must also send `sellPrice` and `salesAnalysisId`. If it can't, Omono saves `sellPrice` as 0 and saves no margin, sales analysis code or commodity code, so the item reads `marginWarningPercent: null`.\n\nOmono doesn't fill in any fields for you. Send the warehouse and analysis codes the kind needs, and `commodityCodeId` if you want the item to have one. Omono rounds `cost` and `sellPrice` to your organisation's Unit Pricing precision.\n\nPart numbers must be unique. Before you create an item, look its part number up with `archived=any` to check that it doesn't exist already. Learn more about [duplicates](/docs/writing#duplicates).\n\nOmono saves a new assembly first, and then all the components in its `bom` at once. If it can't save them, it removes the new assembly before it answers with an error, so you can send the same request again.\n\nRequires the `stock:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `duplicate-part-number` | Another stock item already has this part number. The check ignores capital letters. If a look-up with `archived=any` then finds nothing, another request was creating the same part number at the same moment, so retry yours. |\n| 412 | `precondition-failed` | Someone changed the new assembly's BOM in Omono while your request was saving it. Nothing was saved, so send the same request again. |\n| 422 | `invalid-reference` | An ID you sent, such as `warehouseId` or `purchaseAnalysisId`, doesn't exist or is archived, or a `bom` component is an assembly or can't be bought. |\n| 422 | `unknown-field` | You sent a field the item's kind doesn't take, for example `cost` on an assembly or `warehouseId` on a never-diminishing item. |\n| 422 | `missing-required-field` | You left out a required field, for example `sellPrice` or `salesAnalysisId` when `canSell` is `true`. The error names the field. |\n| 422 | `validation-failed` | A value breaks a rule its field describes, for example `marginWarningPercent` is 0, or `description` is longer than 32,000 bytes. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "The stock item to create.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StockItemCreate"
              },
              "example": {
                "kind": "normal",
                "partNo": "GSK-DN50-EPDM",
                "title": "Gasket DN50 EPDM",
                "canSell": true,
                "description": "Gasket DN50, EPDM, PN16 rated",
                "location": "B1-04",
                "warehouseId": "whsMainWarehouse1",
                "cost": 1.85,
                "sellPrice": 4.4,
                "salesAnalysisId": "sac5MachinedParts",
                "purchaseAnalysisId": "pacRawMaterials4Q",
                "minStockLevel": 50,
                "minOrderQuantity": 100
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new stock item.",
            "headers": {
              "Location": {
                "$ref": "#/components/headers/Location"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockItem"
                },
                "example": {
                  "id": "stkGasketDN50EPDM",
                  "externalRef": null,
                  "partNo": "GSK-DN50-EPDM",
                  "title": "Gasket DN50 EPDM",
                  "kind": "normal",
                  "archived": false,
                  "canBuy": true,
                  "canSell": true,
                  "description": "Gasket DN50, EPDM, PN16 rated",
                  "purchasingDescription": null,
                  "dualDescriptionEnabled": false,
                  "location": "B1-04",
                  "warehouseId": "whsMainWarehouse1",
                  "cost": 1.85,
                  "sellPrice": 4.4,
                  "lastCostUpdatedAt": null,
                  "taxExempt": false,
                  "purchaseAnalysisId": "pacRawMaterials4Q",
                  "salesAnalysisId": "sac5MachinedParts",
                  "commodityCodeId": null,
                  "countryOfOriginId": null,
                  "productWebLink": null,
                  "minStockLevel": 50,
                  "minOrderQuantity": 100,
                  "marginWarningPercent": null,
                  "inStock": 0,
                  "allocated": 0,
                  "onOrder": 0,
                  "insufficientStock": true,
                  "lastStockTake": null,
                  "bom": [],
                  "created": "2026-08-19T16:50:31.000Z",
                  "updated": "2026-08-19T16:50:31.000Z"
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "stock:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/stock-items/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "getStockItem",
        "x-stability": "stable",
        "tags": [
          "Stock items"
        ],
        "summary": "Retrieve a stock item",
        "description": "Retrieves a stock item. To get its suppliers with it, send `include=suppliers`. A change to the item's suppliers also changes its `updated` time and its `ETag`.\n\nRequires the `stock:read` or `stock:write` scope. With `include=suppliers`, your API key also needs the `purchasing:read` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 403 | `insufficient-scope` | You sent `include=suppliers`, and your API key doesn't have the `purchasing:read` scope. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          },
          {
            "$ref": "#/components/parameters/IncludeStockItem"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the stock item.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockItem"
                },
                "example": {
                  "id": "stkPumpAssembly8Q",
                  "externalRef": null,
                  "partNo": "PMP-ASSY-200",
                  "title": "Pump assembly 200 series",
                  "kind": "assembly",
                  "archived": false,
                  "canBuy": false,
                  "canSell": true,
                  "description": "Pump assembly, 200 series, fully tested",
                  "purchasingDescription": null,
                  "dualDescriptionEnabled": false,
                  "location": "ASSY-2",
                  "warehouseId": "whsMainWarehouse1",
                  "cost": 480,
                  "sellPrice": 1150,
                  "lastCostUpdatedAt": "2026-07-02T08:12:40.000Z",
                  "taxExempt": false,
                  "purchaseAnalysisId": null,
                  "salesAnalysisId": "sac5MachinedParts",
                  "commodityCodeId": "cmc84818059000Xk2",
                  "countryOfOriginId": "ctyUnitedKingdom1",
                  "productWebLink": "https://acme-engineering.example/pumps/200",
                  "minStockLevel": 2,
                  "minOrderQuantity": 1,
                  "marginWarningPercent": 40,
                  "inStock": 4,
                  "allocated": 1,
                  "onOrder": 0,
                  "insufficientStock": false,
                  "lastStockTake": "2026-06-30",
                  "bom": [
                    {
                      "stockItemId": "stkFlangeDN50PN16",
                      "quantity": 2
                    },
                    {
                      "stockItemId": "stkGasketDN50EPDM",
                      "quantity": 2
                    }
                  ],
                  "created": "2025-11-03T09:00:00.000Z",
                  "updated": "2026-07-02T08:12:40.000Z"
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "stock:read"
            ]
          },
          {
            "bearerAuth": [
              "stock:write"
            ]
          }
        ]
      },
      "patch": {
        "operationId": "updateStockItem",
        "x-stability": "beta",
        "tags": [
          "Stock items"
        ],
        "summary": "Update a stock item",
        "description": "Updates a stock item. Any fields you leave out stay as they are. If your request doesn't change anything, for example because it sends back values the stock item already has, Omono doesn't save the stock item, so its `updated` time and ETag stay the same.\n\nYou can update all three kinds of item. Send the item's `kind` with every update: it selects the fields you can send, as the request body shows, and it can't change. To change an assembly's components, send `bom`. You can't change stock levels through the API: staff adjust them in Omono, for example with a stock take.\n\nTo archive or unarchive the item, send `archived` with its `kind`. You can't change an archived item until you unarchive it: send `archived: false`, on its own or together with your other changes. If a request that unarchives the item and changes other fields fails after Omono unarchived it, because someone changed the item at the same moment or because of a server error, the item stays unarchived: read it again before you retry. The response always shows the item as it is now, which can differ from what you asked for if someone else changed `archived` at the same moment.\n\nOmono saves one update to a stock item at a time. If another request is updating the same item, or someone is saving a change to its BOM in Omono, yours waits for it to finish, for up to 5 seconds, and then starts from the item as that update left it. So if you sent `If-Match` with the ETag from before that update, your request fails with a `412` error.\n\nOmono saves a change to `bom` all at once: if the request fails, the BOM is as it was before, so you can send the same request again.\n\nIf you change `cost`, Omono records the time in `lastCostUpdatedAt`. The new cost also becomes the item's last cost, which Omono uses in stock valuation and for the cost of new line items, until the next purchase order for the item is created.\n\nSome items, for example ones imported into Omono, have no warehouse or purchase analysis code, or have a title, location or web link that's longer than the API allows. To update one of these items, send the missing field, or a shorter value, in the same request. A saved value can also break one of the API's other limits, such as a title with an invisible character in it. You can leave a value like that out of your request, but if you send it back unchanged, the request fails with a `422` error.\n\nRequires the `stock:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `immutable-field` | The `kind` you sent isn't the item's kind: an item keeps its kind for life. |\n| 409 | `stock-item-archived` | You changed a field on an item that is archived and stays archived. The error's `field` names the first field you changed. Send `archived: false` to unarchive the item. |\n| 409 | `duplicate-part-number` | Another stock item already has the part number you sent. |\n| 412 | `precondition-failed` | Your `If-Match` doesn't match the item's current `ETag`, or you sent `bom` and someone changed the BOM in Omono while your request ran. Read the item again and retry. |\n| 422 | `validation-failed` | You sent `salesAnalysisId: null` while `canSell` is `true`, or the item has a saved title, location or web link that's too long. |\n| 422 | `missing-required-field` | After your changes, the item would have no `warehouseId` or `purchaseAnalysisId` (where its kind needs them), or it could be sold but would have no `salesAnalysisId`. |\n| 422 | `unknown-field` | You sent a field the item's kind doesn't take, for example `cost` on an assembly. |\n| 422 | `invalid-reference` | A new `bom` component is an assembly, can't be bought, or isn't in your organisation, or a component you remove isn't in the BOM. |\n| 503 | `temporarily-unavailable` | Another request is still updating this stock item after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "description": "The fields to change. Any fields you leave out stay as they are.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StockItemUpdate"
              },
              "example": {
                "kind": "normal",
                "sellPrice": 4.6,
                "minStockLevel": 60
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns the updated stock item.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockItem"
                },
                "example": {
                  "id": "stkGasketDN50EPDM",
                  "externalRef": null,
                  "partNo": "GSK-DN50-EPDM",
                  "title": "Gasket DN50 EPDM",
                  "kind": "normal",
                  "archived": false,
                  "canBuy": true,
                  "canSell": true,
                  "description": "Gasket DN50, EPDM, PN16 rated",
                  "purchasingDescription": null,
                  "dualDescriptionEnabled": false,
                  "location": "B1-04",
                  "warehouseId": "whsMainWarehouse1",
                  "cost": 1.85,
                  "sellPrice": 4.6,
                  "lastCostUpdatedAt": null,
                  "taxExempt": false,
                  "purchaseAnalysisId": "pacRawMaterials4Q",
                  "salesAnalysisId": "sac5MachinedParts",
                  "commodityCodeId": null,
                  "countryOfOriginId": null,
                  "productWebLink": null,
                  "minStockLevel": 60,
                  "minOrderQuantity": 100,
                  "marginWarningPercent": null,
                  "inStock": 0,
                  "allocated": 0,
                  "onOrder": 0,
                  "insufficientStock": true,
                  "lastStockTake": null,
                  "bom": [],
                  "created": "2026-08-19T16:50:31.000Z",
                  "updated": "2026-08-19T16:52:14.000Z"
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "stock:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/stock-items/{id}/notes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "listStockItemNotes",
        "x-stability": "beta",
        "tags": [
          "Notes"
        ],
        "summary": "List a stock item's notes",
        "description": "Returns the notes on a stock item, newest first. The list has user notes, which people write in Omono or which an API key adds, and system notes, which are the history that Omono writes itself, such as a status change or a changed delivery date. Each note's `kind` says which it is, and the `kind` filter returns one of them. A system note is the record's history as staff see it in Omono, and it can name other records, such as an order number on a stock item.\n\nA new note doesn't change the stock item's `updated` time. To keep a copy of the notes up to date, read this list again with `created_gte` set to the `created` time of the newest note you have, and skip the notes whose `id` you already have. Learn more about [notes](/docs/reading#notes).\n\nRequires the `stock:read` or `stock:write` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "kind",
            "in": "query",
            "description": "Pass `user` to return only the notes that people wrote or that an API key added, or `system` to return only the notes that Omono wrote itself.\n",
            "schema": {
              "type": "string",
              "enum": [
                "user",
                "system"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of notes.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NoteList"
                },
                "example": {
                  "data": [
                    {
                      "id": "nte8Rq2LmXw4KpZt7",
                      "kind": "user",
                      "text": "Called Priya Shah: the customer wants delivery before 12 December.",
                      "authorName": "API · CRM sync",
                      "userId": "usrApi4Wn8Kq2Lp5X",
                      "apiKeyId": "key7Tz3Mq9Wb2Xc4V",
                      "created": "2026-11-30T14:05:12.000Z"
                    },
                    {
                      "id": "nte5Bc9TyUw1QsVn3",
                      "kind": "system",
                      "text": "Status changed from Draft to Active",
                      "authorName": "Hannah Okafor",
                      "userId": "usr2Pq8Lm4Xw7Kz9R",
                      "apiKeyId": null,
                      "created": "2026-11-28T09:41:37.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "stock:read"
            ]
          },
          {
            "bearerAuth": [
              "stock:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createStockItemNote",
        "x-stability": "beta",
        "tags": [
          "Notes"
        ],
        "summary": "Add a note to a stock item",
        "description": "Adds a plain-text note to a stock item. The note appears in the stock item's notes in Omono, as if someone had written it there. The note's author is the API key, shown as `API · ` and the key's name. You can add a note to a stock item in any state, archived, closed or cancelled ones included, as staff can in Omono. A note can't be changed or deleted through the API, so check the text before you send it. The returned `text` can differ from the text you sent in two ways: Omono removes spaces and line breaks from the start and end, and replaces a character that isn't valid Unicode. One record can take about 50 notes through the API in any 24 hours: Omono checks the count before it adds the note, so notes sent at the same moment can pass it by a few.\n\nA new note doesn't change the stock item's `updated` time. Learn more about [adding notes](/docs/writing#notes).\n\nRequires the `stock:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 422 | `validation-failed` | `text` is blank, is longer than 2,000 characters, has more than 50 lines, or contains a control character other than a tab or a line break. |\n| 429 | `rate-limited` | The record already has about 50 notes added through the API in the last 24 hours. This is a daily cap on the record, not a request limit: `Retry-After` gives the seconds until it can take another, which can be many hours. |\n| 429 | `rate-limited` | Your organisation has stored its daily limit of descriptions and notes. `Retry-After` gives the seconds until 00:00 UTC. Learn more about [limits](/docs/limits#stored-descriptions). |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "The note to add.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NoteCreate"
              },
              "example": {
                "text": "Called Priya Shah: the customer wants delivery before 12 December."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new note.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Note"
                },
                "example": {
                  "id": "nte8Rq2LmXw4KpZt7",
                  "kind": "user",
                  "text": "Called Priya Shah: the customer wants delivery before 12 December.",
                  "authorName": "API · CRM sync",
                  "userId": "usrApi4Wn8Kq2Lp5X",
                  "apiKeyId": "key7Tz3Mq9Wb2Xc4V",
                  "created": "2026-11-30T14:05:12.000Z"
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "stock:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/stock-items/{id}/suppliers": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "listStockItemSuppliers",
        "x-stability": "beta",
        "tags": [
          "Stock items"
        ],
        "summary": "List a stock item's suppliers",
        "description": "Returns all the suppliers of a stock item on one page, in the order Omono shows them: the companies you buy the item from, each with its part number, lead time and price. `hasMore` is always `false`. An assembly has no suppliers, so its list is empty. You get the same rows with `include=suppliers` when you [retrieve the stock item](#tag/stock-items/GET/stock-items/{id}).\n\nAny change to an item's suppliers also changes the item's `updated` time, so you find changed suppliers by syncing stock items. Learn more about [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `stock:read` or `stock:write` scope. Your API key also needs the `purchasing:read` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 403 | `insufficient-scope` | Your API key doesn't have the `purchasing:read` scope. |\n| 404 | `not-found` | There's no stock item with this ID. |\n",
        "responses": {
          "200": {
            "description": "Returns the stock item's suppliers.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockItemSupplierList"
                },
                "example": {
                  "data": [
                    {
                      "supplierId": "cmpFlangeSupplies7Q",
                      "partNo": "FS-DN50-316",
                      "leadTimeDays": 10,
                      "price": 82.4,
                      "currencyId": "curGBP4Lm8Qz2Wx7Rt",
                      "preferred": true
                    },
                    {
                      "supplierId": "cmpEuroValvesGmbH3",
                      "partNo": "EV-50-16-L",
                      "leadTimeDays": 21,
                      "price": 91.75,
                      "currencyId": "curEUR9Kp3Vn6Hs2Yd",
                      "preferred": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "stock:read"
            ]
          },
          {
            "bearerAuth": [
              "stock:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      },
      "post": {
        "operationId": "createStockItemSupplier",
        "x-stability": "beta",
        "tags": [
          "Stock items"
        ],
        "summary": "Add a supplier to a stock item",
        "description": "Adds a supplier to a normal or never-diminishing stock item, as the Suppliers window of the stock item does in Omono. Send the supplier company in `supplierId`, with the supplier's own part number, its lead time in days and its price in the supplier's currency. To make it the preferred supplier, send `preferred: true`: Omono then clears `preferred` on the item's other suppliers in the same change.\n\nA stock item has one row for each supplier and up to 100 suppliers. The change also changes the item's `updated` time and its `ETag`, and the response's `ETag` is the item's new one. If you send `If-Match` with the item's `ETag` and the item has changed since you read it, nothing is saved. Omono adds a note to the item's history, which names your API key.\n\nRequires the `stock:write` scope. Your API key also needs the `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 403 | `insufficient-scope` | Your API key doesn't have the `purchasing:write` scope. |\n| 404 | `not-found` | There's no stock item with this ID. |\n| 409 | `stock-not-buyable` | The stock item is an assembly, which Omono builds rather than buys, so it has no suppliers. |\n| 409 | `stock-item-archived` | The stock item is archived. Unarchive it first by sending `archived: false` in a [`PATCH` of the item](#tag/stock-items/PATCH/stock-items/{id}). |\n| 409 | `duplicate-supplier` | The company is already a supplier of the item. Change its row with [`PATCH /stock-items/{id}/suppliers/{supplierId}`](#tag/stock-items/PATCH/stock-items/{id}/suppliers/{supplierId}) instead. |\n| 412 | `precondition-failed` | Your `If-Match` doesn't match the item's current `ETag`, or someone changed the item in Omono while your request was saving it. Read the item again and retry. |\n| 422 | `invalid-reference` | `supplierId` isn't one of your companies, isn't a supplier (its `isSupplier` is `false`), or is archived. |\n| 422 | `validation-failed` | The item already has 100 suppliers. The error's `field` is `supplierId`. |\n| 503 | `temporarily-unavailable` | Another request is still changing this stock item after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "description": "The supplier to add.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StockItemSupplierCreate"
              },
              "example": {
                "supplierId": "cmpFlangeSupplies7Q",
                "partNo": "FS-DN50-316",
                "leadTimeDays": 10,
                "price": 82.4,
                "preferred": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new supplier row.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockItemSupplier"
                },
                "example": {
                  "supplierId": "cmpFlangeSupplies7Q",
                  "partNo": "FS-DN50-316",
                  "leadTimeDays": 10,
                  "price": 82.4,
                  "currencyId": "curGBP4Lm8Qz2Wx7Rt",
                  "preferred": true
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "stock:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/stock-items/{id}/suppliers/{supplierId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        },
        {
          "name": "supplierId",
          "in": "path",
          "required": true,
          "description": "The ID of the supplier company.",
          "schema": {
            "type": "string",
            "maxLength": 64
          }
        }
      ],
      "patch": {
        "operationId": "updateStockItemSupplier",
        "x-stability": "beta",
        "tags": [
          "Stock items"
        ],
        "summary": "Update a stock item's supplier",
        "description": "Changes the part number, lead time, price or `preferred` flag of one of a stock item's suppliers. Any fields you leave out stay as they are. `preferred: true` makes this the item's preferred supplier and clears `preferred` on the item's other suppliers in the same change, and `preferred: false` clears it on this row only. If your request doesn't change anything, Omono doesn't save the item, so its `updated` time and `ETag` stay the same.\n\nA supplier row has no `ETag` of its own: send the stock item's `ETag` in `If-Match`. The response's `ETag` is the item's new one.\n\nRequires the `stock:write` scope. Your API key also needs the `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 403 | `insufficient-scope` | Your API key doesn't have the `purchasing:write` scope. |\n| 404 | `not-found` | There's no stock item with this ID, or the company isn't one of the item's suppliers. |\n| 409 | `stock-not-buyable` | The stock item is an assembly, which has no suppliers. |\n| 409 | `stock-item-archived` | The stock item is archived. Unarchive it first by sending `archived: false` in a [`PATCH` of the item](#tag/stock-items/PATCH/stock-items/{id}). |\n| 412 | `precondition-failed` | Your `If-Match` doesn't match the item's current `ETag`, or someone changed the item in Omono while your request was saving it. Read the item again and retry. |\n| 503 | `temporarily-unavailable` | Another request is still changing this stock item after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "description": "The fields to change. Any fields you leave out stay as they are.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StockItemSupplierUpdate"
              },
              "example": {
                "leadTimeDays": 14,
                "price": 84.1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns the updated supplier row.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockItemSupplier"
                },
                "example": {
                  "supplierId": "cmpFlangeSupplies7Q",
                  "partNo": "FS-DN50-316",
                  "leadTimeDays": 14,
                  "price": 84.1,
                  "currencyId": "curGBP4Lm8Qz2Wx7Rt",
                  "preferred": true
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "stock:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      },
      "delete": {
        "operationId": "deleteStockItemSupplier",
        "x-stability": "beta",
        "tags": [
          "Stock items"
        ],
        "summary": "Remove a supplier from a stock item",
        "description": "Removes one supplier from a stock item, as the Suppliers window of the stock item does in Omono. The company itself doesn't change. Omono adds a note to the item's history, which names your API key.\n\nSend the stock item's `ETag` in `If-Match`. The response has no body, and its `ETag` is the item's new `ETag`. A supplier that's already removed returns `404`, so a retry after a lost response is safe.\n\nRequires the `stock:write` scope. Your API key also needs the `purchasing:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 403 | `insufficient-scope` | Your API key doesn't have the `purchasing:write` scope. |\n| 404 | `not-found` | There's no stock item with this ID, or the company isn't one of the item's suppliers. |\n| 409 | `stock-not-buyable` | The stock item is an assembly, which has no suppliers. |\n| 409 | `stock-item-archived` | The stock item is archived. Unarchive it first by sending `archived: false` in a [`PATCH` of the item](#tag/stock-items/PATCH/stock-items/{id}). |\n| 412 | `precondition-failed` | Your `If-Match` doesn't match the item's current `ETag`, or someone changed the item in Omono while your request was saving it. Read the item again and retry. |\n| 428 | `precondition-required` | You didn't send `If-Match`. |\n| 503 | `temporarily-unavailable` | Another request is still changing this stock item after 5 seconds. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfMatchDelete"
          }
        ],
        "responses": {
          "204": {
            "description": "The supplier is removed from the stock item.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "428": {
            "$ref": "#/components/responses/PreconditionRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "stock:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/tasks": {
      "get": {
        "operationId": "listTasks",
        "x-stability": "stable",
        "tags": [
          "Tasks"
        ],
        "summary": "List all tasks",
        "description": "Returns a list of your tasks. The newest tasks come first unless you choose another order with `sort`.\n\nPrivate tasks, which only their owner and assigned users can see in Omono, never appear. A task is complete when its status is a closed status, one with `isClosedStatus: true` in [List all task statuses](#tag/task-settings).\n\nYou can find a company's tasks in two ways. `linkedEntityType=company` with the company's ID in `linkedEntityId` returns only the tasks linked to the company itself. `companyId` also returns the tasks linked to the company's quotes, sales orders, credit notes, contacts and purchase orders.\n\nLearn more about [pagination](/docs/reading#pagination), [filters](/docs/reading#filters), [sorting](/docs/reading#sorting) and [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `tasks:read` or `tasks:write` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/SortStandard"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "$ref": "#/components/parameters/ExternalRef"
          },
          {
            "name": "taskStatusId",
            "in": "query",
            "description": "Only return tasks with these statuses. Send up to 100 task status IDs, separated by commas. You can also repeat the parameter, as in `taskStatusId=a&taskStatusId=b`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "taskTypeId",
            "in": "query",
            "description": "Only return tasks of these types. Send up to 100 task type IDs, separated by commas. You can also repeat the parameter, as in `taskTypeId=a&taskTypeId=b`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "ownerId",
            "in": "query",
            "description": "Only return tasks owned by these users. Send up to 100 user IDs, separated by commas. You can also repeat the parameter, as in `ownerId=a&ownerId=b`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "linkedEntityType",
            "in": "query",
            "description": "Only return tasks linked to these types of record. Send one or more types, separated by commas. You can also repeat the parameter, as in `linkedEntityType=quote&linkedEntityType=sales_order`. Use it with `linkedEntityId` to find the tasks on particular records. It matches the direct link only, so `company` doesn't return the tasks on the company's quotes, orders, credit notes or contacts. To include those, use `companyId` instead.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "$ref": "#/components/schemas/KnownTaskLinkedEntityType"
              },
              "minItems": 1
            }
          },
          {
            "name": "linkedEntityId",
            "in": "query",
            "description": "Only return tasks linked to these records. Send up to 100 record IDs, separated by commas, and use this filter with `linkedEntityType`. You can also repeat the parameter, as in `linkedEntityId=a&linkedEntityId=b`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "companyId",
            "in": "query",
            "description": "Only return tasks that belong to these companies. A task belongs to a company when it's linked to the company itself, or to one of the company's quotes, sales orders, credit notes, contacts or purchase orders. For a purchase order, the company is the supplier. Tasks linked to a stock item, or to nothing, don't belong to a company. Send up to 100 company IDs, separated by commas. You can also repeat the parameter, as in `companyId=a&companyId=b`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "assignedUserId",
            "in": "query",
            "description": "Only return tasks assigned to at least one of these users. Send up to 100 user IDs, separated by commas. You can also repeat the parameter, as in `assignedUserId=a&assignedUserId=b`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "dueAt_gte",
            "in": "query",
            "description": "Only return tasks due at or after this time. Send a date and time in ISO 8601 format, such as `2026-09-01T00:00:00.000Z`. It must end with `Z` or an offset, such as `+01:00`. A time without one fails with a `422` error and the code `validation-failed`. If you build the URL yourself, encode the `+` of an offset as `%2B`. An all-day task is compared using the `dueAt` Omono sets for it, the end of its day in UTC.\n",
            "schema": {
              "type": "string",
              "format": "date-time",
              "minLength": 1
            }
          },
          {
            "name": "dueAt_lte",
            "in": "query",
            "description": "Only return tasks due at or before this time. Send a date and time in ISO 8601 format, such as `2026-09-30T23:59:59.999Z`. It must end with `Z` or an offset, such as `+01:00`. A time without one fails with a `422` error and the code `validation-failed`. If you build the URL yourself, encode the `+` of an offset as `%2B`. An all-day task is compared using the `dueAt` Omono sets for it, the end of its day in UTC.\n",
            "schema": {
              "type": "string",
              "format": "date-time",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of tasks.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskRecordList"
                },
                "example": {
                  "data": [
                    {
                      "id": "tskChaseQuote961x",
                      "externalRef": null,
                      "subject": "Chase quote SQ-0961 with Priya",
                      "taskTypeId": "ttyFollowUp6Qz9Km",
                      "taskPriorityId": "tprHigh3Mk8qZw2Xv",
                      "taskStatusId": "tstOpen5Kq9mWz3Xb",
                      "dueAt": "2026-08-28T09:00:00.000Z",
                      "allDayDate": null,
                      "isAllDay": false,
                      "timeZone": "Europe/London",
                      "estimatedDuration": 15,
                      "ownerId": "usrJaneDoe4Kq9mWt",
                      "createdById": "usrJaneDoe4Kq9mWt",
                      "assignedUserIds": [
                        "usrJaneDoe4Kq9mWt"
                      ],
                      "linkedEntityType": "quote",
                      "linkedEntityId": "qteWn8kP4mXz2JhRv",
                      "blocksShipping": false,
                      "companyId": "b2FpLmNvbXBhbnkQQ",
                      "isRecurring": false,
                      "recurrenceConfig": null,
                      "recurrenceRule": null,
                      "isAutomated": false,
                      "completedAt": null,
                      "completedById": null,
                      "previousTaskId": null,
                      "nextTaskId": null,
                      "created": "2026-08-12T09:35:00.000Z",
                      "updated": "2026-08-12T09:35:00.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "tasks:read"
            ]
          },
          {
            "bearerAuth": [
              "tasks:write"
            ]
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createTask",
        "x-stability": "beta",
        "tags": [
          "Tasks"
        ],
        "summary": "Create a task",
        "description": "Creates a task.\n\nA task is all-day unless you send `isAllDay: false`. An all-day task needs an `allDayDate`. A timed task needs a `dueAt` and a `timeZone`, which is an IANA name such as `Europe/London`.\n\nA new task must have an open status. To complete a task, use `POST /tasks/{id}/complete`. Tasks you create through the API are never private. Omono sets `companyId` for you from the record you link the task to. To match the tasks your staff create in Omono, send your organisation's default status and priority, the ones with `isDefault: true`.\n\nLearn more about [the rules for every write](/docs/writing#the-rules-for-every-write).\n\nRequires the `tasks:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 422 | `missing-required-field` | An all-day task has no `allDayDate`, or a timed task has no `dueAt` or `timeZone`. |\n| 422 | `validation-failed` | The status is a closed status. |\n| 422 | `validation-failed` | You sent only one of `linkedEntityType` and `linkedEntityId`, or you sent an ID with the type `general`. |\n| 422 | `validation-failed` | `blocksShipping` is `true`, but the task isn't linked to a sales order. |\n| 422 | `validation-failed` | `isRecurring` doesn't match `recurrenceConfig`. For example, it's `false` but you sent a recurrence. |\n| 422 | `validation-failed` | You sent an `allDayDate` for a timed task. |\n| 422 | `validation-failed` | The recurrence's `untilDate` is before today, or before the day the task is due. |\n| 422 | `validation-failed` | The `timeZone` you sent isn't a valid IANA time zone name. The error names `timeZone`. |\n| 422 | `validation-failed` | A monthly recurrence with `bySetPos` has more than one day in `byDay`. The error names `recurrenceConfig.byDay`. |\n| 422 | `invalid-reference` | An ID doesn't match a record in your organisation, or it names something you can't use: an archived type, priority or status, a user who isn't assignable, or an archived company, contact or stock item. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "The task to create.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskCreate"
              },
              "example": {
                "subject": "Confirm delivery slot with Goods In",
                "taskTypeId": "ttyFollowUp6Qz9Km",
                "taskPriorityId": "tprHigh3Mk8qZw2Xv",
                "taskStatusId": "tstOpen5Kq9mWz3Xb",
                "dueAt": "2026-08-21T14:00:00.000Z",
                "isAllDay": false,
                "timeZone": "Europe/London",
                "estimatedDuration": 10,
                "ownerId": "usrTomSmith8Zp2Qk",
                "linkedEntityType": "purchase_order",
                "linkedEntityId": "aK3nMh2PqXwYbTzVc",
                "blocksShipping": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new task.",
            "headers": {
              "Location": {
                "$ref": "#/components/headers/Location"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskRecord"
                },
                "example": {
                  "id": "tskConfirmSlot2Kq",
                  "externalRef": null,
                  "subject": "Confirm delivery slot with Goods In",
                  "taskTypeId": "ttyFollowUp6Qz9Km",
                  "taskPriorityId": "tprHigh3Mk8qZw2Xv",
                  "taskStatusId": "tstOpen5Kq9mWz3Xb",
                  "dueAt": "2026-08-21T14:00:00.000Z",
                  "allDayDate": null,
                  "isAllDay": false,
                  "timeZone": "Europe/London",
                  "estimatedDuration": 10,
                  "ownerId": "usrTomSmith8Zp2Qk",
                  "createdById": "usrApiService2Kq9",
                  "assignedUserIds": [],
                  "linkedEntityType": "purchase_order",
                  "linkedEntityId": "aK3nMh2PqXwYbTzVc",
                  "blocksShipping": false,
                  "companyId": "cmpRheinmetallDE1",
                  "isRecurring": false,
                  "recurrenceConfig": null,
                  "recurrenceRule": null,
                  "isAutomated": false,
                  "completedAt": null,
                  "completedById": null,
                  "previousTaskId": null,
                  "nextTaskId": null,
                  "created": "2026-08-19T16:55:02.000Z",
                  "updated": "2026-08-19T16:55:02.000Z"
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "tasks:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/tasks/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "getTask",
        "x-stability": "stable",
        "tags": [
          "Tasks"
        ],
        "summary": "Retrieve a task",
        "description": "Retrieves a task. If the task is private, the request fails with a `404` error, as if the task didn't exist.\n\nRequires the `tasks:read` or `tasks:write` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the task.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskRecord"
                },
                "example": {
                  "id": "tskChaseQuote961x",
                  "externalRef": null,
                  "subject": "Chase quote SQ-0961 with Priya",
                  "taskTypeId": "ttyFollowUp6Qz9Km",
                  "taskPriorityId": "tprHigh3Mk8qZw2Xv",
                  "taskStatusId": "tstOpen5Kq9mWz3Xb",
                  "dueAt": "2026-08-28T09:00:00.000Z",
                  "allDayDate": null,
                  "isAllDay": false,
                  "timeZone": "Europe/London",
                  "estimatedDuration": 15,
                  "ownerId": "usrJaneDoe4Kq9mWt",
                  "createdById": "usrJaneDoe4Kq9mWt",
                  "assignedUserIds": [
                    "usrJaneDoe4Kq9mWt"
                  ],
                  "linkedEntityType": "quote",
                  "linkedEntityId": "qteWn8kP4mXz2JhRv",
                  "blocksShipping": false,
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "isRecurring": false,
                  "recurrenceConfig": null,
                  "recurrenceRule": null,
                  "isAutomated": false,
                  "completedAt": null,
                  "completedById": null,
                  "previousTaskId": null,
                  "nextTaskId": null,
                  "created": "2026-08-12T09:35:00.000Z",
                  "updated": "2026-08-12T09:35:00.000Z"
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "tasks:read"
            ]
          },
          {
            "bearerAuth": [
              "tasks:write"
            ]
          }
        ]
      },
      "patch": {
        "operationId": "updateTask",
        "x-stability": "beta",
        "tags": [
          "Tasks"
        ],
        "summary": "Update a task",
        "description": "Updates a task. Any fields you leave out stay as they are. If your request doesn't change anything, for example because it sends back values the task already has, Omono doesn't save the task, so its `updated` time and ETag stay the same.\n\nOmono checks the task as it will be after the update, combining the fields you send with the ones already stored. That applies to the link (`linkedEntityType` and `linkedEntityId`), the recurrence (`isRecurring` and `recurrenceConfig`) and the schedule fields. If you move the link away from a sales order, Omono turns off `blocksShipping`.\n\nA completed task, one whose status is closed, can't be changed through the API, so a change fails with a `409` error and the code `task-completed`. Staff reopen a completed task in Omono. You can't move a task to a closed status in a `PATCH` either: to complete a task, use `POST /tasks/{id}/complete`. Sending a task's current values again is fine. A repeating task whose last occurrence is complete keeps `isRecurring: true`.\n\nIf the task is private, the request fails with a `404` error, as if the task didn't exist.\n\nLearn more about [the rules for every write](/docs/writing#the-rules-for-every-write).\n\nRequires the `tasks:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `task-completed` | The task is complete, so none of its fields can change, and it can't move back to an open status. The error's `field` names the first field you changed. |\n| 422 | `validation-failed` | You tried to move an open task to a closed status. Use `POST /tasks/{id}/complete` instead. |\n| 422 | `validation-failed` | After the update, the task would have only one of `linkedEntityType` and `linkedEntityId`, or an ID with the type `general`. |\n| 422 | `validation-failed` | `blocksShipping` would be `true`, but the task isn't linked to a sales order. |\n| 422 | `validation-failed` | `isRecurring` wouldn't match `recurrenceConfig`. |\n| 422 | `validation-failed` | You sent an `allDayDate` for a timed task. |\n| 422 | `validation-failed` | The recurrence's `untilDate` is before today, or before the day the task is due. |\n| 422 | `validation-failed` | The `timeZone` you sent isn't a valid IANA time zone name. The error names `timeZone`. |\n| 422 | `validation-failed` | A monthly recurrence with `bySetPos` has more than one day in `byDay`. The error names `recurrenceConfig.byDay`. |\n| 422 | `missing-required-field` | You switched the task from all-day to timed without sending a `dueAt`. |\n| 422 | `invalid-reference` | An ID doesn't match a record in your organisation, or it names something you can't use, such as an archived status or a user who isn't assignable. A new link to an archived company, contact or stock item is refused too. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "description": "The fields to change. Any fields you leave out stay as they are.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskUpdate"
              },
              "example": {
                "dueAt": "2026-08-29T09:00:00.000Z",
                "estimatedDuration": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns the updated task.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskRecord"
                },
                "example": {
                  "id": "tskChaseQuote961x",
                  "externalRef": null,
                  "subject": "Chase quote SQ-0961 with Priya",
                  "taskTypeId": "ttyFollowUp6Qz9Km",
                  "taskPriorityId": "tprHigh3Mk8qZw2Xv",
                  "taskStatusId": "tstOpen5Kq9mWz3Xb",
                  "dueAt": "2026-08-29T09:00:00.000Z",
                  "allDayDate": null,
                  "isAllDay": false,
                  "timeZone": "Europe/London",
                  "estimatedDuration": 20,
                  "ownerId": "usrJaneDoe4Kq9mWt",
                  "createdById": "usrJaneDoe4Kq9mWt",
                  "assignedUserIds": [
                    "usrJaneDoe4Kq9mWt"
                  ],
                  "linkedEntityType": "quote",
                  "linkedEntityId": "qteWn8kP4mXz2JhRv",
                  "blocksShipping": false,
                  "companyId": "b2FpLmNvbXBhbnkQQ",
                  "isRecurring": false,
                  "recurrenceConfig": null,
                  "recurrenceRule": null,
                  "isAutomated": false,
                  "completedAt": null,
                  "completedById": null,
                  "previousTaskId": null,
                  "nextTaskId": null,
                  "created": "2026-08-12T09:35:00.000Z",
                  "updated": "2026-08-19T16:57:40.000Z"
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "tasks:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/tasks/{id}/complete": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "operationId": "completeTask",
        "x-stability": "beta",
        "tags": [
          "Tasks"
        ],
        "summary": "Complete a task",
        "description": "Completes a task, as the **Complete** button does in Omono. Omono records when the task was completed and who completed it, gives it a closed status, and adds an entry to the task's history. To choose the closed status, send its ID as `taskStatusId`.\n\nA repeating task completes only its current occurrence. Omono records the occurrence, moves the task on to its next due date and gives it an open status again, so the task isn't complete and `completedAt` stays `null`. When the series ends, the task is complete. Each request completes one occurrence, so send an `Idempotency-Key` with each one to make retries safe.\n\nIf a task that doesn't repeat is already complete, nothing changes and the response has `\"applied\": false`, so it's safe to retry. You can't reopen a task through the API: staff reopen tasks in Omono.\n\nLearn more about [lifecycle actions](/docs/writing#lifecycle-actions).\n\nRequires the `tasks:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 422 | `invalid-reference` | `taskStatusId` isn't one of your task statuses, or the status is archived. |\n| 422 | `validation-failed` | `taskStatusId` isn't a closed status. |\n| 503 | `temporarily-unavailable` | Another request is completing this task. Retry after the `Retry-After` delay. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskComplete"
              },
              "example": {
                "taskStatusId": "tstDone8Kq2mWz5Xb"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns `applied` and the task as it is now. `applied` is `false` if the task was already complete.\n",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskActionResult"
                },
                "example": {
                  "applied": true,
                  "task": {
                    "id": "tskChaseQuote961x",
                    "externalRef": null,
                    "subject": "Chase quote SQ-0961 with Priya",
                    "taskTypeId": "ttyFollowUp6Qz9Km",
                    "taskPriorityId": "tprHigh3Mk8qZw2Xv",
                    "taskStatusId": "tstDone8Kq2mWz5Xb",
                    "dueAt": "2026-08-28T09:00:00.000Z",
                    "allDayDate": null,
                    "isAllDay": false,
                    "timeZone": "Europe/London",
                    "estimatedDuration": 15,
                    "ownerId": "usrJaneDoe4Kq9mWt",
                    "createdById": "usrJaneDoe4Kq9mWt",
                    "assignedUserIds": [
                      "usrJaneDoe4Kq9mWt"
                    ],
                    "linkedEntityType": "quote",
                    "linkedEntityId": "qteWn8kP4mXz2JhRv",
                    "blocksShipping": false,
                    "companyId": "b2FpLmNvbXBhbnkQQ",
                    "isRecurring": false,
                    "recurrenceConfig": null,
                    "recurrenceRule": null,
                    "isAutomated": false,
                    "completedAt": "2026-08-28T10:12:40.000Z",
                    "completedById": "usrApiService7Kq2",
                    "previousTaskId": null,
                    "nextTaskId": null,
                    "created": "2026-08-12T09:35:00.000Z",
                    "updated": "2026-08-28T10:12:40.000Z"
                  }
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "tasks:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/tasks/{id}/notes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "listTaskNotes",
        "x-stability": "beta",
        "tags": [
          "Notes"
        ],
        "summary": "List a task's notes",
        "description": "Returns the notes on a task, newest first. The list has the notes that people write in Omono or that an API key adds, so every note's `kind` is `user`. A task's history, which staff see when they turn on Activity in Omono, isn't part of its notes: it can name records and private tasks that the task itself doesn't show. `kind=system` returns an empty list. Deleted task notes aren't returned. A private task answers `404`, as it does everywhere in the API.\n\nA new note doesn't change the task's `updated` time. To keep a copy of the notes up to date, read this list again with `created_gte` set to the `created` time of the newest note you have, and skip the notes whose `id` you already have. Learn more about [notes](/docs/reading#notes).\n\nRequires the `tasks:read` or `tasks:write` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "kind",
            "in": "query",
            "description": "A task's notes are all `user` notes, so `user` returns them all and `system` returns none. The parameter is here so that every notes list takes the same parameters.\n",
            "schema": {
              "type": "string",
              "enum": [
                "user",
                "system"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of notes.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NoteList"
                },
                "example": {
                  "data": [
                    {
                      "id": "tnt3Hv8PqLm2XwR6k",
                      "kind": "user",
                      "text": "Spoke to Priya: she will send the drawings on Friday.",
                      "authorName": "API · CRM sync",
                      "userId": "usrApi4Wn8Kq2Lp5X",
                      "apiKeyId": "key7Tz3Mq9Wb2Xc4V",
                      "created": "2026-11-30T14:05:12.000Z"
                    },
                    {
                      "id": "tnt7Jk4NrSx9ZqW2m",
                      "kind": "user",
                      "text": "Due date moved to 3 December at the customer's request.",
                      "authorName": "Hannah Okafor",
                      "userId": "usr2Pq8Lm4Xw7Kz9R",
                      "apiKeyId": null,
                      "created": "2026-11-28T09:41:37.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "tasks:read"
            ]
          },
          {
            "bearerAuth": [
              "tasks:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "createTaskNote",
        "x-stability": "beta",
        "tags": [
          "Notes"
        ],
        "summary": "Add a note to a task",
        "description": "Adds a plain-text note to a task. The note is added to the task as plain text, as if someone had written it in the task's notes in Omono. On a recurring task, it belongs to the current occurrence. The note's author is the API key, shown as `API · ` and the key's name. You can add a note to a task in any state, archived, closed or cancelled ones included, as staff can in Omono. A note can't be changed or deleted through the API, so check the text before you send it. The returned `text` can differ from the text you sent in two ways: Omono removes spaces and line breaks from the start and end, and replaces a character that isn't valid Unicode. One record can take about 50 notes through the API in any 24 hours: Omono checks the count before it adds the note, so notes sent at the same moment can pass it by a few.\n\nA new note doesn't change the task's `updated` time. Learn more about [adding notes](/docs/writing#notes).\n\nRequires the `tasks:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 422 | `validation-failed` | `text` is blank, is longer than 2,000 characters, has more than 50 lines, or contains a control character other than a tab or a line break. |\n| 429 | `rate-limited` | The task already has about 50 notes added through the API in the last 24 hours. This is a daily cap on the task, not a request limit: `Retry-After` gives the seconds until it can take another, which can be many hours. |\n| 429 | `rate-limited` | Your organisation has stored its daily limit of descriptions and notes. `Retry-After` gives the seconds until 00:00 UTC. Learn more about [limits](/docs/limits#stored-descriptions). |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "The note to add.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NoteCreate"
              },
              "example": {
                "text": "Spoke to Priya: she will send the drawings on Friday."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new note.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Note"
                },
                "example": {
                  "id": "tnt3Hv8PqLm2XwR6k",
                  "kind": "user",
                  "text": "Spoke to Priya: she will send the drawings on Friday.",
                  "authorName": "API · CRM sync",
                  "userId": "usrApi4Wn8Kq2Lp5X",
                  "apiKeyId": "key7Tz3Mq9Wb2Xc4V",
                  "created": "2026-11-30T14:05:12.000Z"
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "tasks:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/documents": {
      "get": {
        "operationId": "listDocuments",
        "x-stability": "stable",
        "tags": [
          "Documents"
        ],
        "summary": "List all documents",
        "description": "Returns a list of your documents. A document holds the details of a file attached to a record, not the file itself. The newest documents come first unless you choose another order with `sort`.\n\nTo list one record's attachments, filter by the record's ID, for example with `salesOrderId`. Leave out these filters to list every document. Files attached to tasks, and email template attachments, never appear.\n\nArchived documents are left out unless you ask for them with `archived`. If you keep a copy in sync, send `archived=any`, so that you see a document change when it's archived.\n\nLearn more about [pagination](/docs/reading#pagination), [filters](/docs/reading#filters), [sorting](/docs/reading#sorting) and [keeping in sync](/docs/syncing#incremental-sync).\n\nRequires the `documents:read` or `documents:write` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/SortStandard"
          },
          {
            "$ref": "#/components/parameters/Archived"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/CreatedGte"
          },
          {
            "$ref": "#/components/parameters/CreatedLte"
          },
          {
            "name": "salesOrderId",
            "in": "query",
            "description": "Only return documents attached to these sales orders. Send up to 100 sales order IDs, separated by commas. You can also repeat the parameter, as in `salesOrderId=a&salesOrderId=b`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "quoteId",
            "in": "query",
            "description": "Only return documents attached to these quotes. Send up to 100 quote IDs, separated by commas. You can also repeat the parameter, as in `quoteId=a&quoteId=b`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "companyId",
            "in": "query",
            "description": "Only return documents attached to these companies. Send up to 100 company IDs, separated by commas. You can also repeat the parameter, as in `companyId=a&companyId=b`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "purchaseOrderId",
            "in": "query",
            "description": "Only return documents attached to these purchase orders. Send up to 100 purchase order IDs, separated by commas. You can also repeat the parameter, as in `purchaseOrderId=a&purchaseOrderId=b`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "stockItemId",
            "in": "query",
            "description": "Only return documents attached to these stock items. Send up to 100 stock item IDs, separated by commas. You can also repeat the parameter, as in `stockItemId=a&stockItemId=b`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          },
          {
            "name": "creditNoteId",
            "in": "query",
            "description": "Only return documents attached to these credit notes. Send up to 100 credit note IDs, separated by commas. You can also repeat the parameter, as in `creditNoteId=a&creditNoteId=b`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              "minItems": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of documents.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentList"
                },
                "example": {
                  "data": [
                    {
                      "id": "hQz4dTn8WkbRfXaYc",
                      "name": "drawing-rev-b.pdf",
                      "size": 482113,
                      "fileType": "application/pdf",
                      "salesOrderId": "vShvOSNvvpFsuxKgN",
                      "quoteId": null,
                      "companyId": null,
                      "purchaseOrderId": null,
                      "stockItemId": null,
                      "creditNoteId": null,
                      "uploaderUserId": "usrApiService2Kq9",
                      "pinned": true,
                      "archived": false,
                      "contentUrl": "/api/v1/documents/hQz4dTn8WkbRfXaYc/content",
                      "created": "2026-08-19T15:40:12.000Z",
                      "updated": "2026-08-19T15:40:12.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "documents:read"
            ]
          },
          {
            "bearerAuth": [
              "documents:write"
            ]
          }
        ],
        "x-group-parameters": true
      },
      "post": {
        "operationId": "uploadDocument",
        "x-stability": "beta",
        "tags": [
          "Documents"
        ],
        "summary": "Upload a document",
        "description": "Uploads a file and attaches it to a record.\n\nSend the request as `multipart/form-data`. Include exactly one parent ID (`salesOrderId`, `quoteId`, `companyId`, `purchaseOrderId`, `stockItemId` or `creditNoteId`), then `name` and `pinned` if you want them, and finally the `file` part. **The `file` part must come last**: Omono stores the file as it arrives, so it refuses any field that comes after it. For example:\n\n```bash\ncurl -H \"Authorization: Bearer $KEY\" \\\n  -F salesOrderId=<id> -F name=drawing.pdf -F file=@drawing.pdf \\\n  https://api.omono.co/api/v1/documents\n```\n\nYou can upload any type of file up to 20 MB. Check the size before you send a file: Omono answers a larger one with a `413` as soon as it passes 20 MB, or at once when the `Content-Length` header says the request is too large, and then closes the connection, which some HTTP clients report as a connection error instead of the response. Send the body uncompressed, without a `Content-Encoding` header, and make sure the `Content-Type` header names the boundary your body uses. Omono doesn't scan files for malware, so treat the files you download as untrusted. Use a different `Idempotency-Key` for each file.\n\nAn upload counts as a write against your [rate limits](/docs/limits#uploads): 1, plus 1 for every full MB of the request, so a 20 MB file counts as 21. Send a `Content-Length` header: without one, an upload counts as the largest file until the file has arrived. Your organisation can upload up to 1 GB of files a day, in UTC.\n\nRequires the `documents:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 413 | `payload-too-large` | The file is larger than 20 MB. Omono answers before the rest of the request arrives, then closes the connection. Nothing is stored. |\n| 415 | `unsupported-media-type` | The request isn't `multipart/form-data`, or it has a `Content-Encoding` header. |\n| 422 | `validation-failed` | A field comes after the `file` part, there's no `file` part, or the request doesn't have exactly one parent ID. |\n| 422 | `unknown-field` | The request has a field that isn't listed here. |\n| 422 | `invalid-reference` | The parent ID doesn't match a record in your organisation. The record can be archived, or a complete or cancelled document: you can still attach files to it. |\n| 422 | `invalid-filename` | The name isn't a valid file name. |\n| 429 | `upload-limit-reached` | Your organisation has uploaded its 1 GB of files for today (UTC), or this upload would take it past that. `Retry-After` gives the seconds until 00:00 UTC. Nothing is stored. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "description": "The file to upload, with the record to attach it to.",
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentUpload"
              },
              "example": {
                "salesOrderId": "vShvOSNvvpFsuxKgN",
                "file": "(binary — drawing-rev-b.pdf)"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns the new document.",
            "headers": {
              "Location": {
                "$ref": "#/components/headers/Location"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Document"
                },
                "example": {
                  "id": "hQz4dTn8WkbRfXaYc",
                  "name": "drawing-rev-b.pdf",
                  "size": 482113,
                  "fileType": "application/pdf",
                  "salesOrderId": "vShvOSNvvpFsuxKgN",
                  "quoteId": null,
                  "companyId": null,
                  "purchaseOrderId": null,
                  "stockItemId": null,
                  "creditNoteId": null,
                  "uploaderUserId": "usrApiService2Kq9",
                  "pinned": true,
                  "archived": false,
                  "contentUrl": "/api/v1/documents/hQz4dTn8WkbRfXaYc/content",
                  "created": "2026-08-19T15:40:12.000Z",
                  "updated": "2026-08-19T15:40:12.000Z"
                }
              }
            }
          },
          "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"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "documents:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/documents/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "getDocument",
        "x-stability": "stable",
        "tags": [
          "Documents"
        ],
        "summary": "Retrieve a document",
        "description": "Retrieves a document. To download the file itself, follow its `contentUrl`.\n\nYou can still retrieve an archived document, which has `archived: true`, but its `contentUrl` returns a `404` error. Files attached to tasks, and email template attachments, return a `404` error.\n\nRequires the `documents:read` or `documents:write` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the document.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Document"
                },
                "example": {
                  "id": "hQz4dTn8WkbRfXaYc",
                  "name": "drawing-rev-b.pdf",
                  "size": 482113,
                  "fileType": "application/pdf",
                  "salesOrderId": "vShvOSNvvpFsuxKgN",
                  "quoteId": null,
                  "companyId": null,
                  "purchaseOrderId": null,
                  "stockItemId": null,
                  "creditNoteId": null,
                  "uploaderUserId": "usrApiService2Kq9",
                  "pinned": true,
                  "archived": false,
                  "contentUrl": "/api/v1/documents/hQz4dTn8WkbRfXaYc/content",
                  "created": "2026-08-19T15:40:12.000Z",
                  "updated": "2026-08-19T15:40:12.000Z"
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "documents:read"
            ]
          },
          {
            "bearerAuth": [
              "documents:write"
            ]
          }
        ]
      },
      "patch": {
        "operationId": "updateDocument",
        "x-stability": "beta",
        "tags": [
          "Documents"
        ],
        "summary": "Update a document",
        "description": "Updates a document: renames it, pins or unpins it, or archives it. Any fields you leave out stay as they are.\n\nYou can't delete a document outright. Instead, send `archived: true`, which deletes it in the same way as deleting it in Omono: the document disappears from every list in Omono, and its `contentUrl` returns a `404` error. Archiving can't be undone. If you send a field with the value it already has, nothing changes and the request succeeds.\n\nFiles attached to tasks, and email template attachments, return a `404` error.\n\nRequires the `documents:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 409 | `document-archived` | The document is archived, and you tried to unarchive it or change its `name` or `pinned`. The error's `field` names it. |\n| 422 | `invalid-filename` | The new name is blank or isn't a valid file name. |\n| 422 | `validation-failed` | The new name is longer than 250 characters or contains an invisible character. |\n| 422 | `unknown-field` | You sent a field that you can't change. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "description": "The fields to change. Any fields you leave out stay as they are.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentUpdate"
              },
              "example": {
                "name": "drawing-rev-c.pdf",
                "pinned": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns the updated document.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "Idempotency-Replayed": {
                "$ref": "#/components/headers/IdempotencyReplayed"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Document"
                },
                "example": {
                  "id": "hQz4dTn8WkbRfXaYc",
                  "name": "drawing-rev-c.pdf",
                  "size": 482113,
                  "fileType": "application/pdf",
                  "salesOrderId": "vShvOSNvvpFsuxKgN",
                  "quoteId": null,
                  "companyId": null,
                  "purchaseOrderId": null,
                  "stockItemId": null,
                  "creditNoteId": null,
                  "uploaderUserId": "usrApiService2Kq9",
                  "pinned": false,
                  "archived": false,
                  "contentUrl": "/api/v1/documents/hQz4dTn8WkbRfXaYc/content",
                  "created": "2026-08-19T15:40:12.000Z",
                  "updated": "2026-08-19T17:02:19.000Z"
                }
              }
            }
          },
          "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"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "documents:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/documents/{id}/content": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "operationId": "downloadDocumentContent",
        "x-stability": "stable",
        "tags": [
          "Documents"
        ],
        "summary": "Download a document's file",
        "description": "Downloads a document's file. The response is a `302` redirect to a short-lived storage URL, so follow it straight away. Learn more about [downloads](/docs/reading#downloads).\n\nThe file is served with `Content-Disposition: attachment` and the file's name, including UTF-8 names, so browsers save it rather than open it.\n\nAn archived document, a file attached to a task and an email template attachment all return a `404` error.\n\nRequires the `documents:read` or `documents:write` scope.\n",
        "responses": {
          "302": {
            "description": "Redirects you to a short-lived URL that downloads the file.",
            "headers": {
              "Location": {
                "description": "The storage URL to download the file from. It expires 10 to 20 seconds after it's issued, so follow it straight away, and never store or share it.\n",
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "No document has this ID, or the document is archived. The error's code is `not-found`. You can still retrieve an archived document's details with [Retrieve a document](#tag/documents), but you can't download its file.\n",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "examples": {
                  "unknownId": {
                    "summary": "No document with that id",
                    "value": {
                      "type": "https://api.omono.co/docs/errors/not-found",
                      "code": "not-found",
                      "title": "Not found",
                      "status": 404,
                      "detail": "No resource with that id.",
                      "requestId": "req_9Jc4TqX2mBv7RkLpW"
                    }
                  },
                  "archivedDocument": {
                    "summary": "The document is archived",
                    "value": {
                      "type": "https://api.omono.co/docs/errors/not-found",
                      "code": "not-found",
                      "title": "Not found",
                      "status": 404,
                      "detail": "This document has been archived (deleted in Omono); its file can no longer be downloaded.",
                      "requestId": "req_9Jc4TqX2mBv7RkLpW"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "documents:read"
            ]
          },
          {
            "bearerAuth": [
              "documents:write"
            ]
          }
        ]
      }
    },
    "/tax-rates": {
      "get": {
        "operationId": "listTaxRates",
        "x-stability": "stable",
        "tags": [
          "Tax and currency"
        ],
        "summary": "List all tax rates",
        "description": "Returns a list of your tax rates. Companies and line items refer to a tax rate by its ID in `taxRateId`.\n\nThe list also includes the rates Omono defines itself, such as the exempt tax rate it applies to line items for tax-exempt stock. Omono doesn't show these rates in its settings, but they're listed here so that every stored `taxRateId` resolves.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of tax rates.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxRateList"
                },
                "example": {
                  "data": [
                    {
                      "id": "trx20pcVATkQ9m3Zd",
                      "name": "20% (VAT on Income)",
                      "rate": 20,
                      "type": null,
                      "systemDefined": false,
                      "archived": false
                    },
                    {
                      "id": "trxZeroRatedEU9Xk",
                      "name": "Zero Rated EC Goods Income",
                      "rate": 0,
                      "type": null,
                      "systemDefined": false,
                      "archived": false
                    },
                    {
                      "id": "trxSystemExempt1X",
                      "name": "Exempt",
                      "rate": 0,
                      "type": "exempt",
                      "systemDefined": true,
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/sales-analysis-codes": {
      "get": {
        "operationId": "listSalesAnalysisCodes",
        "x-stability": "stable",
        "tags": [
          "Sales settings"
        ],
        "summary": "List all sales analysis codes",
        "description": "Returns a list of your sales analysis codes, the categories you use to analyse your sales, such as \"Machined Parts\". Stock items and quote, sales order and credit note line items refer to a code by its ID in `salesAnalysisId`.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of sales analysis codes.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesAnalysisCodeList"
                },
                "example": {
                  "data": [
                    {
                      "id": "sac5MachinedParts",
                      "name": "Machined Parts",
                      "marginWarningPercent": 30,
                      "defaultCommodityCodeId": "cmc84818059000Xk2",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/purchase-analysis-codes": {
      "get": {
        "operationId": "listPurchaseAnalysisCodes",
        "x-stability": "stable",
        "tags": [
          "Purchasing and shipping"
        ],
        "summary": "List all purchase analysis codes",
        "description": "Returns a list of your purchase analysis codes, the categories you use to analyse your spending, such as \"Raw Materials\". Stock items and purchase order line items refer to a code by its ID in `purchaseAnalysisId`.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of purchase analysis codes.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseAnalysisCodeList"
                },
                "example": {
                  "data": [
                    {
                      "id": "pacRawMaterials4Q",
                      "name": "Raw Materials",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/workflow-statuses": {
      "get": {
        "operationId": "listWorkflowStatuses",
        "x-stability": "stable",
        "tags": [
          "Sales settings"
        ],
        "summary": "List all workflow statuses",
        "description": "Returns a list of your organisation's dispatch workflow statuses. A dispatch moves through these statuses on its way to being shipped: its `statusId` is one of them, and so is every status you can move it to.\n\nLike every reference list, the list is ordered by ID, not in workflow order. To show the statuses in workflow order, sort them by `sortOrder` yourself.\n\nYour organisation can rename its statuses, so rely on `type`, not `name`, to know what a status means. Moving a dispatch to the final status (the one whose type is `final`) ships it and invoices it. Learn more about [dispatches and invoicing](/docs/workflow).\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of workflow statuses.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowStatusList"
                },
                "example": {
                  "data": [
                    {
                      "id": "wfsUnalloc2Kq8mWz",
                      "name": "Awaiting Allocation",
                      "type": "unallocated",
                      "sortOrder": 1,
                      "archived": false
                    },
                    {
                      "id": "wfsAllocated7Kq2M",
                      "name": "Allocated",
                      "type": "allocated",
                      "sortOrder": 2,
                      "archived": false
                    },
                    {
                      "id": "wfsOnHold3Qk8mWzX",
                      "name": "On Hold",
                      "type": "on_hold",
                      "sortOrder": 3,
                      "archived": false
                    },
                    {
                      "id": "wfsShipped9Kq4mTz",
                      "name": "Shipped",
                      "type": "final",
                      "sortOrder": 4,
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/task-statuses": {
      "get": {
        "operationId": "listTaskStatuses",
        "x-stability": "stable",
        "tags": [
          "Task settings"
        ],
        "summary": "List all task statuses",
        "description": "Returns a list of your task statuses, such as \"Open\" or \"Done\". A task refers to its status by its ID in `taskStatusId`.\n\nEach status is either open or closed, and a task is complete once its status is closed (`isClosedStatus: true`). You can't give a task a closed status in a `PATCH`: to complete a task, use `POST /tasks/{id}/complete`. The status with `isDefault: true` is the one Omono selects for a new task.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of task statuses.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskStatusRecordList"
                },
                "example": {
                  "data": [
                    {
                      "id": "tstOpen5Kq9mWz3Xb",
                      "name": "Open",
                      "isClosedStatus": false,
                      "isDefault": true,
                      "archived": false
                    },
                    {
                      "id": "tstDone8Pq2kXw4Zj",
                      "name": "Done",
                      "isClosedStatus": true,
                      "isDefault": false,
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/task-priorities": {
      "get": {
        "operationId": "listTaskPriorities",
        "x-stability": "stable",
        "tags": [
          "Task settings"
        ],
        "summary": "List all task priorities",
        "description": "Returns a list of your task priorities, such as \"High\". A task refers to its priority by its ID in `taskPriorityId`.\n\nThe priority with `isDefault: true` is the one Omono selects for a new task. To match the tasks your staff create in Omono, send it when you create a task.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of task priorities.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskPriorityList"
                },
                "example": {
                  "data": [
                    {
                      "id": "tprHigh3Mk8qZw2Xv",
                      "name": "High",
                      "isDefault": false,
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/task-types": {
      "get": {
        "operationId": "listTaskTypes",
        "x-stability": "stable",
        "tags": [
          "Task settings"
        ],
        "summary": "List all task types",
        "description": "Returns a list of your task types, such as \"Call\" or \"Follow Up\". A task refers to its type by its ID in `taskTypeId`.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of task types.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskTypeList"
                },
                "example": {
                  "data": [
                    {
                      "id": "ttyFollowUp6Qz9Km",
                      "name": "Follow Up",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/currencies": {
      "get": {
        "operationId": "listCurrencies",
        "x-stability": "stable",
        "tags": [
          "Tax and currency"
        ],
        "summary": "List all currencies",
        "description": "Returns a list of every currency. Companies, quotes, sales orders, credit notes, purchase orders and bank accounts refer to a currency by its ID in `currencyId`.\n\nThe list is the same for every organisation, and it has no `archived` filter. To find the currencies your organisation trades in, with their exchange rates, use [List all currency rates](#tag/tax-and-currency) instead.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of currencies.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CurrencyList"
                },
                "example": {
                  "data": [
                    {
                      "id": "curGBPqk2j9x4mWpT",
                      "name": "Pound Sterling",
                      "iso4217code": "GBP",
                      "symbol": "£"
                    },
                    {
                      "id": "curEURqk2j9x4mWpZ",
                      "name": "Euro",
                      "iso4217code": "EUR",
                      "symbol": "€"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/countries": {
      "get": {
        "operationId": "listCountries",
        "x-stability": "stable",
        "tags": [
          "Tax and currency"
        ],
        "summary": "List all countries",
        "description": "Returns a list of every country, with the rules for writing addresses there. Companies, addresses and your organisation refer to a country by its ID in `countryId`. Stock items and line items record where goods were made in `countryOfOriginId`.\n\nThe list is the same for every organisation, and it has no `archived` filter. It includes countries that Omono doesn't offer in its own lists, so that every stored country ID resolves.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of countries.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CountryList"
                },
                "example": {
                  "data": [
                    {
                      "id": "ctyUnitedKingdom1",
                      "name": "United Kingdom",
                      "iso2code": "GB",
                      "postcodeBeforeCity": false,
                      "cityUppercase": false,
                      "localityLineFormat": null
                    }
                  ],
                  "hasMore": true,
                  "nextCursor": "eyJ2IjoxLCJzIjpbIlVuaXRlZCBLaW5nZG9tIl19"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/divisions": {
      "get": {
        "operationId": "listDivisions",
        "x-stability": "stable",
        "tags": [
          "Organisation"
        ],
        "summary": "List all divisions",
        "description": "Returns a list of your divisions. Divisions let one organisation run several business units, such as branches, regions or brands, each with its own address and branding on documents.\n\nQuotes, sales orders, credit notes and purchase orders refer to a division by its ID in `divisionId`. A company records the division it deals with as a customer in `customerDivisionId`, and as a supplier in `supplierDivisionId`.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of divisions.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DivisionList"
                },
                "example": {
                  "data": [
                    {
                      "id": "divNorthOffice3Qz",
                      "name": "North Office",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/warehouses": {
      "get": {
        "operationId": "listWarehouses",
        "x-stability": "stable",
        "tags": [
          "Organisation"
        ],
        "summary": "List all warehouses",
        "description": "Returns a list of your warehouses. A stock item refers to the warehouse it's kept in by its ID in `warehouseId`.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of warehouses.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WarehouseList"
                },
                "example": {
                  "data": [
                    {
                      "id": "whsMainWarehouse1",
                      "name": "Main Warehouse",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/couriers": {
      "get": {
        "operationId": "listCouriers",
        "x-stability": "stable",
        "tags": [
          "Purchasing and shipping"
        ],
        "summary": "List all couriers",
        "description": "Returns a list of your couriers. A dispatch refers to the courier that carries it by its ID in `courierId`.\n\nThe list has the couriers your organisation added itself, and the couriers built into Omono that your organisation has chosen to use. A dispatch can still refer to a built-in courier that your organisation has stopped using. To look up any stored `courierId`, pass it in `ids`, which finds these couriers too.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of couriers.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CourierList"
                },
                "example": {
                  "data": [
                    {
                      "id": "crrDHLExpressUK1x",
                      "name": "DHL Express",
                      "trackingUrl": "https://www.dhl.com/gb-en/home/tracking.html?tracking-id={{TRACKINGNO}}",
                      "source": "default",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/incoterms": {
      "get": {
        "operationId": "listIncoterms",
        "x-stability": "stable",
        "tags": [
          "Purchasing and shipping"
        ],
        "summary": "List all incoterms",
        "description": "Returns a list of your incoterms, the standard trade terms that set out who is responsible for goods, and who pays, at each stage of delivery. Quotes, sales orders and purchase orders refer to an incoterm by its ID in `incotermId`.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of incoterms.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IncotermList"
                },
                "example": {
                  "data": [
                    {
                      "id": "incFCA2020Rules9x",
                      "term": "FCA",
                      "description": "Free Carrier (Incoterms 2020)",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/commodity-codes": {
      "get": {
        "operationId": "listCommodityCodes",
        "x-stability": "stable",
        "tags": [
          "Purchasing and shipping"
        ],
        "summary": "List all commodity codes",
        "description": "Returns a list of your commodity codes, the customs tariff codes for the goods you trade. Stock items and quote and sales order line items refer to a commodity code by its ID in `commodityCodeId`, and a sales analysis code can name one as its default.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of commodity codes.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommodityCodeList"
                },
                "example": {
                  "data": [
                    {
                      "id": "cmc84818059000Xk2",
                      "commodityCode": "8481805900",
                      "description": "Valves and similar appliances",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/eori-numbers": {
      "get": {
        "operationId": "listEoriNumbers",
        "x-stability": "stable",
        "tags": [
          "Purchasing and shipping"
        ],
        "summary": "List all EORI numbers",
        "description": "Returns a list of your organisation's EORI numbers. An EORI number identifies a business to customs authorities, and you may have more than one, for example a GB and an XI number. Quotes, sales orders and purchase orders refer to the number they use by its ID in `eoriNumberId`.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of EORI numbers.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EoriNumberList"
                },
                "example": {
                  "data": [
                    {
                      "id": "eorGB123456789000",
                      "eoriNumber": "GB123456789000",
                      "description": "UK EORI",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/users": {
      "get": {
        "operationId": "listUsers",
        "x-stability": "stable",
        "tags": [
          "Organisation"
        ],
        "summary": "List all users",
        "description": "Returns a list of your organisation's users, with their names and email addresses. Use it to look up the user fields on other objects: `salesPersonId`, `buyerId`, `ownerId`, `createdById`, `raisedById`, `accountManagerId`, `assignedUserIds`, `completedById` and `uploaderUserId`. To find the user who sent an email, look them up with `email`.\n\nUnlike other lists, this one includes archived users unless you ask it not to. It also includes your organisation's API user, the user that stands for the API. That way, every user ID stored on a record resolves. When you create or change a record, you can name only a user whose `assignable` is `true`.\n\nEvery key with the `reference:read` scope can read your users' email addresses.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "name": "email",
            "in": "query",
            "description": "Only return the users with this email address. Send one address only. The match ignores capital letters and spaces at the start and end of the address, and archived users are included unless you send `archived=false`. An address that no user of your organisation has returns an empty list.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 254
            }
          },
          {
            "name": "archived",
            "in": "query",
            "description": "Whether to return archived users (`true`), users who aren't archived (`false`), or both (`any`). The default is `any`, so that every user ID stored on a record resolves.\n",
            "schema": {
              "type": "string",
              "enum": [
                "false",
                "true",
                "any"
              ],
              "default": "any"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of users.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserSummaryList"
                },
                "example": {
                  "data": [
                    {
                      "id": "usrJaneDoe4Kq9mWt",
                      "fullName": "Jane Doe",
                      "email": "jane.doe@example.com",
                      "archived": false,
                      "assignable": true
                    },
                    {
                      "id": "usrTomSmith8Zp2Qk",
                      "fullName": "Tom Smith",
                      "email": "tom.smith@example.com",
                      "archived": false,
                      "assignable": true
                    },
                    {
                      "id": "usrApiService2Kq9",
                      "fullName": "API",
                      "email": null,
                      "archived": false,
                      "assignable": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/commissions": {
      "get": {
        "operationId": "listCommissions",
        "x-stability": "stable",
        "tags": [
          "Sales settings"
        ],
        "summary": "List all commissions",
        "description": "Returns a list of your commission schemes. Each scheme names a referrer, such as an agent, and the commission rate they earn. Companies, quotes and sales orders refer to a scheme by its ID in `commissionId`.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of commission schemes.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommissionList"
                },
                "example": {
                  "data": [
                    {
                      "id": "cmsAgentUKSouth2X",
                      "referrer": "UK South Agent",
                      "rate": 5,
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/customer-segments": {
      "get": {
        "operationId": "listCustomerSegments",
        "x-stability": "stable",
        "tags": [
          "Sales settings"
        ],
        "summary": "List all customer segments",
        "description": "Returns a list of your customer segments, the groups you sort customers into for reporting, such as \"Key Accounts\". A customer company refers to its segment by its ID in `customerSegmentId`.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of customer segments.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerSegmentList"
                },
                "example": {
                  "data": [
                    {
                      "id": "csgKeyAccounts5Xw",
                      "name": "Key Accounts",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/departments": {
      "get": {
        "operationId": "listDepartments",
        "x-stability": "stable",
        "tags": [
          "Organisation"
        ],
        "summary": "List all departments",
        "description": "Returns a list of your departments, such as \"Engineering\". A contact refers to the department they work in by its ID in `departmentId`.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of departments.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepartmentList"
                },
                "example": {
                  "data": [
                    {
                      "id": "dptEngineering7Kq",
                      "name": "Engineering",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/industries": {
      "get": {
        "operationId": "listIndustries",
        "x-stability": "stable",
        "tags": [
          "Sales settings"
        ],
        "summary": "List all industries",
        "description": "Returns a list of your industries, the sectors you use to classify companies, such as \"Aerospace\". A company refers to its industry by its ID in `industryId`.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of industries.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IndustryList"
                },
                "example": {
                  "data": [
                    {
                      "id": "indAerospace9Wz3P",
                      "name": "Aerospace",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/company-types": {
      "get": {
        "operationId": "listCompanyTypes",
        "x-stability": "stable",
        "tags": [
          "Sales settings"
        ],
        "summary": "List all company types",
        "description": "Returns a list of your company types, the categories that describe what kind of business a company is, such as \"Limited Company\". A company refers to its type by its ID in `typeId`.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of company types.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyTypeList"
                },
                "example": {
                  "data": [
                    {
                      "id": "ctpLimitedCo4Qk8Z",
                      "name": "Limited Company",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/quote-validities": {
      "get": {
        "operationId": "listQuoteValidities",
        "x-stability": "stable",
        "tags": [
          "Sales settings"
        ],
        "summary": "List all quote validities",
        "description": "Returns a list of your quote validities, the options for how long a quote stands, such as \"30 days\". A quote refers to its validity by its ID in `validityId`.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of quote validities.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuoteValidityList"
                },
                "example": {
                  "data": [
                    {
                      "id": "vld30DaysStandard",
                      "name": "30 days",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/conversion-probabilities": {
      "get": {
        "operationId": "listConversionProbabilities",
        "x-stability": "stable",
        "tags": [
          "Sales settings"
        ],
        "summary": "List all conversion probabilities",
        "description": "Returns a list of your conversion probabilities, the options for how likely a quote is to be won, such as 75%. A quote refers to one by its ID in `conversionProbabilityId`.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of conversion probabilities.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversionProbabilityList"
                },
                "example": {
                  "data": [
                    {
                      "id": "cvp75PctLikely9Qz",
                      "probability": 75,
                      "description": "Likely",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/lost-quote-reasons": {
      "get": {
        "operationId": "listLostQuoteReasons",
        "x-stability": "stable",
        "tags": [
          "Sales settings"
        ],
        "summary": "List all lost-quote reasons",
        "description": "Returns a list of your lost-quote reasons, the reasons you record when a quote is lost, such as \"Price too high\". A lost quote refers to its reason by its ID in `lostReasonId`.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of lost-quote reasons.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LostQuoteReasonList"
                },
                "example": {
                  "data": [
                    {
                      "id": "lqrPriceTooHigh2M",
                      "name": "Price too high",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/currency-rates": {
      "get": {
        "operationId": "listCurrencyRates",
        "x-stability": "stable",
        "tags": [
          "Tax and currency"
        ],
        "summary": "List all currency rates",
        "description": "Returns a list of the currencies your organisation trades in, with the current exchange rate for each. These are the rates Omono's forms fill in when staff create new documents.\n\nWhen you create a quote, sales order, credit note or purchase order in one of these currencies, send the currency's `rate` as the document's `exchangeRate`. Learn more about [money and exchange rates](/docs/conventions#money).\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of currency rates.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CurrencyRateList"
                },
                "example": {
                  "data": [
                    {
                      "id": "crtEURStanding4Kq",
                      "currencyId": "curEURqk2j9x4mWpZ",
                      "rate": 1.1682,
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/organisation-addresses": {
      "get": {
        "operationId": "listOrganisationAddresses",
        "x-stability": "stable",
        "tags": [
          "Organisation"
        ],
        "summary": "List all organisation addresses",
        "description": "Returns a list of your organisation's own addresses. You can read these addresses but not change them through the API.\n\nA purchase order's delivery address, `addressId`, is one of these addresses. On a drop-ship order, where the supplier delivers straight to your customer, it's one of the customer company's addresses instead.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of organisation addresses.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganisationAddressList"
                },
                "example": {
                  "data": [
                    {
                      "id": "oadBristolWorks4Kq",
                      "companyName": "Acme Group Ltd",
                      "line1": "Unit 3, Feeder Road Works",
                      "line2": null,
                      "city": "Bristol",
                      "county": null,
                      "postcode": "BS2 0TQ",
                      "countryId": "ctyUnitedKingdom1",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/bank-accounts": {
      "get": {
        "operationId": "listBankAccounts",
        "x-stability": "stable",
        "tags": [
          "Organisation"
        ],
        "summary": "List all bank accounts",
        "description": "Returns a list of your organisation's bank accounts. A customer company refers to one of these accounts by its ID in `invoicePaymentBankAccountId`: it's the account the customer's invoices ask them to pay into.\n\nThe list shows each account's name and currency only. Account numbers, sort codes and other bank details are never included.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "$ref": "#/components/parameters/Archived"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of bank accounts.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankAccountList"
                },
                "example": {
                  "data": [
                    {
                      "id": "bnkGBPCurrent4Kq9m",
                      "displayName": "Main current account (GBP)",
                      "currencyId": "curGBPqk2j9x4mWpT",
                      "archived": false
                    },
                    {
                      "id": "bnkEURAccount7Wq2x",
                      "displayName": "EUR receipts account",
                      "currencyId": "curEURqk2j9x4mWpZ",
                      "archived": false
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/organisation": {
      "get": {
        "operationId": "getOrganisation",
        "x-stability": "stable",
        "tags": [
          "Organisation"
        ],
        "summary": "Retrieve your organisation",
        "description": "Retrieves the organisation your API key belongs to. It's a single object, not a list.\n\nUse it to learn the details that affect the values you send and read: your base currency, the time zone Omono uses to decide what \"today\" is, and the day your financial year ends. The settings that change what Omono accepts, such as how many decimal places it rounds unit prices to, are in [Retrieve your settings](#tag/organisation/GET/settings).\n\nRequires the `reference:read` scope.\n",
        "responses": {
          "200": {
            "description": "Returns your organisation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Organisation"
                },
                "example": {
                  "id": "orgAcmeGroup7Kq2M",
                  "name": "Acme Group Ltd",
                  "countryId": "ctyUnitedKingdom1",
                  "baseCurrencyId": "curGBPqk2j9x4mWpT",
                  "defaultTaxRateId": "trx20pcVATkQ9m3Zd",
                  "timeZone": "Europe/London",
                  "financialYearEnd": {
                    "day": 31,
                    "month": 3
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ]
      }
    },
    "/settings": {
      "get": {
        "operationId": "getSettings",
        "x-stability": "beta",
        "tags": [
          "Organisation"
        ],
        "summary": "Retrieve your settings",
        "description": "Retrieves the settings of your organisation that change what the API accepts or does: the decimal places Omono rounds unit prices to, the fields your organisation makes required on sales orders and quotes, when a dispatch can take tracking details, the quote tasks Omono creates for you, when Omono closes quotes for you, how addresses are laid out, your working week, and whether your organisation is connected to Xero. It's a single object, not a list.\n\nIf Quote Auto-Close is on, an Active quote can become Lost overnight. Check `quotes.autoClose` before you rely on a quote staying Active: if `enabled` is `true` but `daysAfterExpectedAwardDate`, `valueBelow` or `lostReasonId` is `null`, Omono closes no quotes. [Reactivate](#tag/quotes/POST/quotes/{id}/reactivate) a quote that Omono closed. The days your organisation is closed on top of its working week are in [List all closed days](#tag/organisation/GET/closed-days).\n\nRead it when your integration starts, and before you build a form or a request that depends on it, so that you can send what Omono needs instead of meeting a `422` error. Your admins change these settings in Omono, so check them again from time to time. The response has an `ETag`: send it back in `If-None-Match`, and Omono answers `304 Not Modified` while nothing has changed. Learn more about [conditional reads](/docs/reading#conditional-reads).\n\nYou can't change settings through the API. When Omono adds a setting that changes how the API behaves, it adds it here.\n\nRequires the `reference:read` scope.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns your settings.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Settings"
                },
                "example": {
                  "unitPricing": {
                    "salesDecimalPlaces": 2,
                    "purchasingDecimalPlaces": 4
                  },
                  "salesOrders": {
                    "customerOrderNoRequired": true,
                    "earlyTrackingEntry": false,
                    "duplicateCustomerOrderNoWarning": true
                  },
                  "quotes": {
                    "chaseByRequired": true,
                    "expectedAwardDateRequired": true,
                    "autoClose": {
                      "enabled": true,
                      "daysAfterExpectedAwardDate": 30,
                      "valueBelow": 5000,
                      "conversionProbabilityBelow": 50,
                      "lostReasonId": "lqrNoReply7Kq2M9Z"
                    }
                  },
                  "taskAutomations": {
                    "quoteChase": true,
                    "quoteAwardDate": false
                  },
                  "addresses": {
                    "localPostalFormat": false
                  },
                  "workingWeek": {
                    "monday": true,
                    "tuesday": true,
                    "wednesday": true,
                    "thursday": true,
                    "friday": true,
                    "saturday": false,
                    "sunday": false
                  },
                  "xero": {
                    "connected": true
                  }
                }
              }
            }
          },
          "304": {
            "$ref": "#/components/responses/NotModified"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/closed-days": {
      "get": {
        "operationId": "listClosedDays",
        "x-stability": "beta",
        "tags": [
          "Organisation"
        ],
        "summary": "List all closed days",
        "description": "Returns a list of the days your organisation is closed, such as bank holidays, sorted by date. Your admins set them in Omono, under Settings → Company → Closed Days.\n\nTogether with the `workingWeek` in [Retrieve your settings](#tag/organisation/GET/settings), they tell you which days are working days. The dashboard counts a day towards a target only when it's a working day that isn't a closed day. Use `from` and `to` to read one year, or the days around a date you plan for.\n\nRequires the `reference:read` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 422 | `validation-failed` | `from` or `to` isn't a date in the format `YYYY-MM-DD`, or is a date that doesn't exist, such as `2026-02-30`. |\n| 422 | `validation-failed` | `from` is after `to`. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Ids"
          },
          {
            "name": "from",
            "in": "query",
            "description": "Only return the closed days on or after this date. Send a date in the format `YYYY-MM-DD`, such as `2026-01-01`.\n",
            "schema": {
              "type": "string",
              "format": "date",
              "maxLength": 10,
              "minLength": 1
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Only return the closed days on or before this date. Send a date in the format `YYYY-MM-DD`, such as `2026-12-31`. It can't be before `from`.\n",
            "schema": {
              "type": "string",
              "format": "date",
              "maxLength": 10,
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of closed days.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClosedDayList"
                },
                "example": {
                  "data": [
                    {
                      "id": "cldXmas2026Kq2M7Z",
                      "date": "2026-12-25",
                      "reason": "Christmas Day",
                      "updated": "2026-01-05T09:12:44.000Z"
                    },
                    {
                      "id": "cldBoxing26Wp4N8T",
                      "date": "2026-12-28",
                      "reason": "Boxing Day (substitute day)",
                      "updated": "2026-01-05T09:13:02.000Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "reference:read"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ],
        "x-group-parameters": true
      }
    },
    "/events": {
      "get": {
        "operationId": "listEvents",
        "x-stability": "stable",
        "tags": [
          "Events"
        ],
        "summary": "List all events",
        "description": "Returns a list of records deleted in your organisation, oldest first, in `sequence` order. Deleted records don't come back when you list their resource, so use this list to remove them from your copy. You see only events for the kinds of records your API key can read. Learn more about [handling deletes](/docs/syncing#deletes).\n\nStore the `nextSince` from every response and send it as `since` on your next call, even when the page is empty. It moves you past events your key can't see, so a key that rarely sees an event doesn't fall behind and get a `410` error. While `hasMore` is `true`, call again at once. A page can hold fewer events than `limit`, or none at all, even while `hasMore` is `true`.\n\nYou can also page through events the way you page through any other list: while `hasMore` is `true`, send `nextCursor` as `cursor`. A cursor holds the same position as `nextSince`. On the last page `nextCursor` is `null`, so keep the `nextSince` from that page for your next poll.\n\nEvery successful response, and the `410` error, includes `latestSequence`. After a `410` error, do the [initial load](/docs/syncing#initial-load) again, then carry on from `latestSequence`.\n\nToday, `deleted` is the only kind of event. If Omono adds other kinds, such as `created` or `updated`, you'll get them only if you ask for them with `op`, so the events you get without it never change.\n\nA key whose scopes can't read any kind of record that has events, such as a key with only `reference:read` or `pricing:read`, always gets an empty list, with `hasMore` set to `false` and `latestSequence` and `nextSince` set to the `since` you sent, or 0.\n\nRequires any read or write scope, such as `sales:read`.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 410 | `events-expired` | Your `since`, or the position in your `cursor`, is older than the events Omono keeps, which is 30 days, or it's higher than `latestSequence`. Events after it can also be removed for age while the request runs. |\n| 422 | `validation-failed` | You sent both `since` and `cursor`, or your `cursor` came from a request with other `resource` or `op` filters, or can't be read. Poll again with `since` set to the `nextSince` of the page that returned the cursor. |\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/Since"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "A cursor for pagination, which you can send instead of `since`. Send the `nextCursor` value from the previous page to get the next page. You can send `cursor` or `since`, but not both: if you send both, the request fails with a `422` error, the code `validation-failed` and the field `cursor`.\n\nA cursor is opaque, so don't parse it or build your own. It works only with the same `resource` and `op` filters as the request that returned it. If they change, or the cursor can't be read, the request fails with a `422` error, the code `validation-failed` and the field `cursor`. The same page's `nextSince` holds the same position, so poll again with `since` set to it. Like `since`, a cursor whose events have been removed fails with a `410` error and the code `events-expired`.\n",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "name": "resource",
            "in": "query",
            "required": false,
            "description": "Only return events for these kinds of records. Send one or more names, separated by commas, for example `resource=sales_orders,sales_order_line_items`. You can also repeat the parameter, as in `resource=sales_orders&resource=sales_order_line_items`.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/KnownEventResource"
              },
              "maxItems": 16,
              "minItems": 1
            }
          },
          {
            "name": "op",
            "in": "query",
            "required": false,
            "description": "Only return these kinds of event. Send one or more, separated by commas. The default is `deleted`, which is the only kind of event today. If Omono adds other kinds later, you'll get them only if you ask for them here.\n",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "deleted"
                ]
              },
              "maxItems": 1,
              "default": [
                "deleted"
              ],
              "minItems": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns a page of events, oldest first.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventList"
                },
                "example": {
                  "data": [
                    {
                      "id": "Zq8mTbN4xWc2RkPfJ",
                      "sequence": 1042,
                      "resource": "sales_order_line_items",
                      "resourceId": "aK3nMh2PqXwYbTzWc",
                      "parentId": "bT7pQx4RmN2sWvZyK",
                      "op": "deleted",
                      "at": "2026-09-18T10:15:30.123Z"
                    }
                  ],
                  "hasMore": false,
                  "nextCursor": null,
                  "latestSequence": 1042,
                  "nextSince": 1042
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:read"
            ]
          },
          {
            "bearerAuth": [
              "companies:write"
            ]
          },
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          },
          {
            "bearerAuth": [
              "purchasing:read"
            ]
          },
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          },
          {
            "bearerAuth": [
              "stock:read"
            ]
          },
          {
            "bearerAuth": [
              "stock:write"
            ]
          },
          {
            "bearerAuth": [
              "tasks:read"
            ]
          },
          {
            "bearerAuth": [
              "tasks:write"
            ]
          },
          {
            "bearerAuth": [
              "documents:read"
            ]
          },
          {
            "bearerAuth": [
              "documents:write"
            ]
          },
          {
            "bearerAuth": [
              "reference:read"
            ]
          },
          {
            "bearerAuth": [
              "pricing:read"
            ]
          }
        ],
        "x-group-parameters": true
      }
    },
    "/api-key": {
      "get": {
        "operationId": "getApiKey",
        "x-stability": "beta",
        "tags": [
          "API key"
        ],
        "summary": "Retrieve your API key",
        "description": "Retrieves the API key that made the request: its name, scopes and expiry, its organisation, and the rate limits it runs under now. Call it when your integration starts, to check that the key has every scope your integration needs before the first request that needs one fails with a `403` error. It never returns the key itself.\n\nRequires any read or write scope.\n",
        "responses": {
          "200": {
            "description": "Returns the key.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeySelf"
                },
                "example": {
                  "id": "akyW8n2QkLp4XzRtV",
                  "name": "Warehouse integration",
                  "last4": "7Hq2",
                  "organisationId": "orgN4kWq8mZt2XpLs",
                  "scopes": [
                    "documents:write",
                    "reference:read",
                    "sales:write",
                    "stock:read"
                  ],
                  "expiresAt": null,
                  "created": "2026-11-24T09:12:44.000Z",
                  "limits": {
                    "perMinute": 120,
                    "perSecond": 10,
                    "inFlight": 4,
                    "writesPerMinute": 30,
                    "perDay": 10000,
                    "organisationPerMinute": 240
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "companies:read"
            ]
          },
          {
            "bearerAuth": [
              "companies:write"
            ]
          },
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          },
          {
            "bearerAuth": [
              "purchasing:read"
            ]
          },
          {
            "bearerAuth": [
              "purchasing:write"
            ]
          },
          {
            "bearerAuth": [
              "stock:read"
            ]
          },
          {
            "bearerAuth": [
              "stock:write"
            ]
          },
          {
            "bearerAuth": [
              "tasks:read"
            ]
          },
          {
            "bearerAuth": [
              "tasks:write"
            ]
          },
          {
            "bearerAuth": [
              "documents:read"
            ]
          },
          {
            "bearerAuth": [
              "documents:write"
            ]
          },
          {
            "bearerAuth": [
              "reference:read"
            ]
          },
          {
            "bearerAuth": [
              "pricing:read"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    },
    "/dashboard": {
      "get": {
        "operationId": "getDashboard",
        "x-stability": "beta",
        "tags": [
          "Dashboard"
        ],
        "summary": "Retrieve the dashboard figures",
        "description": "Retrieves your sales and output for today, this month and this financial year, with your targets: the figures on the dashboard in Omono. Every amount covers your whole organisation, is net of tax and is in your base currency, rounded to 2 decimal places.\n\nSales are the sales orders created in the period that aren't cancelled, less the complete credit notes created in it. An order counts on the day it was created, whatever its status, so Draft orders are included, as Omono's own dashboard counts them. Output is the dispatches at your final workflow status whose dispatch date is in the period, less the same credit notes. A target is the daily target from your settings, added up over the working days that aren't closed days, and `pace` is the part of the target up to and including today. If you haven't set targets, every target and `pace` is `0`.\n\nOmono decides what today and this month are in your organisation's time zone, which the response returns in `timeZone`. The dashboard in Omono uses the time zone of each person's browser, so near midnight the two can show different days. The financial year's figures run on whole calendar days in UTC, as they do in Omono's dashboard, while today and the month use your organisation's time zone. The request takes no parameters.\n\nOmono keeps the figures for about 30 seconds after it works them out, so a request soon after another can return the same figures. Against your rate limits, the request counts as 5 requests on your organisation's per-minute limit, also when the figures are ones Omono had already worked out. Learn more about [the dashboard's weight](/docs/limits#dashboard).\n\nRequires the `sales:read` or `sales:write` scope.\n\n#### Errors\n\n| Status | Code | When it happens |\n| --- | --- | --- |\n| 403 | `insufficient-scope` | Your API key doesn't have the `sales:read` or `sales:write` scope. |\n| 429 | `rate-limited` | Your organisation's per-minute limit doesn't have room for the request's weight of 5. Wait for the number of seconds in `Retry-After`, then retry. |\n| 500 | `internal-error` | Omono couldn't work out the figures, for example because your organisation has no final workflow status. Retrying doesn't help until that's fixed. |\n| 503 | `temporarily-unavailable` | Omono couldn't work out the figures just now. Wait for the number of seconds in `Retry-After`, then retry. |\n| 503 | `request-timeout` | The request took longer than 15 seconds. Wait for the number of seconds in `Retry-After`, then retry. |\n",
        "responses": {
          "200": {
            "description": "Returns the dashboard figures.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-Client-Request-Id": {
                "$ref": "#/components/headers/XClientRequestId"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dashboard"
                },
                "example": {
                  "date": "2026-11-30",
                  "timeZone": "Europe/London",
                  "financialYear": "2026/27",
                  "currencyId": "curGBPqk2j9x4mWpT",
                  "sales": {
                    "day": {
                      "actual": 4820.5,
                      "target": 6000
                    },
                    "month": {
                      "actual": 118340.25,
                      "target": 126000,
                      "pace": 126000
                    },
                    "year": {
                      "actual": 812604.9,
                      "target": 1500000,
                      "pace": 1032000
                    }
                  },
                  "output": {
                    "day": {
                      "actual": 3910,
                      "target": 5500
                    },
                    "month": {
                      "actual": 104215.75,
                      "target": 115500,
                      "pace": 115500
                    },
                    "year": {
                      "actual": 765480.4,
                      "target": 1375000,
                      "pace": 946000
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "security": [
          {
            "bearerAuth": [
              "sales:read"
            ]
          },
          {
            "bearerAuth": [
              "sales:write"
            ]
          }
        ],
        "x-badges": [
          {
            "name": "Beta",
            "position": "before"
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authenticate with an API key, sent as a bearer token in the `Authorization` header: `Authorization: Bearer omk_live_…`. Each key belongs to one organisation, and its prefix names the platform it works on, such as `omk_live_` for production and `omk_demo_` for demo. An admin creates keys on the **API** page of **Settings** in Omono, and each key is shown only once.\n\nEach key has scopes, which decide what it can read and change. A write scope, such as `sales:write`, includes reading the same kind of record, but never another kind. Each operation's `security` lists the scopes that let a key call it, and any one of them is enough.\n\nNever send a key in a URL. If you send a key in the path or the query string of any API request, including a request for the OpenAPI document, the request fails with a `401` error, and Omono revokes the key at once and emails your organisation's admins. If a key appears in any other URL, revoke it yourself on the **API** page of **Settings**. Don't send a key in the `X-Request-Id` header either: that request fails with a `400` error and the code `malformed-request`, although the key isn't revoked.\n\nWhen Omono recognises a key but refuses it, the `detail` of the `401` error explains why: it's a production or demo key sent to another platform's host, it has been revoked (automatically, if it was sent in a URL), or it has expired.\n"
      }
    },
    "parameters": {
      "Limit": {
        "name": "limit",
        "in": "query",
        "description": "The number of records to return on each page, between 1 and 200. The default is 50.\n",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 200,
          "default": 50
        }
      },
      "Cursor": {
        "name": "cursor",
        "in": "query",
        "description": "A cursor for pagination. Send the `nextCursor` value from the previous page to get the next page.\n\nA cursor is opaque, so don't parse it or build your own. It works only with the same parameters as the request that returned it, such as its filters and its `sort` on the lists that take one, although you can change `limit` and `include`. If any of them change, the request fails with a `422` error, the code `validation-failed` and the field `cursor`.\n\nA cursor doesn't expire, but it's meant for paging straight through a list, not for storing. After an update to Omono, a cursor you saved earlier can fail with the same `422` error. Learn more about [pagination](/docs/reading#pagination).\n",
        "schema": {
          "type": "string",
          "minLength": 1
        }
      },
      "UpdatedSince": {
        "name": "updated_since",
        "in": "query",
        "description": "Only return records that were last changed at or after this time. Send a date and time in ISO 8601 format, such as `2026-09-01T00:00:00.000Z`. It must end with `Z` or an offset, such as `+01:00`. A time without one fails with a `422` error and the code `validation-failed`. If you build the URL yourself, encode the `+` of an offset as `%2B`.\n\nUse it with `sort=updated` to fetch what has changed since your last sync. Upsert every record you get, because you'll see some records more than once. Learn more about [incremental sync](/docs/syncing#incremental-sync).\n",
        "schema": {
          "type": "string",
          "format": "date-time",
          "minLength": 1
        }
      },
      "SortCompanies": {
        "name": "sort",
        "in": "query",
        "description": "The order to return companies in. Send one field name, such as `companyName`, to sort in ascending order, or put a hyphen in front of it, such as `-created`, to sort in descending order. The default is `-created`, which returns the newest companies first. Sorting by `companyName` ignores capital letters, and companies with the same value are ordered by `id`.\n",
        "schema": {
          "type": "string",
          "enum": [
            "created",
            "-created",
            "updated",
            "-updated",
            "companyName",
            "-companyName"
          ],
          "x-enum-varnames": [
            "CREATED",
            "CREATED_DESC",
            "UPDATED",
            "UPDATED_DESC",
            "COMPANY_NAME",
            "COMPANY_NAME_DESC"
          ],
          "default": "-created"
        }
      },
      "IncludeCompany": {
        "name": "include",
        "in": "query",
        "description": "Related objects to return with each company, as a comma-separated list: `contacts`, `addresses` or both. You can also repeat the parameter, as in `include=contacts&include=addresses`. Each company then includes all of its contacts, addresses or both, including archived ones, and each of them has an `archived` field.\n\nIn a list, if the contacts and addresses on one page add up to more than 2,000, or the page comes to more than about 8 MB of JSON, the page can end early with `hasMore` set to `true`. One record can bring at most 10,000 related objects, and come to at most 32 MB of JSON with them. A record over either limit is too large for the API to return, so the request fails with a `409` error and the code `document-too-large`. Learn more about [including related objects](/docs/reading#include).\n",
        "style": "form",
        "explode": false,
        "schema": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "contacts",
              "addresses"
            ]
          },
          "maxItems": 2,
          "minItems": 1
        }
      },
      "Archived": {
        "name": "archived",
        "in": "query",
        "description": "Whether to return archived records. Send `false` for records that aren't archived, `true` for archived records only, or `any` for both. The default is `false`, but it's `any` when you also send `ids`.\n\nIf you keep a copy of the data, send `archived=any` so that your copy includes archived records. On a list you poll with `updated_since`, archiving a record then reaches you as an ordinary update. A reference list has no `updated` time, so read it again in full to see what's changed. Learn more about [keeping in sync](/docs/syncing#incremental-sync).\n",
        "schema": {
          "type": "string",
          "enum": [
            "false",
            "true",
            "any"
          ]
        }
      },
      "Ids": {
        "name": "ids",
        "in": "query",
        "required": false,
        "description": "Only return records with these IDs, as a comma-separated list of up to 100 IDs. You can also repeat the parameter, as in `ids=a&ids=b`. IDs that don't exist, or that your key can't see, are left out of the results. On a list that takes `archived`, sending `ids` makes `archived` default to `any`, so archived records are included. On reference lists, `ids` returns the records you ask for whether or not they're archived or enabled.\n",
        "style": "form",
        "explode": false,
        "schema": {
          "type": "array",
          "maxItems": 100,
          "items": {
            "type": "string",
            "maxLength": 64,
            "minLength": 1
          },
          "minItems": 1
        }
      },
      "ExternalRef": {
        "name": "externalRef",
        "in": "query",
        "required": false,
        "description": "Only return records with these `externalRef` values, your own references, as a comma-separated list of up to 100. You can also repeat the parameter, as in `externalRef=a&externalRef=b`. The match is exact, capital letters included, and values that no record has are left out of the results. As with `ids`, sending `externalRef` makes `archived` default to `any`, so archived records are included. Learn more about [external references](/docs/writing#external-references).\n",
        "style": "form",
        "explode": false,
        "schema": {
          "type": "array",
          "minItems": 1,
          "maxItems": 100,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      },
      "CreatedGte": {
        "name": "created_gte",
        "in": "query",
        "required": false,
        "description": "Only return records created at or after this time. Send a date and time in ISO 8601 format, such as `2026-09-01T00:00:00.000Z`. It must end with `Z` or an offset, such as `+01:00`. A time without one fails with a `422` error and the code `validation-failed`. If you build the URL yourself, encode the `+` of an offset as `%2B`.\n",
        "schema": {
          "type": "string",
          "format": "date-time",
          "minLength": 1
        }
      },
      "CreatedLte": {
        "name": "created_lte",
        "in": "query",
        "required": false,
        "description": "Only return records created at or before this time. Send a date and time in ISO 8601 format, such as `2026-09-30T23:59:59.999Z`. It must end with `Z` or an offset, such as `+01:00`. A time without one fails with a `422` error and the code `validation-failed`. If you build the URL yourself, encode the `+` of an offset as `%2B`.\n",
        "schema": {
          "type": "string",
          "format": "date-time",
          "minLength": 1
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "A unique key that makes it safe to retry this request. Use a new key for each new request, and send the same key every time you retry that request, so the work isn't done twice. A key belongs to this operation: the same key sent to another operation counts as a new key. Send one on every `POST` and `PATCH`, including actions. A key is 1 to 255 characters long. Omono keeps a key for up to 24 hours, and it can forget one sooner, for example when its cache is short of memory, so retry promptly. The header is optional, but without it a retry can do the work twice.\n\nLearn more about [idempotency](/docs/writing#idempotency).\n",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      },
      "Id": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "The ID of the record. An ID is an opaque string, so use it exactly as the API returned it.\n",
        "schema": {
          "type": "string",
          "maxLength": 64
        }
      },
      "IfNoneMatch": {
        "name": "If-None-Match",
        "in": "header",
        "required": false,
        "description": "The `ETag` from your most recent read of this record. If the record hasn't changed since then, the response is `304 Not Modified` with no body, so you can skip work you've already done. Learn more about [conditional reads](/docs/reading#conditional-reads).\n",
        "schema": {
          "type": "string",
          "examples": [
            "\"1758190530123\""
          ]
        }
      },
      "IfMatch": {
        "name": "If-Match",
        "in": "header",
        "required": false,
        "description": "The `ETag` from your most recent read of this record. If the record has changed since then, the request fails with a `412` error and nothing is written. Send `*` if you only need the record to exist.\n\nA `PATCH` that sends `lineItems` or `lineItemOrder` must send this header, or it fails with a `428` error and the code `precondition-required`. Learn more about [ETags](/docs/writing#etags).\n",
        "schema": {
          "type": "string",
          "examples": [
            "\"1758190530123\""
          ]
        }
      },
      "SortStandard": {
        "name": "sort",
        "in": "query",
        "description": "The order to return records in. Send one field name, such as `updated`, to sort in ascending order, or put a hyphen in front of it, such as `-created`, to sort in descending order. The default is `-created`, which returns the newest records first. Records with the same value are ordered by `id`.\n",
        "schema": {
          "type": "string",
          "enum": [
            "created",
            "-created",
            "updated",
            "-updated"
          ],
          "x-enum-varnames": [
            "CREATED",
            "CREATED_DESC",
            "UPDATED",
            "UPDATED_DESC"
          ],
          "default": "-created"
        }
      },
      "IncludeLineItems": {
        "name": "include",
        "in": "query",
        "description": "Send `lineItems` to return each record's line items in the list. Without it, list items have no `lineItems` field. Retrieving a single record always returns its line items.\n\nIn a list, if the line items on one page, together with any BOM items on them, add up to more than 2,000, or the page comes to more than about 8 MB of JSON, the page can end early with `hasMore` set to `true`. One record can bring at most 10,000 related objects, and come to at most 32 MB of JSON with them. A record over either limit is too large for the API to return, so the request fails with a `409` error and the code `document-too-large`. Learn more about [including related objects](/docs/reading#include).\n",
        "style": "form",
        "explode": false,
        "schema": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "lineItems"
            ]
          },
          "maxItems": 1,
          "minItems": 1
        }
      },
      "IfMatchDelete": {
        "name": "If-Match",
        "in": "header",
        "required": false,
        "description": "The `ETag` from your most recent read of this record. You must send it: without it, the request fails with a `428` error and the code `precondition-required`. If the record has changed since you read it, the request fails with a `412` error, and nothing is deleted.\n\nDon't send `*`. It skips that check, so you could delete a record that someone changed after you read it. Learn more about [deleting](/docs/writing#deleting).\n",
        "schema": {
          "type": "string",
          "examples": [
            "\"1758190530123\""
          ]
        }
      },
      "RevisionId": {
        "name": "revisionId",
        "in": "query",
        "required": false,
        "description": "The ID of the revision to print, from the quote's `revisions`. Leave it out to print the revision that [Retrieve a quote](#tag/quotes/GET/quotes/{id}) shows: the won revision of a won quote, and otherwise the latest revision.\n",
        "schema": {
          "type": "string",
          "maxLength": 64,
          "minLength": 1
        }
      },
      "IncludeSalesOrder": {
        "name": "include",
        "in": "query",
        "description": "Related objects to return with each sales order, as a comma-separated list: `lineItems`, `dispatches` or both. You can also repeat the parameter, as in `include=lineItems&include=dispatches`. Dispatches are returned in order of `dispatchNo`, and each one includes its `legalTransitions`. Retrieving a single sales order always returns its line items.\n\nIn a list, if the related objects on one page add up to more than 2,000, or the page comes to more than about 8 MB of JSON, the page can end early with `hasMore` set to `true`. Line items, their BOM items, dispatches and the dispatches' line items all count. One record can bring at most 10,000 related objects, and come to at most 32 MB of JSON with them. A record over either limit is too large for the API to return, so the request fails with a `409` error and the code `document-too-large`. Learn more about [including related objects](/docs/reading#include).\n",
        "style": "form",
        "explode": false,
        "schema": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "lineItems",
              "dispatches"
            ]
          },
          "maxItems": 2,
          "minItems": 1
        }
      },
      "IncludePurchaseOrder": {
        "name": "include",
        "in": "query",
        "description": "Related objects to return with each purchase order, as a comma-separated list: `lineItems`, `deliveries` or both. You can also repeat the parameter, as in `include=lineItems&include=deliveries`. Deliveries are returned in order of `deliveryNo`. Retrieving a single purchase order always returns its line items.\n\nIn a list, if the related objects on one page add up to more than 2,000, or the page comes to more than about 8 MB of JSON, the page can end early with `hasMore` set to `true`. Line items, deliveries and the deliveries' line items all count. One record can bring at most 10,000 related objects, and come to at most 32 MB of JSON with them. A record over either limit is too large for the API to return, so the request fails with a `409` error and the code `document-too-large`. Learn more about [including related objects](/docs/reading#include).\n",
        "style": "form",
        "explode": false,
        "schema": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "lineItems",
              "deliveries"
            ]
          },
          "maxItems": 2,
          "minItems": 1
        }
      },
      "SortStockItems": {
        "name": "sort",
        "in": "query",
        "description": "The order to return stock items in. Send one field name, such as `partNo`, to sort in ascending order, or put a hyphen in front of it, such as `-created`, to sort in descending order. The default is `-created`, which returns the newest items first. Sorting by `partNo` ignores capital letters, and items with the same value are ordered by `id`.\n",
        "schema": {
          "type": "string",
          "enum": [
            "created",
            "-created",
            "updated",
            "-updated",
            "partNo",
            "-partNo"
          ],
          "x-enum-varnames": [
            "CREATED",
            "CREATED_DESC",
            "UPDATED",
            "UPDATED_DESC",
            "PART_NO",
            "PART_NO_DESC"
          ],
          "default": "-created"
        }
      },
      "IncludeStockItem": {
        "name": "include",
        "in": "query",
        "description": "Related objects to return with each stock item, as a comma-separated list. The only value is `suppliers`: each stock item then includes its `suppliers`, with each supplier's part number, lead time, price and the currency of that price. Your API key also needs the `purchasing:read` scope. An item's suppliers are part of the item, so they don't count towards the limits on related objects. Learn more about [including related objects](/docs/reading#include).\n",
        "style": "form",
        "explode": false,
        "schema": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "suppliers"
            ]
          },
          "maxItems": 1,
          "minItems": 1
        }
      },
      "Since": {
        "name": "since",
        "in": "query",
        "required": false,
        "description": "Only return events that come after this `sequence` number. Send the `nextSince` value from the previous response. Leave it out on your first call: the list then starts at the oldest event Omono still keeps, and it never fails with a `410` error.\n\nYou can send `since` or `cursor`, but not both. If you send both, the request fails with a `422` error, the code `validation-failed` and the field `cursor`.\n\nEvents are kept for 30 days. If the events after your `since` have been removed, or if `since` is higher than `latestSequence`, the request fails with a `410` error and the code `events-expired`. Learn more about [deletes](/docs/syncing#deletes).\n",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "headers": {
      "XRequestId": {
        "description": "Omono's unique ID for this request. Quote it whenever you ask for help with a request. You can also send your own ID in an `X-Request-Id` header, and Omono returns it in `X-Client-Request-Id`. Learn more about [request IDs](/docs/errors#request-ids).\n",
        "schema": {
          "type": "string",
          "examples": [
            "req_9Jc4TqX2mBv7RkLpW"
          ]
        }
      },
      "XClientRequestId": {
        "description": "The `X-Request-Id` you sent, returned so you can match the response with your own logs. It's returned only when your value was valid: 1 to 64 characters, using only letters, digits and the characters `.`, `_`, `:` and `-`. An `X-Request-Id` that contains an API key is never returned, because the request fails with a `400` error.\n",
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9._:-]{1,64}$",
          "examples": [
            "erp-sync-20260924-0042"
          ]
        }
      },
      "RateLimitLimit": {
        "description": "The number of requests allowed in the rate-limit window that has the fewest requests left. On a `429` error, it describes the window that refused the request instead. The limit on requests in flight at the same time appears here only on a `429` error caused by that limit. `RateLimit` gives the requests left in every window. Learn more about [rate-limit headers](/docs/limits#headers).\n",
        "schema": {
          "type": "integer",
          "examples": [
            120
          ]
        }
      },
      "RateLimitRemaining": {
        "description": "The number of requests you have left in the window that `RateLimit-Limit` describes. On a `429` error caused by the limit on requests in flight, it's `0`. A heavy write, such as one that changes many line items or has a large body, can use up several requests at once, as [heavy writes](/docs/limits#heavy-writes) explains.\n",
        "schema": {
          "type": "integer",
          "examples": [
            117
          ]
        }
      },
      "RateLimitReset": {
        "description": "The number of seconds until the window that `RateLimit-Limit` describes starts again. On a `429` error caused by the limit on requests in flight, it's `1`.\n",
        "schema": {
          "type": "integer",
          "examples": [
            42
          ]
        }
      },
      "RateLimitPolicy": {
        "description": "Every rate-limit window that applies to this request, in a comma-separated list. Each item is `\"<name>\";q=<limit>;w=<window in seconds>`: the name of the window as a quoted string, `q` the number of requests it allows, and `w` its length in seconds. This is the syntax of the current draft of the IETF rate-limit headers work (draft 12), which isn't final. The names are `burst`, `sustained`, `writes` (on a write only), `daily`, `org-burst` and `org`. The limits are the ones that apply to your key and your organisation now, including a higher limit that Omono has set for you. The `daily` window is the UTC day, so it starts again at 00:00 UTC. The limits on requests in flight at the same time aren't listed. Learn more about [rate-limit headers](/docs/limits#headers).\n",
        "schema": {
          "type": "string",
          "examples": [
            "\"burst\";q=10;w=1, \"sustained\";q=120;w=60, \"daily\";q=10000;w=86400, \"org-burst\";q=20;w=1, \"org\";q=240;w=60"
          ]
        }
      },
      "RateLimit": {
        "description": "The requests you have left in every rate-limit window that applies to this request, in a comma-separated list. Each item is `\"<name>\";a=<requests left>;w=<seconds>`: the name of the window as a quoted string, `a` the number of requests you can still send in it, and `w` the number of seconds until it starts again. The windows, their names and their order are the same as in `RateLimit-Policy`. The counts are after this request, including the extra requests that a heavy request uses up. On a `429` or `503` error caused by a window, that window's item has `a=0` and its `w` is the same as `Retry-After`. If a window refused the request, the windows after it in `RateLimit-Policy` weren't checked and aren't listed. The limits on requests in flight at the same time aren't listed. This is the syntax of the current draft of the IETF rate-limit headers work (draft 12), which isn't final. Learn more about [rate-limit headers](/docs/limits#headers).\n",
        "schema": {
          "type": "string",
          "examples": [
            "\"burst\";a=9;w=1, \"sustained\";a=30;w=22, \"daily\";a=9880;w=40112, \"org-burst\";a=19;w=1, \"org\";a=228;w=22"
          ]
        }
      },
      "RetryAfter": {
        "description": "The number of seconds to wait before you retry. It's sent with `429` and `503` errors, and with a `409` error whose code is `idempotency-in-progress`. Always wait at least this long.\n",
        "schema": {
          "type": "integer",
          "examples": [
            12
          ]
        }
      },
      "Location": {
        "description": "The URL of the record you created.\n",
        "schema": {
          "type": "string",
          "examples": [
            "/api/v1/purchase-orders/aK3nMh2PqXwYbTzVc"
          ]
        }
      },
      "ETag": {
        "description": "An opaque value that identifies the version of the record in this response. Send it back, exactly as you received it, in the `If-Match` header when you change the record, so that you don't overwrite a change you haven't seen. Don't build an ETag yourself or compare two ETags to decide which is newer, because Omono can change how they're made. Learn more about [ETags](/docs/writing#etags).\n",
        "schema": {
          "type": "string",
          "examples": [
            "\"1758190530123\""
          ]
        }
      },
      "IdempotencyReplayed": {
        "description": "Set to `true` when this response replays an earlier successful request with the same `Idempotency-Key`, instead of running the request again. The body shows the record as it is now, which can differ from the first response. Learn more about [idempotency](/docs/writing#idempotency).\n",
        "schema": {
          "type": "boolean"
        }
      }
    },
    "schemas": {
      "ListEnvelope": {
        "type": "object",
        "description": "The paging fields of a page of records from a list. Each list's own schema, such as `CompanyList`, adds the records themselves as `data`. Learn more about [pagination](/docs/reading#pagination).\n",
        "properties": {
          "hasMore": {
            "type": "boolean",
            "description": "Whether there are more records after this page. If it's `true`, send `nextCursor` as `cursor` to get the next page. On a [search](/docs/reading#search), it's `true` when more records match than you got, and there's no next page.\n"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "The cursor for the next page, which you send as `cursor`. It's `null` on the last page, and always `null` on a [search](/docs/reading#search). A cursor is meant for paging straight through a list, not for storing.\n"
          }
        },
        "required": [
          "hasMore",
          "nextCursor"
        ],
        "additionalProperties": true
      },
      "TermsType": {
        "description": "How Omono reads the number of days in a set of payment terms to work out when an invoice or bill is due. The values are the same for every organisation. For `day_of_current_month` and `day_of_next_month`, if the day doesn't exist in that month, such as the 31st in April, Omono makes an invoice due on the last day of the month. A customer with invoice terms of `days_after_invoice` and `0` days is a proforma customer, who must pay for each dispatch before it can ship.\n\nKnown values: `days_after_invoice`, `days_after_month_end`, `day_of_current_month`, `day_of_next_month`. Omono can add values; handle one you don't recognise.\n",
        "type": "string",
        "x-known-values": [
          "days_after_invoice",
          "days_after_month_end",
          "day_of_current_month",
          "day_of_next_month"
        ],
        "x-enum-descriptions": [
          "The invoice is due a number of days after its date. For example, 30 days on an invoice dated 10 March makes it due on 9 April.",
          "The invoice is due a number of days after the end of the month it's dated in. For example, 30 days on an invoice dated 10 March makes it due on 30 April.",
          "The invoice is due on a set day of the month it's dated in. For example, 20 on an invoice dated 10 March makes it due on 20 March. The due date never moves to the next month, so 20 on an invoice dated 25 March also makes it due on 20 March, before the invoice date.",
          "The invoice is due on a set day of the following month. For example, 20 on an invoice dated 10 March makes it due on 20 April."
        ]
      },
      "KnownTermsType": {
        "description": "How Omono reads the number of days in a set of payment terms to work out when an invoice or bill is due. The values are the same for every organisation. For `day_of_current_month` and `day_of_next_month`, if the day doesn't exist in that month, such as the 31st in April, Omono makes an invoice due on the last day of the month. A customer with invoice terms of `days_after_invoice` and `0` days is a proforma customer, who must pay for each dispatch before it can ship.\n",
        "type": "string",
        "enum": [
          "days_after_invoice",
          "days_after_month_end",
          "day_of_current_month",
          "day_of_next_month"
        ],
        "x-enum-descriptions": [
          "The invoice is due a number of days after its date. For example, 30 days on an invoice dated 10 March makes it due on 9 April.",
          "The invoice is due a number of days after the end of the month it's dated in. For example, 30 days on an invoice dated 10 March makes it due on 30 April.",
          "The invoice is due on a set day of the month it's dated in. For example, 20 on an invoice dated 10 March makes it due on 20 March. The due date never moves to the next month, so 20 on an invoice dated 25 March also makes it due on 20 March, before the invoice date.",
          "The invoice is due on a set day of the following month. For example, 20 on an invoice dated 10 March makes it due on 20 April."
        ]
      },
      "Contact": {
        "type": "object",
        "description": "A person you deal with at a company.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the contact."
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for the contact, such as its ID in your CRM, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's contacts, archived ones included, so you can find the contact again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references).\n"
          },
          "companyId": {
            "type": "string",
            "description": "The ID of the company the contact works for."
          },
          "firstName": {
            "type": "string",
            "description": "The contact's first name."
          },
          "lastName": {
            "type": "string",
            "description": "The contact's last name."
          },
          "fullName": {
            "type": "string",
            "description": "The contact's full name. You can't set it: Omono builds it from `firstName` and `lastName`.\n"
          },
          "email": {
            "type": "string",
            "description": "The contact's email address. Omono emails documents to it. It's a full address with a top-level domain, such as `.com` or `.co.uk`.\n"
          },
          "jobTitle": {
            "type": [
              "string",
              "null"
            ],
            "description": "The contact's job title, or `null` if none has been saved."
          },
          "departmentId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the contact's department, or `null` if none has been set. Your departments are listed by [List all departments](#tag/organisation).\n"
          },
          "telephone1": {
            "type": [
              "string",
              "null"
            ],
            "description": "The contact's main telephone number, or `null` if none has been saved."
          },
          "telephone2": {
            "type": [
              "string",
              "null"
            ],
            "description": "The contact's other telephone number, or `null` if none has been saved."
          },
          "addressId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the company address that the contact is linked to, or `null` if there isn't one. On a purchase order, this address prints as the supplier's address. If it's `null`, the supplier's accounts address prints instead.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the contact is archived. Archived contacts can't be chosen on new documents. A company must always have at least one contact that isn't archived, so you can't archive its last one.\n"
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the contact was created."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the contact was last changed."
          }
        },
        "required": [
          "id",
          "externalRef",
          "companyId",
          "firstName",
          "lastName",
          "fullName",
          "email",
          "jobTitle",
          "departmentId",
          "telephone1",
          "telephone2",
          "addressId",
          "archived",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "Address": {
        "type": "object",
        "description": "An address that belongs to a company, such as a delivery address or the accounts address, which is the address the company is invoiced at.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the address."
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for the address, such as its ID in your web shop or CRM, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's addresses, archived ones included, so you can find the address again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references).\n"
          },
          "companyId": {
            "type": "string",
            "description": "The ID of the company the address belongs to."
          },
          "accountsAddress": {
            "type": "boolean",
            "description": "Whether this is the company's accounts address, which is the address the company is invoiced at. Omono prints it as the invoice address and sends it to Xero with the company. Every company has exactly one accounts address, and it can't be archived.\n"
          },
          "companyName": {
            "type": [
              "string",
              "null"
            ],
            "description": "The name printed as the first line of the address, on paperwork and on the company's page in Omono. It's usually the company's own name, but it can be different, for example when goods go to a site that trades under another name.\n"
          },
          "line1": {
            "type": "string",
            "description": "The first line of the address."
          },
          "line2": {
            "type": [
              "string",
              "null"
            ],
            "description": "The second line of the address, or `null` if there isn't one."
          },
          "city": {
            "type": "string",
            "description": "The town or city."
          },
          "county": {
            "type": [
              "string",
              "null"
            ],
            "description": "The county, or `null` if none has been saved."
          },
          "postcode": {
            "type": [
              "string",
              "null"
            ],
            "description": "The postcode, or `null` if none has been saved."
          },
          "countryId": {
            "type": "string",
            "description": "The ID of the country the address is in. Countries are listed by [List all countries](#tag/tax-and-currency).\n"
          },
          "telephone": {
            "type": [
              "string",
              "null"
            ],
            "description": "The telephone number at this address, or `null` if none has been saved. On the accounts address, it's also the company's `telephone`.\n"
          },
          "accountsEmail": {
            "type": [
              "string",
              "null"
            ],
            "description": "The email address that the company's invoices are sent to when this is the accounts address. Omono requires one on a new accounts address, but some older accounts addresses don't have one. It's `null` on an address that doesn't have one. To change an accounts address that has none, send `accountsEmail` with your change, or the request fails with a `422` error and the code `missing-required-field`.\n"
          },
          "eoriNumber": {
            "type": [
              "string",
              "null"
            ],
            "description": "The customer's EORI number for deliveries to this address, which is used on customs paperwork. When it's set, it's used instead of the EORI number on the company. It's `null` if none has been saved.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the address is archived. Archived addresses can't be chosen on new documents, but they stay on existing ones. The accounts address can't be archived.\n"
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the address was created."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the address was last changed."
          }
        },
        "required": [
          "id",
          "externalRef",
          "companyId",
          "accountsAddress",
          "companyName",
          "line1",
          "line2",
          "city",
          "county",
          "postcode",
          "countryId",
          "telephone",
          "accountsEmail",
          "eoriNumber",
          "archived",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "Company": {
        "type": "object",
        "description": "A company you sell to, buy from, or both. The API never shows or accepts a company's bank details.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the company."
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for the company, such as its ID in your CRM or accounting system, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's companies, archived ones included, so you can find the company again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references).\n"
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the company was created."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the company was last changed. It also changes when any of the company's contacts or addresses change, so you can use it to tell when to read them again.\n"
          },
          "companyName": {
            "type": "string",
            "description": "The company's name. It's unique in your organisation, including archived companies, and capital letters don't make one name different from another.\n"
          },
          "accountNo": {
            "type": "string",
            "description": "The company's account number, a short code that identifies it in Omono. Like the name, it's unique in your organisation, including archived companies, and capital letters don't make one account number different from another.\n"
          },
          "website": {
            "type": [
              "string",
              "null"
            ],
            "description": "The company's website, or `null` if none has been saved."
          },
          "industryId": {
            "type": "string",
            "description": "The ID of the industry the company works in. Your industries are listed by [List all industries](#tag/sales-settings).\n"
          },
          "typeId": {
            "type": "string",
            "description": "The ID of the company's type. Your company types are listed by [List all company types](#tag/sales-settings).\n"
          },
          "countryId": {
            "type": "string",
            "description": "The ID of the country the company is in. You set it when you create the company. After that, Omono copies it from the accounts address, so to change it, update the accounts address. Countries are listed by [List all countries](#tag/tax-and-currency).\n"
          },
          "currencyId": {
            "type": "string",
            "description": "The ID of the currency you trade with this company in. Every quote, sales order, credit note and purchase order for the company uses this currency. When you set it, it must be one of the currencies your organisation uses, which [List all currency rates](#tag/tax-and-currency) returns. Once the company has any of those documents, its currency is locked and can't change (see `currencyLocked`).\n"
          },
          "currencyLocked": {
            "type": "boolean",
            "description": "Whether the company's currency is locked. It becomes `true` when the first quote, sales order, credit note or purchase order is created for the company, and it stays `true` even if that document is deleted later, including a Draft that the API removed after a failed create. While it's `true`, you can't change `currencyId`.\n"
          },
          "taxNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The company's VAT number or other tax registration number, or `null` if none has been saved."
          },
          "taxRateId": {
            "type": "string",
            "description": "The ID of the company's default tax rate. New line items on the company's documents use this rate unless you send another one. Your tax rates are listed by [List all tax rates](#tag/tax-and-currency).\n"
          },
          "postcode": {
            "type": [
              "string",
              "null"
            ],
            "description": "The postcode of the company's accounts address. You can't set it here, because Omono copies it from the accounts address. To change it, update the accounts address.\n"
          },
          "telephone": {
            "type": [
              "string",
              "null"
            ],
            "description": "The telephone number of the company's accounts address. You can't set it here, because Omono copies it from the accounts address. To change it, update the accounts address.\n"
          },
          "isCustomer": {
            "type": "boolean",
            "description": "Whether you sell to this company. A company can be both a customer and a supplier, but it must be at least one of them.\n"
          },
          "isSupplier": {
            "type": "boolean",
            "description": "Whether you buy from this company. A company can be both a supplier and a customer, but it must be at least one of them.\n"
          },
          "accountManagerId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the user who manages this customer's account. Every customer has one, and the customer's quotes and sales orders carry it too. It's `null` if the company isn't a customer. Your users are listed by [List all users](#tag/organisation).\n"
          },
          "invoiceTermsType": {
            "description": "How Omono reads `invoiceTermsDays` to work out when this customer's invoices are due. The days can count from the invoice date or from the end of the invoice month, or they can name a day of the month the invoice is dated in or of the following month. It's `null` if the company isn't a customer.\n\nKnown values: `days_after_invoice`, `days_after_month_end`, `day_of_current_month`, `day_of_next_month`. Omono can add values; handle one you don't recognise.\n",
            "type": [
              "string",
              "null"
            ],
            "x-known-values": [
              "days_after_invoice",
              "days_after_month_end",
              "day_of_current_month",
              "day_of_next_month"
            ],
            "x-enum-descriptions": [
              "The invoice is due a number of days after its date. For example, 30 days on an invoice dated 10 March makes it due on 9 April.",
              "The invoice is due a number of days after the end of the month it's dated in. For example, 30 days on an invoice dated 10 March makes it due on 30 April.",
              "The invoice is due on a set day of the month it's dated in. For example, 20 on an invoice dated 10 March makes it due on 20 March. The due date never moves to the next month, so 20 on an invoice dated 25 March also makes it due on 20 March, before the invoice date.",
              "The invoice is due on a set day of the following month. For example, 20 on an invoice dated 10 March makes it due on 20 April."
            ]
          },
          "invoiceTermsDays": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "The number that goes with `invoiceTermsType`, from 0 to 99. For example, `days_after_invoice` with 30 days means each invoice is due 30 days after its date. It's `null` if the company isn't a customer.\n"
          },
          "creditLimit": {
            "type": [
              "number",
              "null"
            ],
            "description": "The credit limit you allow this customer, in the customer's currency. If your organisation has turned on Omono's credit limit check for Xero, Omono compares it with the customer's Xero balance when staff ship a dispatch in Omono. The API never runs this check, including when you ship a dispatch through the API. It's `null` if no limit has been set or the company isn't a customer.\n"
          },
          "salesDiscount": {
            "type": [
              "number",
              "null"
            ],
            "description": "The customer's usual discount, as a percentage from 0 to 100. Staff see it filled in on new line items in Omono, but the API doesn't apply it to line items you send. It's `null` if none has been set or the company isn't a customer.\n"
          },
          "customerSegmentId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the customer segment this customer belongs to, which your organisation uses for reporting. It's `null` if the company isn't a customer. Your customer segments are listed by [List all customer segments](#tag/sales-settings).\n"
          },
          "commissionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of a referrer's commission scheme for this customer, or `null` if there isn't one. New quotes and sales orders for the customer use this commission unless you send another. Your commissions are listed by [List all commissions](#tag/sales-settings).\n"
          },
          "customerDivisionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the division of your organisation that normally deals with this customer, or `null` if none has been set. New quotes, sales orders and credit notes for the customer use this division unless you send another. Your divisions are listed by [List all divisions](#tag/organisation).\n"
          },
          "invoicePaymentBankAccountId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of your organisation's bank account that this customer's invoices ask to be paid into. Omono prints its details on the customer's invoices and proformas. It's always in the company's currency, and it's `null` if the company isn't a customer. Your bank accounts are listed by [List all bank accounts](#tag/organisation).\n"
          },
          "eoriNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The customer's EORI number, which is used on customs paperwork, up to 50 characters. It's free text, not the ID of one of your organisation's EORI numbers. It's `null` if none has been saved or the company isn't a customer.\n"
          },
          "onStop": {
            "type": "boolean",
            "description": "Whether the customer is on stop. While a customer is on stop, its dispatches can't be shipped, although you can still raise quotes, sales orders and credit notes for it. Staff put a customer on stop, or take it off, in Omono, so you can't change this field through the API. If a customer on stop stops being a customer, Omono takes it off stop.\n"
          },
          "billTermsType": {
            "description": "How Omono reads `billTermsDays` to work out when this supplier's bills are due. It takes the same values as `invoiceTermsType`. It's `null` if the company isn't a supplier.\n\nKnown values: `days_after_invoice`, `days_after_month_end`, `day_of_current_month`, `day_of_next_month`. Omono can add values; handle one you don't recognise.\n",
            "type": [
              "string",
              "null"
            ],
            "x-known-values": [
              "days_after_invoice",
              "days_after_month_end",
              "day_of_current_month",
              "day_of_next_month"
            ],
            "x-enum-descriptions": [
              "The invoice is due a number of days after its date. For example, 30 days on an invoice dated 10 March makes it due on 9 April.",
              "The invoice is due a number of days after the end of the month it's dated in. For example, 30 days on an invoice dated 10 March makes it due on 30 April.",
              "The invoice is due on a set day of the month it's dated in. For example, 20 on an invoice dated 10 March makes it due on 20 March. The due date never moves to the next month, so 20 on an invoice dated 25 March also makes it due on 20 March, before the invoice date.",
              "The invoice is due on a set day of the following month. For example, 20 on an invoice dated 10 March makes it due on 20 April."
            ]
          },
          "billTermsDays": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "The number that goes with `billTermsType`, from 0 to 99. It's `null` if the company isn't a supplier.\n"
          },
          "supplierDivisionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the division of your organisation that normally buys from this supplier, or `null` if none has been set. New purchase orders for the supplier use this division unless you send another. Your divisions are listed by [List all divisions](#tag/organisation).\n"
          },
          "rating": {
            "description": "The supplier's quality rating, from 1 to 5 stars, which staff set in Omono, or `null` if the supplier hasn't been rated. You can't change it through the API.\n\nKnown values: `1`, `2`, `3`, `4`, `5`. Omono can add values; handle one you don't recognise.\n",
            "type": [
              "integer",
              "null"
            ],
            "x-known-values": [
              1,
              2,
              3,
              4,
              5
            ]
          },
          "ratedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The time the supplier's rating was last set, or `null` if it hasn't been set."
          },
          "isProforma": {
            "type": "boolean",
            "description": "Whether this is a proforma customer, who must pay for each dispatch before it can ship. It's `true` when `invoiceTermsType` is `days_after_invoice` and `invoiceTermsDays` is `0`, so to make a customer proforma, set those two fields to those values.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the company is archived. Archived companies are left out of lists unless you ask for them, and you can't raise documents for them or change them until you unarchive them. To archive or unarchive a company, send `archived` in [Update a company](#tag/companies/PATCH/companies/{id}). [Archive and unarchive a record](/docs/writing#archiving) explains how.\n"
          },
          "contacts": {
            "type": "array",
            "description": "The company's contacts, including archived ones. This field is only present when you ask for it with `include=contacts`, and in the response when you create a company.\n",
            "items": {
              "$ref": "#/components/schemas/Contact"
            }
          },
          "addresses": {
            "type": "array",
            "description": "The company's addresses, including archived ones. This field is only present when you ask for it with `include=addresses`, and in the response when you create a company.\n",
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          }
        },
        "required": [
          "id",
          "externalRef",
          "created",
          "updated",
          "companyName",
          "accountNo",
          "website",
          "industryId",
          "typeId",
          "countryId",
          "currencyId",
          "currencyLocked",
          "taxNo",
          "taxRateId",
          "postcode",
          "telephone",
          "isCustomer",
          "isSupplier",
          "accountManagerId",
          "invoiceTermsType",
          "invoiceTermsDays",
          "creditLimit",
          "salesDiscount",
          "customerSegmentId",
          "commissionId",
          "customerDivisionId",
          "invoicePaymentBankAccountId",
          "eoriNumber",
          "onStop",
          "billTermsType",
          "billTermsDays",
          "supplierDivisionId",
          "rating",
          "ratedAt",
          "isProforma",
          "archived"
        ],
        "additionalProperties": true
      },
      "CompanyList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The companies on this page.",
                "items": {
                  "$ref": "#/components/schemas/Company"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "ProblemFieldError": {
        "type": "object",
        "description": "One field at fault in the request.",
        "properties": {
          "field": {
            "type": "string",
            "description": "The offending field, dot-notated for nested paths (`lineItems[3].quantity`)."
          },
          "message": {
            "type": "string",
            "description": "What is wrong with the field."
          }
        },
        "required": [
          "field",
          "message"
        ],
        "additionalProperties": true
      },
      "CreatedLineItem": {
        "type": "object",
        "description": "A line item you added, matched to its position in your `lineItems` array.",
        "properties": {
          "index": {
            "type": "integer",
            "minimum": 0,
            "description": "The item's position in your `lineItems` array, counting from 0. Every item in the array counts, including the ones that update or delete a line item.\n"
          },
          "id": {
            "type": "string",
            "description": "The ID of the new line item created from that item.\n"
          }
        },
        "required": [
          "index",
          "id"
        ],
        "additionalProperties": true
      },
      "ProblemAppliedLineItems": {
        "type": "object",
        "description": "Present on an error from a `lineItems` PATCH that changed some lines, or the document's other fields, before it stopped — a 500, or the 409 of a per-line guard that a concurrent change (usually an app user's) made fail after pre-validation. The PATCH saves the other fields before its lines, so when only those changed, all three lists are empty. Never on a create: a create that fails part-way deletes its new Draft. `index` is the position in your array. The document's `ETag` has changed: re-read it, rebuild the array from the fresh read plus your change, and retry with the new `If-Match`.\n",
        "properties": {
          "created": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreatedLineItem"
            }
          },
          "updated": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "deleted": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "created",
          "updated",
          "deleted"
        ],
        "additionalProperties": true
      },
      "QuoteStatus": {
        "description": "The stage a quote has reached. A new quote starts as `draft`, becomes `active` once it has been sent to the customer, and ends as `won` or `lost`. These values are the same in every organisation.\n\nKnown values: `draft`, `active`, `won`, `lost`. Omono can add values; handle one you don't recognise.\n",
        "type": "string",
        "x-known-values": [
          "draft",
          "active",
          "won",
          "lost"
        ],
        "x-enum-descriptions": [
          "The quote, or its newest revision, hasn't been sent to the customer yet.",
          "The quote has been sent to the customer, and you're waiting for their decision.",
          "The customer accepted the quote, and Omono created a sales order from it.",
          "The customer didn't accept the quote, or Omono closed it automatically."
        ]
      },
      "KnownQuoteStatus": {
        "description": "The stage a quote has reached. A new quote starts as `draft`, becomes `active` once it has been sent to the customer, and ends as `won` or `lost`. These values are the same in every organisation.\n",
        "type": "string",
        "enum": [
          "draft",
          "active",
          "won",
          "lost"
        ],
        "x-enum-descriptions": [
          "The quote, or its newest revision, hasn't been sent to the customer yet.",
          "The quote has been sent to the customer, and you're waiting for their decision.",
          "The customer accepted the quote, and Omono created a sales order from it.",
          "The customer didn't accept the quote, or Omono closed it automatically."
        ]
      },
      "OrderStatus": {
        "description": "The status of a sales order or purchase order. Both kinds of order use the same list of statuses.\n\nKnown values: `draft`, `on_order`, `complete`, `cancelled`, `on_hold`, `on_order_call_off`. Omono can add values; handle one you don't recognise.\n",
        "type": "string",
        "x-known-values": [
          "draft",
          "on_order",
          "complete",
          "cancelled",
          "on_hold",
          "on_order_call_off"
        ],
        "x-enum-descriptions": [
          "The order is still being prepared and isn't active yet.",
          "The order is active. A sales order is on order once it's activated, and a purchase order once it's issued to the supplier.",
          "Everything on a sales order has shipped, or everything on a purchase order has been received.",
          "The order was cancelled and is no longer active.",
          "At least one of the order's dispatches or deliveries is on hold.",
          "The order is an active call-off order, which means its goods are delivered in several parts over a period."
        ]
      },
      "KnownOrderStatus": {
        "description": "The status of a sales order or purchase order. Both kinds of order use the same list of statuses.\n",
        "type": "string",
        "enum": [
          "draft",
          "on_order",
          "complete",
          "cancelled",
          "on_hold",
          "on_order_call_off"
        ],
        "x-enum-descriptions": [
          "The order is still being prepared and isn't active yet.",
          "The order is active. A sales order is on order once it's activated, and a purchase order once it's issued to the supplier.",
          "Everything on a sales order has shipped, or everything on a purchase order has been received.",
          "The order was cancelled and is no longer active.",
          "At least one of the order's dispatches or deliveries is on hold.",
          "The order is an active call-off order, which means its goods are delivered in several parts over a period."
        ]
      },
      "CreditNoteStatus": {
        "description": "The stage a credit note has reached. These values are the same in every organisation.\n\nKnown values: `draft`, `complete`. Omono can add values; handle one you don't recognise.\n",
        "type": "string",
        "x-known-values": [
          "draft",
          "complete"
        ],
        "x-enum-descriptions": [
          "The credit note can still be changed.",
          "The credit note is final and can't be changed or reopened."
        ]
      },
      "KnownCreditNoteStatus": {
        "description": "The stage a credit note has reached. These values are the same in every organisation.\n",
        "type": "string",
        "enum": [
          "draft",
          "complete"
        ],
        "x-enum-descriptions": [
          "The credit note can still be changed.",
          "The credit note is final and can't be changed or reopened."
        ]
      },
      "CreatedLineItems": {
        "type": "array",
        "description": "The new ID of each line item you added, matched to its position in your `lineItems` array. Use these IDs to find your new line items, never a line item's position in the response, because someone may add a line item in Omono at the same time.\n\nAfter a create, there's one entry for each item in `lineItems`, or an empty list if you sent none. After a `PATCH` that includes `lineItems`, there's one entry for each item without an `id`, and the field is left out when the body has no `lineItems`. A replayed request returns the original entries. Learn more about [changing line items](/docs/writing#line-changes).\n",
        "items": {
          "$ref": "#/components/schemas/CreatedLineItem"
        }
      },
      "ProblemKeptDocument": {
        "type": "object",
        "description": "Present only when a document create stopped part-way and its Draft was kept: on the 500 `internal-error`, and on the 409 `create-incomplete` that a same-key retry then gets.\n",
        "properties": {
          "resource": {
            "description": "The kind of document that was kept, in the words the events feed uses for its `resource`.\n\nKnown values: `quotes`, `sales_orders`, `credit_notes`, `purchase_orders`. Omono can add values; handle one you don't recognise.\n",
            "type": "string",
            "x-known-values": [
              "quotes",
              "sales_orders",
              "credit_notes",
              "purchase_orders"
            ]
          },
          "id": {
            "type": "string"
          },
          "status": {
            "description": "The kept document's status, in the words its resource uses (a quote, sales order, purchase order or credit note status).\n\nKnown values: `draft`, `active`, `won`, `lost`, `on_order`, `complete`, `cancelled`, `on_hold`, `on_order_call_off`. Omono can add values; handle one you don't recognise.\n",
            "type": [
              "string",
              "null"
            ],
            "x-known-values": [
              "draft",
              "active",
              "won",
              "lost",
              "on_order",
              "complete",
              "cancelled",
              "on_hold",
              "on_order_call_off"
            ]
          },
          "createdLineItems": {
            "$ref": "#/components/schemas/CreatedLineItems",
            "description": "On the 500 only: each item of your array that was created before the failure (always a prefix of the array), with its line id. Lines may also have been added, changed or removed in Omono. Absent on the 409 `create-incomplete` of a retry, where the mapping is not known.\n"
          }
        },
        "required": [
          "resource",
          "id",
          "status"
        ],
        "additionalProperties": true
      },
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. Every error response the API itself makes uses this shape with `Content-Type: application/problem+json`. Responses made by the edge (Cloudflare) are the exception: a firewall 403 and the 520–526 origin errors are HTML with a `cf-ray` header and no `X-Request-Id`, the edge per-address rate limit answers a JSON 429 without a `requestId`, and while the API service is scaled to zero the load balancer answers its own 503.\n",
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "description": "`https://api.omono.co/docs/errors/<code>` — the page for this `code`."
          },
          "title": {
            "type": "string",
            "description": "A short summary of the error, written for a person to read. Every error with the same `code` has the same title today, but the wording can change, so don't match on it."
          },
          "status": {
            "type": "integer",
            "description": "The HTTP status code."
          },
          "detail": {
            "type": "string",
            "description": "Human-readable explanation of this occurrence."
          },
          "code": {
            "description": "A short code that identifies the error, one of the values below. Handle errors by this field, never by `title` or `detail`, which are written for people and can change. Omono can add new codes, so handle a code you don't recognise by its status. Once the API is generally available, Omono won't rename or remove a code that a stable operation returns within version 1, as the [compatibility policy](/docs/compatibility) explains. When a field is at fault, `errors[]` names it: it comes with every `422` error, with a `404` or `409` error about a `lineItems` entry or about `lineItemOrder`, and with a `409` error that refuses a field because of the state of the record, such as `contact-archived`, `task-completed` or `no-line-items`.\n\nKnown values: `malformed-request`, `validation-failed`, `unknown-field`, `missing-required-field`, `invalid-reference`, `invalid-exchange-rate`, `negative-amount`, `negative-quantity`, `invalid-discount`, `missing-exempt-tax-rate`, `bank-currency-mismatch`, `invalid-filename`, `invalid-recurrence`, `invalid-transition-target`, `unauthenticated`, `insufficient-scope`, `api-access-disabled`, `not-found`, `route-not-found`, `method-not-allowed`, `duplicate-name`, `duplicate-account-number`, `duplicate-part-number`, `duplicate-external-ref`, `duplicate-supplier`, `currency-locked`, `company-archived`, `last-contact`, `accounts-address-protected`, `contact-archived`, `address-archived`, `quote-locked`, `quote-not-active`, `quote-not-lost`, `quote-has-revisions`, `not-a-draft`, `quote-revision-stale`, `sales-order-locked`, `line-item-on-invoiced-dispatch`, `line-item-allocated`, `line-item-parent-mismatch`, `immutable-field`, `dispatch-not-fully-picked`, `dispatch-pick-not-saved`, `blocking-tasks`, `company-on-stop`, `proforma-not-paid`, `dispatch-order-mismatch`, `dispatch-shipped`, `dispatch-allocated`, `dispatch-picked`, `delivery-received`, `quantity-exceeds-remaining`, `tracking-too-early`, `dispatch-state-changed`, `credit-note-complete`, `purchase-order-cancelled`, `purchase-order-locked`, `line-order-fixed`, `purchase-order-has-received-deliveries`, `exchange-rate-locked`, `line-item-invoiced-locked`, `below-delivered-quantity`, `stock-not-buyable`, `stock-item-archived`, `document-archived`, `task-completed`, `document-too-large`, `idempotency-key-reuse`, `create-incomplete`, `idempotency-in-progress`, `payload-too-large`, `unsupported-media-type`, `rate-limited`, `upload-limit-reached`, `precondition-failed`, `precondition-required`, `events-expired`, `order-not-active`, `no-line-items`, `dispatches-incomplete`, `deliveries-incomplete`, `temporarily-unavailable`, `request-timeout`, `internal-error`. Omono can add values; handle one you don't recognise.\n",
            "type": "string",
            "x-known-values": [
              "malformed-request",
              "validation-failed",
              "unknown-field",
              "missing-required-field",
              "invalid-reference",
              "invalid-exchange-rate",
              "negative-amount",
              "negative-quantity",
              "invalid-discount",
              "missing-exempt-tax-rate",
              "bank-currency-mismatch",
              "invalid-filename",
              "invalid-recurrence",
              "invalid-transition-target",
              "unauthenticated",
              "insufficient-scope",
              "api-access-disabled",
              "not-found",
              "route-not-found",
              "method-not-allowed",
              "duplicate-name",
              "duplicate-account-number",
              "duplicate-part-number",
              "duplicate-external-ref",
              "duplicate-supplier",
              "currency-locked",
              "company-archived",
              "last-contact",
              "accounts-address-protected",
              "contact-archived",
              "address-archived",
              "quote-locked",
              "quote-not-active",
              "quote-not-lost",
              "quote-has-revisions",
              "not-a-draft",
              "quote-revision-stale",
              "sales-order-locked",
              "line-item-on-invoiced-dispatch",
              "line-item-allocated",
              "line-item-parent-mismatch",
              "immutable-field",
              "dispatch-not-fully-picked",
              "dispatch-pick-not-saved",
              "blocking-tasks",
              "company-on-stop",
              "proforma-not-paid",
              "dispatch-order-mismatch",
              "dispatch-shipped",
              "dispatch-allocated",
              "dispatch-picked",
              "delivery-received",
              "quantity-exceeds-remaining",
              "tracking-too-early",
              "dispatch-state-changed",
              "credit-note-complete",
              "purchase-order-cancelled",
              "purchase-order-locked",
              "line-order-fixed",
              "purchase-order-has-received-deliveries",
              "exchange-rate-locked",
              "line-item-invoiced-locked",
              "below-delivered-quantity",
              "stock-not-buyable",
              "stock-item-archived",
              "document-archived",
              "task-completed",
              "document-too-large",
              "idempotency-key-reuse",
              "create-incomplete",
              "idempotency-in-progress",
              "payload-too-large",
              "unsupported-media-type",
              "rate-limited",
              "upload-limit-reached",
              "precondition-failed",
              "precondition-required",
              "events-expired",
              "order-not-active",
              "no-line-items",
              "dispatches-incomplete",
              "deliveries-incomplete",
              "temporarily-unavailable",
              "request-timeout",
              "internal-error"
            ],
            "x-enum-descriptions": [
              "The request could not be parsed: the body is not valid JSON, or the query uses a parameter this operation does not accept; `detail` names it.",
              "A value in the request body or query is not valid: it fails the request schema, or a rule such as a date range or a decimal-place limit. `errors[]` names the field at fault, usually only the first one found; for a rule, `detail` describes it.",
              "The body contains a field the resource does not accept (for example bank fields on a company, cost fields on a line item).",
              "A required field is absent (the request schema requires it), or a field the organisation's settings or the resource state make mandatory is absent or null, or has no default to fill it (a line's analysis code when the stock item has none; a customer's `invoicePaymentBankAccountId` when several bank accounts match); `errors[]` names every missing field found at that stage.",
              "An id in the body does not name a record you can use in that field: it is not in your organisation, is archived, or is the wrong kind (for example another company's contact, or a stock item that cannot be sold). `errors[].field` names it.",
              "`exchangeRate` must be a positive number. Normally not returned: the request schema's bounds answer 422 `validation-failed` first; kept as defence in depth.",
              "A money field (`unitPrice`, `price`, `cost`) is negative. Normally not returned: the request schema's bounds answer 422 `validation-failed` first; kept as defence in depth.",
              "`quantity` is negative (zero is allowed). Normally not returned: the request schema's bounds answer 422 `validation-failed` first; kept as defence in depth.",
              "`discount` must be between 0 and 100. Normally not returned: the request schema's bounds answer 422 `validation-failed` first; kept as defence in depth.",
              "The stock item is tax-exempt but the organisation has no EXEMPT tax rate configured; add one in Settings.",
              "A customer company's `invoicePaymentBankAccountId` must be a bank account in the company's currency: none of the organisation's bank accounts matches it, or the one sent is in another currency.",
              "The document name is blank, contains characters that are not allowed, or exceeds 250 characters.",
              "`isRecurring` is true without a valid `recurrenceConfig`, or the derived recurrence rule is invalid; `detail` carries the reason. Normally not returned: the request schema and the task checks answer 422 `validation-failed` first; kept as defence in depth.",
              "`statusId` is not a workflow status of this organisation, or it is an archived one (a retired status; an archived status that is already the dispatch's current status answers 200 `\"applied\": false` instead).",
              "The API key is missing, wrong, expired or revoked, or was sent in a URL. For a key Omono recognises, `detail` says which (another platform's key, revoked, or expired). A key sent in a URL is revoked at once and your admins are emailed.",
              "The API key does not hold the scope this endpoint requires; an admin can add the scope to the key on Settings → API.",
              "API access is not on for your organisation. `detail` says why: Omono has not switched the API on yet (it is switched on by request), an admin has switched it off on Settings → API, or Omono has suspended it.",
              "No record with that id exists in your organisation (also returned for records you are not permitted to see).",
              "There is no API operation at this path. Paths are case-sensitive and have no trailing slash. This code says nothing about any record.",
              "The resource does not support this HTTP method.",
              "Another company already uses this `companyName`. `conflictingId` names the record that already has the value, unless another request was writing it at the same moment.",
              "Another company already uses this `accountNo`. `conflictingId` names the record that already has the value, unless another request was writing it at the same moment.",
              "Another stock item already uses this `partNo` (case-insensitive). `conflictingId` names the record that already has the value, unless another request was writing it at the same moment.",
              "Another record of the same kind in your organisation already uses this `externalRef`, archived and cancelled records included, or another line item of the same document does. `conflictingId` names the record or line item that already has the value, unless another request was writing it at the same moment.",
              "The company is already a supplier of this stock item. A stock item has one row for each supplier.",
              "`currencyId` cannot change once any money document (quote, sales order, credit note or purchase order) has been created against the company, even if it has since been deleted (including a Draft an API create removed after a failure); `currencyLocked` on the company shows it.",
              "The company is archived. Unarchive it by sending archived: false in a PATCH of the company, on its own or with your other changes, before raising documents against it, adding contacts or addresses, or changing it.",
              "The last active contact of a company cannot be archived.",
              "The accounts address cannot be archived or un-flagged, and an archived address cannot become the accounts address; promote another (un-archived) address first.",
              "The contact is archived, so it can't change until it is un-archived. `errors[].field` names the first field your request would change. Nothing was changed.",
              "The address is archived, so it can't change until it is un-archived. `errors[].field` names the first field your request would change. Nothing was changed.",
              "The quote is Won or Lost and cannot be edited, activated, or marked won or lost again (a Lost quote cannot be marked won, and a Won quote cannot be marked lost). A Lost quote that has a sales order cannot be reactivated.",
              "The quote is a Draft. Only an active quote can be marked won or lost.",
              "The quote is a Draft or Won. Only a lost quote can be reactivated.",
              "The quote is a Draft with more than one revision, so it can't be deleted. Omono only deletes a quote that has one revision. Nothing was deleted.",
              "The record isn't a Draft. Only a Draft quote, sales order, credit note or purchase order can be deleted. Nothing was deleted.",
              "The revision you addressed is no longer the latest; re-read the quote.",
              "The sales order is Cancelled or Complete and cannot be edited or activated (and a Cancelled order's dispatches cannot be marked paid).",
              "The line sits on an invoiced dispatch; only its quantity can change (description, price, unit price, discount, tax, analysis, tag, commodity code and country of origin are frozen).",
              "The line is allocated to a dispatch (sales) or scheduled on a delivery (purchasing): it cannot be deleted, and a sales line's quantity cannot go below the total on its dispatches.",
              "The line item does not belong to the document in the URL. Normally not returned: a line item id from another document answers 422 `invalid-reference` first; kept as defence in depth.",
              "The field cannot change after creation (`stockItemId` on an existing line item, or a stock item's `kind`).",
              "The dispatch is not fully picked yet, so it cannot move to the final status. Staff finish the picking in Omono and save it.",
              "The dispatch's picking is in progress in Omono, or staff picked it but the picking was not saved, so it cannot move to the final status yet. In Omono the dispatch can look picked.",
              "An open task with `blocksShipping` is linked to the order. It may be a private task, which the API does not list and only Omono can complete.",
              "The customer is on stop; shipping is blocked.",
              "The customer is on proforma terms and the dispatch is not marked paid; mark it paid with `POST /sales-orders/{id}/dispatches/{dispatchId}/proforma-paid`.",
              "`dispatchId` does not belong to the sales order in the URL.",
              "The dispatch is already shipped (it is in the final status): it cannot move to another status, its proforma payment flag, date and line items cannot change, and it cannot be deleted. Nothing was changed.",
              "The dispatch has left the first, unallocated stage of your workflow, so stock is reserved for it: its line items can't change and it can't be deleted. Nothing was changed.",
              "Goods on the dispatch have been picked in Omono, so the dispatch can't be deleted and a line item can't drop below its picked quantity. Nothing was changed.",
              "The delivery has been received, so its goods are in stock: it can't be changed or deleted through the API. Nothing was changed.",
              "A quantity on the dispatch or delivery is more than is left of its line item: the line item's quantity less what is on its other dispatches or deliveries. `errors[]` names the entry, and its message says how many are left. Nothing was changed.",
              "A dispatch's `courierId` and `trackingNo` can be set once it has shipped, or once it is allocated when early tracking entry is on in Omono (`salesOrders.earlyTrackingEntry` in `GET /settings`). The dispatch has not reached that stage, so nothing was changed.",
              "Another request moved the dispatch to a different status while this transition ran, or is still shipping or invoicing it; this request changed nothing. Re-read the order and retry.",
              "The credit note is Complete and cannot be edited.",
              "The purchase order is cancelled, so it can't be changed or issued. This covers its header fields, adding, changing or deleting a line item, changing the order of its line items, and adding, changing or deleting a delivery. (Cancelling it again answers 200 with `\"applied\": false`.)",
              "Editing is locked because every delivery is invoiced and every line item has been fully received. A complete purchase order (every line item received) also takes no new delivery.",
              "The order of the document's line items can't change any more. A sales order's line order is fixed once it has a dispatch, and a purchase order's once it has a delivery. Your `lineItemOrder` would change it, so nothing was changed.",
              "A purchase order with received deliveries cannot be cancelled.",
              "`exchangeRate` cannot change: a delivery or dispatch is already invoiced.",
              "The line sits on an invoiced delivery; description, price, tax, analysis, and tag are frozen (quantity stays editable).",
              "`quantity` cannot go below the total already scheduled on deliveries.",
              "The stock item is not purchasable (`canBuy` false, e.g. an assembly).",
              "The stock item is archived. Unarchive it by sending archived: false in a PATCH of the item, on its own or with your other changes, before changing it.",
              "The document is archived, which is how Omono deletes a document, so the API can't unarchive, rename, pin or unpin it. Nothing was changed. A request that only sends the document's current values succeeds.",
              "The task is complete: its status is a closed status. The API can't change a completed task or reopen it. `errors[].field` names the first field your request would change. Nothing was changed. A request that only sends the task's current values succeeds.",
              "The record has more than 10,000 related records to return with it, or comes to more than 32 MB of JSON with them, which is more than one response can carry. The related records count as the API returns them: a document's line items and their BOM items, the dispatches or deliveries you include with their line items, or a company's contacts and addresses. A list page that starts with such a record fails in the same way when you include its related records. A write that would return a record with more than 10,000 related records is refused in the same way before it changes anything: a `PATCH` also counts the new line items it adds and the BOM items that new assembly line items bring (updating or deleting a line item adds nothing), and moving a dispatch or marking one as paid counts the order's dispatches and their line items.",
              "This Idempotency-Key was already used for the same operation with a different body, or for a different record. A key belongs to one operation, such as creating a sales order or updating a task, so the same key sent to another operation is a new key.",
              "An earlier request with this `Idempotency-Key` started to create this document and stopped part-way. Someone has changed the Draft it left since then, so Omono kept it instead of deleting it and starting again. `keptDocument` names the Draft.",
              "A request with this `Idempotency-Key` is still being processed; retry after `Retry-After`. If the server failed mid-request, the key is usable again after 60 s.",
              "The body exceeds 1 MB (JSON) or the platform document size limit (20 MB, uploads).",
              "The request body is not `application/json` (or `multipart/form-data` for uploads).",
              "A request limit of your key or your organisation is used up, or too many requests with a bad key came from your address. `Retry-After` says how long to wait.",
              "Your organisation has uploaded its daily allowance of files (1 GB each day, UTC), or this upload would take it past that allowance. Until a file is stored, an upload counts as its whole request body (its `Content-Length`), or as the largest file allowed when it has no `Content-Length`. A file that isn't stored doesn't count. `Retry-After` is the time until 00:00 UTC.",
              "`If-Match` does not match the resource's current `ETag`; re-read, re-apply your change, and retry.",
              "A DELETE, or a PATCH that carries `lineItems` or `lineItemOrder`, must send `If-Match`.",
              "An event after your `since` has been purged (older than the 30-day window), or your `since` is ahead of this organisation's latest sequence (a cursor from another organisation, a sandbox reset or a restore); run a full crawl, then resume from the `latestSequence` in this response.",
              "The sales order is Draft or Cancelled. Activate a Draft order before transitioning its dispatches; a Cancelled order's dispatches cannot move.",
              "The quote, sales order, purchase order or credit note has no line items, so it can't be activated, won, issued or completed (for a quote, the revision has none: its latest one, or the one you marked as won). `errors[].field` is `lineItems`. Nothing was changed.",
              "A Draft sales order that is not a call-off can be activated only when the quantity of every line item is on its dispatches, as in Omono. `errors[]` names each line item whose quantity on dispatches differs from its quantity.",
              "A Draft purchase order that is not a call-off can be issued only when the quantity of every line item is on its deliveries, as in Omono. `errors[]` names each line item whose quantity on deliveries differs from its quantity.",
              "The API is draining for a deploy, waiting for a migration, cannot reach its database during a read, is over its platform-wide request budget, has too many requests in progress platform-wide, or is switched off platform-wide, or another request, or a save in Omono, was still changing the same record (for example a dispatch of the same order) after 5 seconds of waiting. On a purchase order, it can also mean that other saves kept changing its line items or their stock items while a `PATCH` tried to change its line items, or while `/issue` tried to issue it. A `DELETE` of a Draft can also mean that other saves kept changing the record while Omono tried to delete it. In every case nothing was executed, but after such a `PATCH` the purchase order has a new ETag, and after such an `/issue` it can have one. Honour `Retry-After`.",
              "The request did not finish within 15 seconds, or one read of your data took longer than 10 seconds; a write may still complete — retry with the same `Idempotency-Key` or re-read first. `Retry-After: 5`.",
              "The server could not complete the request. What happened before the failure depends on the request: see After a 500 in the Errors guide (/docs/errors)."
            ]
          },
          "requestId": {
            "type": "string",
            "description": "Matches the `X-Request-Id` response header."
          },
          "errors": {
            "type": "array",
            "description": "Per-field or per-line detail: always on 422; also on 404/409 when a `lineItems` entry is at fault (`field` is `lineItems[<i>]` or `lineItems[<i>].<field>`, `<i>` the index in your array), on a 409 about `lineItemOrder` (`field` is `lineItemOrder`), and on a 409 that refuses a field because of the state of the record, such as `contact-archived`, `tracking-too-early`, `task-completed` or `no-line-items` (`field` names it).\n",
            "items": {
              "$ref": "#/components/schemas/ProblemFieldError"
            }
          },
          "appliedLineItems": {
            "$ref": "#/components/schemas/ProblemAppliedLineItems"
          },
          "latestSequence": {
            "type": "integer",
            "description": "410 `events-expired` only: the organisation's latest event sequence when the request ran — resume the feed from it after a full crawl.\n",
            "minimum": 0
          },
          "conflictingId": {
            "type": "string",
            "description": "Present only on `duplicate-name`, `duplicate-account-number` and `duplicate-part-number`: the ID of the record that already has the value you sent. Look it up to decide whether it's the record you meant to create.\n"
          },
          "keptDocument": {
            "$ref": "#/components/schemas/ProblemKeptDocument"
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "code",
          "requestId"
        ],
        "additionalProperties": true
      },
      "CompanyFirstContact": {
        "type": "object",
        "additionalProperties": false,
        "description": "The company's first contact, sent as `contact` when you create a company. It has the same fields as a contact you add later, except `addressId`: Omono links the first contact to the new accounts address, so sending `addressId` fails with a `422` error and the code `unknown-field`.\n",
        "properties": {
          "firstName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The contact's first name, up to 50 characters. It can't contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "lastName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The contact's last name, up to 50 characters. It can't contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "email": {
            "type": "string",
            "maxLength": 254,
            "pattern": "^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$",
            "description": "The contact's email address, up to 254 characters. Omono emails documents to it. It must be a full address with a top-level domain, such as `.com` or `.co.uk`.\n"
          },
          "jobTitle": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The contact's job title, up to 50 characters."
          },
          "departmentId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the contact's department, from [List all departments](#tag/organisation). It must be a department that isn't archived.\n",
            "minLength": 1
          },
          "telephone1": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The contact's main telephone number, up to 50 characters."
          },
          "telephone2": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The contact's other telephone number, up to 50 characters."
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the contact, such as its ID in your CRM. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. If another of your organisation's contacts already has it, archived ones included, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one, so a contact you send twice is created only once. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "firstName",
          "lastName",
          "email"
        ]
      },
      "CompanyCreateAddress": {
        "type": "object",
        "additionalProperties": false,
        "description": "The company's accounts address, which is the address the company is invoiced at. `accountsAddress` is always `true` here, and sending `false` fails with a `422` error and the code `validation-failed`. You must send an `accountsEmail`, because every invoice email goes to it. If you leave out `companyName`, the address uses the company's name. Omono removes any spaces at the start or end of its text fields.\n",
        "properties": {
          "accountsAddress": {
            "type": "boolean",
            "description": "Whether this is the company's accounts address. It's always `true` here, because the first address becomes the accounts address. Sending `false` fails with a `422` error and the code `validation-failed`.\n"
          },
          "companyName": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100,
            "pattern": "^[^‎-‏‪-‮⁦-⁩﻿]*$",
            "description": "The name to print as the first line of the address, up to 100 characters. If you leave it out or send `null`, Omono uses the company's name. It can't contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "line1": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "The first line of the address, up to 500 characters."
          },
          "line2": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 500,
            "description": "The second line of the address, up to 500 characters."
          },
          "city": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "The town or city, up to 255 characters."
          },
          "county": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 255,
            "description": "The county, up to 255 characters."
          },
          "postcode": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The postcode, up to 50 characters. Omono converts it to capital letters."
          },
          "countryId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the country the address is in, from [List all countries](#tag/tax-and-currency).\n",
            "minLength": 1
          },
          "telephone": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The telephone number at this address, up to 50 characters."
          },
          "accountsEmail": {
            "type": "string",
            "maxLength": 254,
            "pattern": "^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$",
            "description": "The email address that the company's invoices are sent to, up to 254 characters. It must be a full address with a top-level domain, such as `.com` or `.co.uk`. It's required here, because this address becomes the accounts address. If you leave it out, the request fails with a `422` error and the code `missing-required-field`.\n"
          },
          "eoriNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The customer's EORI number for deliveries to this address, up to 50 characters. When it's set, it's used instead of the EORI number on the company.\n"
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the address, such as its ID in your web shop or CRM. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. If another of your organisation's addresses already has it, archived ones included, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one, so a address you send twice is created only once. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "line1",
          "city",
          "countryId",
          "accountsEmail"
        ]
      },
      "CompanyCreate": {
        "type": "object",
        "additionalProperties": false,
        "description": "A new company, with its first `contact` and its accounts `address`. Omono removes any spaces at the start or end of text fields.\n\nSend customer fields only for a customer, and supplier fields only for a supplier. Otherwise the request fails with a `422` error and the code `validation-failed`. A customer (`isCustomer: true`) also needs `accountManagerId` and `invoiceTermsDays`. It needs `customerSegmentId` too, unless your organisation has exactly one customer segment that isn't archived. A supplier (`isSupplier: true`) needs `billTermsDays`. If one of these is missing, the request fails with a `422` error and the code `missing-required-field`.\n\nA create and a read have different shapes. You create a company with one `contact` and one `address`, and when you read a company you get its `contacts` and `addresses` as lists. The company's `telephone` and `postcode` come from its accounts address, so send them on `address` when you create it. You can send the company's `website` when you create it.\n",
        "properties": {
          "companyName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The company's name, up to 100 characters. It can't contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains. It must be unique in your organisation, including archived companies, and capital letters don't make one name different from another. If the request fails with a `409` error and the code `duplicate-name` although your search found nothing, search again with `archived=any`. If that search still finds nothing, another request was creating the same company at the same moment, so retry.\n"
          },
          "accountNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "description": "The company's account number, up to 50 characters. Like the name, it must be unique in your organisation, including archived companies, and capital letters don't make one account number different from another. If it isn't unique, the request fails with a `409` error and the code `duplicate-account-number`.\n"
          },
          "website": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "The company's website, up to 200 characters."
          },
          "industryId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the industry the company works in. It must be an industry that isn't archived.\n",
            "minLength": 1
          },
          "typeId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the company's type. It must be a company type that isn't archived.\n",
            "minLength": 1
          },
          "countryId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the country the company is in, from [List all countries](#tag/tax-and-currency). When staff create a company in Omono, the form suggests your organisation's own country, which is the `countryId` of [your organisation](#tag/organisation).\n",
            "minLength": 1
          },
          "currencyId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the currency you'll trade with this company in. It must be one of the currencies your organisation uses, that is, the `currencyId` of a rate that isn't archived in [List all currency rates](#tag/tax-and-currency). Don't pick from the full list of currencies, because it also includes currencies your organisation hasn't turned on. When staff create a company in Omono, the form suggests your base currency, which is the `baseCurrencyId` of your organisation.\n",
            "minLength": 1
          },
          "taxNo": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The company's VAT number or other tax registration number, up to 50 characters."
          },
          "taxRateId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the company's default tax rate. It must be a tax rate that isn't archived and isn't a system rate, so its `systemDefined` is `false`. When staff create a company in Omono, the form suggests your organisation's `defaultTaxRateId`, as long as that rate isn't archived.\n",
            "minLength": 1
          },
          "isCustomer": {
            "type": "boolean",
            "description": "Whether you sell to this company. At least one of `isCustomer` and `isSupplier` must be `true`, and both can be.\n"
          },
          "isSupplier": {
            "type": "boolean",
            "description": "Whether you buy from this company. At least one of `isCustomer` and `isSupplier` must be `true`, and both can be.\n"
          },
          "accountManagerId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the user who manages this customer's account. Send it only for a customer, where it's required: the automatic invoice email needs it, and the customer's quotes, sales orders and credit notes copy it. It must be a user whose `assignable` is `true` in [List all users](#tag/organisation).\n",
            "minLength": 1
          },
          "invoiceTermsType": {
            "allOf": [
              {
                "$ref": "#/components/schemas/KnownTermsType"
              }
            ],
            "description": "How Omono reads `invoiceTermsDays` to work out when this customer's invoices are due. Send it only for a customer. The default is `days_after_invoice`, which means a number of days after the invoice date.\n"
          },
          "invoiceTermsDays": {
            "type": "integer",
            "minimum": 0,
            "maximum": 99,
            "description": "The number that goes with `invoiceTermsType`, from 0 to 99. You must send it for a customer, and you can't send it for a company that is only a supplier. A customer with a terms type of `days_after_invoice` and `0` days is a proforma customer, who must pay for each dispatch before it can ship.\n"
          },
          "creditLimit": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 100000000,
            "description": "The credit limit you allow this customer, from 0 to 100,000,000. Send it only for a customer."
          },
          "salesDiscount": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 100,
            "description": "The customer's usual discount, as a percentage from 0 to 100. Send it only for a customer."
          },
          "customerSegmentId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the customer segment this customer belongs to. It must be a segment that isn't archived. Send it only for a customer. If you leave it out and your organisation has exactly one segment that isn't archived, Omono uses that one. If it has none or several, the request fails with a `422` error and the code `missing-required-field`.\n",
            "minLength": 1
          },
          "commissionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of a referrer's commission scheme for this customer. It must be a commission that isn't archived. Send it only for a customer.\n",
            "minLength": 1
          },
          "customerDivisionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the division of your organisation that normally deals with this customer. It must be a division that isn't archived. Send it only for a customer.\n",
            "minLength": 1
          },
          "invoicePaymentBankAccountId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of your organisation's bank account that this customer's invoices ask to be paid into, from [List all bank accounts](#tag/organisation). Send it only for a customer. It must be a bank account that isn't archived and is in the company's currency, or the request fails with a `422` error and the code `bank-currency-mismatch`. If you leave it out or send `null`, Omono uses your organisation's only bank account in that currency. If you have no bank account in that currency, the request fails with the code `bank-currency-mismatch`, and if you have several, it fails with the code `missing-required-field` so that you can choose one.\n",
            "minLength": 1
          },
          "eoriNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The customer's EORI number for customs paperwork, up to 50 characters. It's free text, not an ID. Send it only for a customer.\n"
          },
          "billTermsType": {
            "allOf": [
              {
                "$ref": "#/components/schemas/KnownTermsType"
              }
            ],
            "description": "How Omono reads `billTermsDays` to work out when this supplier's bills are due. Send it only for a supplier. The default is `days_after_invoice`, which means a number of days after the invoice date.\n"
          },
          "billTermsDays": {
            "type": "integer",
            "minimum": 0,
            "maximum": 99,
            "description": "The number that goes with `billTermsType`, from 0 to 99. You must send it for a supplier, and you can't send it for a company that is only a customer.\n"
          },
          "supplierDivisionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the division of your organisation that normally buys from this supplier. It must be a division that isn't archived. Send it only for a supplier.\n",
            "minLength": 1
          },
          "contact": {
            "$ref": "#/components/schemas/CompanyFirstContact"
          },
          "address": {
            "$ref": "#/components/schemas/CompanyCreateAddress"
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the company, such as its ID in your CRM or accounting system. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. If another of your organisation's companies already has it, archived ones included, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one, so a company you send twice is created only once. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "companyName",
          "accountNo",
          "industryId",
          "typeId",
          "countryId",
          "currencyId",
          "taxRateId",
          "isCustomer",
          "isSupplier",
          "contact",
          "address"
        ],
        "if": {
          "properties": {
            "isCustomer": {
              "const": true
            }
          },
          "required": [
            "isCustomer"
          ]
        },
        "then": {
          "required": [
            "accountManagerId",
            "invoiceTermsDays"
          ]
        }
      },
      "CompanyUpdate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The fields to change on a company. Any fields you leave out stay as they are. You can't send bank details, `onStop` or `countryId`: to change the company's country, update its accounts address. You can't change an archived company, so unarchive it first by sending `archived: false` with your changes. Otherwise the request fails with a `409` error and the code `company-archived`. You can clear only `commissionId`, `eoriNumber`, `customerDivisionId` and `supplierDivisionId`, by sending `null`. Sending `null` for any other field fails with a `422` error.\n",
        "properties": {
          "companyName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The company's new name, up to 100 characters. It can't contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains. It must be unique in your organisation, including archived companies, or the request fails with a `409` error and the code `duplicate-name`. The new name also appears on the company's quotes, sales orders, dispatches and purchase orders.\n"
          },
          "accountNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "description": "The company's new account number, up to 50 characters. It must be unique in your organisation, including archived companies, or the request fails with a `409` error and the code `duplicate-account-number`.\n"
          },
          "website": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The company's website, up to 200 characters. You can change it but not clear it: an empty value fails with a `422` error and the code `validation-failed`.\n"
          },
          "industryId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the industry the company works in. It must be an industry that isn't archived.\n",
            "minLength": 1
          },
          "typeId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the company's type. It must be a company type that isn't archived.\n",
            "minLength": 1
          },
          "currencyId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the currency you trade with this company in. It must be one of the currencies your organisation uses, which [List all currency rates](#tag/tax-and-currency) returns. You can't change it once `currencyLocked` is `true`: the request fails with a `409` error and the code `currency-locked`. On a customer, a new currency can also change `invoicePaymentBankAccountId`. If the company supplies stock items, their supplier prices stay in the old currency, so review them in Omono.\n",
            "minLength": 1
          },
          "taxNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "description": "The company's VAT number or other tax registration number, up to 50 characters. You can change it but not clear it: an empty value fails with a `422` error and the code `validation-failed`.\n"
          },
          "taxRateId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the company's default tax rate. It must be a tax rate that isn't archived and isn't a system rate.\n",
            "minLength": 1
          },
          "isCustomer": {
            "type": "boolean",
            "description": "Whether you sell to this company. Setting it to `false` clears every customer field. Setting it to `true` means the company needs everything a customer requires, such as an `accountManagerId` and `invoiceTermsDays`.\n"
          },
          "isSupplier": {
            "type": "boolean",
            "description": "Whether you buy from this company. Setting it to `false` clears every supplier field. Setting it to `true` means the company needs `billTermsDays`.\n"
          },
          "accountManagerId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the user who manages this customer's account. It must be a user whose `assignable` is `true`. You must send it when the company becomes a customer and has no account manager yet, or the request fails with a `422` error and the code `missing-required-field`. A new account manager also takes over every quote and sales order for this customer.\n",
            "minLength": 1
          },
          "invoiceTermsType": {
            "$ref": "#/components/schemas/KnownTermsType"
          },
          "invoiceTermsDays": {
            "type": "integer",
            "minimum": 0,
            "maximum": 99,
            "description": "The number that goes with `invoiceTermsType`, from 0 to 99. Send it only for a customer.\n"
          },
          "creditLimit": {
            "type": "number",
            "minimum": 0,
            "maximum": 100000000,
            "description": "The credit limit you allow this customer, from 0 to 100,000,000. Send it only for a customer."
          },
          "salesDiscount": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "The customer's usual discount, as a percentage from 0 to 100. Send it only for a customer."
          },
          "customerSegmentId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the customer segment this customer belongs to. It must be a segment that isn't archived. Send it only for a customer.\n",
            "minLength": 1
          },
          "commissionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of a referrer's commission scheme for this customer. It must be a commission that isn't archived. Send it only for a customer, or send `null` to remove it.\n",
            "minLength": 1
          },
          "customerDivisionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the division of your organisation that normally deals with this customer. It must be a division that isn't archived. Send it only for a customer, or send `null` to clear it.\n",
            "minLength": 1
          },
          "invoicePaymentBankAccountId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of your organisation's bank account that this customer's invoices ask to be paid into. It must be a bank account that isn't archived and is in the company's currency, or the request fails with a `422` error and the code `bank-currency-mismatch`. If you leave it out, the company keeps its current bank account, except in two cases: when the company has no bank account yet, for example because it's becoming a customer, and when you change `currencyId` and the current bank account is in a different currency. In those cases Omono uses your organisation's only bank account in the company's currency, and the request fails if you have none or several.\n",
            "minLength": 1
          },
          "eoriNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The customer's EORI number for customs paperwork, up to 50 characters. It's free text, not an ID. Send it only for a customer, or send `null` to clear it.\n"
          },
          "billTermsType": {
            "$ref": "#/components/schemas/KnownTermsType"
          },
          "billTermsDays": {
            "type": "integer",
            "minimum": 0,
            "maximum": 99,
            "description": "The number that goes with `billTermsType`, from 0 to 99. Send it only for a supplier.\n"
          },
          "supplierDivisionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the division of your organisation that normally buys from this supplier. It must be a division that isn't archived. Send it only for a supplier, or send `null` to clear it.\n",
            "minLength": 1
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the company should be archived. Send the state you want, not a toggle: sending the current value changes nothing. If you send other fields as well, `false` unarchives the company before applying them, and `true` archives it afterwards. While the company is archived, you can't change its other fields unless you send `archived: false` in the same request, and you can't add contacts or addresses to it or create quotes, sales orders, credit notes or purchase orders for it: those requests fail with a `409` error and the code `company-archived`. You can still update its contacts and addresses. As in Omono, archiving doesn't check whether the company has open quotes, orders or purchase orders. Omono adds a note to the company's history that names your key.\n"
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the company. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. Send `null` to remove it. If another of your organisation's companies already has it, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one. Learn more about [external references](/docs/writing#external-references).\n"
          }
        }
      },
      "ContactList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The contacts on this page.",
                "items": {
                  "$ref": "#/components/schemas/Contact"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "ContactCreate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The contact to add to a company. Omono removes any spaces at the start or end of its text fields.\n",
        "properties": {
          "firstName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The contact's first name, up to 50 characters. It can't contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "lastName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The contact's last name, up to 50 characters. It can't contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "email": {
            "type": "string",
            "maxLength": 254,
            "pattern": "^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$",
            "description": "The contact's email address, up to 254 characters. Omono emails documents to it. It must be a full address with a top-level domain, such as `.com` or `.co.uk`.\n"
          },
          "jobTitle": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The contact's job title, up to 50 characters."
          },
          "departmentId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the contact's department, from [List all departments](#tag/organisation). It must be a department that isn't archived.\n",
            "minLength": 1
          },
          "telephone1": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The contact's main telephone number, up to 50 characters."
          },
          "telephone2": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The contact's other telephone number, up to 50 characters."
          },
          "addressId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the company address to link the contact to. It must be one of this company's addresses and not archived, or the request fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the contact, such as its ID in your CRM. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. If another of your organisation's contacts already has it, archived ones included, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one, so a contact you send twice is created only once. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "firstName",
          "lastName",
          "email"
        ]
      },
      "ContactUpdate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The fields to change on a contact. Any fields you leave out stay as they are, and `null` clears an optional field. You can't change an archived contact, so unarchive it first by sending `archived: false` with your changes. Otherwise the request fails with a `409` error and the code `contact-archived`.\n",
        "properties": {
          "firstName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The contact's first name, up to 50 characters. It can't contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "lastName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The contact's last name, up to 50 characters. It can't contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "email": {
            "type": "string",
            "maxLength": 254,
            "pattern": "^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$",
            "description": "The contact's email address, up to 254 characters. Omono emails documents to it. It must be a full address with a top-level domain, such as `.com` or `.co.uk`.\n"
          },
          "jobTitle": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The contact's job title, up to 50 characters."
          },
          "departmentId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the contact's department, from [List all departments](#tag/organisation). It must be a department that isn't archived.\n",
            "minLength": 1
          },
          "telephone1": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The contact's main telephone number, up to 50 characters."
          },
          "telephone2": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The contact's other telephone number, up to 50 characters."
          },
          "addressId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the company address to link the contact to. It must be one of this company's addresses and not archived, or the request fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the contact should be archived. Send the state you want, not a toggle: sending the current value changes nothing. If you send other fields as well, `false` unarchives the contact before applying them, and `true` archives it afterwards. You can't archive the company's last contact that isn't archived: the request fails with a `409` error and the code `last-contact`, and nothing changes.\n"
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the contact. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. Send `null` to remove it. If another of your organisation's contacts already has it, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one. Learn more about [external references](/docs/writing#external-references).\n"
          }
        }
      },
      "AddressList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The addresses on this page.",
                "items": {
                  "$ref": "#/components/schemas/Address"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "AddressCreate": {
        "type": "object",
        "additionalProperties": false,
        "description": "A new address for a company. Omono removes any spaces at the start or end of its text fields. The accounts address needs an `accountsEmail`, because every invoice email goes to it.\n",
        "properties": {
          "accountsAddress": {
            "type": "boolean",
            "description": "Whether to make this the company's accounts address. The default is `false`. If you set it to `true`, the company's current accounts address becomes an ordinary address, and the company's telephone, postcode and country change to match this one. When you create a company, it's always `true`.\n"
          },
          "companyName": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The name to print as the first line of the address, up to 100 characters. If you leave it out or send `null`, Omono uses the company's name. It can't contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "line1": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "The first line of the address, up to 500 characters."
          },
          "line2": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 500,
            "description": "The second line of the address, up to 500 characters."
          },
          "city": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "The town or city, up to 255 characters."
          },
          "county": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 255,
            "description": "The county, up to 255 characters."
          },
          "postcode": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The postcode, up to 50 characters. Omono converts it to capital letters."
          },
          "countryId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the country the address is in, from [List all countries](#tag/tax-and-currency).\n",
            "minLength": 1
          },
          "telephone": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The telephone number at this address, up to 50 characters."
          },
          "accountsEmail": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 254,
            "pattern": "^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$",
            "description": "The email address that the company's invoices are sent to, up to 254 characters. It must be a full address with a top-level domain, such as `.com` or `.co.uk`. It's required when `accountsAddress` is `true`: if you leave it out, the request fails with a `422` error and the code `missing-required-field`.\n"
          },
          "eoriNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The customer's EORI number for deliveries to this address, up to 50 characters. When it's set, it's used instead of the EORI number on the company.\n"
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the address, such as its ID in your web shop or CRM. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. If another of your organisation's addresses already has it, archived ones included, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one, so a address you send twice is created only once. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "line1",
          "city",
          "countryId"
        ],
        "if": {
          "properties": {
            "accountsAddress": {
              "const": true
            }
          },
          "required": [
            "accountsAddress"
          ]
        },
        "then": {
          "properties": {
            "accountsEmail": {
              "type": "string"
            }
          }
        }
      },
      "AddressUpdate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The fields to change on an address. Any fields you leave out stay as they are, and `null` clears an optional field. You can't change an archived address, so unarchive it first by sending `archived: false` with your changes. Otherwise the request fails with a `409` error and the code `address-archived`.\n",
        "properties": {
          "accountsAddress": {
            "type": "boolean",
            "description": "Set this to `true` to make the address the company's accounts address. The old accounts address becomes an ordinary address, and the company's telephone, postcode and country change to match this one. You can't set it to `false` on the accounts address: make another address the accounts address instead, or the request fails with a `409` error and the code `accounts-address-protected`. To make an archived address the accounts address, unarchive it in one request, then set `accountsAddress` in the next.\n"
          },
          "companyName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The name to print as the first line of the address, up to 100 characters. You can change it but not clear it: sending `null` fails with a `422` error and the code `validation-failed`. It can't contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "line1": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "The first line of the address, up to 500 characters."
          },
          "line2": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 500,
            "description": "The second line of the address, up to 500 characters."
          },
          "city": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "The town or city, up to 255 characters."
          },
          "county": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 255,
            "description": "The county, up to 255 characters."
          },
          "postcode": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The postcode, up to 50 characters. Omono removes any spaces at the start or end and converts it to capital letters."
          },
          "countryId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the country the address is in, from [List all countries](#tag/tax-and-currency).\n",
            "minLength": 1
          },
          "telephone": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The telephone number at this address, up to 50 characters."
          },
          "accountsEmail": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 254,
            "pattern": "^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$",
            "description": "The email address that the company's invoices are sent to, up to 254 characters. It must be a full address with a top-level domain, such as `.com` or `.co.uk`. The accounts address must have one, including an address you make the accounts address in this request: without one, the request fails with a `422` error and the code `missing-required-field`. On other addresses, send `null` to clear it.\n"
          },
          "eoriNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The customer's EORI number for deliveries to this address, up to 50 characters. When it's set, it's used instead of the EORI number on the company.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the address should be archived. Send the state you want, not a toggle: sending the current value changes nothing. If you send other fields as well, `false` unarchives the address before applying them, and `true` archives it afterwards. You can't archive the accounts address: the request fails with a `409` error and the code `accounts-address-protected`.\n"
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the address. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. Send `null` to remove it. If another of your organisation's addresses already has it, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one. Learn more about [external references](/docs/writing#external-references).\n"
          }
        }
      },
      "CustomerPrice": {
        "type": "object",
        "description": "One price on a customer's price list: the price of a stock item for this customer from a minimum quantity, on the price list that takes effect on `effectiveDate`. The price is in the customer's currency, which the list names as `currencyId`.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the price."
          },
          "stockItemId": {
            "type": "string",
            "description": "The ID of the stock item this price is for."
          },
          "minQuantity": {
            "type": "number",
            "description": "The smallest quantity this price applies to. On a line for this quantity or more, Omono uses this price unless the same price list has a higher minimum quantity that the line also reaches.\n"
          },
          "price": {
            "type": "number",
            "description": "The list price of one unit, in the customer's currency, before any discount."
          },
          "customerRef": {
            "type": [
              "string",
              "null"
            ],
            "description": "The customer's own reference for the stock item, such as their part number, or `null` if there isn't one."
          },
          "effectiveDate": {
            "type": "string",
            "format": "date",
            "description": "The day the price list this price is on takes effect, in the format `YYYY-MM-DD`. It's the date your team chose in Omono, with no time and no time zone.\n"
          },
          "created": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the price was added to the price list. The `created_gte` and `created_lte` filters work on it. It's `null` if none is saved.",
            "examples": [
              "2026-10-28T14:02:11.000Z"
            ]
          },
          "updated": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the price was last changed."
          }
        },
        "required": [
          "id",
          "stockItemId",
          "minQuantity",
          "price",
          "customerRef",
          "effectiveDate",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "CustomerPriceList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The prices on this page, sorted by effective date, then by an order that stays the same from page to page.",
                "items": {
                  "$ref": "#/components/schemas/CustomerPrice"
                }
              },
              "currencyId": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The ID of the customer's currency, which every price on the list is in. It's `null` only if the company has no currency."
              },
              "effectiveDates": {
                "type": "array",
                "maxItems": 100,
                "description": "The days the customer's price lists take effect, in the format `YYYY-MM-DD`, oldest first. Use one of them as `effectiveDate` to read that price list. A price list with no prices on it isn't listed. If the customer has more than 100, this lists the latest 100.\n",
                "items": {
                  "type": "string",
                  "format": "date"
                }
              }
            },
            "required": [
              "data",
              "currencyId",
              "effectiveDates"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "LinePrice": {
        "type": "object",
        "description": "The price Omono fills in when you add this stock item to a quote or sales order for this customer, for this quantity. It comes from the customer's price list if one applies, and from the stock item's sell price if not. The price list is always the one in effect today, whatever the date of the quote or sales order.\n",
        "properties": {
          "price": {
            "type": "number",
            "description": "The list price of one unit, before any discount, in the currency `currencyId` names. Omono doesn't convert it: a sell price is in your organisation's base currency. `linePrice` has the price in a quote's or sales order's currency. It's `0`, with `source` `stock-sell-price`, when the stock item has no sell price or can't be sold, as Omono fills in on a new line, and a price of 0 on the price list is used as it is. A `0` means Omono holds no price for the item: don't send a line at 0 unless you mean it to be free.\n"
          },
          "source": {
            "description": "Where the price comes from. `customer-price-list` is a price on the customer's price list, in the customer's currency. `stock-sell-price` is the stock item's sell price, in your organisation's base currency, used when no price on the price list in effect applies.\n\nKnown values: `customer-price-list`, `stock-sell-price`. Omono can add values; handle one you don't recognise.\n",
            "type": "string",
            "x-known-values": [
              "customer-price-list",
              "stock-sell-price"
            ]
          },
          "currencyId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the currency `price` is in: the customer's currency for `customer-price-list`, and your organisation's base currency for `stock-sell-price`. It's `null` only if that record has no currency.\n"
          },
          "effectiveDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The day the price list the price comes from takes effect, in the format `YYYY-MM-DD`, or `null` for `stock-sell-price`."
          },
          "minQuantity": {
            "type": [
              "number",
              "null"
            ],
            "description": "The minimum quantity of the price list's price that applies, or `null` for `stock-sell-price`."
          },
          "discount": {
            "type": "number",
            "description": "The discount, as a percentage, Omono fills in on the line: 0 for `customer-price-list`, and the customer's sales discount, or 0 if it has none, for `stock-sell-price`. Send it as the line's `discount`.\n"
          },
          "linePrice": {
            "type": [
              "number",
              "null"
            ],
            "description": "The price to send as the line's `price`, in the currency `lineCurrencyId` names, if you sent `quoteId` or `salesOrderId`. A price-list price isn't converted. A sell price is converted with the document's exchange rate as Omono does it. Both are rounded to your organisation's Unit Pricing setting, 2 or 4 decimal places. It's `null` if you didn't name a document, if the price is a sell price and the document has no exchange rate, or if the price is from the price list and the document's currency isn't the customer's currency now. A price-list price is in the customer's current currency, and a document made before the customer's currency changed keeps the old one, so that price isn't in the document's currency.\n"
          },
          "lineCurrencyId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the named quote's or sales order's currency, or `null` if you didn't name one."
          }
        },
        "required": [
          "price",
          "source",
          "currencyId",
          "effectiveDate",
          "minQuantity",
          "discount",
          "linePrice",
          "lineCurrencyId"
        ],
        "additionalProperties": true
      },
      "Note": {
        "type": "object",
        "description": "A note on a record: a line of history that someone wrote, or that Omono wrote when something happened to the record. Notes can't be changed or deleted through the API.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the note."
          },
          "kind": {
            "description": "Who wrote the note. `user` is a note that a person wrote in Omono, or that an API key added. `system` is a note that Omono wrote itself to record a change, such as a new status or a changed date. A task's notes are always `user` notes.\n\nKnown values: `user`, `system`. Omono can add values; handle one you don't recognise.\n",
            "type": "string",
            "x-known-values": [
              "user",
              "system"
            ]
          },
          "text": {
            "type": "string",
            "description": "The note's text, as plain text, with a line break between lines. Formatting that staff added in Omono isn't included. It can differ from the text an API key sent: Omono removes spaces and line breaks from the start and end, and replaces a character that isn't valid Unicode.\n"
          },
          "authorName": {
            "type": "string",
            "description": "The name Omono shows as the note's author, as it was when the note was written. A note that an API key added shows `API · ` and the key's name, such as `API · Zapier`. It's an empty string when Omono has no name for the author.\n"
          },
          "userId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the user the note is recorded against, or `null` if there isn't one. For a note that an API key added, it's your organisation's API user, which is the same for every key. Your users are listed by [List all users](#tag/organisation).\n"
          },
          "apiKeyId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the API key that added the note, or `null` if no key added it.\n"
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the note was written."
          }
        },
        "required": [
          "id",
          "kind",
          "text",
          "authorName",
          "userId",
          "apiKeyId",
          "created"
        ],
        "additionalProperties": true
      },
      "NoteList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The notes on this page.",
                "items": {
                  "$ref": "#/components/schemas/Note"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "NoteCreate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The note to add. A note is plain text: Omono shows it as you send it, with no formatting.\n",
        "properties": {
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000,
            "pattern": "^(?=\\s*\\S)[^\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F\\u007F\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The note's text, between 1 and 2,000 characters, as plain text. It must contain at least one character that isn't a space or a line break. It can have up to 50 lines: start a new line with a line feed (`\\n`). Tabs are allowed, but other control characters aren't, and neither are the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          }
        },
        "required": [
          "text"
        ]
      },
      "QuoteRevisionSummary": {
        "type": "object",
        "description": "A short summary of one revision of a quote. A revision is a version of the quote, with its own details and line items, that staff create in Omono when the quote changes after it has been sent.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the revision."
          },
          "revisionNo": {
            "type": "integer",
            "description": "The revision's place in the sequence. The original version is `0`, the first revision is `1`, and so on."
          },
          "label": {
            "type": "string",
            "description": "The revision's name, as Omono shows it and prints it on the quote: \"Original\" for the first version, then \"A\", \"B\", \"C\" and so on."
          },
          "isLatest": {
            "type": "boolean",
            "description": "Whether this is the latest revision. The latest revision is the one that changes when you update the quote."
          },
          "isWon": {
            "type": "boolean",
            "description": "Whether the quote's sales order (`salesOrderId`) was created from this revision. It isn't always the latest revision, because staff can win a quote from an earlier one. If that sales order is deleted, no revision is marked as won, although the quote stays Won.\n"
          },
          "totalValue": {
            "type": "number",
            "description": "The total value of this revision, before tax, in the quote's currency. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains.\n"
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the revision was created."
          }
        },
        "required": [
          "id",
          "revisionNo",
          "label",
          "isLatest",
          "isWon",
          "totalValue",
          "created"
        ],
        "additionalProperties": true
      },
      "LineItemBomItem": {
        "type": "object",
        "description": "One component in the bill of materials (BOM) of an assembly on a line item. An assembly is a stock item built from other stock items, and its bill of materials lists those components. You can read BOM items, but you can't change them through the API.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the BOM item."
          },
          "stockItemId": {
            "type": "string",
            "description": "The ID of the component's stock item."
          },
          "quantity": {
            "type": "number",
            "x-decimal-places": 4,
            "description": "How many of this component go into one unit of the assembly, with up to 4 decimal places."
          }
        },
        "required": [
          "id",
          "stockItemId",
          "quantity"
        ],
        "additionalProperties": true
      },
      "QuoteLineItem": {
        "type": "object",
        "description": "A line item on the presented revision of a quote.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the line item."
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for the line item, such as the line's ID in your system, or `null` if it has none. Only the API sets it. It's unique among the line items of its quote revision. Learn more about [external references](/docs/writing#external-references).\n"
          },
          "stockItemId": {
            "type": "string",
            "description": "The ID of the [stock item](#tag/stock-items) on this line item. It can't change after the line item is created."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "The line item's description, as plain text, or `null` if there isn't one."
          },
          "quantity": {
            "type": "number",
            "minimum": 0,
            "x-decimal-places": 4,
            "description": "The quantity quoted, with up to 4 decimal places. It can be zero, but it can't be negative.\n"
          },
          "unitPrice": {
            "type": "number",
            "description": "The net price of one unit, after the discount. It's normally `price` reduced by the `discount` percentage, rounded to your organisation's Unit Pricing precision. The line item's total is `quantity` multiplied by `unitPrice`, rounded to 2 decimal places, and the quote's totals are worked out from `unitPrice`. A price saved earlier can have more decimal places than your Unit Pricing setting, so don't assume a fixed number. Learn more about [money](/docs/conventions#money).\n"
          },
          "price": {
            "type": "number",
            "description": "The list price of one unit, before any discount. Omono rounds a price you send to your organisation's Unit Pricing precision, 2 or 4 decimal places, but a price saved earlier can have more, so don't assume a fixed number of decimal places. Learn more about [money](/docs/conventions#money).\n"
          },
          "discount": {
            "type": "number",
            "description": "The discount on this line item, as a percentage. It's `0` when there's no discount. A discount you send must be between 0 and 100, but Omono returns the value as it's stored, so a discount saved another way can be outside that range."
          },
          "taxRateId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the line item's tax rate. Your tax rates are listed by [List all tax rates](#tag/tax-and-currency). It's `null` only on some old line items that were saved without a rate. To change such a line item, send a `taxRateId` with your change, because a line item can't be saved without a tax rate and `null` is refused.\n"
          },
          "salesAnalysisId": {
            "type": "string",
            "description": "The ID of the line item's sales analysis code, which groups your sales for reporting. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings)."
          },
          "tagNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "An optional label for the line item, such as the customer's part reference or a machine number, or `null` if there isn't one."
          },
          "lastCost": {
            "type": [
              "number",
              "null"
            ],
            "description": "The cost of one unit, in the quote's currency, as the line item saved it, or `null` if none is saved. It's the **Last Cost** in the line item window in Omono. When the line item is added, Omono fills it in from the latest purchase order for the stock item that's on order, a call-off or complete (the highest `price` on it if it has several line items for the stock item), or from the stock item's `cost` if that changed after that order or there's no such order, converted into the quote's currency and rounded to your organisation's purchasing decimal places. For an assembly, it's the cost of each component multiplied by its quantity, added up. Staff can change it on the line item, and it doesn't follow later changes to the stock item's cost. When the API adds a line item and Omono finds no cost, because the stock item has no such purchase order and no `cost`, the line item saves a `lastCost` of 0, not `null`. A `lastCost` of 0 means no cost is known for the line item, and its `margin` is then `null`. Only a key that also has the `stock:read` scope gets it, and `stock:write` includes `stock:read`. For any other key the field is left out, not `null`.\n"
          },
          "margin": {
            "type": [
              "number",
              "null"
            ],
            "description": "The line item's margin, as a percentage of its net price for one unit, as the line item saved it. It's the **Margin** in the line item window in Omono: (net price − `lastCost`) ÷ net price × 100, where the net price is `price` reduced by the `discount` percentage, with up to 2 decimal places. For example, a net price of 80 and a cost of 60 give `25`. It's `0` when the price is 0 or the `discount` is 100%, because the net price is then 0, and below 0 when the cost is more than a net price above 0. It's `null` when the line item has no cost, that is when `lastCost` is 0 or `null`, because a margin worked out against no cost means nothing. It's also `null` if none is saved. Omono saves it with the line item, and it stays as saved until the line item changes. Only a key that also has the `stock:read` scope gets it, and `stock:write` includes `stock:read`. For any other key the field is left out, not `null`.\n"
          },
          "leadTime": {
            "type": [
              "string",
              "null"
            ],
            "description": "The lead time quoted for this line item, as free text, or `null` if there isn't one. When the quote is won, it's copied to the sales order line item as `quotedLeadTime`."
          },
          "commodityCodeId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the line item's commodity code for customs paperwork, or `null` if there isn't one. Your commodity codes are listed by [List all commodity codes](#tag/purchasing-and-shipping)."
          },
          "countryOfOriginId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the country the goods were made in, for customs paperwork, or `null` if it isn't set. Countries are listed by [List all countries](#tag/tax-and-currency)."
          },
          "bomItems": {
            "type": "array",
            "description": "The components of the line item's stock item, if it's an assembly, which is a stock item built from other stock items. This list is the assembly's bill of materials (BOM), and it's empty for any other stock item. Omono copies the BOM from the stock item when the line item is added, and staff can change it for this quote in Omono. You can't change it through the API.",
            "items": {
              "$ref": "#/components/schemas/LineItemBomItem"
            }
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the line item was created."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the line item was last changed."
          }
        },
        "required": [
          "id",
          "externalRef",
          "stockItemId",
          "description",
          "quantity",
          "unitPrice",
          "price",
          "discount",
          "taxRateId",
          "salesAnalysisId",
          "tagNumber",
          "leadTime",
          "commodityCodeId",
          "countryOfOriginId",
          "bomItems",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "Quote": {
        "type": "object",
        "description": "A quote is a priced offer to one of your customers. A quote can have several revisions, and its fields show the details of its presented revision: the revision the customer accepted if the quote is won, and otherwise the latest revision.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the quote."
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for the quote, such as its ID in your CRM, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's quotes, archived ones included, and cancelled ones, so you can find the quote again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references).\n"
          },
          "quoteNo": {
            "type": "string",
            "description": "The quote number, as a string and without the \"SQ-\" prefix. It stays the same on every revision of the quote."
          },
          "companyId": {
            "type": "string",
            "description": "The ID of the customer the quote is for. You set it when you create the quote, and it can't change after that."
          },
          "currencyId": {
            "type": "string",
            "description": "The ID of the quote's currency, which is always the customer's currency. You can't set it, because Omono copies it from the company. Currencies are listed by [List all currencies](#tag/tax-and-currency)."
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuoteStatus"
              }
            ],
            "description": "The quote's status, which is one of `draft`, `active`, `won` or `lost`. A quote starts as a Draft, becomes Active once it has been sent to the customer, and ends as Won or Lost. You can't set this field directly. To move a Draft quote to Active, activate it with `POST /quotes/{id}/activate`. Staff mark quotes as won or lost, and reactivate lost ones, in Omono. A quote also goes back to Draft when someone creates a new revision in Omono, and if your organisation closes old quotes automatically, an Active quote can become Lost without anyone changing it.\n"
          },
          "salesPersonId": {
            "type": "string",
            "description": "The ID of the user responsible for the quote, shown on it as the sales person. Your users are listed by [List all users](#tag/organisation)."
          },
          "contactId": {
            "type": "string",
            "description": "The ID of the contact at the customer who the quote is for."
          },
          "addressId": {
            "type": "string",
            "description": "The ID of the customer's address that the goods would be delivered to. On a quote where the customer collects the goods, it's the customer's accounts address."
          },
          "customerCollection": {
            "type": "boolean",
            "description": "Whether the customer collects the goods themselves. When it's `true`, the quote's paperwork prints \"Customer Collection\" instead of a delivery address, and the sales order created when the quote is won is a collection order too. That order takes the value from the revision that was won.\n"
          },
          "refNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The customer's reference for their enquiry, or `null` if there isn't one."
          },
          "delivery": {
            "type": [
              "string",
              "null"
            ],
            "description": "Free-text delivery terms, for example \"4 weeks from order\", or `null` if there are none."
          },
          "validityId": {
            "type": "string",
            "description": "The ID of the quote validity, which says how long the quote stands. Your quote validities are listed by [List all quote validities](#tag/sales-settings)."
          },
          "chaseBy": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The date to follow the quote up with the customer, as `YYYY-MM-DD`, or `null` if there isn't one. If your organisation uses task automation, Omono creates a follow-up task due on this date, moves it when the date changes and cancels it when the date is cleared. Learn more about [dates](/docs/conventions#dates)."
          },
          "exchangeRate": {
            "type": [
              "number",
              "null"
            ],
            "description": "The exchange rate for the quote: the number of units of the quote's currency that equal 1 unit of your base currency. If you send back the value you read in an update, the rate doesn't change. It's `null` only on some old quotes that were saved without a rate. Learn more about [money](/docs/conventions#money).\n"
          },
          "eoriNumberId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of your organisation's EORI number to show on the quote, or `null` if there isn't one. An EORI number identifies your business to customs. Your EORI numbers are listed by [List all EORI numbers](#tag/purchasing-and-shipping)."
          },
          "incotermId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the quote's incoterm, or `null` if there isn't one. An incoterm is a standard trade term that says who pays for shipping the goods and who carries the risk on the way. Your incoterms are listed by [List all incoterms](#tag/purchasing-and-shipping)."
          },
          "incotermNamedPlace": {
            "type": [
              "string",
              "null"
            ],
            "description": "The place named with the incoterm, for example a port, or `null` if there isn't one."
          },
          "conversionProbabilityId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the conversion probability, which says how likely you are to win the quote, or `null` if there isn't one. Your conversion probabilities are listed by [List all conversion probabilities](#tag/sales-settings)."
          },
          "expectedAwardDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The date you expect the customer to decide, as `YYYY-MM-DD`, or `null` if there isn't one. Omono uses it in quote forecasts and, if your organisation uses task automation, for a reminder task. If your organisation closes old quotes automatically, Omono counts the days from this date, and it never closes a quote that has no expected award date."
          },
          "enquiryReceivedDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The date the customer's enquiry arrived, as `YYYY-MM-DD`, or `null` if there isn't one."
          },
          "commissionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the commission for the quote, or `null` if there isn't one. A commission is a scheme set up in Omono with two parts, a referrer who earns commission on the sale and the rate they earn. Your commissions are listed by [List all commissions](#tag/sales-settings)."
          },
          "divisionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the division the quote belongs to, or `null` if it has none. Your divisions are listed by [List all divisions](#tag/organisation)."
          },
          "totalValue": {
            "type": "number",
            "description": "The total value of the presented revision, before tax, in the quote's currency. You can't set it, because Omono works it out from the line items. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains.\n"
          },
          "totalValueBase": {
            "type": [
              "number",
              "null"
            ],
            "description": "`totalValue` in your organisation's base currency, as Omono saved it, or `null` if the quote has none saved, as on some old records. Omono saves it each time it works out the total in the quote's currency, converted at the quote's exchange rate and rounded to 2 decimal places, so working it out yourself from the total and the `exchangeRate` can differ by 0.01. Learn more about [money](/docs/conventions#money). Like `totalValue`, it's the presented revision's.\n"
          },
          "lostReasonId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the reason the quote was lost. It's set only when the status is Lost, and it's `null` otherwise. Your lost-quote reasons are listed by [List all lost-quote reasons](#tag/sales-settings)."
          },
          "salesOrderId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the [sales order](#tag/sales-orders) created when the quote was won. It's `null` if the quote hasn't been won, or if that sales order has since been deleted."
          },
          "salesOrderNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The number of the sales order in `salesOrderId`, or `null` if there isn't one."
          },
          "revisions": {
            "type": "array",
            "description": "A summary of every revision of the quote, oldest first. You can't create or change revisions through the API, because staff create them in Omono.",
            "items": {
              "$ref": "#/components/schemas/QuoteRevisionSummary"
            }
          },
          "lineItems": {
            "type": "array",
            "description": "The line items of the presented revision, in the order they appear on the quote. A single quote always includes them, but a list includes them only when you ask with `include=lineItems`. A new revision gives every line item a new ID, so replace a quote's line items as a whole each time you read it. Learn more about [mirroring rules](/docs/syncing#mirroring-rules).\n",
            "items": {
              "$ref": "#/components/schemas/QuoteLineItem"
            }
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the quote was created."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the quote was last changed."
          }
        },
        "required": [
          "id",
          "externalRef",
          "quoteNo",
          "companyId",
          "currencyId",
          "status",
          "salesPersonId",
          "contactId",
          "addressId",
          "customerCollection",
          "refNo",
          "delivery",
          "validityId",
          "chaseBy",
          "exchangeRate",
          "eoriNumberId",
          "incotermId",
          "incotermNamedPlace",
          "conversionProbabilityId",
          "expectedAwardDate",
          "enquiryReceivedDate",
          "commissionId",
          "divisionId",
          "totalValue",
          "totalValueBase",
          "lostReasonId",
          "salesOrderId",
          "salesOrderNo",
          "revisions",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "QuoteList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The quotes on this page.",
                "items": {
                  "$ref": "#/components/schemas/Quote"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "QuoteLineItemCreate": {
        "type": "object",
        "additionalProperties": false,
        "description": "One entry in the `lineItems` array when you create a quote. Each entry adds a new line item to the quote's first revision. It needs `stockItemId`, `quantity` and `price`. Omono fills in the other fields if you leave them out, and `discount` is 0 unless you send one. You can't send `id` or `delete`, because every entry is a new line item. Either one fails with a `422` error and the code `validation-failed`. To change line items later, update the quote. Learn more about [creating a document with line items](/docs/writing#creating-a-document-with-lines).\n",
        "properties": {
          "stockItemId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the stock item to quote. It must be a stock item you sell, with `canSell` set to `true`, and it can't be archived. Otherwise the request fails with a `422` error and the code `invalid-reference`. Omono checks this first, so a stock item you don't sell is never reported as a missing `salesAnalysisId`.\n",
            "minLength": 1
          },
          "description": {
            "type": "string",
            "maxLength": 60000,
            "pattern": "^[^‎-‏‪-‮⁦-⁩﻿]*$",
            "description": "The line item's description, as plain text. It can be up to 60,000 characters, and it can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners. If you leave it out, Omono copies the stock item's `description`, not its `title`. If the stock item has no description, the line item's `description` is `null`. Omono stores the description with formatting, and that stored form must stay under 128 KB, so very long text can fail with a `422` error and the code `validation-failed`, even within the character limit. You can't send `null`.\n"
          },
          "quantity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "The quantity to quote, up to 1,000,000,000 and with up to 4 decimal places. If the stock item is an assembly, which is a stock item built from other stock items, the quantity must be a whole number, or the request fails with a `422` error and the code `validation-failed`.\n"
          },
          "unitPrice": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "The net price of one unit, after the discount, up to 1,000,000,000. It's optional. If you leave it out, Omono works it out from `price` and `discount`. If you send it, it can differ from that worked-out value by at most one unit in the last decimal place, or the request fails with a `422` error and the code `validation-failed`.\n"
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "The list price of one unit, before any discount, up to 1,000,000,000. Omono rounds it to your organisation's Unit Pricing precision, which is 2 or 4 decimal places. You always send the price yourself. To use the price Omono would fill in from the customer's price list or the stock item's sell price, look it up first with [Retrieve the price for a line](#tag/customer-prices/GET/companies/{id}/price).\n"
          },
          "discount": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "The discount, as a percentage between 0 and 100. If you leave it out, it's 0, because the API doesn't apply the customer's usual sales discount."
          },
          "taxRateId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the line item's tax rate. It can't be archived, and it can't be a system rate, one with `systemDefined` set to `true`, except for the exempt tax rate on tax-exempt stock. If you leave it out, Omono uses the customer's tax rate. You can't send `null`, because every line item needs a tax rate. Line items for tax-exempt stock always get your organisation's exempt tax rate, whatever you send. Learn more about [references](/docs/writing#references).\n",
            "minLength": 1
          },
          "salesAnalysisId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the line item's sales analysis code, which can't be archived. If you leave it out, Omono uses the stock item's code. If the stock item has no code, the request fails with a `422` error and the code `missing-required-field`.\n",
            "minLength": 1
          },
          "tagNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "An optional label for the line item, such as the customer's part reference or a machine number, up to 1,000 characters, or `null` for none."
          },
          "leadTime": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The lead time you're quoting for the line item, as free text up to 50 characters, for example \"4 weeks\", or `null` for none."
          },
          "commodityCodeId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the line item's commodity code for customs paperwork, which can't be archived. If you leave it out, Omono uses the stock item's commodity code, or else the default commodity code of the stock item's sales analysis code. Send `null` for none.\n",
            "minLength": 1
          },
          "countryOfOriginId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the country the goods were made in, for customs paperwork. It must be a country from [List all countries](#tag/tax-and-currency), or the request fails with a `422` error and the code `invalid-reference`. If you leave it out, Omono uses the stock item's country of origin, if it has one. Send `null` for none.\n",
            "minLength": 1
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the line item, such as the line's ID in your system. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. Two line items of one quote revision can't have the same one: two entries with the same value fail with a `422` error and the code `validation-failed`, and a value another line item already has fails with a `409` error and the code `duplicate-external-ref`. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "stockItemId",
          "quantity",
          "price"
        ]
      },
      "QuoteCreate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The quote to create: the customer, the details of the quote's first revision and, if you like, its line items. You can leave out `addressId` only when `customerCollection` is `true`. Omono fills in fields you leave out, as its own forms do, and `null` means you want a field left empty. Learn more about [prefilled fields](/docs/writing#prefilled-fields). Your organisation's settings can also make `chaseBy` and `expectedAwardDate` required, which `quotes.chaseByRequired` and `quotes.expectedAwardDateRequired` in [your settings](#tag/organisation/GET/settings) show.\n",
        "properties": {
          "companyId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the customer the quote is for. The company must be a customer (`isCustomer` is `true`) with an account manager, the user who looks after its account, and it can't be archived. You can't change it later. If the customer has no account manager, set one by updating the company first.\n",
            "minLength": 1
          },
          "salesPersonId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the user responsible for the quote. It must be a user whose `assignable` is `true` in [List all users](#tag/organisation). Archived users, users who represent a contact and your organisation's API user aren't assignable, and naming one makes the request fail with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "contactId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of a contact at the customer. The contact can't be archived, or the request fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "addressId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the customer's address that the goods would be delivered to. It's required unless `customerCollection` is `true`: if you leave it out of any other quote, the request fails with a `422` error and the code `missing-required-field`. The address can't be archived, or the request fails with a `422` error and the code `invalid-reference`. If `customerCollection` is `true`, it must be the customer's accounts address, or you can leave it out and Omono uses the accounts address.\n",
            "minLength": 1
          },
          "customerCollection": {
            "type": "boolean",
            "description": "Whether the customer collects the goods themselves. If it's `true`, `addressId` must be the customer's accounts address, or the request fails with a `422` error and the code `invalid-reference`. If you leave `addressId` out, Omono fills in the accounts address, and if the customer has none, the request fails with a `422` error and the code `missing-required-field`. Defaults to `false`.\n"
          },
          "refNo": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "The customer's reference for their enquiry, up to 200 characters."
          },
          "delivery": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "Free-text delivery terms, up to 200 characters, for example \"6 weeks from order\"."
          },
          "validityId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the quote validity, which says how long the quote stands. It can't be archived. Your quote validities are listed by [List all quote validities](#tag/sales-settings).",
            "minLength": 1
          },
          "chaseBy": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The date to follow the quote up, as `YYYY-MM-DD`. It can't be before today in your organisation's time zone, or the request fails with a `422` error and the code `validation-failed`. Your organisation can make this date required, which `quotes.chaseByRequired` in [your settings](#tag/organisation/GET/settings) shows, and then leaving it out fails with a `422` error and the code `missing-required-field`.\n"
          },
          "exchangeRate": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000,
            "x-decimal-places": 5,
            "description": "The exchange rate for the quote: the number of units of the quote's currency that equal 1 unit of your base currency, with up to 5 decimal places. Take the current rate from [List all currency rates](#tag/tax-and-currency). If the customer trades in your base currency, Omono always stores 1, whatever you send. Learn more about [money](/docs/conventions#money).\n"
          },
          "eoriNumberId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of your organisation's EORI number to show on the quote, which can't be archived. If you leave it out and your organisation has exactly one EORI number, Omono uses that one. Otherwise the quote has none. Send `null` for none.\n",
            "minLength": 1
          },
          "incotermId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the quote's incoterm, which can't be archived. Your incoterms are listed by [List all incoterms](#tag/purchasing-and-shipping).",
            "minLength": 1
          },
          "incotermNamedPlace": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100,
            "description": "The place named with the incoterm, for example a port, up to 100 characters."
          },
          "conversionProbabilityId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the conversion probability, which says how likely you are to win the quote. It can't be archived. If you leave it out, the quote has none, because the API doesn't estimate it the way Omono's quote form does.\n",
            "minLength": 1
          },
          "expectedAwardDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The date you expect the customer to decide, as `YYYY-MM-DD`. It can't be before today in your organisation's time zone, or the request fails with a `422` error and the code `validation-failed`. If your organisation closes old quotes automatically, this date is required, which `quotes.expectedAwardDateRequired` in [your settings](#tag/organisation/GET/settings) shows, and leaving it out fails with a `422` error and the code `missing-required-field`. The API doesn't estimate it when you leave it out, and a quote without it counts only in the undated total of the Quote Conversion Forecast report, not in its charts.\n"
          },
          "enquiryReceivedDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The date the customer's enquiry arrived, as `YYYY-MM-DD`. It can't be after today in your organisation's time zone, or the request fails with a `422` error and the code `validation-failed`. If you leave it out, Omono uses today. Send `null` for none.\n"
          },
          "commissionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the commission for the quote, which can't be archived. If you leave it out, Omono uses the customer's commission (`commissionId` on the company), if it has one. Send `null` for none. The Sales Commission report uses this field.\n",
            "minLength": 1
          },
          "divisionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the division the quote belongs to, which can't be archived. If you leave it out, Omono uses the customer's division (`customerDivisionId` on the company), as long as that division isn't archived. Otherwise the quote has none. Send `null` for none.\n",
            "minLength": 1
          },
          "lineItems": {
            "type": "array",
            "maxItems": 250,
            "description": "The line items of the quote's first revision, in the order you want them. They're optional, and you can send up to 250. Each entry adds a new line item, so you can't send `id` or `delete`. Each new line item for an assembly also brings the BOM items Omono copies from the assembly, and the line items and BOM items together can add up to at most 1,000. Otherwise the request fails with a `422` error and the code `validation-failed`. Learn more about [creating a document with line items](/docs/writing#creating-a-document-with-lines).\n",
            "items": {
              "$ref": "#/components/schemas/QuoteLineItemCreate"
            }
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the quote, such as its ID in your CRM. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. If another of your organisation's quotes already has it, archived ones included, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one, so a quote you send twice is created only once. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "companyId",
          "contactId",
          "salesPersonId",
          "validityId",
          "exchangeRate"
        ],
        "if": {
          "properties": {
            "customerCollection": {
              "const": true
            }
          },
          "required": [
            "customerCollection"
          ]
        },
        "else": {
          "required": [
            "addressId"
          ]
        }
      },
      "QuoteCreated": {
        "description": "The response to creating a quote: the new quote with its line items, plus `createdLineItems`, which gives the ID of the line item created from each entry in your `lineItems` array.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/Quote"
          },
          {
            "type": "object",
            "properties": {
              "createdLineItems": {
                "$ref": "#/components/schemas/CreatedLineItems"
              }
            },
            "required": [
              "lineItems",
              "createdLineItems"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "QuoteWithLineItems": {
        "description": "A quote with its line items always included. Every response that returns a single quote uses this shape.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Quote"
          },
          {
            "type": "object",
            "required": [
              "lineItems"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "QuoteLineItemWrite": {
        "type": "object",
        "additionalProperties": false,
        "description": "One entry in the `lineItems` array when you update a quote. Each entry adds, changes or deletes one line item on the quote's latest revision. A new line item needs `stockItemId`, `quantity` and `price`. Omono fills in the other fields if you leave them out, and `discount` is 0 unless you send one. Learn more about [changing line items](/docs/writing#line-changes).\n",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of an existing line item on the quote's latest revision, to change or delete it. Leave it out to add a new line item. If the ID isn't a line item on the latest revision of this quote, the request fails with a `422` error and the code `invalid-reference`. If you send the same ID twice, it fails with a `422` error and the code `validation-failed`.\n",
            "minLength": 1
          },
          "delete": {
            "type": "boolean",
            "description": "Set this to `true` to delete the line item named by `id`. Don't send any other fields with it, or the request fails with a `422` error and the code `validation-failed`.\n"
          },
          "stockItemId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the stock item to quote. A new line item needs it, and the stock item must be one you sell, with `canSell` set to `true`, and it can't be archived. Otherwise the request fails with a `422` error and the code `invalid-reference`. Omono checks this first, so a stock item you don't sell is never reported as a missing `salesAnalysisId`. Existing line items aren't checked again. You can't change the stock item of an existing line item, so leave `stockItemId` out or send the value it already has. A different value fails with a `409` error and the code `immutable-field`.\n",
            "minLength": 1
          },
          "description": {
            "type": "string",
            "maxLength": 60000,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The line item's description, as plain text. It can be up to 60,000 characters, and it can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners. If you leave it out on a new line item, Omono copies the stock item's `description`, not its `title`. If the stock item has no description, the line item's `description` is `null`. Omono stores the description with formatting, and that stored form must stay under 128 KB, so very long text can fail with a `422` error and the code `validation-failed`, even within the character limit. You can't send `null`, even though a line item you read can have a `null` description: to keep the description as it is, leave the field out.\n"
          },
          "quantity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "The quantity to quote, up to 1,000,000,000 and with up to 4 decimal places. If the stock item is an assembly, which is a stock item built from other stock items, the quantity must be a whole number, or the request fails with a `422` error and the code `validation-failed`. A quantity that's already stored is always accepted when you send it back, as long as it's no more than 1,000,000,000.\n"
          },
          "unitPrice": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "The net price of one unit, after the discount, up to 1,000,000,000. It's optional. If you leave it out, Omono works it out from `price` and `discount`. If you send it, it can differ from that worked-out value by at most one unit in the last decimal place, or the request fails with a `422` error and the code `validation-failed`.\n"
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "The list price of one unit, before any discount, up to 1,000,000,000. Omono rounds it to your organisation's Unit Pricing precision, which is 2 or 4 decimal places. On a new line item, you always send the price yourself. To use the price Omono would fill in from the customer's price list or the stock item's sell price, look it up first with [Retrieve the price for a line](#tag/customer-prices/GET/companies/{id}/price).\n"
          },
          "discount": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "The discount, as a percentage between 0 and 100. If you leave it out on a new line item, it's 0, because the API doesn't apply the customer's usual sales discount."
          },
          "taxRateId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the line item's tax rate. It can't be archived, and it can't be a system rate, one with `systemDefined` set to `true`, except for the exempt tax rate on tax-exempt stock. If you leave it out on a new line item, Omono uses the customer's tax rate. You can't send `null`, because every line item needs a tax rate. Line items for tax-exempt stock always get your organisation's exempt tax rate, whatever you send. Learn more about [references](/docs/writing#references).\n",
            "minLength": 1
          },
          "salesAnalysisId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the line item's sales analysis code, which can't be archived. If you leave it out on a new line item, Omono uses the stock item's code. If the stock item has no code, the request fails with a `422` error and the code `missing-required-field`.\n",
            "minLength": 1
          },
          "tagNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "An optional label for the line item, such as the customer's part reference or a machine number, up to 1,000 characters. Send `null` to clear it."
          },
          "leadTime": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50,
            "description": "The lead time you're quoting for the line item, as free text up to 50 characters, for example \"4 weeks\". Send `null` to clear it."
          },
          "commodityCodeId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the line item's commodity code for customs paperwork, which can't be archived. If you leave it out on a new line item, Omono uses the stock item's commodity code, or else the default commodity code of the stock item's sales analysis code. Send `null` for none.\n",
            "minLength": 1
          },
          "countryOfOriginId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the country the goods were made in, for customs paperwork. It must be a country from [List all countries](#tag/tax-and-currency), or the request fails with a `422` error and the code `invalid-reference`. If you leave it out on a new line item, Omono uses the stock item's country of origin, if it has one. Send `null` for none.\n",
            "minLength": 1
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the line item. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. On an existing line item, send `null` to remove it. Two line items of one quote revision can't have the same one: two entries with the same value fail with a `422` error and the code `validation-failed`, and a value another line item already has fails with a `409` error and the code `duplicate-external-ref`. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "if": {
          "not": {
            "required": [
              "id"
            ]
          }
        },
        "then": {
          "required": [
            "stockItemId",
            "quantity",
            "price"
          ]
        }
      },
      "QuoteUpdate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The fields to change on the quote's latest revision. Any fields you leave out stay as they are, and `null` clears a field that can be empty. You can't change a Won or Lost quote: a request that would change it fails with a `409` error and the code `quote-locked`, but one that sends back its current values succeeds. You can't change the customer either, so sending `companyId` fails with a `422` error and the code `unknown-field`. Any ID you change must point to a record that isn't archived, but you can send back an archived value that's already stored. Learn more about [references](/docs/writing#references).\n",
        "properties": {
          "salesPersonId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the user responsible for the quote. It must be a user whose `assignable` is `true` in [List all users](#tag/organisation). Archived users, users who represent a contact and your organisation's API user aren't assignable, and naming one makes the request fail with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "contactId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of a contact at the quote's customer. A new contact can't be archived, or the request fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "addressId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the customer's address that the goods would be delivered to. A new address can't be archived, or the request fails with a `422` error and the code `invalid-reference`. While `customerCollection` is `true`, a new address must be the customer's accounts address.\n",
            "minLength": 1
          },
          "customerCollection": {
            "type": "boolean",
            "description": "Whether the customer collects the goods themselves. If you set it to `true`, or change `addressId` while it's `true`, `addressId` must be the customer's accounts address, or the request fails with a `422` error and the code `invalid-reference`. Sending both unchanged is always accepted, so a quote keeps its address even after the customer's accounts address changes.\n"
          },
          "refNo": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "The customer's reference for their enquiry, up to 200 characters. Send `null` to clear it."
          },
          "delivery": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "Free-text delivery terms, up to 200 characters. Send `null` to clear them."
          },
          "validityId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the quote validity, which says how long the quote stands. It can't be archived.",
            "minLength": 1
          },
          "chaseBy": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The date to follow the quote up, as `YYYY-MM-DD`. If you change it, the new date can't be before today in your organisation's time zone, or the request fails with a `422` error and the code `validation-failed`. Send `null` to clear it. If your organisation requires a chase date (`quotes.chaseByRequired` in [your settings](#tag/organisation/GET/settings)), clearing it fails with a `422` error and the code `missing-required-field`. The same check runs on every request that sends any field except `lineItems`, `lineItemOrder` and `externalRef`. So on a quote that has no chase date, such as one created before your organisation required it, send `chaseBy` with any other change to its fields.\n"
          },
          "exchangeRate": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000,
            "x-decimal-places": 5,
            "description": "The exchange rate for the quote: the number of units of the quote's currency that equal 1 unit of your base currency, with up to 5 decimal places. Take the current rate from [List all currency rates](#tag/tax-and-currency). If the customer trades in your base currency, Omono always stores 1, whatever you send. Learn more about [money](/docs/conventions#money).\n"
          },
          "eoriNumberId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of your organisation's EORI number to show on the quote, which can't be archived. Send `null` to clear it.",
            "minLength": 1
          },
          "incotermId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the quote's incoterm, which can't be archived. Send `null` to clear it.",
            "minLength": 1
          },
          "incotermNamedPlace": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100,
            "description": "The place named with the incoterm, for example a port, up to 100 characters. Send `null` to clear it."
          },
          "conversionProbabilityId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the conversion probability, which says how likely you are to win the quote. It can't be archived. Send `null` to clear it.",
            "minLength": 1
          },
          "expectedAwardDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The date you expect the customer to decide, as `YYYY-MM-DD`. If you change it, the new date can't be before today in your organisation's time zone, or the request fails with a `422` error and the code `validation-failed`. Send `null` to clear it. If your organisation closes old quotes automatically (`quotes.expectedAwardDateRequired` in [your settings](#tag/organisation/GET/settings)), clearing it fails with a `422` error and the code `missing-required-field`. The same check runs on every request that sends any field except `lineItems`, `lineItemOrder` and `externalRef`. So on a quote that has no expected award date, send `expectedAwardDate` with any other change to its fields.\n"
          },
          "enquiryReceivedDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The date the customer's enquiry arrived, as `YYYY-MM-DD`. If you change it, the new date can't be after today in your organisation's time zone, or the request fails with a `422` error and the code `validation-failed`. Send `null` to clear it.\n"
          },
          "commissionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the commission for the quote, which can't be archived. Send `null` to clear it.",
            "minLength": 1
          },
          "divisionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the division the quote belongs to, which can't be archived. Send `null` to clear it.",
            "minLength": 1
          },
          "lineItems": {
            "type": "array",
            "maxItems": 250,
            "description": "A list of changes to the line items of the latest revision, with up to 250 entries. Each new line item for an assembly also brings the BOM items Omono copies from the assembly, and the line items and BOM items together can add up to at most 1,000. Otherwise the request fails with a `422` error and the code `validation-failed`. When you send it, you must also send `If-Match`. The list never changes the order of the line items: a line item you change keeps its place, and new line items go at the end, in the order you send them. To reorder the line items, send `lineItemOrder`. A request with `lineItems` counts as more than one request against your rate limits. Learn more about [changing line items](/docs/writing#line-changes) and [heavy writes](/docs/limits#heavy-writes).\n",
            "items": {
              "$ref": "#/components/schemas/QuoteLineItemWrite"
            }
          },
          "lineItemOrder": {
            "type": "array",
            "maxItems": 250,
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "description": "The order you want the latest revision's line items in, as a list of their IDs. This is the only way to reorder them, because `lineItems` never changes their order. List every line item that stays, once each. Leave out any line item your `lineItems` deletes in the same request, and any new line item you add, because new line items go after the ones you list, in the order you send them. An ID that isn't one of these line items fails with a `422` error and the code `invalid-reference`. A list that leaves a line item out, names one twice or names one you delete fails with a `422` error and the code `validation-failed`. Sending the current order changes nothing, so the ETag stays the same. When you send `lineItemOrder`, you must also send `If-Match`, and it counts against your rate limits in the same way as a `lineItems` change. Learn more about [changing line items](/docs/writing#line-changes).\n"
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the quote. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. Send `null` to remove it. If another of your organisation's quotes already has it, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one. Learn more about [external references](/docs/writing#external-references).\n"
          }
        }
      },
      "QuoteUpdated": {
        "description": "The response to updating a quote: the quote with its line items. If you sent `lineItems`, it also includes `createdLineItems`, which gives the ID of each line item you added. Otherwise that field is left out.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/QuoteWithLineItems"
          },
          {
            "type": "object",
            "properties": {
              "createdLineItems": {
                "$ref": "#/components/schemas/CreatedLineItems"
              }
            },
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "QuoteActionResult": {
        "type": "object",
        "description": "The response to a quote action: activating it, marking it as won or lost, or reactivating it. It tells you whether this request changed the quote, and it always includes the quote as it is now.\n",
        "properties": {
          "applied": {
            "type": "boolean",
            "description": "Whether this request changed the quote. It's `false` if the quote was already in the state you asked for, and in that case nothing changed."
          },
          "quote": {
            "$ref": "#/components/schemas/QuoteWithLineItems"
          }
        },
        "required": [
          "applied",
          "quote"
        ],
        "additionalProperties": true
      },
      "QuoteMarkWon": {
        "type": "object",
        "description": "Marks a quote as won. Both fields are optional, so you can send an empty object or no body.",
        "additionalProperties": false,
        "properties": {
          "revisionId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the revision to win. The default is the quote's latest revision. Any revision of the quote can be won.",
            "minLength": 1
          },
          "customerOrderNo": {
            "type": "string",
            "maxLength": 100,
            "description": "The customer's own reference for the new sales order, such as their purchase order number, up to 100 characters. It's required when `salesOrders.customerOrderNoRequired` is `true` in [your settings](#tag/organisation/GET/settings). Omono doesn't warn you if another order already has the same reference.\n"
          }
        }
      },
      "QuoteMarkLost": {
        "type": "object",
        "description": "Marks a quote as lost.",
        "additionalProperties": false,
        "properties": {
          "lostReasonId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the reason the quote was lost, from [List all lost-quote reasons](#tag/sales-settings). It must be a reason that isn't archived.",
            "minLength": 1
          }
        },
        "required": [
          "lostReasonId"
        ]
      },
      "LinkedPurchaseOrder": {
        "type": "object",
        "description": "A purchase order that staff raised from this sales order in Omono. You can't change it through the sales order.",
        "properties": {
          "purchaseOrderId": {
            "type": "string",
            "description": "The ID of the purchase order."
          },
          "purchaseOrderNo": {
            "type": "string",
            "description": "The purchase order's number, without the \"PO-\" prefix that Omono shows."
          }
        },
        "required": [
          "purchaseOrderId",
          "purchaseOrderNo"
        ],
        "additionalProperties": true
      },
      "OrderInvoice": {
        "type": "object",
        "description": "An invoice raised on the order. There's one for each dispatch that has been invoiced. Very occasionally an invoiced dispatch is missing from this list, so if you need to be certain, check each dispatch's `invoiceNo`, which you get with `include=dispatches`.\n",
        "properties": {
          "dispatchId": {
            "type": "string",
            "description": "The ID of the dispatch the invoice is for."
          },
          "invoiceNo": {
            "type": "string",
            "description": "The invoice number, without the \"INV-\" prefix that Omono shows. Invoice numbers come from a single sequence shared by your whole organisation.\n"
          },
          "invoiceDate": {
            "type": "string",
            "format": "date",
            "description": "The date of the invoice, as `YYYY-MM-DD`. Learn more about [dates](/docs/conventions#dates)."
          }
        },
        "required": [
          "dispatchId",
          "invoiceNo",
          "invoiceDate"
        ],
        "additionalProperties": true
      },
      "SalesOrderLineItem": {
        "type": "object",
        "description": "A line item on a sales order: a stock item, the quantity ordered and its price. Once a line item is on an invoiced dispatch, only its `quantity` can change. A change to any other field fails with a `409` error and the code `line-item-on-invoiced-dispatch`, although sending a field's current value is accepted.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the line item."
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for the line item, such as the line's ID in your system, or `null` if it has none. Only the API sets it. It's unique among the line items of the sales order. Learn more about [external references](/docs/writing#external-references).\n"
          },
          "stockItemId": {
            "type": "string",
            "description": "The ID of the stock item being sold. It can't change after the line item is created."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "The line item's description, as plain text. Any formatting added in Omono isn't included."
          },
          "quantity": {
            "type": "number",
            "minimum": 0,
            "x-decimal-places": 4,
            "description": "The quantity ordered. It's zero or more, with up to 4 decimal places.\n"
          },
          "unitPrice": {
            "type": "number",
            "description": "The net price of one unit, after the discount. It's `price` reduced by the `discount` percentage, rounded to your organisation's Unit Pricing precision. The line item's total is `quantity` multiplied by `unitPrice`, rounded to 2 decimal places, and the order's totals are worked out from `unitPrice` alone. A price saved earlier can have more decimal places than your Unit Pricing setting, so don't assume a fixed number. Learn more about [money](/docs/conventions#money).\n"
          },
          "price": {
            "type": "number",
            "description": "The list price of one unit, before any discount. Omono rounds a price you send to your organisation's Unit Pricing precision, 2 or 4 decimal places, but a price saved earlier can have more, so don't assume a fixed number of decimal places. Learn more about [money](/docs/conventions#money).\n"
          },
          "discount": {
            "type": "number",
            "description": "The discount on the line item, as a percentage. It's `0` when there's no discount. A discount you send must be between 0 and 100, but Omono returns the value as it's stored, so a discount saved another way can be outside that range."
          },
          "taxRateId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the line item's tax rate. Your tax rates are listed by [List all tax rates](#tag/tax-and-currency). It's `null` only on some old line items that were saved without a rate. When you change one of those line items, send a `taxRateId` with your change, because a line item can't be saved without a tax rate. If you leave it out, the request fails with a `422` error and the code `missing-required-field`, and sending `null` fails with a `422` error too.\n"
          },
          "salesAnalysisId": {
            "type": "string",
            "description": "The ID of the line item's sales analysis code, which groups your sales for reporting. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings)."
          },
          "tagNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "An optional label for the line item, such as the customer's part reference or a machine number, or `null` if there isn't one. It prints as \"Tag"
          },
          "lastCost": {
            "type": [
              "number",
              "null"
            ],
            "description": "The cost of one unit, in the order's currency, as the line item saved it, or `null` if none is saved. It's the **Last Cost** in the line item window in Omono. When the line item is added, Omono fills it in from the latest purchase order for the stock item that's on order, a call-off or complete (the highest `price` on it if it has several line items for the stock item), or from the stock item's `cost` if that changed after that order or there's no such order, converted into the order's currency and rounded to your organisation's purchasing decimal places. For an assembly, it's the cost of each component multiplied by its quantity, added up. Staff can change it on the line item, and it doesn't follow later changes to the stock item's cost. When the API adds a line item and Omono finds no cost, because the stock item has no such purchase order and no `cost`, the line item saves a `lastCost` of 0, not `null`. A `lastCost` of 0 means no cost is known for the line item, and its `margin` is then `null`. Only a key that also has the `stock:read` scope gets it, and `stock:write` includes `stock:read`. For any other key the field is left out, not `null`.\n"
          },
          "margin": {
            "type": [
              "number",
              "null"
            ],
            "description": "The line item's margin, as a percentage of its net price for one unit, as the line item saved it. It's the **Margin** in the line item window in Omono: (net price − `lastCost`) ÷ net price × 100, where the net price is `price` reduced by the `discount` percentage, with up to 2 decimal places. For example, a net price of 80 and a cost of 60 give `25`. It's `0` when the price is 0 or the `discount` is 100%, because the net price is then 0, and below 0 when the cost is more than a net price above 0. It's `null` when the line item has no cost, that is when `lastCost` is 0 or `null`, because a margin worked out against no cost means nothing. It's also `null` if none is saved. Omono saves it with the line item, and it stays as saved until the line item changes. Only a key that also has the `stock:read` scope gets it, and `stock:write` includes `stock:read`. For any other key the field is left out, not `null`.\n"
          },
          "quotedLeadTime": {
            "type": [
              "string",
              "null"
            ],
            "description": "The lead time that was quoted for this line item, copied from the quote line item's `leadTime` when the quote was won. It's `null` if the order didn't come from a quote or no lead time was quoted."
          },
          "commodityCodeId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the line item's commodity code for customs paperwork, or `null` if there isn't one. Your commodity codes are listed by [List all commodity codes](#tag/purchasing-and-shipping)."
          },
          "countryOfOriginId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the country the goods were made in, for customs paperwork, or `null` if it isn't set. Countries are listed by [List all countries](#tag/tax-and-currency)."
          },
          "bomItems": {
            "type": "array",
            "description": "The components of the line item's stock item, if it's an assembly, which is a stock item built from other stock items. This list is the assembly's bill of materials (BOM), and it's empty for any other stock item.",
            "items": {
              "$ref": "#/components/schemas/LineItemBomItem"
            }
          },
          "linkedPurchaseOrderId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the purchase order that staff raised in Omono for this line item, or `null` if there isn't one. For example, the supplier may ship the goods straight to your customer, which is called a drop shipment, or you may buy them in for this order alone, which is called back-to-back buying."
          },
          "linkedPurchaseOrderNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The number of the linked purchase order, without the \"PO-\" prefix that Omono shows, or `null` if there isn't one."
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the line item was created."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the line item was last changed."
          }
        },
        "required": [
          "id",
          "externalRef",
          "stockItemId",
          "description",
          "quantity",
          "unitPrice",
          "price",
          "discount",
          "taxRateId",
          "salesAnalysisId",
          "tagNumber",
          "quotedLeadTime",
          "commodityCodeId",
          "countryOfOriginId",
          "bomItems",
          "linkedPurchaseOrderId",
          "linkedPurchaseOrderNo",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "WorkflowStatusType": {
        "description": "The type of a workflow status. Your organisation names its statuses as it likes, but each status has one of these types, so build your integration on the `type` rather than on the status `name`. The status whose type is `final` is called the final status, and moving a dispatch to it ships the dispatch and raises its invoice.\n\nKnown values: `unallocated`, `allocated`, `on_hold`, `final`. Omono can add values; handle one you don't recognise.\n",
        "type": "string",
        "x-known-values": [
          "unallocated",
          "allocated",
          "on_hold",
          "final"
        ],
        "x-enum-descriptions": [
          "No stock is reserved for the dispatch yet. Moving an allocated dispatch back to a status of this type unpicks its goods and releases their stock. Omono asks staff to confirm this first, but a move through the API doesn't ask.",
          "Stock is reserved for the dispatch, so it can be picked. Moving a dispatch to a status of this type reserves its stock.",
          "The dispatch is on hold. While any of a sales order's dispatches is on hold, the order's status is `on_hold`.",
          "A status of this type is the last step in the workflow, and it's called the final status. Moving a dispatch to it ships the dispatch and raises its invoice, and the dispatch can't move again after that."
        ]
      },
      "KnownWorkflowStatusType": {
        "description": "The type of a workflow status. Your organisation names its statuses as it likes, but each status has one of these types, so build your integration on the `type` rather than on the status `name`. The status whose type is `final` is called the final status, and moving a dispatch to it ships the dispatch and raises its invoice.\n",
        "type": "string",
        "enum": [
          "unallocated",
          "allocated",
          "on_hold",
          "final"
        ],
        "x-enum-descriptions": [
          "No stock is reserved for the dispatch yet. Moving an allocated dispatch back to a status of this type unpicks its goods and releases their stock. Omono asks staff to confirm this first, but a move through the API doesn't ask.",
          "Stock is reserved for the dispatch, so it can be picked. Moving a dispatch to a status of this type reserves its stock.",
          "The dispatch is on hold. While any of a sales order's dispatches is on hold, the order's status is `on_hold`.",
          "A status of this type is the last step in the workflow, and it's called the final status. Moving a dispatch to it ships the dispatch and raises its invoice, and the dispatch can't move again after that."
        ]
      },
      "DispatchLineItem": {
        "type": "object",
        "description": "A line item on a dispatch, saying how much of one of the order's line items the dispatch ships. You can't change it through the API.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the dispatch line item."
          },
          "salesOrderLineItemId": {
            "type": "string",
            "description": "The ID of the sales order line item that this dispatch line item ships."
          },
          "stockItemId": {
            "type": "string",
            "description": "The ID of the stock item being shipped."
          },
          "quantity": {
            "type": "number",
            "x-decimal-places": 4,
            "description": "The quantity this dispatch ships, with up to 4 decimal places."
          },
          "pickedQuantity": {
            "type": "number",
            "x-decimal-places": 4,
            "description": "How much of `quantity` staff have picked and saved in Omono. A dispatch of stock items can ship once each of their lines is picked in full. It stays 0 on a line for an assembly, whose components are picked instead, and on a line for a never-diminishing item, which isn't picked. Whether the dispatch's stock is reserved is in the dispatch's `statusType`.\n"
          },
          "serialNumber": {
            "type": [
              "string",
              "null"
            ],
            "description": "The serial numbers recorded for the goods on this line item, or `null` if there aren't any. A line item has one serial number field for all its units, so several numbers are stored together, usually separated by commas."
          }
        },
        "required": [
          "id",
          "salesOrderLineItemId",
          "stockItemId",
          "quantity",
          "pickedQuantity",
          "serialNumber"
        ],
        "additionalProperties": true
      },
      "LegalTransition": {
        "type": "object",
        "description": "A workflow status that a dispatch can move to right now. The list includes every workflow status in your organisation except the dispatch's current one and any archived ones, in workflow order (`sortOrder`). The final status (the one whose type is `final`) is listed even when something stops the dispatch shipping, and `blockedBy` then says what. Archived statuses are never listed, and a move to one is refused, so drop any status ID you've saved that no longer appears here.\n",
        "properties": {
          "statusId": {
            "type": "string",
            "description": "The ID of the workflow status. Send it as `statusId` when you move the dispatch."
          },
          "name": {
            "type": "string",
            "description": "The status's name, as your organisation has set it up in Omono."
          },
          "type": {
            "$ref": "#/components/schemas/WorkflowStatusType"
          },
          "blockedBy": {
            "type": "array",
            "description": "The reasons a move to this status would be refused right now, in the order Omono checks them. The list is empty when nothing is in the way. Today, only the final status, which ships the dispatch, can be blocked. `dispatch-pick-not-saved` means the dispatch's picking is in progress in Omono, or it wasn't saved, so staff open the picking and press Save. `dispatch-not-fully-picked` means the goods aren't all picked in Omono yet. `blocking-tasks` means an open task linked to the order blocks shipping. `company-on-stop` means the customer is on stop, a hold that staff put on a customer's account in Omono. `proforma-not-paid` means a proforma customer hasn't paid yet. Omono can add new codes, so check whether the list is empty rather than looking for particular codes. A change to a task or to the customer doesn't change the order's `updated` time, so read this list again just before you ship. Learn more about [when a dispatch can't ship](/docs/workflow#when-a-dispatch-cannot-ship).\n",
            "items": {
              "description": "A code for one reason the move is blocked. Omono may add new codes, so make sure your code accepts values it doesn't recognise.\n\nKnown values: `dispatch-pick-not-saved`, `dispatch-not-fully-picked`, `blocking-tasks`, `company-on-stop`, `proforma-not-paid`. Omono can add values; handle one you don't recognise.\n",
              "type": "string",
              "x-known-values": [
                "dispatch-pick-not-saved",
                "dispatch-not-fully-picked",
                "blocking-tasks",
                "company-on-stop",
                "proforma-not-paid"
              ]
            }
          }
        },
        "required": [
          "statusId",
          "name",
          "type",
          "blockedBy"
        ],
        "additionalProperties": true
      },
      "Dispatch": {
        "type": "object",
        "description": "One shipment of goods from a sales order. Each dispatch has its own workflow status and, once it ships, its own invoice, so a dispatch with an `invoiceNo` has been invoiced. Through the API, you can create dispatches, read them, move them between workflow statuses and mark a proforma dispatch as paid. Staff allocate stock to them and pick them in Omono. `statusType` shows whether the dispatch's stock is reserved, and each line item shows how much is picked. [List all dispatches](#tag/dispatches/GET/dispatches) lists them across your sales orders.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the dispatch."
          },
          "salesOrderId": {
            "type": "string",
            "description": "The ID of the sales order the dispatch belongs to."
          },
          "salesOrderNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The number of the sales order, without the \"SO-\" prefix that Omono shows."
          },
          "customerOrderNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The reference your customer gave for the order, or `null` if there isn't one."
          },
          "companyId": {
            "type": "string",
            "description": "The ID of the customer, the sales order's company."
          },
          "dispatchNo": {
            "type": "integer",
            "description": "The dispatch's number within its sales order. Omono shows it after the order number, for example SO-1042-2 for the second dispatch on order 1042."
          },
          "statusType": {
            "description": "The type of the dispatch's workflow status, or `null` if Omono can't find the status. Omono reserves stock for a whole dispatch, not for each line item: when the dispatch moves to a status of type `allocated`, Omono adds the full quantity of each of its line items to the stock item's `allocated`, even when there isn't enough in stock. A status of type `final` means the dispatch has shipped and been invoiced.\n\nKnown values: `unallocated`, `allocated`, `on_hold`, `final`. Omono can add values; handle one you don't recognise.\n",
            "type": [
              "string",
              "null"
            ],
            "x-known-values": [
              "unallocated",
              "allocated",
              "on_hold",
              "final"
            ],
            "x-enum-descriptions": [
              "No stock is reserved for the dispatch yet. Moving an allocated dispatch back to a status of this type unpicks its goods and releases their stock. Omono asks staff to confirm this first, but a move through the API doesn't ask.",
              "Stock is reserved for the dispatch, so it can be picked. Moving a dispatch to a status of this type reserves its stock.",
              "The dispatch is on hold. While any of a sales order's dispatches is on hold, the order's status is `on_hold`.",
              "A status of this type is the last step in the workflow, and it's called the final status. Moving a dispatch to it ships the dispatch and raises its invoice, and the dispatch can't move again after that."
            ]
          },
          "statusId": {
            "type": "string",
            "description": "The ID of the dispatch's current workflow status. Your workflow statuses are listed by [List all workflow statuses](#tag/sales-settings)."
          },
          "dispatchDate": {
            "type": "string",
            "format": "date",
            "description": "The date the dispatch is due to ship, as `YYYY-MM-DD`. When the dispatch ships, Omono changes it to the invoice date. Learn more about [dates](/docs/conventions#dates).\n"
          },
          "courierId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the courier carrying the dispatch, or `null` if there isn't one. Staff set it in Omono, or you can send it when you ship the dispatch. Your couriers are listed by [List all couriers](#tag/purchasing-and-shipping).\n"
          },
          "trackingNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The courier's tracking number for the dispatch, or `null` if there isn't one. The invoice email and the invoice PDF print it. Staff set it in Omono. Through the API, you can send it when you ship the dispatch with `POST /sales-orders/{id}/transitions`, and change it later with `PATCH /sales-orders/{id}/dispatches/{dispatchId}`. On both, Omono removes any spaces at the start and end of the value you send, and an empty value, or one of only spaces, clears the tracking number. A value can be up to 200 characters.\n"
          },
          "deliveryNotes": {
            "type": [
              "string",
              "null"
            ],
            "description": "The dispatch's delivery notes, as plain text, or `null` if it has none. The delivery note prints them, so they're the place for instructions to the carrier or the customer, such as \"Deliver to the rear entrance\". Staff can add them in Omono, and you can send them when you create or change the dispatch.\n"
          },
          "invoiceNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The number of the dispatch's invoice, without the \"INV-\" prefix that Omono shows, or `null` if the dispatch hasn't been invoiced yet. Omono takes the next number from your organisation's invoice number sequence when the dispatch ships.\n"
          },
          "invoiceDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The date of the dispatch's invoice, as `YYYY-MM-DD`, or `null` if the dispatch hasn't been invoiced yet. Learn more about [dates](/docs/conventions#dates)."
          },
          "invoiceDueDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The date that payment of the invoice is due, as `YYYY-MM-DD`, or `null` if the dispatch hasn't been invoiced yet. Omono works it out from the customer's payment terms when the dispatch ships."
          },
          "proformaPaid": {
            "type": "boolean",
            "description": "Whether a proforma customer has paid for this dispatch. A proforma customer pays before their goods ship, so their dispatch can ship only once this is `true`. It's `false` until someone marks the dispatch as paid. Staff set it in Omono, or you can mark the dispatch as paid through the API before it ships.\n"
          },
          "totalValue": {
            "type": "number",
            "description": "The total value of the dispatch, before tax, in the order's currency. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains.\n"
          },
          "totalTax": {
            "type": "number",
            "description": "The total tax on the dispatch, in the order's currency. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains.\n"
          },
          "totalWithTax": {
            "type": "number",
            "description": "The total value of the dispatch including tax, in the order's currency. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains.\n"
          },
          "totalValueBase": {
            "type": [
              "number",
              "null"
            ],
            "description": "`totalValue` in your organisation's base currency, as Omono saved it, or `null` if the dispatch has none saved, as on some old records. Omono saves it each time it works out the total in the order's currency, converted at the order's exchange rate and rounded to 2 decimal places, so working it out yourself from the total and the `exchangeRate` can differ by 0.01. Learn more about [money](/docs/conventions#money).\n"
          },
          "totalTaxBase": {
            "type": [
              "number",
              "null"
            ],
            "description": "`totalTax` in your organisation's base currency, as Omono saved it, or `null` if the dispatch has none saved. Omono converts it the same way as `totalValueBase`. Learn more about [money](/docs/conventions#money).\n"
          },
          "lineItems": {
            "type": "array",
            "description": "The goods on the dispatch. Each entry says which of the order's line items it ships, and how many.",
            "items": {
              "$ref": "#/components/schemas/DispatchLineItem"
            }
          },
          "legalTransitions": {
            "type": "array",
            "description": "The workflow statuses this dispatch can move to right now. Choose one of these when you move the dispatch. The list is empty when the dispatch has already shipped, or when the order is a Draft or Cancelled. A dispatch has shipped once it's at the final status, the one whose type is `final`.\n",
            "items": {
              "$ref": "#/components/schemas/LegalTransition"
            }
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the dispatch was created."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the dispatch was last changed."
          }
        },
        "required": [
          "id",
          "salesOrderId",
          "salesOrderNo",
          "customerOrderNo",
          "companyId",
          "dispatchNo",
          "statusId",
          "statusType",
          "dispatchDate",
          "courierId",
          "trackingNo",
          "deliveryNotes",
          "invoiceNo",
          "invoiceDate",
          "invoiceDueDate",
          "proformaPaid",
          "totalValue",
          "totalTax",
          "totalWithTax",
          "totalValueBase",
          "totalTaxBase",
          "lineItems",
          "legalTransitions",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "SalesOrder": {
        "type": "object",
        "description": "An order from a customer for goods that you ship in one or more dispatches.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the sales order."
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for the sales order, such as its ID in your web shop, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's sales orders, archived ones included, and cancelled ones, so you can find the sales order again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references).\n"
          },
          "orderNo": {
            "type": "string",
            "description": "The order number, without the \"SO-\" prefix that Omono shows. Omono gives the order its number when it's created."
          },
          "companyId": {
            "type": "string",
            "description": "The ID of the customer the order is for. You set it when you create the order, and it can't change after that."
          },
          "currencyId": {
            "type": "string",
            "description": "The ID of the order's currency, which is always the customer's currency. You can't set it, because Omono copies it from the company. Currencies are listed by [List all currencies](#tag/tax-and-currency)."
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderStatus"
              }
            ],
            "description": "The order's status, which is one of `draft`, `on_order`, `complete`, `cancelled`, `on_hold` or `on_order_call_off`. A new order is a Draft until you activate it. After that, it's On Order, or On Order - Call Off if it's a call-off order. An order is On Hold while any of its dispatches is on hold, and Complete once everything on it has shipped. You can't set the status directly. It changes when you activate the order, when its dispatches move through the workflow, and when you set or clear `callOff`. Learn more about [statuses](/docs/conventions#statuses).\n"
          },
          "contactId": {
            "type": "string",
            "description": "The ID of the customer's contact for this order. It's always a contact of the order's company."
          },
          "addressId": {
            "type": "string",
            "description": "The ID of the address the goods go to. It's always one of the company's addresses. On a customer collection order, it's the company's accounts address."
          },
          "salesPersonId": {
            "type": "string",
            "description": "The ID of the user who is the sales person for this order. Your users are listed by [List all users](#tag/organisation)."
          },
          "customerCollection": {
            "type": "boolean",
            "description": "Whether the customer collects the goods themselves instead of having them delivered. When it's `true`, the order's paperwork prints \"Customer Collection\" instead of a delivery address. It's `false` on older orders.\n"
          },
          "customerOrderNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The customer's own reference for the order, such as their purchase order number, or `null` if there isn't one. Your organisation can make it required, which `salesOrders.customerOrderNoRequired` in [your settings](#tag/organisation/GET/settings) shows. If it does, a request that leaves it empty fails with a `422` error and the code `missing-required-field`.\n"
          },
          "callOff": {
            "type": "boolean",
            "description": "Whether this is a call-off order: a standing order that the customer takes in several deliveries over a period. Setting it on an order that's On Order (`on_order`) changes the status to On Order - Call Off (`on_order_call_off`), and clearing it changes the status back to On Order.\n"
          },
          "exchangeRate": {
            "type": [
              "number",
              "null"
            ],
            "description": "The exchange rate for the order: the number of units of the order's currency that equal 1 unit of your base currency. If you send back the value you read in an update, the rate doesn't change. It's `null` only on some old orders that were saved without a rate. Learn more about [money](/docs/conventions#money).\n"
          },
          "eoriNumberId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of your organisation's EORI number that prints on the order, or `null` if there isn't one. An EORI number identifies your business to customs. Your EORI numbers are listed by [List all EORI numbers](#tag/purchasing-and-shipping)."
          },
          "incotermId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the order's incoterm, or `null` if there isn't one. An incoterm is a standard trade term that says who pays for shipping the goods and who carries the risk on the way. Your incoterms are listed by [List all incoterms](#tag/purchasing-and-shipping)."
          },
          "incotermNamedPlace": {
            "type": [
              "string",
              "null"
            ],
            "description": "The place named with the incoterm, for example `Bristol, UK`, or `null` if there isn't one."
          },
          "commissionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the commission for the order, which the Sales Commission report uses, or `null` if there isn't one. Your commissions are listed by [List all commissions](#tag/sales-settings)."
          },
          "divisionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the division of your organisation that the order belongs to, or `null` if there isn't one. Your divisions are listed by [List all divisions](#tag/organisation)."
          },
          "totalValue": {
            "type": "number",
            "description": "The total value of the order, before tax, in the order's currency. You can't set it, because Omono works it out from the line items: each line item's quantity multiplied by its `unitPrice`, rounded to 2 decimal places, and then added up. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains.\n"
          },
          "totalValueBase": {
            "type": [
              "number",
              "null"
            ],
            "description": "`totalValue` in your organisation's base currency, as Omono saved it, or `null` if the order has none saved, as on some old records. Omono saves it each time it works out the total in the order's currency, converted at the order's exchange rate and rounded to 2 decimal places, so working it out yourself from the total and the `exchangeRate` can differ by 0.01. Learn more about [money](/docs/conventions#money).\n"
          },
          "quoteId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the quote this order was won from, or `null` if the order didn't come from a quote."
          },
          "quoteRevisionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the quote revision that was won to create this order, or `null` if the order didn't come from a quote. It matches one of the IDs in the quote's `revisions`.\n"
          },
          "quoteNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The number of the quote this order was won from, without the \"SQ-\" prefix, or `null` if the order didn't come from a quote."
          },
          "wentActiveAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The time the order was activated and stopped being a Draft, whether that happened in Omono or through the API. It's `null` if the order has never been active."
          },
          "linkedPurchaseOrders": {
            "type": "array",
            "description": "The purchase orders that staff raised from this order in Omono to buy the goods it needs. The list is empty if there aren't any.",
            "items": {
              "$ref": "#/components/schemas/LinkedPurchaseOrder"
            }
          },
          "invoices": {
            "type": "array",
            "description": "The invoices raised on this order, one for each dispatch that has been invoiced. The list is empty until the first dispatch ships.",
            "items": {
              "$ref": "#/components/schemas/OrderInvoice"
            }
          },
          "lineItems": {
            "type": "array",
            "description": "The order's line items, in order. When you retrieve a single order, they're always included. In a list of orders, they're included only if you ask for them with `include=lineItems`.\n",
            "items": {
              "$ref": "#/components/schemas/SalesOrderLineItem"
            }
          },
          "dispatches": {
            "type": "array",
            "description": "The order's dispatches, sorted by `dispatchNo`. Each one lists the statuses it can move to in `legalTransitions`. They're included only if you ask for them with `include=dispatches`, but they're always included when you move a dispatch or mark a proforma dispatch as paid.\n",
            "items": {
              "$ref": "#/components/schemas/Dispatch"
            }
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the order was created."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the order was last changed. A change to any of its dispatches also changes this time."
          }
        },
        "required": [
          "id",
          "externalRef",
          "orderNo",
          "companyId",
          "currencyId",
          "status",
          "contactId",
          "addressId",
          "salesPersonId",
          "customerCollection",
          "customerOrderNo",
          "callOff",
          "exchangeRate",
          "eoriNumberId",
          "incotermId",
          "incotermNamedPlace",
          "commissionId",
          "divisionId",
          "totalValue",
          "totalValueBase",
          "quoteId",
          "quoteRevisionId",
          "quoteNo",
          "wentActiveAt",
          "linkedPurchaseOrders",
          "invoices",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "SalesOrderList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The sales orders on this page.",
                "items": {
                  "$ref": "#/components/schemas/SalesOrder"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "SalesOrderLineItemCreate": {
        "type": "object",
        "additionalProperties": false,
        "description": "One entry in the `lineItems` array when you create a sales order. Each entry adds a new line item. It needs `stockItemId`, `quantity` and `price`, and Omono fills in the rest. You can't send `id` or `delete`, because every entry is a new line item. Either one fails with a `422` error and the code `validation-failed`. To change line items later, update the order. Learn more about [creating a document with line items](/docs/writing#creating-a-document-with-lines) and [prefilled fields](/docs/writing#prefilled-fields).\n",
        "properties": {
          "stockItemId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the stock item to sell. It must be a stock item you sell, with `canSell` set to `true`, and it can't be archived. Otherwise the request fails with a `422` error and the code `invalid-reference`, and Omono checks this before it fills in any other fields.\n",
            "minLength": 1
          },
          "description": {
            "type": "string",
            "maxLength": 60000,
            "pattern": "^[^‎-‏‪-‮⁦-⁩﻿]*$",
            "description": "The line item's description, as plain text. It can be up to 60,000 characters, and it can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners. If you leave it out, Omono copies the stock item's `description`, not its `title`. If the stock item has no description, the line item's `description` is `null`. Omono stores the description with formatting, and that stored form must stay under 128 KB, so very long text can fail with a `422` error and the code `validation-failed`, even within the character limit. You can't send `null`.\n"
          },
          "quantity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "The quantity ordered, up to 1,000,000,000 and with up to 4 decimal places. For an assembly, it must be a whole number, or the request fails with a `422` error and the code `validation-failed`.\n"
          },
          "unitPrice": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "The net price of one unit, after the discount, up to 1,000,000,000. It's optional. If you leave it out, Omono works it out from `price` and `discount`. If you send it, it can differ from that worked-out value by at most one unit in the last decimal place, or the request fails with a `422` error and the code `validation-failed`.\n"
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "The list price of one unit, before any discount, up to 1,000,000,000. You always send it. To use the price Omono would fill in from the customer's price list or the stock item's sell price, look it up first with [Retrieve the price for a line](#tag/customer-prices/GET/companies/{id}/price). Omono rounds it to your organisation's Unit Pricing precision.\n"
          },
          "discount": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "The discount on the line item, as a percentage between 0 and 100. It's 0 if you don't send one."
          },
          "taxRateId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the line item's tax rate. Your tax rates are listed by [List all tax rates](#tag/tax-and-currency). If you leave it out, Omono uses the customer's tax rate. You can't send `null`, which fails with a `422` error and the code `validation-failed`. A rate you send can't be archived, and it can't be a system rate, one with `systemDefined` set to `true`. A tax-exempt stock item always gets your organisation's exempt tax rate, whatever you send, so sending the exempt tax rate for one is accepted.\n",
            "minLength": 1
          },
          "salesAnalysisId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the line item's sales analysis code, which can't be archived. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings). If you leave it out, Omono uses the stock item's `salesAnalysisId`. If the stock item has none, the request fails with a `422` error and the code `missing-required-field`.\n",
            "minLength": 1
          },
          "tagNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "An optional label for the line item, such as the customer's part reference or a machine number, or `null` for none. Up to 1,000 characters."
          },
          "commodityCodeId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the line item's commodity code for customs paperwork, or `null` for none. It can't be archived. If you leave it out, Omono uses the stock item's commodity code. If the stock item has none, Omono uses the default code of the stock item's sales analysis code, and otherwise leaves it empty.\n",
            "minLength": 1
          },
          "countryOfOriginId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the country the goods were made in, for customs paperwork, or `null` for none. Countries are listed by [List all countries](#tag/tax-and-currency), and an unknown ID fails with a `422` error and the code `invalid-reference`. If you leave it out, Omono uses the stock item's country of origin, if it has one.\n",
            "minLength": 1
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the line item, such as the line's ID in your system. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. Two line items of the sales order can't have the same one: two entries with the same value fail with a `422` error and the code `validation-failed`, and a value another line item already has fails with a `409` error and the code `duplicate-external-ref`. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "stockItemId",
          "quantity",
          "price"
        ]
      },
      "SalesOrderCreate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The sales order to create and, if you like, its line items. You must send `addressId` unless `customerCollection` is `true`. If you leave out `commissionId`, `divisionId` or `eoriNumberId`, Omono fills it in for you, and you can send `null` to leave it empty instead. Learn more about [prefilled fields](/docs/writing#prefilled-fields).\n",
        "properties": {
          "companyId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the customer the order is for. The company must be a customer (`isCustomer` is `true`) with an account manager, the user who looks after its account, and it can't be archived. You can't change it later. If the customer has no account manager, set one by updating the company first.\n",
            "minLength": 1
          },
          "contactId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the customer's contact for this order. It must be a contact at the order's customer, and it can't be archived. If you send another company's contact, the request fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "addressId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the address the goods go to. It's required unless `customerCollection` is `true`: if you leave it out of any other order, the request fails with a `422` error and the code `missing-required-field`. It must be one of the customer's addresses, and it can't be archived. If you send another company's address, the request fails with a `422` error and the code `invalid-reference`. For a customer collection order, it must be the company's accounts address, and if you leave it out, Omono uses the accounts address for you.\n",
            "minLength": 1
          },
          "salesPersonId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the user who is the sales person for this order. It must be a user whose `assignable` is `true` in [List all users](#tag/organisation). Archived users, users who represent a contact and your organisation's API user aren't assignable, and naming one makes the request fail with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "customerCollection": {
            "type": "boolean",
            "description": "Whether the customer collects the goods themselves instead of having them delivered. If it's `true`, `addressId` must be the company's accounts address, and if you leave `addressId` out, Omono uses the accounts address for you. If you send any other address, the request fails with a `422` error and the code `invalid-reference`. Defaults to `false`.\n"
          },
          "customerOrderNo": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100,
            "description": "The customer's own reference for the order, such as their purchase order number, up to 100 characters. It's required when `salesOrders.customerOrderNoRequired` is `true` in [your settings](#tag/organisation/GET/settings), and leaving it out then fails with a `422` error and the code `missing-required-field`. Omono doesn't warn you if another order already has the same reference.\n"
          },
          "callOff": {
            "type": "boolean",
            "description": "Whether this is a call-off order: a standing order that the customer takes in several deliveries over a period. When you activate a call-off order, it becomes On Order - Call Off (`on_order_call_off`) instead of On Order (`on_order`). The default is `false`.\n"
          },
          "exchangeRate": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000,
            "x-decimal-places": 5,
            "description": "The exchange rate for the order: the number of units of the order's currency that equal 1 unit of your base currency. Take the current rate from [List all currency rates](#tag/tax-and-currency). If the order is in your base currency, send 1. Omono always stores 1 in that case, whatever you send. Learn more about [money](/docs/conventions#money).\n"
          },
          "eoriNumberId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of your organisation's EORI number to print on the order, or `null` for none. It can't be archived. If you leave it out, Omono uses your organisation's EORI number when you have exactly one, and none otherwise. Your EORI numbers are listed by [List all EORI numbers](#tag/purchasing-and-shipping).\n",
            "minLength": 1
          },
          "incotermId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the order's incoterm, or `null` for none. It can't be archived. Your incoterms are listed by [List all incoterms](#tag/purchasing-and-shipping).",
            "minLength": 1
          },
          "incotermNamedPlace": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100,
            "description": "The place named with the incoterm, for example `Bristol, UK`, or `null` for none. Up to 100 characters."
          },
          "commissionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the commission for the order, which the Sales Commission report uses, or `null` for none. It can't be archived. If you leave it out, Omono uses the customer's `commissionId`, and none if the customer has no commission. Your commissions are listed by [List all commissions](#tag/sales-settings).\n",
            "minLength": 1
          },
          "divisionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the division of your organisation that the order belongs to, or `null` for none. It can't be archived. If you leave it out, Omono uses the customer's division (`customerDivisionId`) as long as that division isn't archived, and none otherwise. Your divisions are listed by [List all divisions](#tag/organisation).\n",
            "minLength": 1
          },
          "lineItems": {
            "type": "array",
            "maxItems": 250,
            "description": "The order's line items, in the order you want them, up to 250. Each entry adds a new line item, so you can't send `id` or `delete`. Each new line item for an assembly also brings the BOM items Omono copies from the assembly, and the line items and BOM items together can add up to at most 1,000. Otherwise the request fails with a `422` error and the code `validation-failed`. Leave `lineItems` out, or send an empty list, to create an order without line items. Learn more about [creating a document with line items](/docs/writing#creating-a-document-with-lines).\n",
            "items": {
              "$ref": "#/components/schemas/SalesOrderLineItemCreate"
            }
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the sales order, such as its ID in your web shop. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. If another of your organisation's sales orders already has it, archived ones included, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one, so a sales order you send twice is created only once. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "companyId",
          "contactId",
          "salesPersonId",
          "exchangeRate"
        ],
        "if": {
          "properties": {
            "customerCollection": {
              "const": true
            }
          },
          "required": [
            "customerCollection"
          ]
        },
        "else": {
          "required": [
            "addressId"
          ]
        }
      },
      "SalesOrderCreated": {
        "description": "The response to creating a sales order: the new sales order with its line items, plus `createdLineItems`, which gives the ID of the line item created from each entry in your `lineItems` array.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/SalesOrder"
          },
          {
            "type": "object",
            "properties": {
              "createdLineItems": {
                "$ref": "#/components/schemas/CreatedLineItems"
              }
            },
            "required": [
              "lineItems",
              "createdLineItems"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "SalesOrderWithLineItems": {
        "description": "A sales order with its line items always included. You get this shape when you retrieve, update or activate a single sales order.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/SalesOrder"
          },
          {
            "type": "object",
            "required": [
              "lineItems"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "SalesOrderLineItemWrite": {
        "type": "object",
        "additionalProperties": false,
        "description": "One entry in the `lineItems` array when you update a sales order. Each entry adds, changes or deletes one line item: an entry with an `id` changes that line item, an entry with an `id` and `delete: true` deletes it, and an entry without an `id` adds a new one. A new line item needs `stockItemId`, `quantity` and `price`, and Omono fills in the rest. Learn more about [changing line items](/docs/writing#line-changes) and [prefilled fields](/docs/writing#prefilled-fields).\n",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of an existing line item on this order, to change or delete it. Leave it out to add a new line item. Any fields you leave out keep their values. If the ID belongs to a line item on another order, the request fails with a `422` error and the code `invalid-reference`. If you send the same ID twice, it fails with a `422` error and the code `validation-failed`.\n",
            "minLength": 1
          },
          "delete": {
            "type": "boolean",
            "description": "Set this to `true` to delete the line item named by `id`. Don't send any other fields with it, or the request fails with a `422` error and the code `validation-failed`.\n"
          },
          "stockItemId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the stock item to sell. A new line item needs it, and the stock item must be one you sell, with `canSell` set to `true`, and it can't be archived. Otherwise the request fails with a `422` error and the code `invalid-reference`, and Omono checks this before it fills in any other fields. When you update an existing line item, its stock item isn't checked again, and you can't change it: leave `stockItemId` out or send the value it already has. A different value fails with a `409` error and the code `immutable-field`.\n",
            "minLength": 1
          },
          "description": {
            "type": "string",
            "maxLength": 60000,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The line item's description, as plain text. It can be up to 60,000 characters, and it can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners. If you leave it out on a new line item, Omono copies the stock item's `description`, not its `title`. If the stock item has no description, the line item's `description` is `null`. Omono stores the description with formatting, and that stored form must stay under 128 KB, so very long text can fail with a `422` error and the code `validation-failed`, even within the character limit. You can't send `null`, even though a line item you read can have a `null` description: to keep the description as it is, leave the field out.\n"
          },
          "quantity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "The quantity ordered, up to 1,000,000,000 and with up to 4 decimal places. A new line item needs it. For an assembly, it must be a whole number, or the request fails with a `422` error and the code `validation-failed`. When you update a line item, you can't lower its quantity below the total already on its dispatches: that fails with a `409` error and the code `line-item-allocated`. Sending the quantity the line item already has is always accepted, as long as it's no more than 1,000,000,000.\n"
          },
          "unitPrice": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "The net price of one unit, after the discount, up to 1,000,000,000. It's optional. If you leave it out, Omono works it out from `price` and `discount`. If you send it, it can differ from that worked-out value by at most one unit in the last decimal place, or the request fails with a `422` error and the code `validation-failed`.\n"
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "The list price of one unit, before any discount, up to 1,000,000,000. A new line item needs it. To use the price Omono would fill in from the customer's price list or the stock item's sell price, look it up first with [Retrieve the price for a line](#tag/customer-prices/GET/companies/{id}/price). Omono rounds it to your organisation's Unit Pricing precision.\n"
          },
          "discount": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "The discount on the line item, as a percentage between 0 and 100. It's 0 if you don't send one."
          },
          "taxRateId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the line item's tax rate. Your tax rates are listed by [List all tax rates](#tag/tax-and-currency). If you leave it out on a new line item, Omono uses the customer's tax rate. You can't send `null`, which fails with a `422` error and the code `validation-failed`. A rate you send can't be archived, and it can't be a system rate, one with `systemDefined` set to `true`. A tax-exempt stock item always gets your organisation's exempt tax rate, whatever you send, so sending the exempt tax rate for one is accepted.\n",
            "minLength": 1
          },
          "salesAnalysisId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the line item's sales analysis code, which can't be archived. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings). If you leave it out on a new line item, Omono uses the stock item's `salesAnalysisId`. If the stock item has none, the request fails with a `422` error and the code `missing-required-field`.\n",
            "minLength": 1
          },
          "tagNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "An optional label for the line item, such as the customer's part reference or a machine number, or `null` for none. Up to 1,000 characters."
          },
          "commodityCodeId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the line item's commodity code for customs paperwork, or `null` for none. It can't be archived. If you leave it out on a new line item, Omono uses the stock item's commodity code. If the stock item has none, Omono uses the default code of the stock item's sales analysis code, and otherwise leaves it empty.\n",
            "minLength": 1
          },
          "countryOfOriginId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the country the goods were made in, for customs paperwork, or `null` for none. Countries are listed by [List all countries](#tag/tax-and-currency), and an unknown ID fails with a `422` error and the code `invalid-reference`. If you leave it out on a new line item, Omono uses the stock item's country of origin, if it has one.\n",
            "minLength": 1
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the line item. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. On an existing line item, send `null` to remove it. Two line items of the sales order can't have the same one: two entries with the same value fail with a `422` error and the code `validation-failed`, and a value another line item already has fails with a `409` error and the code `duplicate-external-ref`. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "if": {
          "not": {
            "required": [
              "id"
            ]
          }
        },
        "then": {
          "required": [
            "stockItemId",
            "quantity",
            "price"
          ]
        }
      },
      "SalesOrderUpdate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The fields to change on a sales order. Any fields you leave out stay as they are. You can't change a Complete or Cancelled order: a request that would change it fails with a `409` error and the code `sales-order-locked`, but one that sends back its current values succeeds. You can't change the customer either, so sending `companyId` fails with a `422` error and the code `unknown-field`. An ID you change must point to a record that isn't archived, but an ID you leave unchanged is accepted even if its record has been archived since. Learn more about [references](/docs/writing#references).\n",
        "properties": {
          "contactId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the customer's contact for this order. It must be a contact at the order's customer, and it can't be archived. If you send another company's contact, the request fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "addressId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the address the goods go to. It must be one of the customer's addresses, and it can't be archived. If you send another company's address, the request fails with a `422` error and the code `invalid-reference`. While `customerCollection` is `true`, a new address must be the company's accounts address.\n",
            "minLength": 1
          },
          "salesPersonId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the user who is the sales person for this order. It must be a user whose `assignable` is `true` in [List all users](#tag/organisation). Archived users, users who represent a contact and your organisation's API user aren't assignable, and naming one makes the request fail with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "customerCollection": {
            "type": "boolean",
            "description": "Whether the customer collects the goods themselves instead of having them delivered. When you set it to `true`, or change `addressId` while it's `true`, `addressId` must be the company's accounts address. Otherwise the request fails with a `422` error and the code `invalid-reference`. If you change neither field, the order is accepted as it is, even if the company's accounts address has changed since.\n"
          },
          "customerOrderNo": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100,
            "description": "The customer's own reference for the order, such as their purchase order number, up to 100 characters. When you change it, Omono copies the new value to every dispatch on the order. If your organisation requires a customer order number (`salesOrders.customerOrderNoRequired` in [your settings](#tag/organisation/GET/settings)), clearing it fails with a `422` error and the code `missing-required-field`. The same check runs on every request that sends any field except `lineItems`, `lineItemOrder` and `externalRef`. So on an order that has no customer order number, such as one created before your organisation required it, send `customerOrderNo` with any other change to its fields. Omono doesn't warn you if another order already has the same reference.\n"
          },
          "callOff": {
            "type": "boolean",
            "description": "Whether this is a call-off order: a standing order that the customer takes in several deliveries over a period. Setting it on an order that's On Order (`on_order`) changes the status to On Order - Call Off (`on_order_call_off`), and clearing it changes the status back to On Order. On a Draft or On Hold order, the status doesn't change. Omono uses the value later, to choose between those two statuses when you activate the order or when it comes off hold.\n"
          },
          "exchangeRate": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000,
            "x-decimal-places": 5,
            "description": "The exchange rate for the order: the number of units of the order's currency that equal 1 unit of your base currency. If the order is in your base currency, Omono always stores 1. Once any dispatch on the order has been invoiced, the rate is locked, and a different rate fails with a `409` error and the code `exchange-rate-locked`. Sending back the value you read is always accepted. Learn more about [money](/docs/conventions#money).\n"
          },
          "eoriNumberId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of your organisation's EORI number to print on the order, or `null` for none. A new value can't be archived. Your EORI numbers are listed by [List all EORI numbers](#tag/purchasing-and-shipping).",
            "minLength": 1
          },
          "incotermId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the order's incoterm, or `null` for none. A new value can't be archived. Your incoterms are listed by [List all incoterms](#tag/purchasing-and-shipping).",
            "minLength": 1
          },
          "incotermNamedPlace": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100,
            "description": "The place named with the incoterm, for example `Bristol, UK`, or `null` for none. Up to 100 characters."
          },
          "commissionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the commission for the order, which the Sales Commission report uses, or `null` for none. A new value can't be archived. Your commissions are listed by [List all commissions](#tag/sales-settings).",
            "minLength": 1
          },
          "divisionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the division of your organisation that the order belongs to, or `null` for none. A new value can't be archived. Your divisions are listed by [List all divisions](#tag/organisation).",
            "minLength": 1
          },
          "lineItems": {
            "type": "array",
            "maxItems": 250,
            "description": "A list of changes to the order's line items, with up to 250 entries. An entry without an `id` adds a new line item. Each new line item for an assembly also brings the BOM items Omono copies from the assembly, and the line items and BOM items together can add up to at most 1,000. Otherwise the request fails with a `422` error and the code `validation-failed`. When you send it, you must also send `If-Match`. The list never changes the order of the line items: a line item you change keeps its place, and new line items go at the end, in the order you send them. To reorder the line items, send `lineItemOrder`. If the order already has more than 250 line items, you can't change its line items through the API, and any `lineItems` change fails with a `422` error and the code `validation-failed`. Learn more about [changing line items](/docs/writing#line-changes) and [heavy writes](/docs/limits#heavy-writes).\n",
            "items": {
              "$ref": "#/components/schemas/SalesOrderLineItemWrite"
            }
          },
          "lineItemOrder": {
            "type": "array",
            "maxItems": 250,
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "description": "The order you want the line items in, as a list of their IDs. This is the only way to reorder them, because `lineItems` never changes their order. List every line item that stays, once each. Leave out any line item your `lineItems` deletes in the same request, and any new line item you add, because new line items go after the ones you list, in the order you send them. An ID that isn't one of these line items fails with a `422` error and the code `invalid-reference`. A list that leaves a line item out, names one twice or names one you delete fails with a `422` error and the code `validation-failed`. Sending the current order changes nothing, so the ETag stays the same. When you send `lineItemOrder`, you must also send `If-Match`, and it counts against your rate limits in the same way as a `lineItems` change. Once the order has a dispatch, the order of its line items is fixed: sending a different order fails with a `409` error and the code `line-order-fixed`, but you can still add line items at the end. Learn more about [changing line items](/docs/writing#line-changes).\n"
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the sales order. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. Send `null` to remove it. If another of your organisation's sales orders already has it, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one. Learn more about [external references](/docs/writing#external-references).\n"
          }
        }
      },
      "SalesOrderUpdated": {
        "description": "The response to updating a sales order: the sales order with its line items. If you sent `lineItems`, it also includes `createdLineItems`, which gives the ID of each line item you added. Otherwise that field is left out.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/SalesOrderWithLineItems"
          },
          {
            "type": "object",
            "properties": {
              "createdLineItems": {
                "$ref": "#/components/schemas/CreatedLineItems"
              }
            },
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "DispatchList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The dispatches on this page.",
                "items": {
                  "$ref": "#/components/schemas/Dispatch"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "DispatchLineItemCreate": {
        "type": "object",
        "description": "One of the order's line items to ship on a new dispatch, and how many.",
        "additionalProperties": false,
        "properties": {
          "salesOrderLineItemId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of a line item on this sales order. If it belongs to another order, the request fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "quantity": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "How many to ship, with up to 4 decimal places. It can't be more than the quantity of the line item that isn't on another dispatch yet. Otherwise the request fails with a `409` error and the code `quantity-exceeds-remaining`, and the message says how many are left.\n"
          },
          "serialNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "The serial numbers of the goods on this line item, if you track them. Several numbers go in this one field, usually separated by commas."
          }
        },
        "required": [
          "salesOrderLineItemId",
          "quantity"
        ]
      },
      "DispatchCreate": {
        "type": "object",
        "additionalProperties": false,
        "description": "A new dispatch on a sales order. Omono creates it in the first status of your workflow, with no stock allocated.",
        "properties": {
          "dispatchDate": {
            "type": "string",
            "format": "date",
            "description": "The date the dispatch is due to ship, as `YYYY-MM-DD`. Learn more about [dates](/docs/conventions#dates).\n"
          },
          "deliveryNotes": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The dispatch's delivery notes, as plain text, up to 2,000 characters. The delivery note prints them. They can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners. Omono removes any spaces at the start and end, and `null`, an empty value or one of only spaces means no notes. Omono stores the notes with formatting, and that stored form must stay under 128 KB, so text with very many lines can fail with a `422` error and the code `validation-failed`.\n"
          },
          "lineItems": {
            "type": "array",
            "minItems": 1,
            "maxItems": 250,
            "description": "The order's line items to ship on this dispatch, and how many of each, up to 250. Name each line item at most once. Omono adds the BOM items of an assembly line item for you.\n",
            "items": {
              "$ref": "#/components/schemas/DispatchLineItemCreate"
            }
          }
        },
        "required": [
          "dispatchDate",
          "lineItems"
        ]
      },
      "DispatchLineItemUpdate": {
        "type": "object",
        "description": "One line item to add to a dispatch, change on it, or remove from it with `delete: true`.\n",
        "additionalProperties": false,
        "properties": {
          "salesOrderLineItemId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of a line item on this sales order. To change or remove a line item that's already on the dispatch, name it here. To add one, name a line item of the order that isn't on the dispatch yet and send its `quantity`.\n",
            "minLength": 1
          },
          "quantity": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "The new quantity for this line item on the dispatch, with up to 4 decimal places. It can't be more than the quantity of the line item that isn't on another dispatch. Otherwise the request fails with a `409` error and the code `quantity-exceeds-remaining`, and the message says how many are left.\n"
          },
          "serialNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "The serial numbers of the goods on this line item. Send `null` or an empty string to clear them."
          },
          "delete": {
            "type": "boolean",
            "description": "Set this to `true` to remove the line item from the dispatch. Don't send any other field with it, apart from `salesOrderLineItemId`."
          }
        },
        "required": [
          "salesOrderLineItemId"
        ]
      },
      "DispatchUpdate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The changes to a dispatch. Any field you leave out keeps its value, and a line item you don't name stays as it is.",
        "properties": {
          "dispatchDate": {
            "type": "string",
            "format": "date",
            "description": "The date the dispatch is due to ship, as `YYYY-MM-DD`. You can't change it once the dispatch has shipped. If the new date is later, Omono emails the staff your organisation has chosen to tell about later dispatch dates, as it does when the date changes in Omono.\n"
          },
          "courierId": {
            "type": "string",
            "maxLength": 64,
            "minLength": 1,
            "description": "The ID of the courier, from `GET /couriers`. You can set it once the dispatch has shipped, or, if early tracking entry is switched on (`salesOrders.earlyTrackingEntry` in [your settings](#tag/organisation/GET/settings)), once it's allocated. You can't clear it through the API.\n"
          },
          "trackingNo": {
            "type": "string",
            "maxLength": 200,
            "description": "The courier's tracking number. Omono removes any spaces at the start and end, and an empty value clears it, as the dispatch's `trackingNo` describes. You can set it or clear it at the same stages as `courierId`.\n"
          },
          "deliveryNotes": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The dispatch's new delivery notes, as plain text, up to 2,000 characters, with the same rules as when you create a dispatch. `null`, an empty value or one of only spaces removes them. You can change them at any stage, even after the dispatch has shipped, as staff can in Omono.\n"
          },
          "lineItems": {
            "type": "array",
            "minItems": 1,
            "maxItems": 250,
            "description": "The line items to add, change or remove, up to 250. Name each line item at most once. You can change quantities only while the dispatch is in the first, unallocated stage of your workflow, and you can't remove a line item or lower its quantity below what has been picked. If any of an assembly's components have been picked, you can't remove the assembly or lower its quantity at all. You can change serial numbers at any stage. To remove every line item, delete the dispatch instead.\n",
            "items": {
              "$ref": "#/components/schemas/DispatchLineItemUpdate"
            }
          }
        }
      },
      "ProformaPaidRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Whether the proforma customer has paid for the dispatch.",
        "properties": {
          "paid": {
            "type": "boolean",
            "description": "Send `true` when the payment has arrived. The dispatch is then marked as paid, and the `proforma-not-paid` block no longer stops it shipping. Send `false` to mark the dispatch as awaiting payment.\n"
          }
        },
        "required": [
          "paid"
        ]
      },
      "SalesOrderWithDispatches": {
        "description": "A sales order with its line items and dispatches always included. Each dispatch lists the statuses it can move to next, in `legalTransitions`.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/SalesOrder"
          },
          {
            "type": "object",
            "required": [
              "dispatches",
              "lineItems"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "ProformaPaidResult": {
        "type": "object",
        "description": "The response to marking a proforma dispatch as paid or as awaiting payment. It tells you whether this request changed the dispatch, and it always includes the sales order as it is now, with its dispatches.\n",
        "properties": {
          "applied": {
            "type": "boolean",
            "description": "Whether this request changed the dispatch. It's `false` if the dispatch already had the value you sent, and in that case nothing changed and the order's `ETag` stays the same."
          },
          "salesOrder": {
            "$ref": "#/components/schemas/SalesOrderWithDispatches"
          }
        },
        "required": [
          "applied",
          "salesOrder"
        ],
        "additionalProperties": true
      },
      "TransitionRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "The dispatch to move and the status to move it to. `invoiceDate`, `suppressCustomerEmail`, `courierId` and `trackingNo` are used only when you move the dispatch to the final status (the one whose type is `final`), which ships it, or when you retry a ship that failed part-way. Any other move ignores them.\n",
        "properties": {
          "dispatchId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the dispatch to move. It must be a dispatch on this sales order.",
            "minLength": 1
          },
          "statusId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the workflow status to move the dispatch to. Take it from the dispatch's `legalTransitions`.",
            "minLength": 1
          },
          "invoiceDate": {
            "type": "string",
            "format": "date",
            "description": "The date for the invoice and the dispatch, as `YYYY-MM-DD`. It can be any day from 31 days before today up to today, where today is the current date in your organisation's time zone. If you leave it out, Omono uses today in your organisation's time zone, not the UTC date. A date outside that range fails with a `422` error and the code `validation-failed`, and no invoice number is used.\n"
          },
          "suppressCustomerEmail": {
            "type": "boolean",
            "description": "Set to `true` to stop Omono sending its automatic invoice email for this shipment, including the copies that go to your own team. Use it when you send the invoice to the customer yourself. It affects this request only and doesn't change your settings in Omono. Defaults to `false`.\n"
          },
          "courierId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the courier carrying the dispatch. The invoice email and PDF print it. It must be one of the couriers your organisation can use, which are the ones [List all couriers](#tag/purchasing-and-shipping) returns when you don't filter by `ids`. Any other courier fails with a `422` error and the code `invalid-reference`, before anything changes. If you leave it out, the dispatch keeps the courier it has.\n",
            "minLength": 1
          },
          "trackingNo": {
            "type": "string",
            "maxLength": 200,
            "description": "The courier's tracking number for the dispatch. Omono removes any spaces at the start and end, and an empty value clears it, as the dispatch's `trackingNo` describes. If you leave it out, the dispatch keeps the tracking number it has.\n"
          }
        },
        "required": [
          "dispatchId",
          "statusId"
        ]
      },
      "TransitionResult": {
        "type": "object",
        "description": "The response to moving a dispatch. It tells you whether this request moved the dispatch, and it always includes the sales order as it is now, with its dispatches, so you don't need to read the order again. Learn more about [what to do if a ship fails](/docs/workflow#if-a-ship-fails).\n",
        "properties": {
          "applied": {
            "type": "boolean",
            "description": "Whether this request moved the dispatch. It's `false` if the dispatch was already at that status and there was nothing left to do. A retry that finishes a ship that failed part-way returns `true`."
          },
          "salesOrder": {
            "$ref": "#/components/schemas/SalesOrderWithDispatches"
          }
        },
        "required": [
          "applied",
          "salesOrder"
        ],
        "additionalProperties": true
      },
      "SalesOrderActionResult": {
        "type": "object",
        "description": "The response to activating a sales order. It tells you whether this request activated the order, and it always includes the order as it is now.\n",
        "properties": {
          "applied": {
            "type": "boolean",
            "description": "Whether this request activated the order. It's `false` if the order was already active, that is On Order, On Hold or On Order - Call Off, and in that case nothing changed."
          },
          "salesOrder": {
            "$ref": "#/components/schemas/SalesOrderWithLineItems"
          }
        },
        "required": [
          "applied",
          "salesOrder"
        ],
        "additionalProperties": true
      },
      "SalesOrderLine": {
        "type": "object",
        "description": "A line item on a sales order, with the order it belongs to, as [List all sales order lines](#tag/sales-orders/GET/sales-order-lines) returns it. It has the fields of a sales order's line item, except `bomItems`, and seven fields from its order. Its prices and costs are in its order's currency, `currencyId`, so convert them with `exchangeRate` before you add up line items of orders in different currencies. The list includes the line items of Draft and Cancelled orders: `orderStatus` tells you which.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the line item."
          },
          "salesOrderId": {
            "type": "string",
            "description": "The ID of the sales order the line item is on."
          },
          "orderNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The sales order's number, without the \"SO-\" prefix that Omono shows. It's `null` only if the order can't be found."
          },
          "companyId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the customer the sales order is for. It's `null` only if the order can't be found."
          },
          "orderStatus": {
            "description": "The sales order's status, as `status` on the [sales order](#tag/sales-orders). It's `null` only if the order can't be found.\n\nKnown values: `draft`, `on_order`, `complete`, `cancelled`, `on_hold`, `on_order_call_off`. Omono can add values; handle one you don't recognise.\n",
            "type": [
              "string",
              "null"
            ],
            "x-known-values": [
              "draft",
              "on_order",
              "complete",
              "cancelled",
              "on_hold",
              "on_order_call_off"
            ],
            "x-enum-descriptions": [
              "The order is still being prepared and isn't active yet.",
              "The order is active. A sales order is on order once it's activated, and a purchase order once it's issued to the supplier.",
              "Everything on a sales order has shipped, or everything on a purchase order has been received.",
              "The order was cancelled and is no longer active.",
              "At least one of the order's dispatches or deliveries is on hold.",
              "The order is an active call-off order, which means its goods are delivered in several parts over a period."
            ]
          },
          "orderCreated": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The time the sales order was created. It's `null` only if the order can't be found."
          },
          "currencyId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the sales order's currency, as `currencyId` on the [sales order](#tag/sales-orders). The line item's `price`, `unitPrice` and `lastCost` are in this currency. It's `null` only if the order can't be found."
          },
          "exchangeRate": {
            "type": [
              "number",
              "null"
            ],
            "description": "The sales order's exchange rate, as `exchangeRate` on the [sales order](#tag/sales-orders): the number of units of the order's currency that equal 1 unit of your base currency. Divide an amount by it to get your base currency. It's `null` if the order can't be found, and on some old orders that were saved without a rate. Learn more about [money](/docs/conventions#money).\n"
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for the line item, such as the line's ID in your system, or `null` if it has none. Only the API sets it. It's unique among the line items of the sales order. Learn more about [external references](/docs/writing#external-references).\n"
          },
          "stockItemId": {
            "type": "string",
            "description": "The ID of the stock item being sold. It can't change after the line item is created."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "The line item's description, as plain text. Any formatting added in Omono isn't included."
          },
          "quantity": {
            "type": "number",
            "minimum": 0,
            "x-decimal-places": 4,
            "description": "The quantity ordered. It's zero or more, with up to 4 decimal places.\n"
          },
          "unitPrice": {
            "type": "number",
            "description": "The net price of one unit, after the discount. It's `price` reduced by the `discount` percentage, rounded to your organisation's Unit Pricing precision. The line item's total is `quantity` multiplied by `unitPrice`, rounded to 2 decimal places, and the order's totals are worked out from `unitPrice` alone. A price saved earlier can have more decimal places than your Unit Pricing setting, so don't assume a fixed number. Learn more about [money](/docs/conventions#money).\n"
          },
          "price": {
            "type": "number",
            "description": "The list price of one unit, before any discount. Omono rounds a price you send to your organisation's Unit Pricing precision, 2 or 4 decimal places, but a price saved earlier can have more, so don't assume a fixed number of decimal places. Learn more about [money](/docs/conventions#money).\n"
          },
          "discount": {
            "type": "number",
            "description": "The discount on the line item, as a percentage. It's `0` when there's no discount. A discount you send must be between 0 and 100, but Omono returns the value as it's stored, so a discount saved another way can be outside that range."
          },
          "taxRateId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the line item's tax rate. Your tax rates are listed by [List all tax rates](#tag/tax-and-currency). It's `null` only on some old line items that were saved without a rate. When you change one of those line items, send a `taxRateId` with your change, because a line item can't be saved without a tax rate. If you leave it out, the request fails with a `422` error and the code `missing-required-field`, and sending `null` fails with a `422` error too.\n"
          },
          "salesAnalysisId": {
            "type": "string",
            "description": "The ID of the line item's sales analysis code, which groups your sales for reporting. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings)."
          },
          "tagNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "An optional label for the line item, such as the customer's part reference or a machine number, or `null` if there isn't one. It prints as \"Tag"
          },
          "lastCost": {
            "type": [
              "number",
              "null"
            ],
            "description": "The cost of one unit, in the order's currency, as the line item saved it, or `null` if none is saved. It's the **Last Cost** in the line item window in Omono. When the line item is added, Omono fills it in from the latest purchase order for the stock item that's on order, a call-off or complete (the highest `price` on it if it has several line items for the stock item), or from the stock item's `cost` if that changed after that order or there's no such order, converted into the order's currency and rounded to your organisation's purchasing decimal places. For an assembly, it's the cost of each component multiplied by its quantity, added up. Staff can change it on the line item, and it doesn't follow later changes to the stock item's cost. When the API adds a line item and Omono finds no cost, because the stock item has no such purchase order and no `cost`, the line item saves a `lastCost` of 0, not `null`. A `lastCost` of 0 means no cost is known for the line item, and its `margin` is then `null`. Only a key that also has the `stock:read` scope gets it, and `stock:write` includes `stock:read`. For any other key the field is left out, not `null`.\n"
          },
          "margin": {
            "type": [
              "number",
              "null"
            ],
            "description": "The line item's margin, as a percentage of its net price for one unit, as the line item saved it. It's the **Margin** in the line item window in Omono: (net price − `lastCost`) ÷ net price × 100, where the net price is `price` reduced by the `discount` percentage, with up to 2 decimal places. For example, a net price of 80 and a cost of 60 give `25`. It's `0` when the price is 0 or the `discount` is 100%, because the net price is then 0, and below 0 when the cost is more than a net price above 0. It's `null` when the line item has no cost, that is when `lastCost` is 0 or `null`, because a margin worked out against no cost means nothing. It's also `null` if none is saved. Omono saves it with the line item, and it stays as saved until the line item changes. Only a key that also has the `stock:read` scope gets it, and `stock:write` includes `stock:read`. For any other key the field is left out, not `null`.\n"
          },
          "quotedLeadTime": {
            "type": [
              "string",
              "null"
            ],
            "description": "The lead time that was quoted for this line item, copied from the quote line item's `leadTime` when the quote was won. It's `null` if the order didn't come from a quote or no lead time was quoted."
          },
          "commodityCodeId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the line item's commodity code for customs paperwork, or `null` if there isn't one. Your commodity codes are listed by [List all commodity codes](#tag/purchasing-and-shipping)."
          },
          "countryOfOriginId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the country the goods were made in, for customs paperwork, or `null` if it isn't set. Countries are listed by [List all countries](#tag/tax-and-currency)."
          },
          "linkedPurchaseOrderId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the purchase order that staff raised in Omono for this line item, or `null` if there isn't one. For example, the supplier may ship the goods straight to your customer, which is called a drop shipment, or you may buy them in for this order alone, which is called back-to-back buying."
          },
          "linkedPurchaseOrderNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The number of the linked purchase order, without the \"PO-\" prefix that Omono shows, or `null` if there isn't one."
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the line item was created."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the line item was last changed."
          }
        },
        "required": [
          "id",
          "salesOrderId",
          "orderNo",
          "companyId",
          "orderStatus",
          "orderCreated",
          "currencyId",
          "exchangeRate",
          "externalRef",
          "stockItemId",
          "description",
          "quantity",
          "unitPrice",
          "price",
          "discount",
          "taxRateId",
          "salesAnalysisId",
          "tagNumber",
          "quotedLeadTime",
          "commodityCodeId",
          "countryOfOriginId",
          "linkedPurchaseOrderId",
          "linkedPurchaseOrderNo",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "SalesOrderLineList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The sales order line items on this page.",
                "items": {
                  "$ref": "#/components/schemas/SalesOrderLine"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "XeroSyncStatus": {
        "description": "Where a document stands in Omono's sync to Xero. The values are the same in every organisation.\n\nKnown values: `never`, `ok`, `warning`, `error`, `pending`, `skipped`. Omono can add values; handle one you don't recognise.\n",
        "type": "string",
        "x-known-values": [
          "never",
          "ok",
          "warning",
          "error",
          "pending",
          "skipped"
        ],
        "x-enum-descriptions": [
          "Omono hasn't sent the document to Xero.",
          "The last sync worked.",
          "The last sync worked, but Xero returned a warning. Staff can read it on the document in Omono.",
          "The last sync failed. Staff can read the error on the document in Omono, fix the cause, and Omono tries again.",
          "The document is waiting for the next sync.",
          "Omono doesn't send this document to Xero, such as an invoice whose total is zero."
        ]
      },
      "KnownXeroSyncStatus": {
        "description": "Where a document stands in Omono's sync to Xero. The values are the same in every organisation.\n",
        "type": "string",
        "enum": [
          "never",
          "ok",
          "warning",
          "error",
          "pending",
          "skipped"
        ],
        "x-enum-descriptions": [
          "Omono hasn't sent the document to Xero.",
          "The last sync worked.",
          "The last sync worked, but Xero returned a warning. Staff can read it on the document in Omono.",
          "The last sync failed. Staff can read the error on the document in Omono, fix the cause, and Omono tries again.",
          "The document is waiting for the next sync.",
          "Omono doesn't send this document to Xero, such as an invoice whose total is zero."
        ]
      },
      "XeroSync": {
        "type": "object",
        "description": "The state of a document's sync to Xero. Omono sends invoices, credit notes and supplier bills (deliveries) to Xero on a schedule while your organisation is connected to Xero. The texts of any error or warning aren't included, because they can quote Xero's own messages: staff can read them on the document in Omono.\n",
        "properties": {
          "status": {
            "description": "Where the document stands in the sync. It's `never` if Omono hasn't sent it yet. It's `null` only if Omono stores a status that this version of the API doesn't know.\n\nKnown values: `never`, `ok`, `warning`, `error`, `pending`, `skipped`. Omono can add values; handle one you don't recognise.\n",
            "type": [
              "string",
              "null"
            ],
            "x-known-values": [
              "never",
              "ok",
              "warning",
              "error",
              "pending",
              "skipped"
            ],
            "x-enum-descriptions": [
              "Omono hasn't sent the document to Xero.",
              "The last sync worked.",
              "The last sync worked, but Xero returned a warning. Staff can read it on the document in Omono.",
              "The last sync failed. Staff can read the error on the document in Omono, fix the cause, and Omono tries again.",
              "The document is waiting for the next sync.",
              "Omono doesn't send this document to Xero, such as an invoice whose total is zero."
            ]
          },
          "id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Xero's ID for the document: its `InvoiceID` for an invoice or a supplier bill, and its `CreditNoteID` for a credit note. It's `null` until the document is first synced.\n"
          },
          "lastSyncedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The time of the last sync, whether it worked or not, or `null` if there hasn't been one."
          }
        },
        "required": [
          "status",
          "id",
          "lastSyncedAt"
        ],
        "additionalProperties": true
      },
      "Invoice": {
        "type": "object",
        "description": "An invoice raised by Omono. Omono raises an invoice when a dispatch ships, so each invoice is one invoiced dispatch, and its `id` and `dispatchId` are the dispatch's ID. To get the goods on the invoice, read its sales order with `include=lineItems,dispatches`.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "The ID of the invoiced dispatch, the same as `dispatchId`."
          },
          "dispatchId": {
            "type": "string",
            "description": "The ID of the invoiced dispatch. Use it with the dispatch endpoints of the invoice's sales order, such as `GET /sales-orders/{id}/dispatches/{dispatchId}` with `salesOrderId`."
          },
          "invoiceNo": {
            "type": "string",
            "description": "The invoice number, without the \"INV-\" prefix that Omono shows. Invoice numbers come from a single sequence shared by your whole organisation.\n"
          },
          "invoiceDate": {
            "type": "string",
            "format": "date",
            "description": "The date of the invoice, as `YYYY-MM-DD`. Learn more about [dates](/docs/conventions#dates)."
          },
          "invoiceDueDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The date that payment of the invoice is due, as `YYYY-MM-DD`. Omono works it out from the customer's payment terms when the dispatch ships."
          },
          "salesOrderId": {
            "type": "string",
            "description": "The ID of the sales order the invoice belongs to."
          },
          "orderNo": {
            "type": "string",
            "description": "The number of the sales order, without the \"SO-\" prefix that Omono shows."
          },
          "customerOrderNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The customer's own reference for the sales order, or `null` if there isn't one. It changes when the order's reference changes."
          },
          "dispatchNo": {
            "type": "integer",
            "description": "The dispatch's number within its sales order. Omono shows it after the order number, for example SO-1042-2 for the second dispatch on order 1042."
          },
          "companyId": {
            "type": "string",
            "description": "The ID of the customer the invoice is for."
          },
          "currencyId": {
            "type": "string",
            "description": "The ID of the invoice's currency, which is the sales order's currency. Currencies are listed by [List all currencies](#tag/tax-and-currency)."
          },
          "exchangeRate": {
            "type": [
              "number",
              "null"
            ],
            "description": "The exchange rate of the invoice's sales order: the number of units of the invoice's currency that equal 1 unit of your base currency, as the sales order's `exchangeRate` shows it. Once one of the order's dispatches is invoiced, the sales order window in Omono and the API both stop anyone from changing the rate, so it's the rate the invoice was raised at. It's `null` only on some old orders that were saved without a rate. Learn more about [money](/docs/conventions#money).\n"
          },
          "totalValue": {
            "type": "number",
            "description": "The total value of the invoice, before tax, in the invoice's currency. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains.\n"
          },
          "totalTax": {
            "type": "number",
            "description": "The total tax on the invoice, in the invoice's currency. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains.\n"
          },
          "totalWithTax": {
            "type": "number",
            "description": "The total value of the invoice including tax, in the invoice's currency. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains.\n"
          },
          "totalValueBase": {
            "type": [
              "number",
              "null"
            ],
            "description": "`totalValue` in your organisation's base currency, as Omono saved it, or `null` if the invoice has none saved, as on some old records. Omono saves it each time it works out the total in the order's currency, converted at the order's exchange rate and rounded to 2 decimal places, so working it out yourself from the total and the `exchangeRate` can differ by 0.01. Learn more about [money](/docs/conventions#money).\n"
          },
          "totalTaxBase": {
            "type": [
              "number",
              "null"
            ],
            "description": "`totalTax` in your organisation's base currency, as Omono saved it, or `null` if the invoice has none saved. Omono converts it the same way as `totalValueBase`. Learn more about [money](/docs/conventions#money).\n"
          },
          "costOfGoodsSold": {
            "type": [
              "number",
              "null"
            ],
            "description": "The cost of the goods on the invoice, before tax, in the invoice's currency. For each line item on the dispatch, Omono multiplies the quantity on the dispatch by the `lastCost` of its [sales order line item](#tag/sales-orders), adds them up and rounds to 2 decimal places. A line item with no cost counts as 0, so an invoice with uncosted goods has a lower cost and a higher margin than it should. Omono works it out again whenever a line item of the sales order changes, and once a line item is on an invoiced dispatch its cost can't change, so it's the cost the invoice was raised at. It's `null` if none is saved, as on some old invoices. Only a key that also has the `stock:read` scope gets it, and `stock:write` includes `stock:read`. For any other key the field is left out, not `null`.\n"
          },
          "grossProfit": {
            "type": [
              "number",
              "null"
            ],
            "description": "`totalValue` minus `costOfGoodsSold`, in the invoice's currency, with up to 2 decimal places. It's below 0 when the goods cost more than they were sold for, and `null` if none is saved. Only a key that also has the `stock:read` scope gets it, and `stock:write` includes `stock:read`. For any other key the field is left out, not `null`.\n"
          },
          "grossMargin": {
            "type": [
              "number",
              "null"
            ],
            "description": "The gross profit as a percentage of the invoice's value before tax: `grossProfit` ÷ `totalValue` × 100, with up to 2 decimal places, as Omono saved it. It's `0` when `totalValue` is 0. It's `null` when `costOfGoodsSold` is 0 or `null`, because a margin worked out against no cost means nothing: a cost of 0 means no cost is known for the goods on the invoice. It's also `null` if none is saved. Only a key that also has the `stock:read` scope gets it, and `stock:write` includes `stock:read`. For any other key the field is left out, not `null`.\n"
          },
          "costOfGoodsSoldBase": {
            "type": [
              "number",
              "null"
            ],
            "description": "`costOfGoodsSold` in your organisation's base currency, converted at the sales order's exchange rate and rounded to 2 decimal places, or `null` if none is saved. Only a key that also has the `stock:read` scope gets it, and `stock:write` includes `stock:read`. For any other key the field is left out, not `null`.\n"
          },
          "grossProfitBase": {
            "type": [
              "number",
              "null"
            ],
            "description": "`grossProfit` in your organisation's base currency, converted at the sales order's exchange rate and rounded to 2 decimal places, or `null` if none is saved. Only a key that also has the `stock:read` scope gets it, and `stock:write` includes `stock:read`. For any other key the field is left out, not `null`.\n"
          },
          "xero": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/XeroSync"
              },
              {
                "type": "null"
              }
            ],
            "description": "The state of the invoice's sync to Xero, or `null` if your organisation isn't connected to Xero. Omono counts your organisation as connected while Xero is connected on the **Connect** page of **Settings** in Omono, which is also what `GET /settings` reports in `xero.connected`. Disconnecting Xero makes this `null` on every record, although the record keeps its sync state for when you connect again. A sync changes the record's `updated`.\n"
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the dispatch was created."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the dispatch was last changed. Raising the invoice changes it."
          }
        },
        "required": [
          "id",
          "dispatchId",
          "invoiceNo",
          "invoiceDate",
          "invoiceDueDate",
          "salesOrderId",
          "orderNo",
          "customerOrderNo",
          "dispatchNo",
          "companyId",
          "currencyId",
          "exchangeRate",
          "totalValue",
          "totalTax",
          "totalWithTax",
          "totalValueBase",
          "totalTaxBase",
          "xero",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "InvoiceList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The invoices on this page.",
                "items": {
                  "$ref": "#/components/schemas/Invoice"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "CreditNoteLineItem": {
        "type": "object",
        "description": "A line item on a credit note.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the line item."
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for the line item, such as the line's ID in your system, or `null` if it has none. Only the API sets it. It's unique among the line items of the credit note. Learn more about [external references](/docs/writing#external-references).\n"
          },
          "stockItemId": {
            "type": "string",
            "description": "The ID of the [stock item](#tag/stock-items) this line item credits. It can't change after the line item is created."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "The line item's description, as plain text, or `null` if there isn't one."
          },
          "quantity": {
            "type": "number",
            "minimum": 0,
            "x-decimal-places": 4,
            "description": "The quantity credited, with up to 4 decimal places."
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "description": "The price of one unit. The line item's total is `quantity` multiplied by `price`, rounded to 2 decimal places. Omono rounds a price you send to your organisation's Unit Pricing precision, 2 or 4 decimal places, but a price saved earlier can have more, so don't assume a fixed number of decimal places. Learn more about [money](/docs/conventions#money).\n"
          },
          "salesAnalysisId": {
            "type": "string",
            "description": "The ID of the line item's sales analysis code, which groups your sales for reporting. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings)."
          },
          "taxRateId": {
            "type": "string",
            "description": "The ID of the line item's tax rate. It's always the ID of a tax rate from [List all tax rates](#tag/tax-and-currency), and line items for tax-exempt stock show your organisation's exempt tax rate.\n"
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the line item was created."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the line item was last changed."
          }
        },
        "required": [
          "id",
          "externalRef",
          "stockItemId",
          "description",
          "quantity",
          "price",
          "salesAnalysisId",
          "taxRateId",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "CreditNote": {
        "type": "object",
        "description": "A credit note reduces what a customer owes you, for example to correct an invoice or to refund returned goods. Credit notes don't change your stock levels.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the credit note."
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for the credit note, such as its ID in your returns system, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's credit notes, archived ones included, and cancelled ones, so you can find the credit note again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references).\n"
          },
          "creditNoteNo": {
            "type": "string",
            "description": "The credit note number, as a string and without the \"CN-\" prefix.\n"
          },
          "companyId": {
            "type": "string",
            "description": "The ID of the customer the credit note is for. You set it when you create the credit note, and it can't change after that."
          },
          "contactId": {
            "type": "string",
            "description": "The ID of the contact at the customer who the credit note is for."
          },
          "raisedById": {
            "type": "string",
            "description": "The ID of the user who raised the credit note. Your users are listed by [List all users](#tag/organisation)."
          },
          "refNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your reference for the credit note, or `null` if there isn't one. It prints as \"Reference"
          },
          "currencyId": {
            "type": "string",
            "description": "The ID of the credit note's currency, which is always the customer's currency. You can't set it, because Omono copies it from the company. Currencies are listed by [List all currencies](#tag/tax-and-currency)."
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CreditNoteStatus"
              }
            ],
            "description": "The credit note's status, which is `draft` or `complete`. A new credit note is a Draft, which you can still change. Once it's completed, it's Complete, and it can't change or go back to Draft. You can't set this field directly: to complete a Draft credit note, use `POST /credit-notes/{id}/complete`.\n"
          },
          "exchangeRate": {
            "type": [
              "number",
              "null"
            ],
            "description": "The exchange rate for the credit note: the number of units of its currency that equal 1 unit of your base currency. If you send back the value you read in an update, the rate doesn't change. It's `null` only on some old credit notes that were saved without a rate. Learn more about [money](/docs/conventions#money).\n"
          },
          "divisionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the division the credit note belongs to, or `null` if it has none. Your divisions are listed by [List all divisions](#tag/organisation)."
          },
          "totalValue": {
            "type": "number",
            "description": "The total value of the credit note, before tax, in its currency. You can't set it, because Omono works it out from the line items. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains.\n"
          },
          "totalTax": {
            "type": "number",
            "description": "The total tax on the credit note, in its currency. You can't set it, because Omono works it out from the line items and their tax rates. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains.\n"
          },
          "totalWithTax": {
            "type": "number",
            "description": "The total value of the credit note including tax, in its currency: `totalValue` plus `totalTax`. You can't set it. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains.\n"
          },
          "totalValueBase": {
            "type": [
              "number",
              "null"
            ],
            "description": "`totalValue` in your organisation's base currency, as Omono saved it, or `null` if the credit note has none saved, as on some old records. Omono saves it each time it works out the total in the credit note's currency, converted at the credit note's exchange rate and rounded to 2 decimal places, so working it out yourself from the total and the `exchangeRate` can differ by 0.01. Learn more about [money](/docs/conventions#money).\n"
          },
          "totalTaxBase": {
            "type": [
              "number",
              "null"
            ],
            "description": "`totalTax` in your organisation's base currency, as Omono saved it, or `null` if the credit note has none saved. Omono converts it the same way as `totalValueBase`. Learn more about [money](/docs/conventions#money).\n"
          },
          "xero": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/XeroSync"
              },
              {
                "type": "null"
              }
            ],
            "description": "The state of the credit note's sync to Xero, or `null` if your organisation isn't connected to Xero. Omono counts your organisation as connected while Xero is connected on the **Connect** page of **Settings** in Omono, which is also what `GET /settings` reports in `xero.connected`. Disconnecting Xero makes this `null` on every record, although the record keeps its sync state for when you connect again. A sync changes the record's `updated`.\n"
          },
          "wentCompleteAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The time the credit note became Complete, or `null` while it's a Draft."
          },
          "lineItems": {
            "type": "array",
            "description": "The credit note's line items, in order. A single credit note always includes them, but a list includes them only when you ask with `include=lineItems`.\n",
            "items": {
              "$ref": "#/components/schemas/CreditNoteLineItem"
            }
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the credit note was created. Its PDF prints this as the credit note's date."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the credit note was last changed."
          }
        },
        "required": [
          "id",
          "externalRef",
          "creditNoteNo",
          "companyId",
          "contactId",
          "raisedById",
          "refNo",
          "currencyId",
          "status",
          "exchangeRate",
          "divisionId",
          "totalValue",
          "totalTax",
          "totalWithTax",
          "totalValueBase",
          "totalTaxBase",
          "xero",
          "wentCompleteAt",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "CreditNoteList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The credit notes on this page.",
                "items": {
                  "$ref": "#/components/schemas/CreditNote"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "CreditNoteLineItemCreate": {
        "type": "object",
        "additionalProperties": false,
        "description": "One entry in the `lineItems` array when you create a credit note. Each entry adds a new line item. It needs `stockItemId`, `quantity` and `price`, and Omono fills in `taxRateId`, `salesAnalysisId` and `description` if you leave them out. You can't send `id` or `delete`, because every entry is a new line item. Either one fails with a `422` error and the code `validation-failed`. To change line items later, update the credit note. Learn more about [creating a document with line items](/docs/writing#creating-a-document-with-lines).\n",
        "properties": {
          "stockItemId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the stock item to credit. It must be a stock item you sell, with `canSell` set to `true`, and it can't be archived. Otherwise the request fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "description": {
            "type": "string",
            "maxLength": 60000,
            "pattern": "^[^‎-‏‪-‮⁦-⁩﻿]*$",
            "description": "The line item's description, as plain text. It can be up to 60,000 characters, and it can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners. If you leave it out, Omono copies the stock item's `description`, not its `title`. If the stock item has no description, the line item's `description` is `null`. Omono stores the description with formatting, and that stored form must stay under 128 KB, so very long text can fail with a `422` error and the code `validation-failed`, even within the character limit. You can't send `null`.\n"
          },
          "quantity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "The quantity to credit, up to 1,000,000,000 and with up to 4 decimal places."
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "The price of one unit, up to 1,000,000,000. Omono rounds it to your organisation's Unit Pricing precision. The line item's total is `quantity` multiplied by `price`.\n"
          },
          "salesAnalysisId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the line item's sales analysis code, which can't be archived. If you leave it out, Omono uses the stock item's code. If the stock item has no code, the request fails with a `422` error and the code `missing-required-field`.\n",
            "minLength": 1
          },
          "taxRateId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the line item's tax rate. It can't be archived, and it can't be a system rate, one with `systemDefined` set to `true`, except for the exempt tax rate on tax-exempt stock. If you leave it out, Omono uses the customer's tax rate, and you can't send `null`. Line items for tax-exempt stock always get your organisation's exempt tax rate, whatever you send, so for those line items you can leave `taxRateId` out, or send the ID of the tax rate whose `type` is `exempt` from [List all tax rates](#tag/tax-and-currency). If your organisation has no exempt tax rate, the request fails with a `422` error and the code `missing-exempt-tax-rate`. Sending the exempt tax rate for stock that isn't tax-exempt, or a value that isn't a tax rate's ID, fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the line item, such as the line's ID in your system. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. Two line items of the credit note can't have the same one: two entries with the same value fail with a `422` error and the code `validation-failed`, and a value another line item already has fails with a `409` error and the code `duplicate-external-ref`. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "stockItemId",
          "quantity",
          "price"
        ]
      },
      "CreditNoteCreate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The credit note to create and, if you like, its line items. Omono fills in fields you leave out, as its own forms do, and `null` means you want a field left empty. Learn more about [prefilled fields](/docs/writing#prefilled-fields).\n",
        "properties": {
          "companyId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the customer the credit note is for. The company must be a customer (`isCustomer` is `true`) with an account manager, the user who looks after its account, and it can't be archived. You can't change it later. If the customer has no account manager, set one by updating the company first.\n",
            "minLength": 1
          },
          "contactId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of a contact at the customer. The contact can't be archived, or the request fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "raisedById": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the user who raised the credit note. It must be a user whose `assignable` is `true` in [List all users](#tag/organisation). Archived users, users who represent a contact and your organisation's API user aren't assignable, and naming one makes the request fail with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "exchangeRate": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000,
            "x-decimal-places": 5,
            "description": "The exchange rate for the credit note: the number of units of its currency that equal 1 unit of your base currency, with up to 5 decimal places. Take the current rate from [List all currency rates](#tag/tax-and-currency). If the customer trades in your base currency, Omono always stores 1, whatever you send. Learn more about [money](/docs/conventions#money).\n"
          },
          "refNo": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100,
            "description": "Your reference for the credit note, up to 100 characters, for example the number of the invoice it corrects.\n"
          },
          "divisionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the division the credit note belongs to, which can't be archived. If you leave it out, Omono uses the customer's division (`customerDivisionId` on the company), as long as that division isn't archived. Otherwise the credit note has none. Send `null` for none.\n",
            "minLength": 1
          },
          "lineItems": {
            "type": "array",
            "maxItems": 250,
            "description": "The credit note's line items, in the order you want them. They're optional, and you can send up to 250. Each entry adds a new line item, so you can't send `id` or `delete`. Each line item must end up with a tax rate: the one you send, or else the customer's. If there's neither, the request fails with a `422` error and the code `missing-required-field`. Learn more about [creating a document with line items](/docs/writing#creating-a-document-with-lines).\n",
            "items": {
              "$ref": "#/components/schemas/CreditNoteLineItemCreate"
            }
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the credit note, such as its ID in your returns system. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. If another of your organisation's credit notes already has it, archived ones included, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one, so a credit note you send twice is created only once. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "companyId",
          "contactId",
          "raisedById",
          "exchangeRate"
        ]
      },
      "CreditNoteCreated": {
        "description": "The response to creating a credit note: the new credit note with its line items, plus `createdLineItems`, which gives the ID of the line item created from each entry in your `lineItems` array.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/CreditNote"
          },
          {
            "type": "object",
            "properties": {
              "createdLineItems": {
                "$ref": "#/components/schemas/CreatedLineItems"
              }
            },
            "required": [
              "lineItems",
              "createdLineItems"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "CreditNoteWithLineItems": {
        "description": "A credit note with its line items always included. Every response that returns a single credit note uses this shape.",
        "allOf": [
          {
            "$ref": "#/components/schemas/CreditNote"
          },
          {
            "type": "object",
            "required": [
              "lineItems"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "CreditNoteLineItemWrite": {
        "type": "object",
        "additionalProperties": false,
        "description": "One entry in the `lineItems` array when you update a credit note. Each entry adds, changes or deletes one line item. A new line item needs `stockItemId`, `quantity` and `price`, and Omono fills in `taxRateId`, `salesAnalysisId` and `description` if you leave them out. Learn more about [changing line items](/docs/writing#line-changes).\n",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of an existing line item on this credit note, to change or delete it. Leave it out to add a new line item. If the ID belongs to a line item on another credit note, the request fails with a `422` error and the code `invalid-reference`. If you send the same ID twice, it fails with a `422` error and the code `validation-failed`.\n",
            "minLength": 1
          },
          "delete": {
            "type": "boolean",
            "description": "Set this to `true` to delete the line item named by `id`. Don't send any other fields with it, or the request fails with a `422` error and the code `validation-failed`.\n"
          },
          "stockItemId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the stock item to credit. A new line item needs it, and the stock item must be one you sell, with `canSell` set to `true`, and it can't be archived. Otherwise the request fails with a `422` error and the code `invalid-reference`. Existing line items aren't checked again. You can't change the stock item of an existing line item, so leave `stockItemId` out or send the value it already has. A different value fails with a `409` error and the code `immutable-field`.\n",
            "minLength": 1
          },
          "description": {
            "type": "string",
            "maxLength": 60000,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The line item's description, as plain text. It can be up to 60,000 characters, and it can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners. If you leave it out on a new line item, Omono copies the stock item's `description`, not its `title`. If the stock item has no description, the line item's `description` is `null`. Omono stores the description with formatting, and that stored form must stay under 128 KB, so very long text can fail with a `422` error and the code `validation-failed`, even within the character limit. You can't send `null`, even though a line item you read can have a `null` description: to keep the description as it is, leave the field out.\n"
          },
          "quantity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "The quantity to credit, up to 1,000,000,000 and with up to 4 decimal places."
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "The price of one unit, up to 1,000,000,000. Omono rounds it to your organisation's Unit Pricing precision. The line item's total is `quantity` multiplied by `price`.\n"
          },
          "salesAnalysisId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the line item's sales analysis code, which can't be archived. If you leave it out on a new line item, Omono uses the stock item's code. If the stock item has no code, the request fails with a `422` error and the code `missing-required-field`.\n",
            "minLength": 1
          },
          "taxRateId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the line item's tax rate. It can't be archived, and it can't be a system rate, one with `systemDefined` set to `true`, except for the exempt tax rate on tax-exempt stock. If you leave it out on a new line item, Omono uses the customer's tax rate, and you can't send `null`. Line items for tax-exempt stock always get your organisation's exempt tax rate, whatever you send, so for those line items you can leave `taxRateId` out, or send the ID of the tax rate whose `type` is `exempt` from [List all tax rates](#tag/tax-and-currency). If your organisation has no exempt tax rate, the request fails with a `422` error and the code `missing-exempt-tax-rate`. Sending the exempt tax rate for stock that isn't tax-exempt, or a value that isn't a tax rate's ID, fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the line item. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. On an existing line item, send `null` to remove it. Two line items of the credit note can't have the same one: two entries with the same value fail with a `422` error and the code `validation-failed`, and a value another line item already has fails with a `409` error and the code `duplicate-external-ref`. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "if": {
          "not": {
            "required": [
              "id"
            ]
          }
        },
        "then": {
          "required": [
            "stockItemId",
            "quantity",
            "price"
          ]
        }
      },
      "CreditNoteUpdate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The fields to change on a credit note. Any fields you leave out stay as they are, and `null` clears a field that can be empty. You can't change the company, so sending `companyId` fails with a `422` error and the code `unknown-field`. A request that would change a Complete credit note fails with a `409` error and the code `credit-note-complete`, but one that sends back its current values succeeds.\n",
        "properties": {
          "contactId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of a contact at the credit note's customer. A new contact can't be archived, or the request fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "raisedById": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the user who raised the credit note. It must be a user whose `assignable` is `true` in [List all users](#tag/organisation). Archived users, users who represent a contact and your organisation's API user aren't assignable, and naming one makes the request fail with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "exchangeRate": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000,
            "x-decimal-places": 5,
            "description": "The exchange rate for the credit note: the number of units of its currency that equal 1 unit of your base currency, with up to 5 decimal places. Take the current rate from [List all currency rates](#tag/tax-and-currency). If the customer trades in your base currency, Omono always stores 1, whatever you send. Learn more about [money](/docs/conventions#money).\n"
          },
          "refNo": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100,
            "description": "Your reference for the credit note, up to 100 characters. Send `null` to clear it."
          },
          "divisionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the division the credit note belongs to, which can't be archived. Send `null` to clear it.",
            "minLength": 1
          },
          "lineItems": {
            "type": "array",
            "maxItems": 250,
            "description": "A list of changes to the credit note's line items, with up to 250 entries. When you send it, you must also send `If-Match`. The list never changes the order of the line items: a line item you change keeps its place, and new line items go at the end, in the order you send them. To reorder the line items, send `lineItemOrder`. A request with `lineItems` counts as more than one request against your rate limits. Learn more about [changing line items](/docs/writing#line-changes) and [heavy writes](/docs/limits#heavy-writes).\n",
            "items": {
              "$ref": "#/components/schemas/CreditNoteLineItemWrite"
            }
          },
          "lineItemOrder": {
            "type": "array",
            "maxItems": 250,
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "description": "The order you want the credit note's line items in, as a list of their IDs. This is the only way to reorder them, because `lineItems` never changes their order. List every line item that stays, once each. Leave out any line item your `lineItems` deletes in the same request, and any new line item you add, because new line items go after the ones you list, in the order you send them. An ID that isn't one of these line items fails with a `422` error and the code `invalid-reference`. A list that leaves a line item out, names one twice or names one you delete fails with a `422` error and the code `validation-failed`. Sending the current order changes nothing, so the ETag stays the same. When you send `lineItemOrder`, you must also send `If-Match`, and it counts against your rate limits in the same way as a `lineItems` change. Learn more about [changing line items](/docs/writing#line-changes).\n"
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the credit note. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. Send `null` to remove it. If another of your organisation's credit notes already has it, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one. Learn more about [external references](/docs/writing#external-references).\n"
          }
        }
      },
      "CreditNoteUpdated": {
        "description": "The response to updating a credit note: the credit note with its line items. If you sent `lineItems`, it also includes `createdLineItems`, which gives the ID of each line item you added. Otherwise that field is left out.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/CreditNoteWithLineItems"
          },
          {
            "type": "object",
            "properties": {
              "createdLineItems": {
                "$ref": "#/components/schemas/CreatedLineItems"
              }
            },
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "CreditNoteActionResult": {
        "type": "object",
        "description": "The response to completing a credit note. It tells you whether this request completed the credit note, and it always includes the credit note as it is now.\n",
        "properties": {
          "applied": {
            "type": "boolean",
            "description": "Whether this request completed the credit note. It's `false` if the credit note was already Complete, and in that case nothing changed."
          },
          "creditNote": {
            "$ref": "#/components/schemas/CreditNoteWithLineItems"
          }
        },
        "required": [
          "applied",
          "creditNote"
        ],
        "additionalProperties": true
      },
      "PurchaseOrderLineItem": {
        "type": "object",
        "description": "A line item on a purchase order: one stock item you're buying, with its quantity and price. Once a line item is on an invoiced delivery, you can still change its `quantity`, but not its `price`, `taxRateId`, `purchaseAnalysisId`, `tagNumber` or `description`: a change to any of those fails with a `409` error and the code `line-item-invoiced-locked`. You also can't reduce `quantity` below `quantityOnDeliveries`, which fails with a `409` error and the code `below-delivered-quantity`.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the line item."
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for the line item, such as the line's ID in your system, or `null` if it has none. Only the API sets it. It's unique among the line items of the purchase order. Learn more about [external references](/docs/writing#external-references).\n"
          },
          "stockItemId": {
            "type": "string",
            "description": "The ID of the stock item you're buying. It must be an item you can buy, so it can't be an assembly. You set it when you add the line item, and it can't change after that. If the stock item is tax-exempt, the line item always uses your organisation's exempt tax rate.\n"
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "The description of the goods on this line item, as plain text, or `null` if there isn't one.\n"
          },
          "quantity": {
            "type": "number",
            "minimum": 0,
            "x-decimal-places": 4,
            "description": "The quantity you're ordering, with up to 4 decimal places."
          },
          "price": {
            "type": "number",
            "description": "The price of one unit, before tax, in the order's currency. The line item's total is `quantity` multiplied by `price`, rounded to 2 decimal places. Omono rounds a price you send to your organisation's Unit Pricing precision for purchasing, which is 2 or 4 decimal places, and the lock on invoiced line items compares prices at that precision. A price saved earlier can have more decimal places, so don't assume a fixed number. Learn more about [money](/docs/conventions#money).\n"
          },
          "discount": {
            "type": "number",
            "description": "You can't set this field. Purchase orders don't have discounts in Omono, and their totals ignore this field.\n"
          },
          "taxRateId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the line item's tax rate. Your tax rates are listed by [List all tax rates](#tag/tax-and-currency). It's `null` only on some old line items that were saved without a rate. When you change one of those, send a `taxRateId` with your change, because a line item can't be saved without a tax rate. If you leave it out, the request fails with a `422` error and the code `missing-required-field`, and sending `null` fails with a `422` error too.\n"
          },
          "purchaseAnalysisId": {
            "type": "string",
            "description": "The ID of the line item's purchase analysis code, which groups your purchases in reports. Your purchase analysis codes are listed by [List all purchase analysis codes](#tag/purchasing-and-shipping).\n"
          },
          "tagNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "An optional label for the line item, up to 1,000 characters, or `null` if there isn't one. It prints under the description on the purchase order.\n"
          },
          "quantityOnDeliveries": {
            "type": "number",
            "x-decimal-places": 4,
            "description": "The quantity of this line item that's on deliveries, whatever their status, with up to 4 decimal places. It counts goods booked onto a delivery whether or not they've arrived, so it tells you how much is scheduled for delivery, not how much has been received. You can't set this field.\n"
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the line item was created."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the line item was last changed."
          }
        },
        "required": [
          "id",
          "externalRef",
          "stockItemId",
          "description",
          "quantity",
          "price",
          "discount",
          "taxRateId",
          "purchaseAnalysisId",
          "tagNumber",
          "quantityOnDeliveries",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "DeliveryStatus": {
        "description": "The status of a delivery. The values are the same in every organisation.\n\nKnown values: `not_received`, `received`, `on_hold`. Omono can add values; handle one you don't recognise.\n",
        "type": "string",
        "x-known-values": [
          "not_received",
          "received",
          "on_hold"
        ],
        "x-enum-descriptions": [
          "The goods are expected but haven't arrived yet.",
          "The goods have arrived and are in stock.",
          "The delivery is paused."
        ]
      },
      "KnownDeliveryStatus": {
        "description": "The status of a delivery. The values are the same in every organisation.\n",
        "type": "string",
        "enum": [
          "not_received",
          "received",
          "on_hold"
        ],
        "x-enum-descriptions": [
          "The goods are expected but haven't arrived yet.",
          "The goods have arrived and are in stock.",
          "The delivery is paused."
        ]
      },
      "DeliveryLineItem": {
        "type": "object",
        "description": "A line item on a delivery: the quantity of one purchase order line item that the delivery brings. You can't change it through the API.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the delivery line item."
          },
          "purchaseOrderLineItemId": {
            "type": "string",
            "description": "The ID of the purchase order line item that this delivery line item delivers."
          },
          "stockItemId": {
            "type": "string",
            "description": "The ID of the stock item being delivered."
          },
          "quantity": {
            "type": "number",
            "x-decimal-places": 4,
            "description": "The quantity on this delivery, with up to 4 decimal places."
          },
          "serialNumber": {
            "type": [
              "string",
              "null"
            ],
            "description": "The serial number that staff recorded for the goods on this line item, or `null` if there isn't one.\n"
          }
        },
        "required": [
          "id",
          "purchaseOrderLineItemId",
          "stockItemId",
          "quantity",
          "serialNumber"
        ],
        "additionalProperties": true
      },
      "Delivery": {
        "type": "object",
        "description": "A delivery of goods from the supplier against a purchase order. A delivery is created for the goods expected, then marked as received when the goods arrive, which adds them to stock. Through the API, you can read deliveries and create, change and delete expected ones; staff receive them in Omono.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the delivery."
          },
          "deliveryNo": {
            "type": "integer",
            "description": "The delivery's number within its purchase order, starting at 1. Omono shows it after the order's number, for example PO-311-1 for the first delivery on PO-311.\n"
          },
          "deliveryDate": {
            "type": "string",
            "format": "date",
            "description": "The date the goods are due to arrive, as `YYYY-MM-DD`. Learn more about [dates](/docs/conventions#dates).\n"
          },
          "receivedDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The date the goods were received, as `YYYY-MM-DD`, or `null` if the delivery hasn't been received. When staff mark the delivery as received, Omono sets it to that day in UTC, and staff can change it afterwards. It goes back to `null` if the delivery is moved back to `not_received` or put on hold.\n"
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DeliveryStatus"
              }
            ],
            "description": "The delivery's status. A delivery is `not_received` while the goods are expected but haven't arrived yet, `received` once the goods are in stock, and `on_hold` while it's paused. You can't change it through the API, because staff change it in Omono.\n"
          },
          "invoiceNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The number of the supplier's invoice for this delivery, or `null` if no invoice has been recorded. Staff record it once, in Omono, on a delivery that's been received. After that, the number, the delivery, its status and its line items can't change.\n"
          },
          "invoiceDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The date of the supplier's invoice, as `YYYY-MM-DD`, as staff entered it when they recorded the invoice. It's `null` if no invoice has been recorded, or if staff marked the invoice as unavailable.\n"
          },
          "invoiceUnavailable": {
            "type": "boolean",
            "description": "Whether staff have recorded that the supplier won't send an invoice for this delivery, for example because the goods were a free replacement.\n"
          },
          "totalValue": {
            "type": "number",
            "description": "The value of the goods on this delivery, before tax, in the purchase order's currency. Omono works it out from the quantities on the delivery and the prices on the purchase order's line items. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains.\n"
          },
          "totalValueBase": {
            "type": [
              "number",
              "null"
            ],
            "description": "`totalValue` in your organisation's base currency, as Omono saved it, or `null` if the delivery has none saved, as on some old records. Omono saves it each time it works out the total in the purchase order's currency, converted at the purchase order's exchange rate and rounded to 2 decimal places, so working it out yourself from the total and the `exchangeRate` can differ by 0.01. Learn more about [money](/docs/conventions#money).\n"
          },
          "xero": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/XeroSync"
              },
              {
                "type": "null"
              }
            ],
            "description": "The state of the delivery's sync to Xero, where Omono sends it as a supplier bill, or `null` if your organisation isn't connected to Xero. Omono counts your organisation as connected while Xero is connected on the **Connect** page of **Settings** in Omono, which is also what `GET /settings` reports in `xero.connected`. Disconnecting Xero makes this `null` on every record, although the record keeps its sync state for when you connect again. A sync changes the record's `updated`.\n"
          },
          "lineItems": {
            "type": "array",
            "description": "The delivery's line items: which purchase order line items it brings, and how many of each. They follow the order of the purchase order's line items.\n",
            "items": {
              "$ref": "#/components/schemas/DeliveryLineItem"
            }
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the delivery was created."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the delivery was last changed."
          }
        },
        "required": [
          "id",
          "deliveryNo",
          "deliveryDate",
          "receivedDate",
          "status",
          "invoiceNo",
          "invoiceDate",
          "invoiceUnavailable",
          "totalValue",
          "totalValueBase",
          "xero",
          "lineItems",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "PurchaseOrder": {
        "type": "object",
        "description": "A purchase order you send to a supplier to buy stock items.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the purchase order."
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for the purchase order, such as its ID in your purchasing or planning system, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's purchase orders, archived ones included, and cancelled ones, so you can find the purchase order again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references).\n"
          },
          "purchaseOrderNo": {
            "type": "string",
            "description": "The purchase order's number. Omono shows it with a \"PO-\" prefix, for example PO-311, but this field holds only the number, such as `\"311\"`.\n"
          },
          "companyId": {
            "type": "string",
            "description": "The ID of the supplier you're buying from. You set it when you create the order, and it can't change after that.\n"
          },
          "contactId": {
            "type": "string",
            "description": "The ID of the person at the supplier who deals with this order. The contact always belongs to the supplier.\n"
          },
          "addressId": {
            "type": "string",
            "description": "The ID of the address the supplier delivers the goods to. It's one of your organisation's addresses, which [List all organisation addresses](#tag/organisation) returns. On a drop-ship order, it's one of the customer's addresses instead (see `dropShipCustomerCompanyId`). It's never the supplier's own address.\n"
          },
          "refNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for the order, for example a job number or the customer's order number. It prints on the purchase order, and Omono doesn't check that it's unique.\n"
          },
          "buyerId": {
            "type": "string",
            "description": "The ID of the user in your organisation who is buying the goods. Your users are listed by [List all users](#tag/organisation).\n"
          },
          "callOff": {
            "type": "boolean",
            "description": "Whether this is a call-off order: a blanket order that the supplier delivers in several parts over time. When you issue a call-off order, it moves to On Order - Call Off (`on_order_call_off`) instead of On Order (`on_order`). On an order in one of those two statuses, changing this field moves the order to the other one.\n"
          },
          "status": {
            "allOf": [
              {
                "$ref": "#/components/schemas/OrderStatus"
              }
            ],
            "description": "The order's status, which is one of `draft`, `on_order`, `complete`, `cancelled`, `on_hold` or `on_order_call_off`. A Draft order is still being prepared and doesn't affect stock. An order is On Order once it's issued to the supplier, or On Order - Call Off if it's an issued call-off order. It's On Hold while at least one delivery is on hold, and Complete once every line item has been fully delivered and every delivery received. You can't set the status directly. It changes when you issue or cancel the order, and Omono recalculates it as deliveries are received and line items change.\n"
          },
          "currencyId": {
            "type": "string",
            "description": "The ID of the order's currency, which is always the supplier's currency. You can't set it, because Omono copies it from the company, and it can't change. Currencies are listed by [List all currencies](#tag/tax-and-currency).\n"
          },
          "exchangeRate": {
            "type": [
              "number",
              "null"
            ],
            "description": "The exchange rate for the order: the number of units of the order's currency that equal 1 unit of your base currency. If you send back the value you read in an update, the rate doesn't change. The rate is locked once any delivery on the order has been invoiced, and it's always 1 on an order in your base currency. It's `null` only on some old orders that were saved without a rate. Learn more about [money](/docs/conventions#money).\n"
          },
          "eoriNumberId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the EORI number shown on the order, or `null` if there isn't one. An EORI number identifies your business to customs. Your EORI numbers are listed by [List all EORI numbers](#tag/purchasing-and-shipping).\n"
          },
          "incotermId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the order's incoterm, or `null` if there isn't one. An incoterm is a standard trade term that says who pays for shipping the goods and who carries the risk on the way. Your incoterms are listed by [List all incoterms](#tag/purchasing-and-shipping).\n"
          },
          "incotermNamedPlace": {
            "type": [
              "string",
              "null"
            ],
            "description": "The place named with the incoterm, for example `Düsseldorf, DE`, or `null` if there isn't one.\n"
          },
          "divisionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the division of your organisation that the order belongs to, or `null` if there isn't one. Your divisions are listed by [List all divisions](#tag/organisation).\n"
          },
          "dropShipCustomerCompanyId": {
            "type": [
              "string",
              "null"
            ],
            "description": "On a drop-ship order, the ID of the customer the supplier delivers to. A drop-ship order sends the goods straight from the supplier to your customer, so its `addressId` is one of the customer's addresses. This field is `null` on other orders.\n"
          },
          "totalValue": {
            "type": "number",
            "description": "The total value of the order, before tax, in the order's currency. You can't set it, because Omono works it out from the line items. It has up to 2 decimal places in every currency, as [money](/docs/conventions#money) explains.\n"
          },
          "totalValueBase": {
            "type": [
              "number",
              "null"
            ],
            "description": "`totalValue` in your organisation's base currency, as Omono saved it, or `null` if the order has none saved, as on some old records. Omono saves it each time it works out the total in the order's currency, converted at the order's exchange rate and rounded to 2 decimal places, so working it out yourself from the total and the `exchangeRate` can differ by 0.01. Learn more about [money](/docs/conventions#money).\n"
          },
          "linkedSalesOrderId": {
            "type": [
              "string",
              "null"
            ],
            "description": "If staff raised this order in Omono to buy the goods for a sales order, the ID of that sales order. Otherwise it's `null`. You can't set this field.\n"
          },
          "linkedSalesOrderNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The number of the linked sales order, without its \"SO-\" prefix, or `null` if the order isn't linked to one. You can't set this field.\n"
          },
          "lineItems": {
            "type": "array",
            "description": "The order's line items, in order. A single purchase order always includes them, whether you retrieve, create, update, issue or cancel it. In a list, they're included only when you add `include=lineItems`.\n",
            "items": {
              "$ref": "#/components/schemas/PurchaseOrderLineItem"
            }
          },
          "deliveries": {
            "type": "array",
            "description": "The order's deliveries, sorted by `deliveryNo`, then `id`. They're included only when you add `include=deliveries`, either to a list or when you retrieve a single order.\n",
            "items": {
              "$ref": "#/components/schemas/Delivery"
            }
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the purchase order was created."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the purchase order was last changed. A change to one of its deliveries in Omono also updates this time.\n"
          }
        },
        "required": [
          "id",
          "externalRef",
          "purchaseOrderNo",
          "companyId",
          "contactId",
          "addressId",
          "refNo",
          "buyerId",
          "callOff",
          "status",
          "currencyId",
          "exchangeRate",
          "eoriNumberId",
          "incotermId",
          "incotermNamedPlace",
          "divisionId",
          "dropShipCustomerCompanyId",
          "totalValue",
          "totalValueBase",
          "linkedSalesOrderId",
          "linkedSalesOrderNo",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "PurchaseOrderList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The purchase orders on this page.",
                "items": {
                  "$ref": "#/components/schemas/PurchaseOrder"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "PurchaseOrderLineItemCreate": {
        "type": "object",
        "additionalProperties": false,
        "description": "One entry in the `lineItems` array when you create a purchase order. Each entry adds a new line item. It needs `stockItemId`, `quantity` and `price`, and Omono fills in `taxRateId`, `purchaseAnalysisId` and `description` if you leave them out. You can't send `discount`. You can't send `id` or `delete` either, because every entry is a new line item. Either one fails with a `422` error and the code `validation-failed`. To change line items later, update the order. Learn more about [creating a document with line items](/docs/writing#creating-a-document-with-lines).\n",
        "properties": {
          "stockItemId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the stock item to buy. The stock item can't be archived, or the request fails with a `422` error and the code `invalid-reference`, and it must be one you can buy, or the request fails with a `409` error and the code `stock-not-buyable`.\n",
            "minLength": 1
          },
          "description": {
            "type": "string",
            "maxLength": 60000,
            "pattern": "^[^‎-‏‪-‮⁦-⁩﻿]*$",
            "description": "The description of the goods on this line item, as plain text. It can be up to 60,000 characters, and it can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners. If you leave it out, Omono uses the stock item's `purchasingDescription` when its `dualDescriptionEnabled` is `true`, and its `description` otherwise. Omono stores the description with formatting, and that stored form must stay under 128 KB, so very long text can fail with a `422` error and the code `validation-failed`, even within the character limit. You can't send `null`.\n"
          },
          "quantity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "The quantity to order, up to 1,000,000,000 and with up to 4 decimal places."
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "The price of one unit, before tax, in the order's currency, up to 1,000,000,000. The line item's total is `quantity` multiplied by `price`. Omono rounds the price to your organisation's Unit Pricing precision for purchasing.\n"
          },
          "taxRateId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the line item's tax rate. Your tax rates are listed by [List all tax rates](#tag/tax-and-currency). If you leave it out, Omono uses the supplier's `taxRateId`, and if the supplier doesn't have one, the request fails with a `422` error and the code `missing-required-field`. You can't send `null`, which fails with the code `validation-failed`. A tax-exempt stock item always uses your organisation's exempt tax rate, whatever you send. You can't choose a system rate, one with `systemDefined` set to `true`, except the exempt tax rate on a tax-exempt stock item. Any other system rate fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "purchaseAnalysisId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the line item's purchase analysis code, which groups your purchases in reports. Your purchase analysis codes are listed by [List all purchase analysis codes](#tag/purchasing-and-shipping). If you leave it out, Omono uses the stock item's code, and if the stock item doesn't have one, the request fails with a `422` error and the code `missing-required-field`.\n",
            "minLength": 1
          },
          "tagNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "An optional label for the line item, up to 1,000 characters, or `null` for none. It prints under the description on the purchase order.\n"
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the line item, such as the line's ID in your system. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. Two line items of the purchase order can't have the same one: two entries with the same value fail with a `422` error and the code `validation-failed`, and a value another line item already has fails with a `409` error and the code `duplicate-external-ref`. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "stockItemId",
          "quantity",
          "price"
        ]
      },
      "PurchaseOrderCreate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The purchase order to create and, if you like, its line items. If you leave out `divisionId` or `eoriNumberId`, Omono fills it in for you. Send `null` instead if you want the order to have none.\n",
        "properties": {
          "companyId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the supplier you're buying from. It must be a company with `isSupplier: true`, or the request fails with a `422` error and the code `invalid-reference`. If the supplier is archived, the request fails with a `409` error and the code `company-archived`. Omono checks the supplier before it gives the order a number.\n",
            "minLength": 1
          },
          "contactId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the person at the supplier who deals with this order. If the contact belongs to another company, the request fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "addressId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the address the supplier delivers the goods to. It must be one of your organisation's addresses, which [List all organisation addresses](#tag/organisation) returns, or, if you set `dropShipCustomerCompanyId`, one of that customer's addresses. It's never the supplier's own address. Any other address makes the request fail with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "refNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Your own reference for the order, up to 100 characters, for example a job number or the customer's order number. It prints on the purchase order, and it can't be empty.\n"
          },
          "buyerId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the user in your organisation who is buying the goods. It must be a user whose `assignable` is `true` in [List all users](#tag/organisation). Any other user makes the request fail with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "callOff": {
            "type": "boolean",
            "description": "Whether this is a call-off order: a blanket order that the supplier delivers in several parts over time. When you issue a call-off order, it moves to On Order - Call Off (`on_order_call_off`) instead of On Order (`on_order`). The default is `false`.\n"
          },
          "exchangeRate": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000,
            "x-decimal-places": 5,
            "description": "The exchange rate for the order: the number of units of the order's currency that equal 1 unit of your base currency. The order is in the supplier's currency. Take the current rate from [List all currency rates](#tag/tax-and-currency). If the order is in your base currency, Omono always stores 1, whatever you send. Learn more about [money](/docs/conventions#money).\n"
          },
          "eoriNumberId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the EORI number to show on the order, or `null` for none. If you leave it out and your organisation has exactly one EORI number, Omono uses that one. Otherwise the order has none. Your EORI numbers are listed by [List all EORI numbers](#tag/purchasing-and-shipping).\n",
            "minLength": 1
          },
          "incotermId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the order's incoterm, or `null` for none. Your incoterms are listed by [List all incoterms](#tag/purchasing-and-shipping).\n",
            "minLength": 1
          },
          "incotermNamedPlace": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100,
            "description": "The place named with the incoterm, for example `Düsseldorf, DE`, or `null` for none. Up to 100 characters.\n"
          },
          "divisionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the division of your organisation that the order belongs to, or `null` for none. If you leave it out, Omono uses the supplier's `supplierDivisionId`, as long as that division isn't archived. Otherwise the order has no division: unlike the form in Omono, the API never uses your own user's division. Your divisions are listed by [List all divisions](#tag/organisation).\n",
            "minLength": 1
          },
          "dropShipCustomerCompanyId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "For a drop-ship order, where the supplier delivers straight to your customer, the ID of that customer. It must be a company with `isCustomer: true` that isn't archived, or the request fails with a `422` error and the code `invalid-reference`. Leave it out, or send `null`, for an ordinary order.\n",
            "minLength": 1
          },
          "lineItems": {
            "type": "array",
            "maxItems": 250,
            "description": "The order's line items, in the order you want them, up to 250. Each entry adds a new line item, so you can't send `id` or `delete`. Every stock item must be one you can buy: if one can't be bought, the request fails with a `409` error and the code `stock-not-buyable`. Leave `lineItems` out, or send an empty list, to create an order without line items. Learn more about [creating a document with line items](/docs/writing#creating-a-document-with-lines).\n",
            "items": {
              "$ref": "#/components/schemas/PurchaseOrderLineItemCreate"
            }
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the purchase order, such as its ID in your purchasing or planning system. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. If another of your organisation's purchase orders already has it, archived ones included, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one, so a purchase order you send twice is created only once. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "companyId",
          "contactId",
          "addressId",
          "refNo",
          "buyerId",
          "exchangeRate"
        ]
      },
      "PurchaseOrderCreated": {
        "description": "The response to creating a purchase order: the new purchase order with its line items, plus `createdLineItems`, which gives the ID of the line item created from each entry in your `lineItems` array.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/PurchaseOrder"
          },
          {
            "type": "object",
            "properties": {
              "createdLineItems": {
                "$ref": "#/components/schemas/CreatedLineItems"
              }
            },
            "required": [
              "lineItems",
              "createdLineItems"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "PurchaseOrderWithLineItems": {
        "description": "A purchase order with its line items always included. You get this shape when you retrieve, update, issue or cancel a single purchase order.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/PurchaseOrder"
          },
          {
            "type": "object",
            "required": [
              "lineItems"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "PurchaseOrderLineItemWrite": {
        "type": "object",
        "additionalProperties": false,
        "description": "One entry in the `lineItems` array when you update a purchase order. Each entry adds, changes or deletes one line item. A new line item needs `stockItemId`, `quantity` and `price`, and Omono fills in `taxRateId`, `purchaseAnalysisId` and `description` if you leave them out. You can't send `discount`. Learn more about [changing line items](/docs/writing#line-changes).\n",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of an existing line item on this order, to change or delete it. Leave it out to add a new line item. If the ID belongs to a line item on another order, the request fails with a `422` error and the code `invalid-reference`. If you send the same ID twice, it fails with a `422` error and the code `validation-failed`.\n",
            "minLength": 1
          },
          "delete": {
            "type": "boolean",
            "description": "Set this to `true` to delete the line item named by `id`. Don't send any other fields with it, or the request fails with a `422` error and the code `validation-failed`.\n"
          },
          "stockItemId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the stock item to buy. A new line item needs it. The stock item can't be archived, or the request fails with a `422` error and the code `invalid-reference`, and it must be one you can buy, or the request fails with a `409` error and the code `stock-not-buyable`. You can't change the stock item of an existing line item, so leave `stockItemId` out or send the value it already has. A different value fails with a `409` error and the code `immutable-field`.\n",
            "minLength": 1
          },
          "description": {
            "type": "string",
            "maxLength": 60000,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The description of the goods on this line item, as plain text. It can be up to 60,000 characters, and it can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners. If you leave it out on a new line item, Omono uses the stock item's `purchasingDescription` when its `dualDescriptionEnabled` is `true`, and its `description` otherwise. Omono stores the description with formatting, and that stored form must stay under 128 KB, so very long text can fail with a `422` error and the code `validation-failed`, even within the character limit. You can't send `null`, even though a line item you read can have a `null` description: to keep the description as it is, leave the field out. Once the line item is on an invoiced delivery, its description can't change: a different value fails with a `409` error and the code `line-item-invoiced-locked`, but the same value is accepted.\n"
          },
          "quantity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "The quantity to order, up to 1,000,000,000 and with up to 4 decimal places."
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "description": "The price of one unit, before tax, in the order's currency, up to 1,000,000,000. The line item's total is `quantity` multiplied by `price`. Omono rounds the price to your organisation's Unit Pricing precision for purchasing.\n",
            "maximum": 1000000000
          },
          "taxRateId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the line item's tax rate. Your tax rates are listed by [List all tax rates](#tag/tax-and-currency). If you leave it out on a new line item, Omono uses the supplier's `taxRateId`, and if the supplier doesn't have one, the request fails with a `422` error and the code `missing-required-field`. You can't send `null`, which fails with the code `validation-failed`. A tax-exempt stock item always uses your organisation's exempt tax rate, whatever you send. You can't choose a system rate, one with `systemDefined` set to `true`, except the exempt tax rate on a tax-exempt stock item. Any other system rate fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "purchaseAnalysisId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the line item's purchase analysis code, which groups your purchases in reports. Your purchase analysis codes are listed by [List all purchase analysis codes](#tag/purchasing-and-shipping). If you leave it out on a new line item, Omono uses the stock item's code, and if the stock item doesn't have one, the request fails with a `422` error and the code `missing-required-field`.\n",
            "minLength": 1
          },
          "tagNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "An optional label for the line item, up to 1,000 characters. It prints under the description on the purchase order. Send `null` to remove it.\n"
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the line item. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. On an existing line item, send `null` to remove it. Two line items of the purchase order can't have the same one: two entries with the same value fail with a `422` error and the code `validation-failed`, and a value another line item already has fails with a `409` error and the code `duplicate-external-ref`. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "if": {
          "not": {
            "required": [
              "id"
            ]
          }
        },
        "then": {
          "required": [
            "stockItemId",
            "quantity",
            "price"
          ]
        }
      },
      "PurchaseOrderUpdate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The fields to change on a purchase order. Any fields you leave out stay as they are, and `null` clears a field that can be empty. You can't send `companyId`, because the supplier can't change: if you do, the request fails with a `422` error and the code `unknown-field`.\n",
        "properties": {
          "contactId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the person at the supplier who deals with this order. If the contact belongs to another company, the request fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "addressId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the address the supplier delivers the goods to. It must be one of your organisation's addresses, which [List all organisation addresses](#tag/organisation) returns, or, if the order has a `dropShipCustomerCompanyId`, one of that customer's addresses. It's never the supplier's own address. Any other address makes the request fail with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "refNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Your own reference for the order, up to 100 characters, for example a job number or the customer's order number. It can't be empty.\n"
          },
          "buyerId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the user in your organisation who is buying the goods. It must be a user whose `assignable` is `true` in [List all users](#tag/organisation). Any other user makes the request fail with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "callOff": {
            "type": "boolean",
            "description": "Whether this is a call-off order: a blanket order that the supplier delivers in several parts over time. On an order that's On Order (`on_order`), setting it changes the status to On Order - Call Off (`on_order_call_off`), and clearing it changes the status back. On any other status, the status doesn't change. Omono uses the value later, to choose between those two statuses when you issue the order, when it comes off hold, or when a Complete order is reopened.\n"
          },
          "exchangeRate": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000,
            "x-decimal-places": 5,
            "description": "The exchange rate for the order: the number of units of the order's currency that equal 1 unit of your base currency. Take the current rate from [List all currency rates](#tag/tax-and-currency). If the order is in your base currency, Omono always stores 1, whatever you send. Once any delivery on the order has been invoiced, the rate is locked, and a different rate fails with a `409` error and the code `exchange-rate-locked`. Sending back the value you read is always accepted. Learn more about [money](/docs/conventions#money).\n"
          },
          "eoriNumberId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the EORI number to show on the order, or `null` for none. Your EORI numbers are listed by [List all EORI numbers](#tag/purchasing-and-shipping).\n",
            "minLength": 1
          },
          "incotermId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the order's incoterm, or `null` for none. Your incoterms are listed by [List all incoterms](#tag/purchasing-and-shipping).\n",
            "minLength": 1
          },
          "incotermNamedPlace": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100,
            "description": "The place named with the incoterm, for example `Düsseldorf, DE`, or `null` for none. Up to 100 characters.\n"
          },
          "divisionId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the division of your organisation that the order belongs to, or `null` for none. Your divisions are listed by [List all divisions](#tag/organisation).\n",
            "minLength": 1
          },
          "dropShipCustomerCompanyId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "For a drop-ship order, where the supplier delivers straight to your customer, the ID of that customer, or `null` for an ordinary order. It must be a company with `isCustomer: true` that isn't archived, or the request fails with a `422` error and the code `invalid-reference`. Omono checks this only when you change the value.\n",
            "minLength": 1
          },
          "lineItems": {
            "type": "array",
            "maxItems": 250,
            "description": "A list of changes to the order's line items, with up to 250 entries. When you send it, you must also send `If-Match`. Omono checks every change before it saves any of them. You can't change the line items of an order that has more than 250 of them this way: the request fails with a `422` error and the code `validation-failed`. The list never changes the order of the line items: a line item you change keeps its place, and new line items go at the end, in the order you send them. To reorder the line items, send `lineItemOrder`. Learn more about [changing line items](/docs/writing#line-changes) and [heavy writes](/docs/limits#heavy-writes).\n",
            "items": {
              "$ref": "#/components/schemas/PurchaseOrderLineItemWrite"
            }
          },
          "lineItemOrder": {
            "type": "array",
            "maxItems": 250,
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "description": "The order you want the line items in, as a list of their IDs. This is the only way to reorder them, because `lineItems` never changes their order. List every line item that stays, once each. Leave out any line item your `lineItems` deletes in the same request, and any new line item you add, because new line items go after the ones you list, in the order you send them. An ID that isn't one of these line items fails with a `422` error and the code `invalid-reference`. A list that leaves a line item out, names one twice or names one you delete fails with a `422` error and the code `validation-failed`. Sending the current order changes nothing, so the ETag stays the same. When you send `lineItemOrder`, you must also send `If-Match`, and it counts against your rate limits in the same way as a `lineItems` change. Once the order has a delivery, the order of its line items is fixed: sending a different order fails with a `409` error and the code `line-order-fixed`, but you can still add line items at the end. On a cancelled order, a different order fails with a `409` error and the code `purchase-order-cancelled`. Learn more about [changing line items](/docs/writing#line-changes).\n"
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the purchase order. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. Send `null` to remove it. If another of your organisation's purchase orders already has it, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one. Learn more about [external references](/docs/writing#external-references).\n"
          }
        }
      },
      "PurchaseOrderUpdated": {
        "description": "The response to updating a purchase order: the purchase order with its line items. If you sent `lineItems`, it also includes `createdLineItems`, which gives the ID of each line item you added. Otherwise that field is left out.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/PurchaseOrderWithLineItems"
          },
          {
            "type": "object",
            "properties": {
              "createdLineItems": {
                "$ref": "#/components/schemas/CreatedLineItems"
              }
            },
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "PurchaseOrderActionResult": {
        "type": "object",
        "description": "The response to issuing or cancelling a purchase order. It tells you whether this request changed the order, and it always includes the order as it is now. Learn more about [lifecycle actions](/docs/writing#lifecycle-actions).\n",
        "properties": {
          "applied": {
            "type": "boolean",
            "description": "Whether this request changed the order. It's `false` if the order was already past Draft when you issued it, or already cancelled when you cancelled it, and in that case nothing changed.\n"
          },
          "purchaseOrder": {
            "$ref": "#/components/schemas/PurchaseOrderWithLineItems"
          }
        },
        "required": [
          "applied",
          "purchaseOrder"
        ],
        "additionalProperties": true
      },
      "DeliveryList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The deliveries on this page.",
                "items": {
                  "$ref": "#/components/schemas/Delivery"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "DeliveryLineItemCreate": {
        "type": "object",
        "description": "One of the order's line items expected on a new delivery, and how many.",
        "additionalProperties": false,
        "properties": {
          "purchaseOrderLineItemId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of a line item on this purchase order. If it belongs to another order, the request fails with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "quantity": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "How many are expected, with up to 4 decimal places. It can't be more than the quantity of the line item that isn't on another delivery yet. Otherwise the request fails with a `409` error and the code `quantity-exceeds-remaining`, and the message says how many are left.\n"
          },
          "serialNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "The serial numbers of the goods on this line item, if you track them. Several numbers go in this one field, usually separated by commas."
          }
        },
        "required": [
          "purchaseOrderLineItemId",
          "quantity"
        ]
      },
      "DeliveryCreate": {
        "type": "object",
        "additionalProperties": false,
        "description": "A new expected delivery on a purchase order. Omono creates it as `not_received`, so it doesn't change any stock levels. Staff receive it in Omono when the goods arrive.",
        "properties": {
          "deliveryDate": {
            "type": "string",
            "format": "date",
            "description": "The date the goods are expected, as `YYYY-MM-DD`. Learn more about [dates](/docs/conventions#dates).\n"
          },
          "lineItems": {
            "type": "array",
            "minItems": 1,
            "maxItems": 250,
            "description": "The order's line items expected on this delivery, and how many of each, up to 250. Name each line item at most once.\n",
            "items": {
              "$ref": "#/components/schemas/DeliveryLineItemCreate"
            }
          }
        },
        "required": [
          "deliveryDate",
          "lineItems"
        ]
      },
      "DeliveryLineItemUpdate": {
        "type": "object",
        "description": "One line item to add to a delivery, change on it, or remove from it with `delete: true`.\n",
        "additionalProperties": false,
        "properties": {
          "purchaseOrderLineItemId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of a line item on this purchase order. To change or remove a line item that's already on the delivery, name it here. To add one, name a line item of the order that isn't on the delivery yet and send its `quantity`.\n",
            "minLength": 1
          },
          "quantity": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "The new quantity for this line item on the delivery, with up to 4 decimal places. It can't be more than the quantity of the line item that isn't on another delivery. Otherwise the request fails with a `409` error and the code `quantity-exceeds-remaining`, and the message says how many are left.\n"
          },
          "serialNumber": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "The serial numbers of the goods on this line item. Send `null` or an empty string to clear them."
          },
          "delete": {
            "type": "boolean",
            "description": "Set this to `true` to remove the line item from the delivery. Don't send any other field with it, apart from `purchaseOrderLineItemId`."
          }
        },
        "required": [
          "purchaseOrderLineItemId"
        ]
      },
      "DeliveryUpdate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The changes to an expected delivery. Any field you leave out keeps its value, and a line item you don't name stays as it is.",
        "properties": {
          "deliveryDate": {
            "type": "string",
            "format": "date",
            "description": "The date the goods are expected, as `YYYY-MM-DD`.\n"
          },
          "lineItems": {
            "type": "array",
            "minItems": 1,
            "maxItems": 250,
            "description": "The line items to add, change or remove, up to 250. Name each line item at most once. To remove every line item, delete the delivery instead.\n",
            "items": {
              "$ref": "#/components/schemas/DeliveryLineItemUpdate"
            }
          }
        }
      },
      "DeliveryWithPurchaseOrder": {
        "description": "A delivery with the purchase order it belongs to and the supplier, as [List all deliveries](#tag/deliveries/GET/deliveries) returns it. Its `totalValue` is in the purchase order's currency, `currencyId`. It has no tax: Omono doesn't store the tax on a supplier's invoice, only the difference that staff typed between it and the tax Omono worked out, so read the tax from the invoice itself.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/Delivery"
          },
          {
            "type": "object",
            "properties": {
              "purchaseOrderId": {
                "type": "string",
                "description": "The ID of the purchase order the delivery belongs to."
              },
              "purchaseOrderNo": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The number of the purchase order, without the \"PO-\" prefix that Omono shows. It's `null` only if the purchase order can't be found."
              },
              "companyId": {
                "type": "string",
                "description": "The ID of the supplier, the purchase order's company."
              },
              "currencyId": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The ID of the purchase order's currency, as `currencyId` on the [purchase order](#tag/purchase-orders). The delivery's `totalValue` is in this currency. It's `null` only if the purchase order can't be found."
              },
              "exchangeRate": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "The purchase order's exchange rate, as `exchangeRate` on the [purchase order](#tag/purchase-orders): the number of units of the order's currency that equal 1 unit of your base currency. Divide an amount by it to get your base currency. It's `null` if the purchase order can't be found, and on some old orders that were saved without a rate. Learn more about [money](/docs/conventions#money).\n"
              }
            },
            "required": [
              "purchaseOrderId",
              "purchaseOrderNo",
              "companyId",
              "currencyId",
              "exchangeRate"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "DeliveryWithPurchaseOrderList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The deliveries on this page.",
                "items": {
                  "$ref": "#/components/schemas/DeliveryWithPurchaseOrder"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "StockKind": {
        "description": "The kind of stock item, as in Omono. An item keeps its kind for life.\n\nKnown values: `normal`, `assembly`, `never_diminishing`. Omono can add values; handle one you don't recognise.\n",
        "type": "string",
        "x-known-values": [
          "normal",
          "assembly",
          "never_diminishing"
        ],
        "x-enum-descriptions": [
          "An ordinary item that Omono keeps a stock level for.",
          "An item that Omono builds from the other stock items in its bill of materials (`bom`). Picking an assembly picks its components.",
          "Something you buy and sell but don't count, such as a service, carriage or consumables. Omono keeps no stock level for it."
        ]
      },
      "KnownStockKind": {
        "description": "The kind of stock item, as in Omono. An item keeps its kind for life.",
        "type": "string",
        "enum": [
          "normal",
          "assembly",
          "never_diminishing"
        ],
        "x-enum-descriptions": [
          "An ordinary item that Omono keeps a stock level for.",
          "An item that Omono builds from the other stock items in its bill of materials (`bom`). Picking an assembly picks its components.",
          "Something you buy and sell but don't count, such as a service, carriage or consumables. Omono keeps no stock level for it."
        ]
      },
      "StockBomComponent": {
        "type": "object",
        "description": "One component in an assembly's bill of materials: a stock item, and how many of it go into one unit of the assembly.\n",
        "properties": {
          "stockItemId": {
            "type": "string",
            "description": "The ID of the component's stock item."
          },
          "quantity": {
            "type": "number",
            "x-decimal-places": 4,
            "description": "How many units of the component go into one unit of the assembly, with up to 4 decimal places.\n"
          }
        },
        "required": [
          "stockItemId",
          "quantity"
        ],
        "additionalProperties": true
      },
      "StockItemSupplier": {
        "type": "object",
        "description": "One supplier of a stock item: a company you buy the item from, with that company's part number, lead time and price for it. A stock item has one row for each of its suppliers, and at most one of them is the preferred supplier. Only normal and never-diminishing items have suppliers: an assembly is built, not bought.\n",
        "properties": {
          "supplierId": {
            "type": "string",
            "description": "The ID of the supplier [company](#tag/companies)."
          },
          "partNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "The supplier's own part number for the item, or `null` if Omono has none saved."
          },
          "leadTimeDays": {
            "type": [
              "number",
              "null"
            ],
            "description": "How many days the supplier takes to deliver the item, or `null` if Omono has none saved."
          },
          "price": {
            "type": "number",
            "description": "What one unit costs from this supplier, in the supplier's currency, which `currencyId` names. Omono rounds a price you send to your organisation's Unit Pricing precision for purchasing, but a price saved earlier can have more decimal places, so don't assume a fixed number. It's 0 if Omono has no price saved.\n"
          },
          "currencyId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the supplier company's currency, which `price` is in, or `null` if the company has no currency or isn't one of your companies any more. Currencies are listed by [List all currencies](#tag/tax-and-currency)."
          },
          "preferred": {
            "type": "boolean",
            "description": "Whether this is the item's preferred supplier. At most one row of an item is preferred."
          }
        },
        "required": [
          "supplierId",
          "partNo",
          "leadTimeDays",
          "price",
          "currencyId",
          "preferred"
        ],
        "additionalProperties": true
      },
      "StockItem": {
        "type": "object",
        "description": "A stock item: something you buy, sell or build, such as a part, a product or a service. Every line item on a quote, sales order, purchase order or credit note refers to one. With `include=suppliers`, it also has the item's suppliers. The API doesn't include an item's COSHH (hazardous substances) data.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the stock item."
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for the stock item, such as its ID in your web shop or product information system, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's stock items, archived ones included, so you can find the stock item again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references).\n"
          },
          "partNo": {
            "type": "string",
            "description": "Your part number for the item. It's unique in your organisation, including archived items. The check ignores capital letters but not accents, and a part number that's already taken fails with a `409` error and the code `duplicate-part-number`.\n"
          },
          "title": {
            "type": "string",
            "description": "The item's short name, as it appears on documents."
          },
          "kind": {
            "allOf": [
              {
                "$ref": "#/components/schemas/StockKind"
              }
            ],
            "description": "The kind of stock item, as in Omono: `normal`, `assembly` (built from the stock items in its bill of materials, `bom`) or `never_diminishing` (bought and sold but not counted, such as a service or carriage, with no stock level). An item keeps its kind for life.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the item is archived. To archive or unarchive an item, send `archived` with its `kind` in [Update a stock item](#tag/stock-items/PATCH/stock-items/{id}). You can't change an archived item until you unarchive it. [Archive and unarchive a record](/docs/writing#archiving) explains how.\n"
          },
          "canBuy": {
            "type": "boolean",
            "description": "Whether you can buy the item on a purchase order. You can't set this field. An assembly is built, not bought, so its `canBuy` is always `false`. Every other item you create through the API has `canBuy: true`.\n"
          },
          "canSell": {
            "type": "boolean",
            "description": "Whether you can sell the item on quotes, sales orders and credit notes. When it's `true`, the item needs a `sellPrice` and a `salesAnalysisId`. When it's `false`, Omono clears the sales fields: `sellPrice` is 0, `marginWarningPercent` is `null`, and the item has no `salesAnalysisId` or `commodityCodeId`.\n"
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "The item's full description, as plain text, or `null` if there isn't one. Omono uses it on quotes, sales orders, invoices and credit notes, and on purchase orders too unless the item has a separate purchasing description.\n"
          },
          "purchasingDescription": {
            "type": [
              "string",
              "null"
            ],
            "description": "A separate description for purchase orders, as plain text, or `null` if there isn't one. New purchase order line items use it only while `dualDescriptionEnabled` is `true`, and use `description` otherwise. A purchase order line item raised in Omono from a sales order line item takes that line item's description instead.\n"
          },
          "dualDescriptionEnabled": {
            "type": "boolean",
            "description": "Whether the item has two descriptions: `description` for sales documents and `purchasingDescription` for purchase orders. While it's `false`, new purchase order line items, whether added in Omono or through the API, use `description` and ignore `purchasingDescription`.\n"
          },
          "location": {
            "type": [
              "string",
              "null"
            ],
            "description": "Where the item is kept, for example a bin or shelf label, or `null` if it isn't set.\n"
          },
          "warehouseId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the warehouse the item is kept in, or `null` if it isn't set. Your warehouses are listed by [List all warehouses](#tag/organisation).\n"
          },
          "cost": {
            "type": "number",
            "description": "What one unit costs you, in your base currency. Omono rounds a cost you send to your organisation's Unit Pricing precision for purchasing, but a cost saved earlier can have more decimal places, so don't assume a fixed number. If you change the cost after the item's last purchase order, your cost replaces that order's price as the item's last cost, which Omono uses in stock valuation and for the cost of new line items. It stays that way until the next purchase order for the item is created.\n"
          },
          "sellPrice": {
            "type": "number",
            "description": "Your standard selling price for one unit, in your base currency. It's 0 when the item can't be sold.\n"
          },
          "lastCostUpdatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The time `cost` was last changed by an update, or `null` if it has never changed. You can't set this field.\n"
          },
          "taxExempt": {
            "type": "boolean",
            "description": "Whether the item carries no tax. Line items for a tax-exempt item always use your organisation's exempt tax rate.\n"
          },
          "purchaseAnalysisId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the item's purchase analysis code, which groups your purchases in reports, or `null` if it isn't set. New purchase order line items take this code unless you send another. Your purchase analysis codes are listed by [List all purchase analysis codes](#tag/purchasing-and-shipping).\n"
          },
          "salesAnalysisId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the item's sales analysis code, which groups your sales in reports, or `null` if the item can't be sold. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings).\n"
          },
          "commodityCodeId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the item's commodity code, the customs tariff code for the goods, or `null` if it isn't set. Only items that can be sold have one. Your commodity codes are listed by [List all commodity codes](#tag/purchasing-and-shipping).\n"
          },
          "countryOfOriginId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the country the goods were made in, for customs paperwork, or `null` if it isn't set. Countries are listed by [List all countries](#tag/tax-and-currency).\n"
          },
          "productWebLink": {
            "type": [
              "string",
              "null"
            ],
            "description": "A link to a web page about the product, or `null` if there isn't one.\n"
          },
          "minStockLevel": {
            "type": "number",
            "x-decimal-places": 4,
            "description": "The minimum stock level, with up to 4 decimal places. When `inStock` falls below it, Omono flags the item as short of stock (see `insufficientStock`) and suggests reordering it.\n"
          },
          "minOrderQuantity": {
            "type": "number",
            "x-decimal-places": 4,
            "description": "The smallest quantity you buy at a time, with up to 4 decimal places. Omono uses it when it suggests how many to order.\n"
          },
          "marginWarningPercent": {
            "type": [
              "number",
              "null"
            ],
            "exclusiveMinimum": 0,
            "maximum": 100,
            "x-decimal-places": 2,
            "description": "The item's own minimum sales margin, as a percentage above 0 and up to 100, or `null` if the item uses the margin set on its sales analysis code. Omono shows it on the item as Minimum Sales Margin, and a line item whose margin is below it shows a warning. It's never 0: the value that means \"use the code's margin\" is `null`, when you read the item and when you write it.\n"
          },
          "inStock": {
            "type": "number",
            "x-decimal-places": 4,
            "description": "The quantity physically in stock, with up to 4 decimal places. You can't set this field: it changes as staff receive deliveries, pick dispatches and do stock takes in Omono.\n"
          },
          "allocated": {
            "type": "number",
            "x-decimal-places": 4,
            "description": "The quantity reserved for sales order dispatches that have been allocated but not yet picked, with up to 4 decimal places. To find how many are free for new orders, subtract `allocated` from `inStock`. You can't set this field.\n"
          },
          "onOrder": {
            "type": "number",
            "x-decimal-places": 4,
            "description": "The quantity you're expecting from issued purchase orders and haven't received yet, with up to 4 decimal places. You can't set this field.\n"
          },
          "insufficientStock": {
            "type": "boolean",
            "description": "Whether the item is short of stock, which means `inStock` is below `minStockLevel` or below `allocated`. You can't set this field: Omono keeps it up to date.\n"
          },
          "lastStockTake": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The date of the item's last stock take, as `YYYY-MM-DD`, or `null` if it has never had one. A stock take sets `inStock` to the quantity that staff counted.\n"
          },
          "bom": {
            "type": "array",
            "description": "The item's bill of materials (BOM): the stock items and quantities that go into one unit of an assembly. It's an empty list unless the item is an assembly. Change it with `bom` when you create or update the assembly.\n",
            "items": {
              "$ref": "#/components/schemas/StockBomComponent"
            }
          },
          "suppliers": {
            "type": "array",
            "description": "The companies you buy the item from, each with its part number, lead time and price, in the order Omono shows them. It's an empty list for an assembly, and for an item with no suppliers. This field is only present when you ask for it with `include=suppliers`, which needs the `purchasing:read` scope. Change the suppliers with [Add a supplier to a stock item](#tag/stock-items/POST/stock-items/{id}/suppliers) and the operations after it.\n",
            "items": {
              "$ref": "#/components/schemas/StockItemSupplier"
            }
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the stock item was created."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the stock item was last changed."
          }
        },
        "required": [
          "id",
          "externalRef",
          "partNo",
          "title",
          "kind",
          "archived",
          "canBuy",
          "canSell",
          "description",
          "purchasingDescription",
          "dualDescriptionEnabled",
          "location",
          "warehouseId",
          "cost",
          "sellPrice",
          "lastCostUpdatedAt",
          "taxExempt",
          "purchaseAnalysisId",
          "salesAnalysisId",
          "commodityCodeId",
          "countryOfOriginId",
          "productWebLink",
          "minStockLevel",
          "minOrderQuantity",
          "marginWarningPercent",
          "inStock",
          "allocated",
          "onOrder",
          "insufficientStock",
          "lastStockTake",
          "bom",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "StockItemList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The stock items on this page.",
                "items": {
                  "$ref": "#/components/schemas/StockItem"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "StockItemCreateNormal": {
        "type": "object",
        "additionalProperties": false,
        "description": "A normal stock item to create.",
        "properties": {
          "kind": {
            "type": "string",
            "const": "normal",
            "description": "`normal`: an item Omono keeps a stock level for. An item keeps its kind for life."
          },
          "partNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^\\s*\\S",
            "description": "Your part number for the item, up to 200 characters. Omono removes any spaces from the start and end before it saves it. It can't be blank, and it must be unique in your organisation, including archived items. The check ignores capital letters.\n"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 400,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*[^\\s\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF][^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The item's short name, as it appears on documents. It can be up to 400 characters long, and it can't be blank or contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "canSell": {
            "type": "boolean",
            "description": "Whether you can sell the item on quotes, sales orders and credit notes. If it's `true`, you must also send `sellPrice` and `salesAnalysisId`.\n"
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 32000,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The item's full description, as plain text. It can be up to 32,000 bytes in UTF-8, which is 32,000 characters of plain English text but fewer for accented letters or symbols, because Omono's search stores the whole description as one entry. It can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners.\n"
          },
          "purchasingDescription": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 60000,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "A separate description for purchase orders, as plain text. It can be up to 60,000 characters, and it can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners.\n"
          },
          "dualDescriptionEnabled": {
            "type": "boolean",
            "description": "Whether new purchase order line items use `purchasingDescription` instead of `description`. If you leave it out, it's `true` when you send a `purchasingDescription` that isn't empty, and `false` otherwise.\n"
          },
          "location": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "Where the item is kept, for example a bin or shelf label. Up to 200 characters.\n"
          },
          "warehouseId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the warehouse the item is kept in. Your warehouses are listed by [List all warehouses](#tag/organisation).\n",
            "minLength": 1
          },
          "cost": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "What one unit costs you, in your base currency, up to 1,000,000,000. Omono rounds it to your organisation's Unit Pricing precision for purchasing, which [Retrieve your settings](#tag/organisation/GET/settings) returns in `unitPricing`.\n"
          },
          "sellPrice": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Your standard selling price for one unit, in your base currency, up to 1,000,000,000. You must send it when `canSell` is `true`, and Omono saves 0 when `canSell` is `false`. Omono rounds it to your organisation's Unit Pricing precision for sales.\n"
          },
          "taxExempt": {
            "type": "boolean",
            "description": "Whether the item carries no tax. Line items for a tax-exempt item always use your organisation's exempt tax rate. The default is `false`.\n"
          },
          "purchaseAnalysisId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the item's purchase analysis code, which groups your purchases in reports. Your purchase analysis codes are listed by [List all purchase analysis codes](#tag/purchasing-and-shipping).\n",
            "minLength": 1
          },
          "salesAnalysisId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the item's sales analysis code, which groups your sales in reports. You must send it when `canSell` is `true`, and Omono doesn't save it when `canSell` is `false`. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings).\n",
            "minLength": 1
          },
          "commodityCodeId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the item's commodity code, the customs tariff code for the goods. Your commodity codes are listed by [List all commodity codes](#tag/purchasing-and-shipping). Omono doesn't fill it in for you, even when your organisation has only one commodity code, and it saves the code only when `canSell` is `true`.\n",
            "minLength": 1
          },
          "countryOfOriginId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the country the goods were made in. Countries are listed by [List all countries](#tag/tax-and-currency). An ID that doesn't exist makes the request fail with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "productWebLink": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 400,
            "description": "A link to a web page about the product. Up to 400 characters."
          },
          "minStockLevel": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "The minimum stock level, up to 1,000,000,000 and with up to 4 decimal places. When `inStock` falls below it, Omono flags the item as short of stock.\n"
          },
          "minOrderQuantity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "The smallest quantity you buy at a time, up to 1,000,000,000 and with up to 4 decimal places.\n"
          },
          "marginWarningPercent": {
            "type": [
              "number",
              "null"
            ],
            "exclusiveMinimum": 0,
            "maximum": 100,
            "x-decimal-places": 2,
            "description": "The item's own minimum sales margin, as a percentage above 0 and up to 100, with up to 2 decimal places. Send `null`, or leave it out, and the item uses the margin set on its sales analysis code. Don't send 0 for that: it fails with a `422` error and the code `validation-failed`, because `null` is the one value that means \"use the code's margin\". When `canSell` is `false`, Omono doesn't save the value, but it still checks it, and the item reads `null`.\n"
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the stock item, such as its ID in your web shop or product information system. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. If another of your organisation's stock items already has it, archived ones included, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one, so a stock item you send twice is created only once. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "kind",
          "partNo",
          "title",
          "canSell",
          "warehouseId",
          "cost",
          "purchaseAnalysisId"
        ],
        "if": {
          "properties": {
            "canSell": {
              "const": true
            }
          },
          "required": [
            "canSell"
          ]
        },
        "then": {
          "required": [
            "sellPrice",
            "salesAnalysisId"
          ],
          "properties": {
            "salesAnalysisId": {
              "type": "string",
              "maxLength": 64,
              "minLength": 1
            }
          }
        }
      },
      "StockBomComponentCreate": {
        "type": "object",
        "description": "One component of a new assembly's bill of materials.",
        "additionalProperties": false,
        "properties": {
          "stockItemId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the component's stock item.",
            "minLength": 1
          },
          "quantity": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "How many units of the component go into one unit of the assembly, with up to 4 decimal places."
          }
        },
        "required": [
          "stockItemId",
          "quantity"
        ]
      },
      "StockItemCreateAssembly": {
        "type": "object",
        "additionalProperties": false,
        "description": "An assembly to create.",
        "properties": {
          "kind": {
            "type": "string",
            "const": "assembly",
            "description": "`assembly`: an item Omono builds from the stock items in its bill of materials (`bom`). An item keeps its kind for life."
          },
          "bom": {
            "type": "array",
            "maxItems": 250,
            "description": "An assembly's bill of materials: the components that go into one unit of it, up to 250. Each component must be a stock item you can buy (`canBuy: true`) that isn't an assembly, and you can name each one only once. Only an assembly takes `bom`. The entries count against your rate limits as one request for every 10, rounded up, as [heavy writes](/docs/limits#heavy-writes) explains.\n",
            "items": {
              "$ref": "#/components/schemas/StockBomComponentCreate"
            }
          },
          "partNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^\\s*\\S",
            "description": "Your part number for the item, up to 200 characters. Omono removes any spaces from the start and end before it saves it. It can't be blank, and it must be unique in your organisation, including archived items. The check ignores capital letters.\n"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 400,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*[^\\s\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF][^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The item's short name, as it appears on documents. It can be up to 400 characters long, and it can't be blank or contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "canSell": {
            "type": "boolean",
            "description": "An assembly is always for sale. You can send `true`, for example when you send back an item you read; `false` fails with a `422` error and the code `validation-failed`."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 32000,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The item's full description, as plain text. It can be up to 32,000 bytes in UTF-8, which is 32,000 characters of plain English text but fewer for accented letters or symbols, because Omono's search stores the whole description as one entry. It can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners.\n"
          },
          "location": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "Where the item is kept, for example a bin or shelf label. Up to 200 characters.\n"
          },
          "warehouseId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the warehouse the item is kept in. Your warehouses are listed by [List all warehouses](#tag/organisation).\n",
            "minLength": 1
          },
          "sellPrice": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Your standard selling price for one unit, in your base currency, up to 1,000,000,000. You must send it when `canSell` is `true`, and Omono saves 0 when `canSell` is `false`. Omono rounds it to your organisation's Unit Pricing precision for sales.\n"
          },
          "taxExempt": {
            "type": "boolean",
            "description": "Whether the item carries no tax. Line items for a tax-exempt item always use your organisation's exempt tax rate. The default is `false`.\n"
          },
          "salesAnalysisId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the item's sales analysis code, which groups your sales in reports. You must send it when `canSell` is `true`, and Omono doesn't save it when `canSell` is `false`. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings).\n",
            "minLength": 1
          },
          "commodityCodeId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the item's commodity code, the customs tariff code for the goods. Your commodity codes are listed by [List all commodity codes](#tag/purchasing-and-shipping). Omono doesn't fill it in for you, even when your organisation has only one commodity code, and it saves the code only when `canSell` is `true`.\n",
            "minLength": 1
          },
          "countryOfOriginId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the country the goods were made in. Countries are listed by [List all countries](#tag/tax-and-currency). An ID that doesn't exist makes the request fail with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "productWebLink": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 400,
            "description": "A link to a web page about the product. Up to 400 characters."
          },
          "minStockLevel": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "The minimum stock level, up to 1,000,000,000 and with up to 4 decimal places. When `inStock` falls below it, Omono flags the item as short of stock.\n"
          },
          "marginWarningPercent": {
            "type": [
              "number",
              "null"
            ],
            "exclusiveMinimum": 0,
            "maximum": 100,
            "x-decimal-places": 2,
            "description": "The item's own minimum sales margin, as a percentage above 0 and up to 100, with up to 2 decimal places. Send `null`, or leave it out, and the item uses the margin set on its sales analysis code. Don't send 0 for that: it fails with a `422` error and the code `validation-failed`, because `null` is the one value that means \"use the code's margin\". When `canSell` is `false`, Omono doesn't save the value, but it still checks it, and the item reads `null`.\n"
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the stock item, such as its ID in your web shop or product information system. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. If another of your organisation's stock items already has it, archived ones included, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one, so a stock item you send twice is created only once. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "kind",
          "partNo",
          "title",
          "warehouseId",
          "sellPrice",
          "salesAnalysisId"
        ]
      },
      "StockItemCreateNeverDiminishing": {
        "type": "object",
        "additionalProperties": false,
        "description": "A never-diminishing item to create.",
        "properties": {
          "kind": {
            "type": "string",
            "const": "never_diminishing",
            "description": "`never_diminishing`: something you buy and sell but don't count, such as a service, carriage or consumables, with no warehouse or stock level. An item keeps its kind for life."
          },
          "partNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^\\s*\\S",
            "description": "Your part number for the item, up to 200 characters. Omono removes any spaces from the start and end before it saves it. It can't be blank, and it must be unique in your organisation, including archived items. The check ignores capital letters.\n"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 400,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*[^\\s\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF][^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The item's short name, as it appears on documents. It can be up to 400 characters long, and it can't be blank or contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "canSell": {
            "type": "boolean",
            "description": "Whether you can sell the item on quotes, sales orders and credit notes. If it's `true`, you must also send `sellPrice` and `salesAnalysisId`.\n"
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 32000,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The item's full description, as plain text. It can be up to 32,000 bytes in UTF-8, which is 32,000 characters of plain English text but fewer for accented letters or symbols, because Omono's search stores the whole description as one entry. It can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners.\n"
          },
          "purchasingDescription": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 60000,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "A separate description for purchase orders, as plain text. It can be up to 60,000 characters, and it can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners.\n"
          },
          "dualDescriptionEnabled": {
            "type": "boolean",
            "description": "Whether new purchase order line items use `purchasingDescription` instead of `description`. If you leave it out, it's `true` when you send a `purchasingDescription` that isn't empty, and `false` otherwise.\n"
          },
          "cost": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "What one unit costs you, in your base currency, up to 1,000,000,000. Omono rounds it to your organisation's Unit Pricing precision for purchasing, which [Retrieve your settings](#tag/organisation/GET/settings) returns in `unitPricing`.\n"
          },
          "sellPrice": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Your standard selling price for one unit, in your base currency, up to 1,000,000,000. You must send it when `canSell` is `true`, and Omono saves 0 when `canSell` is `false`. Omono rounds it to your organisation's Unit Pricing precision for sales.\n"
          },
          "taxExempt": {
            "type": "boolean",
            "description": "Whether the item carries no tax. Line items for a tax-exempt item always use your organisation's exempt tax rate. The default is `false`.\n"
          },
          "purchaseAnalysisId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the item's purchase analysis code, which groups your purchases in reports. Your purchase analysis codes are listed by [List all purchase analysis codes](#tag/purchasing-and-shipping).\n",
            "minLength": 1
          },
          "salesAnalysisId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the item's sales analysis code, which groups your sales in reports. You must send it when `canSell` is `true`, and Omono doesn't save it when `canSell` is `false`. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings).\n",
            "minLength": 1
          },
          "commodityCodeId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the item's commodity code, the customs tariff code for the goods. Your commodity codes are listed by [List all commodity codes](#tag/purchasing-and-shipping). Omono doesn't fill it in for you, even when your organisation has only one commodity code, and it saves the code only when `canSell` is `true`.\n",
            "minLength": 1
          },
          "countryOfOriginId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the country the goods were made in. Countries are listed by [List all countries](#tag/tax-and-currency). An ID that doesn't exist makes the request fail with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "productWebLink": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 400,
            "description": "A link to a web page about the product. Up to 400 characters."
          },
          "marginWarningPercent": {
            "type": [
              "number",
              "null"
            ],
            "exclusiveMinimum": 0,
            "maximum": 100,
            "x-decimal-places": 2,
            "description": "The item's own minimum sales margin, as a percentage above 0 and up to 100, with up to 2 decimal places. Send `null`, or leave it out, and the item uses the margin set on its sales analysis code. Don't send 0 for that: it fails with a `422` error and the code `validation-failed`, because `null` is the one value that means \"use the code's margin\". When `canSell` is `false`, Omono doesn't save the value, but it still checks it, and the item reads `null`.\n"
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the stock item, such as its ID in your web shop or product information system. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. If another of your organisation's stock items already has it, archived ones included, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one, so a stock item you send twice is created only once. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "kind",
          "partNo",
          "title",
          "canSell",
          "cost",
          "purchaseAnalysisId"
        ],
        "if": {
          "properties": {
            "canSell": {
              "const": true
            }
          },
          "required": [
            "canSell"
          ]
        },
        "then": {
          "required": [
            "sellPrice",
            "salesAnalysisId"
          ],
          "properties": {
            "salesAnalysisId": {
              "type": "string",
              "maxLength": 64,
              "minLength": 1
            }
          }
        }
      },
      "StockItemCreate": {
        "description": "The stock item to create. Send `kind` first: it selects the fields the item takes, as the three kinds of item do in Omono, and the item keeps that kind for life. A missing field fails with a `422` error and the code `missing-required-field`, whose `errors` lists every field your `kind` needs that you left out, and a field the kind doesn't take fails with the code `unknown-field`.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/StockItemCreateNormal"
          },
          {
            "$ref": "#/components/schemas/StockItemCreateAssembly"
          },
          {
            "$ref": "#/components/schemas/StockItemCreateNeverDiminishing"
          }
        ],
        "discriminator": {
          "propertyName": "kind",
          "mapping": {
            "normal": "#/components/schemas/StockItemCreateNormal",
            "assembly": "#/components/schemas/StockItemCreateAssembly",
            "never_diminishing": "#/components/schemas/StockItemCreateNeverDiminishing"
          }
        }
      },
      "StockItemUpdateNormal": {
        "type": "object",
        "additionalProperties": false,
        "description": "The fields to change on a normal stock item. Any fields you leave out stay as they are.",
        "properties": {
          "kind": {
            "type": "string",
            "const": "normal",
            "description": "The item's kind, `normal`. Send it with every update: it selects the fields you can send. It can't change, so any other value fails with a `409` error and the code `immutable-field`."
          },
          "partNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^\\s*\\S",
            "description": "Your part number for the item, up to 200 characters. Omono removes any spaces from the start and end before it saves it. It can't be blank, and it must be unique in your organisation, including archived items. The check ignores capital letters.\n"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 400,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*[^\\s\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF][^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The item's short name, as it appears on documents. It can be up to 400 characters long, and it can't be blank or contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "canSell": {
            "type": "boolean",
            "description": "Whether you can sell the item on quotes, sales orders and credit notes. If it's `true` after your update, the item needs a `salesAnalysisId`. If it's `false`, Omono clears the sales fields: `sellPrice` becomes 0, `marginWarningPercent` becomes `null`, and the item loses its `salesAnalysisId` and `commodityCodeId`.\n"
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 32000,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The item's full description, as plain text, or `null` to clear it. It can be up to 32,000 bytes in UTF-8, which is 32,000 characters of plain English text but fewer for accented letters or symbols, because Omono's search stores the whole description as one entry. It can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners.\n"
          },
          "purchasingDescription": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 60000,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "A separate description for purchase orders, as plain text, or `null` to clear it. It can be up to 60,000 characters, and it can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners.\n"
          },
          "dualDescriptionEnabled": {
            "type": "boolean",
            "description": "Whether new purchase order line items use `purchasingDescription` instead of `description`. While it's `false`, they use `description` and ignore `purchasingDescription`.\n"
          },
          "location": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "Where the item is kept, for example a bin or shelf label, or `null` to clear it. Up to 200 characters.\n"
          },
          "warehouseId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the warehouse the item is kept in. Your warehouses are listed by [List all warehouses](#tag/organisation).\n",
            "minLength": 1
          },
          "cost": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "What one unit costs you, in your base currency, up to 1,000,000,000. Omono rounds a new value to your organisation's Unit Pricing precision for purchasing and records the time in `lastCostUpdatedAt`. The new cost becomes the item's last cost, which Omono uses in stock valuation and its history and for the cost of new quote and order line items, until the next purchase order for the item is created. Also, if the saved cost has more than 4 decimal places, any update rounds it to 4 and sets `lastCostUpdatedAt`.\n"
          },
          "sellPrice": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Your standard selling price for one unit, in your base currency, up to 1,000,000,000. Omono rounds a new value to your organisation's Unit Pricing precision for sales. A saved price you don't change stays as it is, except that any update rounds a price with more than 4 decimal places to 4 while `canSell` is `true`.\n"
          },
          "taxExempt": {
            "type": "boolean",
            "description": "Whether the item carries no tax. Line items for a tax-exempt item always use your organisation's exempt tax rate.\n"
          },
          "purchaseAnalysisId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the item's purchase analysis code, which groups your purchases in reports. Your purchase analysis codes are listed by [List all purchase analysis codes](#tag/purchasing-and-shipping).\n",
            "minLength": 1
          },
          "salesAnalysisId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the item's sales analysis code, which groups your sales in reports. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings). You can send `null` only if `canSell` is `false` after this update. Otherwise the request fails with a `422` error and the code `validation-failed`.\n",
            "minLength": 1
          },
          "commodityCodeId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the item's commodity code, the customs tariff code for the goods, or `null` to clear it. Your commodity codes are listed by [List all commodity codes](#tag/purchasing-and-shipping).\n",
            "minLength": 1
          },
          "countryOfOriginId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the country the goods were made in, or `null` to clear it. Countries are listed by [List all countries](#tag/tax-and-currency). An ID that doesn't exist makes the request fail with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "productWebLink": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 400,
            "description": "A link to a web page about the product, or `null` to clear it. Up to 400 characters.\n"
          },
          "minStockLevel": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "The minimum stock level, up to 1,000,000,000 and with up to 4 decimal places. When `inStock` falls below it, Omono flags the item as short of stock.\n"
          },
          "minOrderQuantity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "The smallest quantity you buy at a time, up to 1,000,000,000 and with up to 4 decimal places.\n"
          },
          "marginWarningPercent": {
            "type": [
              "number",
              "null"
            ],
            "exclusiveMinimum": 0,
            "maximum": 100,
            "x-decimal-places": 2,
            "description": "The item's own minimum sales margin, as a percentage above 0 and up to 100, with up to 2 decimal places, or `null` to clear it, so that the item uses the margin set on its sales analysis code. Don't send 0 for that: it fails with a `422` error and the code `validation-failed`, because `null` is the one value that means \"use the code's margin\". Sending back the value you read, `null` included, changes nothing. When `canSell` is `false` after your update, Omono doesn't save the value, but it still checks it.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the item should be archived. Send the state you want, not a toggle: sending the current value changes nothing. If you send other fields as well, `false` unarchives the item before applying them, and `true` archives it afterwards. While the item is archived, you can't change its other fields unless you send `archived: false` in the same request: the request fails with a `409` error and the code `stock-item-archived`. As in Omono, archiving doesn't check the item's stock level or whether open documents use it. Omono adds a note to the item's history that names your key.\n"
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the stock item. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. Send `null` to remove it. If another of your organisation's stock items already has it, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "kind"
        ]
      },
      "StockBomComponentUpdate": {
        "type": "object",
        "description": "One change to an assembly's bill of materials: a component to add, a new quantity for one already in it, or `delete: true` to remove one.\n",
        "additionalProperties": false,
        "properties": {
          "stockItemId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the component's stock item.",
            "minLength": 1
          },
          "quantity": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "How many units of the component go into one unit of the assembly, with up to 4 decimal places. Needed unless you send `delete`."
          },
          "delete": {
            "type": "boolean",
            "description": "Set this to `true` to remove the component. Don't send `quantity` with it."
          }
        },
        "required": [
          "stockItemId"
        ]
      },
      "StockItemUpdateAssembly": {
        "type": "object",
        "additionalProperties": false,
        "description": "The fields to change on an assembly. Any fields you leave out stay as they are.",
        "properties": {
          "kind": {
            "type": "string",
            "const": "assembly",
            "description": "The item's kind, `assembly`. Send it with every update: it selects the fields you can send. It can't change, so any other value fails with a `409` error and the code `immutable-field`."
          },
          "bom": {
            "type": "array",
            "minItems": 1,
            "maxItems": 250,
            "description": "Changes to an assembly's bill of materials, up to 250. An entry with a component that isn't in the BOM adds it, an entry with one that is changes its quantity, and an entry with `delete: true` removes it. Components you don't name stay as they are. A new component must be a stock item you can buy (`canBuy: true`) that isn't an assembly. Changing the BOM doesn't change line items already on quotes and orders, which keep the components they copied. Only an assembly takes `bom`. The entries count against your rate limits as one request for every 10, rounded up, even when they change nothing, as [heavy writes](/docs/limits#heavy-writes) explains.\n",
            "items": {
              "$ref": "#/components/schemas/StockBomComponentUpdate"
            }
          },
          "partNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^\\s*\\S",
            "description": "Your part number for the item, up to 200 characters. Omono removes any spaces from the start and end before it saves it. It can't be blank, and it must be unique in your organisation, including archived items. The check ignores capital letters.\n"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 400,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*[^\\s\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF][^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The item's short name, as it appears on documents. It can be up to 400 characters long, and it can't be blank or contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "canSell": {
            "type": "boolean",
            "description": "An assembly is always for sale. You can send `true`, for example when you send back an item you read; `false` fails with a `422` error and the code `validation-failed`."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 32000,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The item's full description, as plain text, or `null` to clear it. It can be up to 32,000 bytes in UTF-8, which is 32,000 characters of plain English text but fewer for accented letters or symbols, because Omono's search stores the whole description as one entry. It can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners.\n"
          },
          "location": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "Where the item is kept, for example a bin or shelf label, or `null` to clear it. Up to 200 characters.\n"
          },
          "warehouseId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the warehouse the item is kept in. Your warehouses are listed by [List all warehouses](#tag/organisation).\n",
            "minLength": 1
          },
          "sellPrice": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Your standard selling price for one unit, in your base currency, up to 1,000,000,000. Omono rounds a new value to your organisation's Unit Pricing precision for sales. A saved price you don't change stays as it is, except that any update rounds a price with more than 4 decimal places to 4 while `canSell` is `true`.\n"
          },
          "taxExempt": {
            "type": "boolean",
            "description": "Whether the item carries no tax. Line items for a tax-exempt item always use your organisation's exempt tax rate.\n"
          },
          "salesAnalysisId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the item's sales analysis code, which groups your sales in reports. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings). You can send `null` only if `canSell` is `false` after this update. Otherwise the request fails with a `422` error and the code `validation-failed`.\n",
            "minLength": 1
          },
          "commodityCodeId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the item's commodity code, the customs tariff code for the goods, or `null` to clear it. Your commodity codes are listed by [List all commodity codes](#tag/purchasing-and-shipping).\n",
            "minLength": 1
          },
          "countryOfOriginId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the country the goods were made in, or `null` to clear it. Countries are listed by [List all countries](#tag/tax-and-currency). An ID that doesn't exist makes the request fail with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "productWebLink": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 400,
            "description": "A link to a web page about the product, or `null` to clear it. Up to 400 characters.\n"
          },
          "minStockLevel": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "x-decimal-places": 4,
            "description": "The minimum stock level, up to 1,000,000,000 and with up to 4 decimal places. When `inStock` falls below it, Omono flags the item as short of stock.\n"
          },
          "marginWarningPercent": {
            "type": [
              "number",
              "null"
            ],
            "exclusiveMinimum": 0,
            "maximum": 100,
            "x-decimal-places": 2,
            "description": "The item's own minimum sales margin, as a percentage above 0 and up to 100, with up to 2 decimal places, or `null` to clear it, so that the item uses the margin set on its sales analysis code. Don't send 0 for that: it fails with a `422` error and the code `validation-failed`, because `null` is the one value that means \"use the code's margin\". Sending back the value you read, `null` included, changes nothing. When `canSell` is `false` after your update, Omono doesn't save the value, but it still checks it.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the item should be archived. Send the state you want, not a toggle: sending the current value changes nothing. If you send other fields as well, `false` unarchives the item before applying them, and `true` archives it afterwards. While the item is archived, you can't change its other fields unless you send `archived: false` in the same request: the request fails with a `409` error and the code `stock-item-archived`. As in Omono, archiving doesn't check the item's stock level or whether open documents use it. Omono adds a note to the item's history that names your key.\n"
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the stock item. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. Send `null` to remove it. If another of your organisation's stock items already has it, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "kind"
        ]
      },
      "StockItemUpdateNeverDiminishing": {
        "type": "object",
        "additionalProperties": false,
        "description": "The fields to change on a never-diminishing item. Any fields you leave out stay as they are.",
        "properties": {
          "kind": {
            "type": "string",
            "const": "never_diminishing",
            "description": "The item's kind, `never_diminishing`. Send it with every update: it selects the fields you can send. It can't change, so any other value fails with a `409` error and the code `immutable-field`."
          },
          "partNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^\\s*\\S",
            "description": "Your part number for the item, up to 200 characters. Omono removes any spaces from the start and end before it saves it. It can't be blank, and it must be unique in your organisation, including archived items. The check ignores capital letters.\n"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 400,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*[^\\s\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF][^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The item's short name, as it appears on documents. It can be up to 400 characters long, and it can't be blank or contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "canSell": {
            "type": "boolean",
            "description": "Whether you can sell the item on quotes, sales orders and credit notes. If it's `true` after your update, the item needs a `salesAnalysisId`. If it's `false`, Omono clears the sales fields: `sellPrice` becomes 0, `marginWarningPercent` becomes `null`, and the item loses its `salesAnalysisId` and `commodityCodeId`.\n"
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 32000,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The item's full description, as plain text, or `null` to clear it. It can be up to 32,000 bytes in UTF-8, which is 32,000 characters of plain English text but fewer for accented letters or symbols, because Omono's search stores the whole description as one entry. It can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners.\n"
          },
          "purchasingDescription": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 60000,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "A separate description for purchase orders, as plain text, or `null` to clear it. It can be up to 60,000 characters, and it can't contain the invisible characters that [Text](/docs/conventions#text) lists, apart from zero-width spaces and joiners.\n"
          },
          "dualDescriptionEnabled": {
            "type": "boolean",
            "description": "Whether new purchase order line items use `purchasingDescription` instead of `description`. While it's `false`, they use `description` and ignore `purchasingDescription`.\n"
          },
          "cost": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "What one unit costs you, in your base currency, up to 1,000,000,000. Omono rounds a new value to your organisation's Unit Pricing precision for purchasing and records the time in `lastCostUpdatedAt`. The new cost becomes the item's last cost, which Omono uses in stock valuation and its history and for the cost of new quote and order line items, until the next purchase order for the item is created. Also, if the saved cost has more than 4 decimal places, any update rounds it to 4 and sets `lastCostUpdatedAt`.\n"
          },
          "sellPrice": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Your standard selling price for one unit, in your base currency, up to 1,000,000,000. Omono rounds a new value to your organisation's Unit Pricing precision for sales. A saved price you don't change stays as it is, except that any update rounds a price with more than 4 decimal places to 4 while `canSell` is `true`.\n"
          },
          "taxExempt": {
            "type": "boolean",
            "description": "Whether the item carries no tax. Line items for a tax-exempt item always use your organisation's exempt tax rate.\n"
          },
          "purchaseAnalysisId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the item's purchase analysis code, which groups your purchases in reports. Your purchase analysis codes are listed by [List all purchase analysis codes](#tag/purchasing-and-shipping).\n",
            "minLength": 1
          },
          "salesAnalysisId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the item's sales analysis code, which groups your sales in reports. Your sales analysis codes are listed by [List all sales analysis codes](#tag/sales-settings). You can send `null` only if `canSell` is `false` after this update. Otherwise the request fails with a `422` error and the code `validation-failed`.\n",
            "minLength": 1
          },
          "commodityCodeId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the item's commodity code, the customs tariff code for the goods, or `null` to clear it. Your commodity codes are listed by [List all commodity codes](#tag/purchasing-and-shipping).\n",
            "minLength": 1
          },
          "countryOfOriginId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the country the goods were made in, or `null` to clear it. Countries are listed by [List all countries](#tag/tax-and-currency). An ID that doesn't exist makes the request fail with a `422` error and the code `invalid-reference`.\n",
            "minLength": 1
          },
          "productWebLink": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 400,
            "description": "A link to a web page about the product, or `null` to clear it. Up to 400 characters.\n"
          },
          "marginWarningPercent": {
            "type": [
              "number",
              "null"
            ],
            "exclusiveMinimum": 0,
            "maximum": 100,
            "x-decimal-places": 2,
            "description": "The item's own minimum sales margin, as a percentage above 0 and up to 100, with up to 2 decimal places, or `null` to clear it, so that the item uses the margin set on its sales analysis code. Don't send 0 for that: it fails with a `422` error and the code `validation-failed`, because `null` is the one value that means \"use the code's margin\". Sending back the value you read, `null` included, changes nothing. When `canSell` is `false` after your update, Omono doesn't save the value, but it still checks it.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the item should be archived. Send the state you want, not a toggle: sending the current value changes nothing. If you send other fields as well, `false` unarchives the item before applying them, and `true` archives it afterwards. While the item is archived, you can't change its other fields unless you send `archived: false` in the same request: the request fails with a `409` error and the code `stock-item-archived`. As in Omono, archiving doesn't check the item's stock level or whether open documents use it. Omono adds a note to the item's history that names your key.\n"
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the stock item. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. Send `null` to remove it. If another of your organisation's stock items already has it, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "kind"
        ]
      },
      "StockItemUpdate": {
        "description": "The fields to change on a stock item, by its kind. Send the item's `kind` with every update; it selects the fields you can send, and it can't change. Any fields you leave out stay as they are. To clear `description`, `purchasingDescription`, `location`, `productWebLink`, `countryOfOriginId`, `commodityCodeId` or `marginWarningPercent`, send `null`. You can clear `salesAnalysisId` the same way, but only while `canSell` is `false`.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/StockItemUpdateNormal"
          },
          {
            "$ref": "#/components/schemas/StockItemUpdateAssembly"
          },
          {
            "$ref": "#/components/schemas/StockItemUpdateNeverDiminishing"
          }
        ],
        "discriminator": {
          "propertyName": "kind",
          "mapping": {
            "normal": "#/components/schemas/StockItemUpdateNormal",
            "assembly": "#/components/schemas/StockItemUpdateAssembly",
            "never_diminishing": "#/components/schemas/StockItemUpdateNeverDiminishing"
          }
        }
      },
      "StockItemSupplierList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The stock item's suppliers.",
                "items": {
                  "$ref": "#/components/schemas/StockItemSupplier"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "StockItemSupplierCreate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The supplier to add to the stock item.\n",
        "properties": {
          "supplierId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the supplier [company](#tag/companies). It must be one of your companies, with `isSupplier` set to `true`, and not archived. A stock item has one row for each supplier, so a company that's already a supplier of the item fails with a `422` error: change its row instead.\n",
            "minLength": 1
          },
          "partNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^\\s*\\S",
            "description": "The supplier's own part number for the item, up to 200 characters. Omono removes any spaces from the start and end before it saves it. It can't be blank.\n"
          },
          "leadTimeDays": {
            "type": "number",
            "minimum": 0,
            "maximum": 3650,
            "description": "How many days the supplier takes to deliver the item, from 0 to 3,650."
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "What one unit costs from this supplier, in the supplier company's currency, up to 1,000,000,000. Omono rounds it to your organisation's Unit Pricing precision for purchasing, which [Retrieve your settings](#tag/organisation/GET/settings) returns in `unitPricing`.\n"
          },
          "preferred": {
            "type": "boolean",
            "description": "Pass `true` to make this the item's preferred supplier. Omono then clears `preferred` on the item's other suppliers. Leave it out, or pass `false`, to add a supplier that isn't preferred.\n"
          }
        },
        "required": [
          "supplierId",
          "partNo",
          "leadTimeDays",
          "price"
        ]
      },
      "StockItemSupplierUpdate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The fields to change on the supplier's row. Any fields you leave out stay as they are.\n",
        "properties": {
          "partNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^\\s*\\S",
            "description": "The supplier's own part number for the item, up to 200 characters. Omono removes any spaces from the start and end before it saves it. It can't be blank.\n"
          },
          "leadTimeDays": {
            "type": "number",
            "minimum": 0,
            "maximum": 3650,
            "description": "How many days the supplier takes to deliver the item, from 0 to 3,650."
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "What one unit costs from this supplier, in the supplier company's currency, up to 1,000,000,000. Omono rounds a new price to your organisation's Unit Pricing precision for purchasing. If you send the price the row already has, Omono keeps it as it is.\n"
          },
          "preferred": {
            "type": "boolean",
            "description": "Pass `true` to make this the item's preferred supplier: Omono clears `preferred` on the item's other suppliers in the same change. Pass `false` to clear it on this row only, which leaves the item with no preferred supplier.\n"
          }
        }
      },
      "TaskLinkedEntityType": {
        "description": "The type of record a task is linked to. The same values are used when you read a task, when you create or update one, and in the `linkedEntityType` filter.\n\nKnown values: `company`, `contact`, `quote`, `sales_order`, `credit_note`, `purchase_order`, `stock_item`, `general`. Omono can add values; handle one you don't recognise.\n",
        "type": "string",
        "x-known-values": [
          "company",
          "contact",
          "quote",
          "sales_order",
          "credit_note",
          "purchase_order",
          "stock_item",
          "general"
        ],
        "x-enum-descriptions": [
          "The task is linked to a company.",
          "The task is linked to a contact.",
          "The task is linked to a quote.",
          "The task is linked to a sales order.",
          "The task is linked to a credit note.",
          "The task is linked to a purchase order.",
          "The task is linked to a stock item.",
          "The task isn't linked to a record."
        ]
      },
      "KnownTaskLinkedEntityType": {
        "description": "The type of record a task is linked to. The same values are used when you read a task, when you create or update one, and in the `linkedEntityType` filter.\n",
        "type": "string",
        "enum": [
          "company",
          "contact",
          "quote",
          "sales_order",
          "credit_note",
          "purchase_order",
          "stock_item",
          "general"
        ],
        "x-enum-descriptions": [
          "The task is linked to a company.",
          "The task is linked to a contact.",
          "The task is linked to a quote.",
          "The task is linked to a sales order.",
          "The task is linked to a credit note.",
          "The task is linked to a purchase order.",
          "The task is linked to a stock item.",
          "The task isn't linked to a record."
        ]
      },
      "RecurrenceMonthDays": {
        "description": "The day of the month the task repeats on, from 1 to 31, or `-1` for the last day of the month. Some older tasks have a list of days here instead of a single day.\n",
        "oneOf": [
          {
            "type": "integer",
            "minimum": -1,
            "maximum": 31
          },
          {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": -1,
              "maximum": 31
            }
          }
        ]
      },
      "RecurrenceConfig": {
        "type": "object",
        "description": "How a task repeats, as you read it. It can describe more patterns than a create or update accepts, because some older tasks were set up differently. If you read a recurrence that you can't send back, send a new one instead.\n\nOmono tidies the recurrence before it returns it. A combined day such as `1TU` is split into `bySetPos: 1` and `byDay: [\"TU\"]`. If both `untilDate` and `count` are stored, only `untilDate` is returned. A weekly recurrence with no `byDay` gets the weekday the task starts on.\n",
        "properties": {
          "frequency": {
            "description": "How often the task repeats: `DAILY`, `WEEKLY`, `MONTHLY` or `YEARLY`.\n\nKnown values: `DAILY`, `WEEKLY`, `MONTHLY`, `YEARLY`. Omono can add values; handle one you don't recognise.\n",
            "type": "string",
            "x-known-values": [
              "DAILY",
              "WEEKLY",
              "MONTHLY",
              "YEARLY"
            ]
          },
          "interval": {
            "type": "integer",
            "minimum": 1,
            "description": "How many days, weeks, months or years pass between occurrences. For example, `2` with `WEEKLY` means every other week. It's `1` if it wasn't set.\n"
          },
          "byDay": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "description": "Known values: `MO`, `TU`, `WE`, `TH`, `FR`, `SA`, `SU`. Omono can add values; handle one you don't recognise.\n",
              "x-known-values": [
                "MO",
                "TU",
                "WE",
                "TH",
                "FR",
                "SA",
                "SU"
              ]
            },
            "description": "The days of the week the task repeats on, as two-letter codes from `MO` to `SU`. A weekly recurrence always has at least one day.\n"
          },
          "byMonthDay": {
            "$ref": "#/components/schemas/RecurrenceMonthDays"
          },
          "byMonth": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            },
            "description": "The months the task repeats in, from 1 for January to 12 for December. It appears only on some older tasks, and you can't send it.\n"
          },
          "untilDate": {
            "type": "string",
            "format": "date",
            "description": "The last day the task can repeat on, as `YYYY-MM-DD`.\n"
          },
          "count": {
            "type": "integer",
            "minimum": 1,
            "description": "The total number of occurrences in the series.\n"
          },
          "bySetPos": {
            "description": "Which occurrence of the `byDay` weekday in the month the task repeats on: 1 to 4 for the first to the fourth, or `-1` for the last. For example, `bySetPos: 2` with `byDay: [\"TU\"]` means the second Tuesday of the month. The values `-2` to `-4`, for the second-last to the fourth-last, appear only on some older tasks, and you can't send them.\n\nKnown values: `1`, `2`, `3`, `4`, `-1`, `-2`, `-3`, `-4`. Omono can add values; handle one you don't recognise.\n",
            "type": "integer",
            "x-known-values": [
              1,
              2,
              3,
              4,
              -1,
              -2,
              -3,
              -4
            ]
          }
        },
        "required": [
          "frequency"
        ],
        "additionalProperties": true
      },
      "TaskRecord": {
        "type": "object",
        "description": "A task is a to-do, reminder or follow-up for someone in your organisation. It can stand alone or be linked to a company, contact, quote, sales order, credit note, purchase order or stock item.\n\nPrivate tasks never appear in the API. If someone makes a task private in Omono, you receive a `deleted` event for it, and the task comes back with the same ID if it's made public again. So when you receive a `tasks` event, retrieve the task before you delete your copy. Learn more about [handling deletes](/docs/syncing#deletes).\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the task."
          },
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own reference for the task, such as the activity's ID in your CRM, or `null` if it has none. Only the API sets it, and Omono doesn't show it to staff. It's unique among your organisation's tasks, completed ones included, so you can find the task again with the `externalRef` filter. Learn more about [external references](/docs/writing#external-references).\n"
          },
          "subject": {
            "type": "string",
            "description": "What needs to be done, for example \"Chase quote SQ-0961 with Priya\".\n"
          },
          "taskTypeId": {
            "type": "string",
            "description": "The ID of the task's type, such as a call or a follow-up. Your task types are listed by [List all task types](#tag/task-settings).\n"
          },
          "taskPriorityId": {
            "type": "string",
            "description": "The ID of the task's priority. Your task priorities are listed by [List all task priorities](#tag/task-settings).\n"
          },
          "taskStatusId": {
            "type": "string",
            "description": "The ID of the task's status. Your task statuses are listed by [List all task statuses](#tag/task-settings). A task is complete once its status is a closed status. To complete a task, use [Complete a task](#tag/tasks), not a change to its status: a change can't give a task a closed status, but sending a task's current status again is fine. A completed task can't be changed through the API, because tasks are reopened in Omono.\n"
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When a timed task is due, as a time in UTC. Use `timeZone` to show it in the task's local time. On an all-day task, Omono sets it to the end of `allDayDate` in UTC, which is the time the `dueAt_gte` and `dueAt_lte` filters compare.\n"
          },
          "allDayDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The day an all-day task is due, as `YYYY-MM-DD`. It has no time zone. It's `null` on a timed task.\n"
          },
          "isAllDay": {
            "type": "boolean",
            "description": "Whether the task is due on a day rather than at a particular time. An all-day task uses `allDayDate`, and a timed task uses `dueAt` and `timeZone`.\n"
          },
          "timeZone": {
            "type": [
              "string",
              "null"
            ],
            "description": "The time zone the task is scheduled in, as an IANA name such as `Europe/London`. A timed task always has one.\n"
          },
          "estimatedDuration": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "description": "How long the task is expected to take, in minutes. It's `null` if there's no estimate.\n"
          },
          "ownerId": {
            "type": "string",
            "description": "The ID of the user who owns the task. Your users are listed by [List all users](#tag/organisation).\n"
          },
          "createdById": {
            "type": "string",
            "description": "The ID of the user who created the task. Tasks created through the API show your organisation's API user.\n"
          },
          "assignedUserIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The IDs of the users assigned to the task. The list is empty if nobody is assigned.\n"
          },
          "linkedEntityType": {
            "description": "The type of record the task is linked to. It's `null`, or `general`, when the task isn't linked to a record.\n\nKnown values: `company`, `contact`, `quote`, `sales_order`, `credit_note`, `purchase_order`, `stock_item`, `general`. Omono can add values; handle one you don't recognise.\n",
            "type": [
              "string",
              "null"
            ],
            "x-known-values": [
              "company",
              "contact",
              "quote",
              "sales_order",
              "credit_note",
              "purchase_order",
              "stock_item",
              "general"
            ],
            "x-enum-descriptions": [
              "The task is linked to a company.",
              "The task is linked to a contact.",
              "The task is linked to a quote.",
              "The task is linked to a sales order.",
              "The task is linked to a credit note.",
              "The task is linked to a purchase order.",
              "The task is linked to a stock item.",
              "The task isn't linked to a record."
            ]
          },
          "linkedEntityId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the record the task is linked to. It always matches `linkedEntityType`: both are `null`, or the type is `general` and the ID is `null`, or the ID belongs to a record of that type.\n"
          },
          "blocksShipping": {
            "type": "boolean",
            "description": "Whether the task stops the linked sales order from shipping. While the task is open, none of the order's dispatches can move to the final status (the one whose type is `final`), which ships and invoices them. Moves to other statuses aren't blocked. Only a task linked to a sales order can block shipping: on any other task, `true` makes the request fail with a `422` error and the code `validation-failed`. Learn more about [when a dispatch can't ship](/docs/workflow#when-a-dispatch-cannot-ship).\n"
          },
          "companyId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the company the task belongs to, which Omono sets from the link. It's the linked company, or the company of the linked quote, sales order, credit note, contact or purchase order. For a purchase order, that's the supplier. It's `null` when the task is linked to a stock item or to nothing.\n"
          },
          "isRecurring": {
            "type": "boolean",
            "description": "Whether the task repeats. A repeating task is a single task that moves on to its next date each time it's completed.\n"
          },
          "recurrenceConfig": {
            "description": "How the task repeats, or `null` if it doesn't.\n",
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecurrenceConfig"
              },
              {
                "type": "null"
              }
            ]
          },
          "recurrenceRule": {
            "type": [
              "string",
              "null"
            ],
            "description": "The task's repeat schedule as an iCalendar RRULE, which Omono builds for you. It doesn't show occurrences that someone deleted one at a time in Omono.\n"
          },
          "isAutomated": {
            "type": "boolean",
            "description": "Whether one of your organisation's automations created the task, for example a task to chase a quote on its chase date or its expected award date. Omono can move or close these tasks itself, without an API call.\n"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The time the task was completed, or `null` if it isn't complete.\n"
          },
          "completedById": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the user who completed the task, or `null` if it isn't complete.\n"
          },
          "previousTaskId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the task that this one was created as a follow-up to. It's `null` if there isn't one, or if that task is private. When that task is made private or public, this task's `updated` changes too, so `updated_since` returns it.\n"
          },
          "nextTaskId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the follow-up task created from this one. It's `null` if there isn't one, or if that task is private. When that task is made private or public, this task's `updated` changes too, so `updated_since` returns it.\n"
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the task was created."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the task was last changed."
          }
        },
        "required": [
          "id",
          "externalRef",
          "subject",
          "taskTypeId",
          "taskPriorityId",
          "taskStatusId",
          "dueAt",
          "allDayDate",
          "isAllDay",
          "timeZone",
          "estimatedDuration",
          "ownerId",
          "createdById",
          "assignedUserIds",
          "linkedEntityType",
          "linkedEntityId",
          "blocksShipping",
          "companyId",
          "isRecurring",
          "recurrenceConfig",
          "recurrenceRule",
          "isAutomated",
          "completedAt",
          "completedById",
          "previousTaskId",
          "nextTaskId",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "TaskRecordList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The tasks on this page.",
                "items": {
                  "$ref": "#/components/schemas/TaskRecord"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "RecurrenceConfigWrite": {
        "type": "object",
        "additionalProperties": false,
        "description": "How a task repeats, as you send it. You can send the same patterns you can set up in Omono:\n\n- `DAILY` or `YEARLY`, with only an `interval`.\n- `WEEKLY`, with at least one day in `byDay`.\n- `MONTHLY`, with either a single `byMonthDay`, or a `bySetPos` and exactly one day in `byDay`.\n\n`frequency` is required. You can also end the series after a number of occurrences with `count`, or on a date with `untilDate`, but not both. The task's `isRecurring` follows the recurrence.\n",
        "properties": {
          "frequency": {
            "type": "string",
            "enum": [
              "DAILY",
              "WEEKLY",
              "MONTHLY",
              "YEARLY"
            ],
            "description": "How often the task repeats: `DAILY`, `WEEKLY`, `MONTHLY` or `YEARLY`.\n"
          },
          "interval": {
            "type": "integer",
            "minimum": 1,
            "maximum": 999,
            "description": "How many days, weeks, months or years pass between occurrences, between 1 and 999. The default is 1. If a task's stored recurrence has a larger value, you can't send it back, so send a new recurrence instead.\n"
          },
          "byDay": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": [
                "MO",
                "TU",
                "WE",
                "TH",
                "FR",
                "SA",
                "SU"
              ]
            },
            "maxItems": 7,
            "description": "The days of the week the task repeats on, as two-letter codes from `MO` to `SU`. Each day can appear only once. A weekly recurrence needs at least one day, and a monthly recurrence with `bySetPos` needs exactly one.\n"
          },
          "byMonthDay": {
            "type": "integer",
            "minimum": -1,
            "maximum": 31,
            "not": {
              "const": 0
            },
            "description": "For a monthly recurrence only, the day of the month the task repeats on, from 1 to 31, or `-1` for the last day of the month. A month that doesn't have that day is skipped.\n"
          },
          "untilDate": {
            "type": "string",
            "format": "date",
            "description": "The last day the task can repeat on, as `YYYY-MM-DD`. It can't be before today in your organisation's time zone, or before the day the task is due. If it is, the request fails with a `422` error and the code `validation-failed`, naming the field `recurrenceConfig.untilDate`. On an update, Omono compares it with today only if you change it, so an end date that has passed never stops other changes. You can't send it together with `count`.\n"
          },
          "count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 999,
            "description": "The total number of occurrences in the series, between 1 and 999. You can't send it together with `untilDate`.\n"
          },
          "bySetPos": {
            "type": "integer",
            "enum": [
              1,
              2,
              3,
              4,
              -1
            ],
            "x-enum-varnames": [
              "FIRST",
              "SECOND",
              "THIRD",
              "FOURTH",
              "LAST"
            ],
            "description": "For a monthly recurrence only, which occurrence of the `byDay` weekday in the month the task repeats on: 1 to 4 for the first to the fourth, or `-1` for the last. Send it with exactly one day in `byDay`. For example, `bySetPos: 2` with `byDay: [\"TU\"]` means the second Tuesday of each month.\n"
          }
        },
        "required": [
          "frequency"
        ],
        "not": {
          "required": [
            "untilDate",
            "count"
          ]
        }
      },
      "TaskCreate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The task to create. An all-day task needs an `allDayDate`. A timed task, one with `isAllDay: false`, needs a `dueAt` and a `timeZone`. If a date or the time zone is missing, the request fails with a `422` error and the code `missing-required-field`. The Errors table for creating a task lists the other checks.\n",
        "properties": {
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "What needs to be done, between 1 and 200 characters. Omono removes any spaces from the start and end. It can't contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "taskTypeId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the task's type. It must be a type that isn't archived.\n",
            "minLength": 1
          },
          "taskPriorityId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the task's priority. It must be a priority that isn't archived. To match the tasks your staff create in Omono, send your organisation's default priority, the one with `isDefault: true`.\n",
            "minLength": 1
          },
          "taskStatusId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the task's status. It must be an open status that isn't archived: a closed status makes the request fail with a `422` error and the code `validation-failed`. To match the tasks your staff create in Omono, send your organisation's default status, the one with `isDefault: true`.\n",
            "minLength": 1
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When a timed task is due, as an ISO 8601 date and time. It's required when `isAllDay` is `false`.\n"
          },
          "allDayDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The day an all-day task is due, as `YYYY-MM-DD`. It's required unless `isAllDay` is `false`, and you can't send it for a timed task.\n"
          },
          "isAllDay": {
            "type": "boolean",
            "description": "Whether the task is due on a day rather than at a particular time. The default is `true`.\n"
          },
          "timeZone": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The time zone of a timed task, as an IANA name such as `Europe/London`, up to 64 characters. It's required when `isAllDay` is `false`. An all-day task doesn't use a time zone, but whenever you send one, it must be a name from the IANA time zone database: any other value fails with a `422` error and the code `validation-failed`.\n"
          },
          "estimatedDuration": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 2147483647,
            "description": "How long the task is expected to take, in minutes. It must be between 1 and 2,147,483,647.\n"
          },
          "ownerId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the user who owns the task. It must be a user whose `assignable` is `true` in [List all users](#tag/organisation).\n",
            "minLength": 1
          },
          "assignedUserIds": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string",
              "maxLength": 64,
              "minLength": 1
            },
            "description": "The IDs of the users to assign to the task, up to 100 of them. Each must be a user whose `assignable` is `true`, and each can appear only once.\n"
          },
          "linkedEntityType": {
            "description": "The type of record to link the task to. Send it with `linkedEntityId`. For a task that isn't linked to a record, send `general` or leave out both fields.\n",
            "oneOf": [
              {
                "$ref": "#/components/schemas/KnownTaskLinkedEntityType"
              },
              {
                "type": "null"
              }
            ]
          },
          "linkedEntityId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the record to link the task to. It must be a record of the type in `linkedEntityType`, or the request fails with a `422` error and the code `invalid-reference`. Leave it out, or send `null`, when the type is `general` or you aren't linking the task: an ID with `general` fails with the code `validation-failed`. You can't link a task to an archived company, contact or stock item. You can link it to a quote, sales order, credit note or purchase order whatever its status.\n",
            "minLength": 1
          },
          "blocksShipping": {
            "type": "boolean",
            "description": "Whether the task stops the linked sales order's dispatches from shipping while it's open. The default is `false`. You can set it to `true` only on a task linked to a sales order: otherwise the request fails with a `422` error and the code `validation-failed`.\n"
          },
          "isRecurring": {
            "type": "boolean",
            "description": "Whether the task repeats. If you leave it out, it's `true` when you send a `recurrenceConfig` and `false` when you don't. If you send a value that doesn't match `recurrenceConfig`, the request fails with a `422` error and the code `validation-failed`, naming the field `isRecurring`.\n"
          },
          "recurrenceConfig": {
            "description": "How the task repeats. Leave it out, or send `null`, for a task that doesn't repeat.\n",
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecurrenceConfigWrite"
              },
              {
                "type": "null"
              }
            ]
          },
          "externalRef": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the task, such as the activity's ID in your CRM. Up to 100 characters, with no spaces at the start or end. Omono compares it exactly, capital letters included. If another of your organisation's tasks already has it, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one, so a task you send twice is created only once. Learn more about [external references](/docs/writing#external-references).\n"
          }
        },
        "required": [
          "subject",
          "taskTypeId",
          "taskPriorityId",
          "taskStatusId",
          "ownerId"
        ],
        "if": {
          "properties": {
            "isAllDay": {
              "const": false
            }
          },
          "required": [
            "isAllDay"
          ]
        },
        "then": {
          "properties": {
            "dueAt": {
              "type": "string"
            },
            "timeZone": {
              "type": "string"
            }
          }
        },
        "else": {
          "properties": {
            "allDayDate": {
              "type": "string"
            }
          }
        }
      },
      "TaskUpdate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The fields to change on a task. Any fields you leave out stay as they are. Omono checks the task as it will be after the update, combining the fields you send with the ones already stored. Learn more about [the rules for every write](/docs/writing#the-rules-for-every-write).\n\nTo make a timed task all-day, send `isAllDay: true`: sending an `allDayDate` for a timed task fails with a `422` error. To make an all-day task timed, send `isAllDay: false` with a `dueAt`, and with a `timeZone` unless the task already has one. On an all-day task, a `dueAt` needs an `allDayDate` too.\n",
        "properties": {
          "externalRef": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[^\\s\\u0000-\\u001F\\u007F](?:[^\\u0000-\\u001F\\u007F]*[^\\s\\u0000-\\u001F\\u007F])?$",
            "description": "Your own reference for the task. Up to 100 characters, with no spaces at the start or end. Send `null` to remove it. You can change it on a completed task too. If another of your organisation's tasks already has it, the request fails with a `409` error and the code `duplicate-external-ref`, and `conflictingId` names that one. Learn more about [external references](/docs/writing#external-references).\n"
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "What needs to be done, between 1 and 200 characters. Omono removes any spaces from the start and end. It can't contain the invisible characters that change the direction of text, as [Text](/docs/conventions#text) explains.\n"
          },
          "taskTypeId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the task's type. A new type can't be archived.\n",
            "minLength": 1
          },
          "taskPriorityId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the task's priority. A new priority can't be archived.\n",
            "minLength": 1
          },
          "taskStatusId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the task's status. A new status must be an open status that isn't archived. You can't move a task to a closed status, or change the status of a completed task.\n",
            "minLength": 1
          },
          "dueAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When a timed task is due, as an ISO 8601 date and time. It's required when you switch a task from all-day to timed.\n"
          },
          "allDayDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The day an all-day task is due, as `YYYY-MM-DD`. You can't send it for a timed task.\n"
          },
          "isAllDay": {
            "type": "boolean",
            "description": "Whether the task is due on a day rather than at a particular time. If you switch it to `false`, send a `dueAt` too.\n"
          },
          "timeZone": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The time zone of a timed task, as an IANA name such as `Europe/London`, up to 64 characters. If you change it, the new value must be a name from the IANA time zone database, even on an all-day task: any other value fails with a `422` error and the code `validation-failed`.\n"
          },
          "estimatedDuration": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 2147483647,
            "description": "How long the task is expected to take, in minutes. It must be between 1 and 2,147,483,647. Send `null` to remove the estimate.\n"
          },
          "ownerId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the user who owns the task. A new owner must be a user whose `assignable` is `true`.\n",
            "minLength": 1
          },
          "assignedUserIds": {
            "type": [
              "array",
              "null"
            ],
            "maxItems": 100,
            "items": {
              "type": "string"
            },
            "description": "The users assigned to the task, up to 100 of them. The list you send replaces the current one, and `null` removes everyone. Each user you add must have `assignable: true`, and each can appear only once.\n"
          },
          "linkedEntityType": {
            "description": "The type of record the task is linked to. To remove the link, send `null` for both link fields.\n",
            "oneOf": [
              {
                "$ref": "#/components/schemas/KnownTaskLinkedEntityType"
              },
              {
                "type": "null"
              }
            ]
          },
          "linkedEntityId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The ID of the record the task is linked to. If you send this or `linkedEntityType`, Omono checks the pair as it will be after the update. Both must be set, or both `null`, and an ID can't go with `general`: otherwise the request fails with a `422` error and the code `validation-failed`. The ID must belong to a record of that type, or the request fails with the code `invalid-reference`. A new link can't be to an archived company, contact or stock item, but a link the task already has is accepted as it is.\n",
            "minLength": 1
          },
          "blocksShipping": {
            "type": "boolean",
            "description": "Whether the task stops the linked sales order's dispatches from shipping while it's open. You can set it to `true` only if the task is linked to a sales order after the update: otherwise the request fails with a `422` error and the code `validation-failed`. If you move the link away from a sales order, Omono turns it off.\n"
          },
          "isRecurring": {
            "type": "boolean",
            "description": "Whether the task repeats. After the update it must match `recurrenceConfig`: `true` with a recurrence, or `false` without one. If you send only `recurrenceConfig`, Omono sets this field to match.\n"
          },
          "recurrenceConfig": {
            "description": "How the task repeats. The recurrence you send replaces the current one. Send `null` to stop the task repeating.\n",
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecurrenceConfigWrite"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "TaskComplete": {
        "type": "object",
        "description": "Completes a task. The field is optional, so you can send an empty object or no body.",
        "additionalProperties": false,
        "properties": {
          "taskStatusId": {
            "type": "string",
            "maxLength": 64,
            "description": "The closed status to give the task, from [List all task statuses](#tag/task-settings). It must be a status with `isClosedStatus: true` that isn't archived. The default is your first closed status.\n",
            "minLength": 1
          }
        }
      },
      "TaskActionResult": {
        "type": "object",
        "description": "The response to completing a task. It tells you whether this request completed the task, and it always includes the task as it is now.\n",
        "properties": {
          "applied": {
            "type": "boolean",
            "description": "Whether this request completed the task, or the current occurrence of a repeating task. It's `false` if the task was already complete, and in that case nothing changed."
          },
          "task": {
            "$ref": "#/components/schemas/TaskRecord"
          }
        },
        "required": [
          "applied",
          "task"
        ],
        "additionalProperties": true
      },
      "Document": {
        "type": "object",
        "description": "A file attached to a record, such as a drawing on a sales order. Each document belongs to exactly one record, so exactly one of its parent IDs is set. Download the file through `contentUrl`. Files attached to tasks and to email templates never appear in the API. Learn more about [downloads](/docs/reading#downloads).\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the document."
          },
          "name": {
            "type": "string",
            "description": "The document's name, for example `drawing-rev-b.pdf`. You can rename a document by updating it. The names of files uploaded in Omono are kept exactly as they were uploaded, with any spaces at the start or end.\n"
          },
          "size": {
            "type": "integer",
            "description": "The size of the file in bytes. Omono measures it for a file uploaded through the API. For a file uploaded in Omono, it's the size the browser reported.\n"
          },
          "fileType": {
            "type": [
              "string",
              "null"
            ],
            "description": "The file's MIME type, for example `application/pdf`. For a file uploaded through the API, Omono takes it from the extension of the uploaded file's name, then from the extension of `name`, then from the file part's `Content-Type`. If none of these gives a valid type, it's `application/octet-stream`.\n"
          },
          "salesOrderId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the sales order the document is attached to, or `null` if it's attached to another kind of record.\n"
          },
          "quoteId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the quote the document is attached to, or `null` if it's attached to another kind of record.\n"
          },
          "companyId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the company the document is attached to, or `null` if it's attached to another kind of record.\n"
          },
          "purchaseOrderId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the purchase order the document is attached to, or `null` if it's attached to another kind of record.\n"
          },
          "stockItemId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the stock item the document is attached to, or `null` if it's attached to another kind of record.\n"
          },
          "creditNoteId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the credit note the document is attached to, or `null` if it's attached to another kind of record.\n"
          },
          "uploaderUserId": {
            "type": "string",
            "description": "The ID of the user who uploaded the file. Files uploaded through the API show your organisation's API user. Your users are listed by [List all users](#tag/organisation).\n"
          },
          "pinned": {
            "type": "boolean",
            "description": "Whether the document is pinned to its record. In Omono, pinned documents sit at the top of a record's documents, and they're the ones shown by default on related records and in the list of email attachments. To change it, update the document with the value you want: it isn't a toggle.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the document has been deleted, in Omono or through the API. A deleted document is archived rather than removed, so you can still read its details, but its `contentUrl` returns a `404` error. Archiving can't be undone: through the API you can't unarchive, rename or re-pin an archived document. Deleting a document doesn't write an event, so if you keep a copy, list documents with `archived=any` to see it. A `documents` event is written only when Omono removes a document for good, which happens when the quote, sales order, credit note or purchase order it's attached to is deleted.\n"
          },
          "contentUrl": {
            "type": "string",
            "description": "The URL to download the file from, relative to the API's host. It redirects you to the file.\n"
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "The time the document was uploaded."
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "The time the document was last changed."
          }
        },
        "required": [
          "id",
          "name",
          "size",
          "fileType",
          "salesOrderId",
          "quoteId",
          "companyId",
          "purchaseOrderId",
          "stockItemId",
          "creditNoteId",
          "uploaderUserId",
          "pinned",
          "archived",
          "contentUrl",
          "created",
          "updated"
        ],
        "additionalProperties": true
      },
      "DocumentList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The documents on this page.",
                "items": {
                  "$ref": "#/components/schemas/Document"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "DocumentUpload": {
        "type": "object",
        "description": "The parts of a `multipart/form-data` upload. Send exactly one parent ID, then `name` and `pinned` if you want them, and the `file` part last.\n",
        "properties": {
          "salesOrderId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the sales order to attach the file to.",
            "minLength": 1
          },
          "quoteId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the quote to attach the file to.",
            "minLength": 1
          },
          "companyId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the company to attach the file to.",
            "minLength": 1
          },
          "purchaseOrderId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the purchase order to attach the file to.",
            "minLength": 1
          },
          "stockItemId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the stock item to attach the file to.",
            "minLength": 1
          },
          "creditNoteId": {
            "type": "string",
            "maxLength": 64,
            "description": "The ID of the credit note to attach the file to.",
            "minLength": 1
          },
          "name": {
            "type": "string",
            "maxLength": 250,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The document's name. If you leave it out, Omono uses the file name from the `file` part, including a UTF-8 name, whether it's sent as it is or in `filename*=`. The name must be between 1 and 250 characters after Omono removes any spaces from the start and end. It must also be a valid file name, under the same file-name rules as when you [update a document](#tag/documents). Otherwise the request fails with a `422` error and the code `invalid-filename`.\n"
          },
          "pinned": {
            "type": "boolean",
            "description": "Whether to pin the document to its record. The default is `true`, as it is in Omono.\n"
          },
          "file": {
            "type": "string",
            "format": "binary",
            "description": "The contents of the file. It must be the last part of the request."
          }
        },
        "required": [
          "file"
        ],
        "additionalProperties": false
      },
      "DocumentUpdate": {
        "type": "object",
        "additionalProperties": false,
        "description": "The changes to make to a document: rename it, pin or unpin it, or archive it. Once a document is archived, any change fails with a `409` error and the code `document-archived`, but sending its current values again is fine.\n",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 250,
            "pattern": "^[^\\u200E-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "The document's new name, up to 250 characters. It can't contain the invisible characters that change the direction of text, or a byte order mark, as [Text](/docs/conventions#text) explains. A name that's too long, or that contains one of those characters, fails with a `422` error and the code `validation-failed`.\n\nAfter Omono removes any whitespace from the start and end, the name must be at least 1 character long and a valid file name: it can't contain `< > : \" / \\ | ? *` or a control character (U+0000 to U+001F), and it can't be `.`, `..` or a reserved device name, such as `CON`, `PRN`, `AUX`, `NUL`, `COM1` or `LPT1`, in capitals or not. There's no rule about the extension. Otherwise the request fails with a `422` error and the code `invalid-filename`. If you send the current name again, Omono doesn't apply these file-name rules to it and changes nothing.\n"
          },
          "pinned": {
            "type": "boolean",
            "description": "Whether the document is pinned to its record. Send the value you want, because it isn't a toggle. You can't change it on an archived document.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Send `true` to archive the document, which deletes it in the same way as deleting it in Omono. Archiving can't be undone: `false` fails with a `409` error and the code `document-archived` on an archived document, and changes nothing on one that isn't archived.\n"
          }
        }
      },
      "TaxRate": {
        "type": "object",
        "description": "A tax rate, such as 20% VAT, that you apply to companies and line items.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the tax rate."
          },
          "name": {
            "type": "string",
            "description": "The tax rate's name, as your organisation set it up, for example \"20% (VAT on Income)\".\n"
          },
          "rate": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "The rate as a percentage, between 0 and 100. For example, `20` means 20%.\n"
          },
          "type": {
            "description": "The rate's special type, if it has one. It's `exempt` on the built-in exempt tax rate, which Omono applies to line items for tax-exempt stock, and `null` on every other rate.\n\nKnown values: `exempt`. Omono can add values; handle one you don't recognise.\n",
            "type": [
              "string",
              "null"
            ],
            "x-known-values": [
              "exempt"
            ]
          },
          "systemDefined": {
            "type": "boolean",
            "description": "Whether Omono defines this rate itself, like the built-in exempt tax rate. Omono doesn't show these rates in its tax-rate settings. You can't give a company a system-defined rate, and a line item can use the exempt tax rate only if its stock item is tax-exempt.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the tax rate is archived. You can't give a record an archived rate, but records that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "name",
          "rate",
          "type",
          "systemDefined",
          "archived"
        ],
        "additionalProperties": true
      },
      "TaxRateList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The tax rates on this page.",
                "items": {
                  "$ref": "#/components/schemas/TaxRate"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "SalesAnalysisCode": {
        "type": "object",
        "description": "A sales analysis code, a category you use to analyse your sales.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the sales analysis code."
          },
          "name": {
            "type": "string",
            "description": "The code's name, for example \"Machined Parts\"."
          },
          "marginWarningPercent": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "The minimum margin you expect on sales with this code, as a percentage between 0 and 100. In Omono, a line item whose margin is below it shows a warning, but it can still be saved. A stock item's own `marginWarningPercent`, when it has one, takes its place.\n"
          },
          "defaultCommodityCodeId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the commodity code that a line item takes when its stock item has no commodity code of its own. It's `null` if the code has no default. Your commodity codes are listed by [List all commodity codes](#tag/purchasing-and-shipping).\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the code is archived. You can't give a record an archived code, but records that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "name",
          "marginWarningPercent",
          "defaultCommodityCodeId",
          "archived"
        ],
        "additionalProperties": true
      },
      "SalesAnalysisCodeList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The sales analysis codes on this page.",
                "items": {
                  "$ref": "#/components/schemas/SalesAnalysisCode"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "PurchaseAnalysisCode": {
        "type": "object",
        "description": "A purchase analysis code, a category you use to analyse your spending.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the purchase analysis code."
          },
          "name": {
            "type": "string",
            "description": "The code's name, for example \"Raw Materials\"."
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the code is archived. You can't give a record an archived code, but records that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "name",
          "archived"
        ],
        "additionalProperties": true
      },
      "PurchaseAnalysisCodeList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The purchase analysis codes on this page.",
                "items": {
                  "$ref": "#/components/schemas/PurchaseAnalysisCode"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "WorkflowStatus": {
        "type": "object",
        "description": "A status in your organisation's dispatch workflow. Your organisation chooses the name of each status, but its `type`, which says what the status means, is fixed.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the workflow status."
          },
          "name": {
            "type": "string",
            "description": "The status's name, for example \"Awaiting Allocation\". Your organisation can change it, so don't rely on it in your code. Use `type` instead.\n"
          },
          "type": {
            "$ref": "#/components/schemas/WorkflowStatusType"
          },
          "sortOrder": {
            "type": "integer",
            "description": "The status's position in the workflow. Statuses with lower numbers come first.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the status is archived. You can't move a dispatch to an archived status.\n"
          }
        },
        "required": [
          "id",
          "name",
          "type",
          "sortOrder",
          "archived"
        ],
        "additionalProperties": true
      },
      "WorkflowStatusList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The workflow statuses on this page.",
                "items": {
                  "$ref": "#/components/schemas/WorkflowStatus"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "TaskStatusRecord": {
        "type": "object",
        "description": "A status a task can have, such as \"Open\" or \"Done\".\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the task status."
          },
          "name": {
            "type": "string",
            "description": "The status's name, for example \"In Progress\"."
          },
          "isClosedStatus": {
            "type": "boolean",
            "description": "Whether this is a closed status. A task with a closed status is complete. You can't give a task a closed status in a `PATCH`: to complete a task, use `POST /tasks/{id}/complete`.\n"
          },
          "isDefault": {
            "type": "boolean",
            "description": "Whether this is your organisation's default status, which Omono selects for a new task.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the status is archived. You can't give a task an archived status, but tasks that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "name",
          "isClosedStatus",
          "isDefault",
          "archived"
        ],
        "additionalProperties": true
      },
      "TaskStatusRecordList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The task statuses on this page.",
                "items": {
                  "$ref": "#/components/schemas/TaskStatusRecord"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "TaskPriority": {
        "type": "object",
        "description": "A priority a task can have, such as \"High\".\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the task priority."
          },
          "name": {
            "type": "string",
            "description": "The priority's name, for example \"High\"."
          },
          "isDefault": {
            "type": "boolean",
            "description": "Whether this is your organisation's default priority, which Omono selects for a new task.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the priority is archived. You can't give a task an archived priority, but tasks that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "name",
          "isDefault",
          "archived"
        ],
        "additionalProperties": true
      },
      "TaskPriorityList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The task priorities on this page.",
                "items": {
                  "$ref": "#/components/schemas/TaskPriority"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "TaskType": {
        "type": "object",
        "description": "A type of task, such as \"Call\" or \"Follow Up\".\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the task type."
          },
          "name": {
            "type": "string",
            "description": "The type's name, for example \"Follow Up\"."
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the type is archived. You can't give a task an archived type, but tasks that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "name",
          "archived"
        ],
        "additionalProperties": true
      },
      "TaskTypeList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The task types on this page.",
                "items": {
                  "$ref": "#/components/schemas/TaskType"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "Currency": {
        "type": "object",
        "description": "A currency. Every organisation sees the same list of currencies.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the currency."
          },
          "name": {
            "type": "string",
            "description": "The currency's name, for example \"Pound Sterling\"."
          },
          "iso4217code": {
            "type": "string",
            "description": "The currency's three-letter ISO 4217 code, for example `GBP`.\n"
          },
          "symbol": {
            "type": "string",
            "description": "The currency's symbol, for example `£`.\n"
          }
        },
        "required": [
          "id",
          "name",
          "iso4217code",
          "symbol"
        ],
        "additionalProperties": true
      },
      "CurrencyList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The currencies on this page.",
                "items": {
                  "$ref": "#/components/schemas/Currency"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "Country": {
        "type": "object",
        "description": "A country, with the rules for writing addresses there. Every organisation sees the same list of countries.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the country."
          },
          "name": {
            "type": "string",
            "description": "The country's name, for example \"United Kingdom\"."
          },
          "iso2code": {
            "type": "string",
            "description": "The country's two-letter ISO 3166-1 code, for example `GB`.\n"
          },
          "postcodeBeforeCity": {
            "type": "boolean",
            "description": "Whether the postcode comes before the town on the same line of an address, as in \"0155 OSLO\". Omono follows this rule only if your organisation has chosen to use each country's own address format.\n"
          },
          "cityUppercase": {
            "type": "boolean",
            "description": "Whether the town is written in capital letters in this country's addresses, as in France and Norway. Like `postcodeBeforeCity`, it applies only if your organisation uses each country's own address format.\n"
          },
          "localityLineFormat": {
            "type": [
              "string",
              "null"
            ],
            "description": "A template for the address line that holds the town and postcode, for countries whose convention the other two fields can't describe. It uses the placeholders `{postcode}`, `{city}` and `{subdivision}`, where the subdivision is the county, state or province from the address's `county` field. For example, the United States uses `{city}, {subdivision} {postcode}`. When it's set, it takes precedence over `postcodeBeforeCity`. It's `null` when the country has no template.\n"
          }
        },
        "required": [
          "id",
          "name",
          "iso2code",
          "postcodeBeforeCity",
          "cityUppercase",
          "localityLineFormat"
        ],
        "additionalProperties": true
      },
      "CountryList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The countries on this page.",
                "items": {
                  "$ref": "#/components/schemas/Country"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "Division": {
        "type": "object",
        "description": "A division of your organisation, such as a branch, region or brand. Each division can have its own address and branding on documents.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the division."
          },
          "name": {
            "type": "string",
            "description": "The division's name, for example \"North Office\". No two divisions in your organisation have the same name.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the division is archived. You can't give a record an archived division, but records that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "name",
          "archived"
        ],
        "additionalProperties": true
      },
      "DivisionList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The divisions on this page.",
                "items": {
                  "$ref": "#/components/schemas/Division"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "Warehouse": {
        "type": "object",
        "description": "A warehouse where you keep stock.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the warehouse."
          },
          "name": {
            "type": "string",
            "description": "The warehouse's name, for example \"Main Warehouse\"."
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the warehouse is archived. You can't give a stock item an archived warehouse, but stock items that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "name",
          "archived"
        ],
        "additionalProperties": true
      },
      "WarehouseList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The warehouses on this page.",
                "items": {
                  "$ref": "#/components/schemas/Warehouse"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "Courier": {
        "type": "object",
        "description": "A courier that carries your dispatches. It's either one of the couriers built into Omono or one your organisation added itself.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the courier."
          },
          "name": {
            "type": "string",
            "description": "The courier's name, for example \"DHL Express\"."
          },
          "trackingUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "The web address of the courier's tracking page, as a template that Omono fills in to build a tracking link for a dispatch. `{{TRACKINGNO}}` marks where the dispatch's tracking number goes. Some couriers also need the delivery postcode to find a parcel, and their template has `{{POSTCODE}}` where the postcode of the sales order's delivery address goes. Omono URL-encodes each value and replaces every placeholder. When the customer collects the order, or the delivery address has no postcode, Omono replaces `{{POSTCODE}}` with nothing. It's `null` when Omono has no tracking page for the courier.\n"
          },
          "source": {
            "description": "Where the courier comes from.\n\nKnown values: `default`, `custom`. Omono can add values; handle one you don't recognise.\n",
            "type": "string",
            "x-known-values": [
              "default",
              "custom"
            ],
            "x-enum-descriptions": [
              "One of the couriers built into Omono.",
              "A courier your organisation added itself."
            ]
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the courier is archived. You can't choose an archived courier when you ship a dispatch.\n"
          }
        },
        "required": [
          "id",
          "name",
          "trackingUrl",
          "source",
          "archived"
        ],
        "additionalProperties": true
      },
      "CourierList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The couriers on this page.",
                "items": {
                  "$ref": "#/components/schemas/Courier"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "Incoterm": {
        "type": "object",
        "description": "An incoterm, one of the standard trade terms that set out who is responsible for goods, and who pays, at each stage of delivery. Your organisation keeps its own list of incoterms, and staff can edit it in Omono, so the terms and their descriptions are whatever your staff entered.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the incoterm."
          },
          "term": {
            "type": "string",
            "description": "The incoterm's short code, for example `FCA`.\n"
          },
          "description": {
            "type": "string",
            "description": "A description of the incoterm, for example \"Free Carrier: the seller delivers the goods to the carrier that the buyer names\".\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the incoterm is archived. You can't give a record an archived incoterm, but records that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "term",
          "description",
          "archived"
        ],
        "additionalProperties": true
      },
      "IncotermList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The incoterms on this page.",
                "items": {
                  "$ref": "#/components/schemas/Incoterm"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "CommodityCode": {
        "type": "object",
        "description": "A commodity code, the customs tariff code that classifies a kind of goods.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the commodity code."
          },
          "commodityCode": {
            "type": "string",
            "description": "The code itself, for example `8481805900`. It's a string, so any leading zeros are kept.\n"
          },
          "description": {
            "type": "string",
            "description": "A description of the goods the code covers, for example \"Valves and similar appliances\".\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the commodity code is archived. You can't give a record an archived code, but records that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "commodityCode",
          "description",
          "archived"
        ],
        "additionalProperties": true
      },
      "CommodityCodeList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The commodity codes on this page.",
                "items": {
                  "$ref": "#/components/schemas/CommodityCode"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "EoriNumber": {
        "type": "object",
        "description": "One of your organisation's EORI numbers. An EORI number identifies a business to customs authorities.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the EORI number."
          },
          "eoriNumber": {
            "type": "string",
            "description": "The EORI number itself, for example `GB123456789000`.\n"
          },
          "description": {
            "type": "string",
            "description": "Your description of the number, for example \"UK EORI\".\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the EORI number is archived. You can't give a record an archived EORI number, but records that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "eoriNumber",
          "description",
          "archived"
        ],
        "additionalProperties": true
      },
      "EoriNumberList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The EORI numbers on this page.",
                "items": {
                  "$ref": "#/components/schemas/EoriNumber"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "UserSummary": {
        "type": "object",
        "description": "A user in your organisation, shown by ID, name and email address. Roles are never included. The list includes archived users and your organisation's API user, the user that stands for the API.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the user."
          },
          "fullName": {
            "type": "string",
            "description": "The user's full name, for example \"Jane Doe\"."
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "description": "The email address on the user's Omono account, as it was saved. It's `null` for your organisation's API user, which has no address.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the user is archived, usually because they've left your organisation. Archived users stay in the list so that older records still show who created or handled them.\n"
          },
          "assignable": {
            "type": "boolean",
            "description": "Whether you can name this user when you create or change a record, in `salesPersonId`, `buyerId`, `raisedById`, `ownerId`, `assignedUserIds` or `accountManagerId`. It's `false` for archived users, for your organisation's API user, and for users who represent a contact rather than a member of staff. If you name a user who isn't assignable, the request fails with a `422` error and the code `invalid-reference`.\n"
          }
        },
        "required": [
          "id",
          "fullName",
          "email",
          "archived",
          "assignable"
        ],
        "additionalProperties": true
      },
      "UserSummaryList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The users on this page.",
                "items": {
                  "$ref": "#/components/schemas/UserSummary"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "Commission": {
        "type": "object",
        "description": "A commission scheme: a referrer, such as an agent, and the commission rate they earn.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the commission scheme."
          },
          "referrer": {
            "type": "string",
            "description": "The name of the referrer who earns the commission, for example \"UK South Agent\".\n"
          },
          "rate": {
            "type": "number",
            "description": "The commission rate as a percentage, between 0 and 100. For example, `5` means 5%.\n",
            "minimum": 0,
            "maximum": 100
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the scheme is archived. You can't give a record an archived scheme, but records that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "referrer",
          "rate",
          "archived"
        ],
        "additionalProperties": true
      },
      "CommissionList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The commission schemes on this page.",
                "items": {
                  "$ref": "#/components/schemas/Commission"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "CustomerSegment": {
        "type": "object",
        "description": "A customer segment, a group you sort customers into for reporting.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the customer segment."
          },
          "name": {
            "type": "string",
            "description": "The segment's name, for example \"Key Accounts\"."
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the segment is archived. You can't give a company an archived segment, but companies that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "name",
          "archived"
        ],
        "additionalProperties": true
      },
      "CustomerSegmentList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The customer segments on this page.",
                "items": {
                  "$ref": "#/components/schemas/CustomerSegment"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "Department": {
        "type": "object",
        "description": "A department that a contact can work in, such as \"Engineering\".\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the department."
          },
          "name": {
            "type": "string",
            "description": "The department's name, for example \"Engineering\"."
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the department is archived. You can't give a contact an archived department, but contacts that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "name",
          "archived"
        ],
        "additionalProperties": true
      },
      "DepartmentList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The departments on this page.",
                "items": {
                  "$ref": "#/components/schemas/Department"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "Industry": {
        "type": "object",
        "description": "An industry, a sector you use to classify companies.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the industry."
          },
          "name": {
            "type": "string",
            "description": "The industry's name, for example \"Aerospace\"."
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the industry is archived. You can't give a company an archived industry, but companies that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "name",
          "archived"
        ],
        "additionalProperties": true
      },
      "IndustryList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The industries on this page.",
                "items": {
                  "$ref": "#/components/schemas/Industry"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "CompanyType": {
        "type": "object",
        "description": "A company type, a category that describes what kind of business a company is.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the company type."
          },
          "name": {
            "type": "string",
            "description": "The type's name, for example \"Limited Company\"."
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the company type is archived. You can't give a company an archived type, but companies that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "name",
          "archived"
        ],
        "additionalProperties": true
      },
      "CompanyTypeList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The company types on this page.",
                "items": {
                  "$ref": "#/components/schemas/CompanyType"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "QuoteValidity": {
        "type": "object",
        "description": "A quote validity, an option for how long a quote stands.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the quote validity."
          },
          "name": {
            "type": "string",
            "description": "The validity's name, for example \"30 days\"."
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the validity is archived. You can't give a quote an archived validity, but quotes that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "name",
          "archived"
        ],
        "additionalProperties": true
      },
      "QuoteValidityList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The quote validities on this page.",
                "items": {
                  "$ref": "#/components/schemas/QuoteValidity"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "ConversionProbability": {
        "type": "object",
        "description": "A conversion probability, an option for how likely a quote is to be won.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the conversion probability."
          },
          "probability": {
            "type": "number",
            "description": "The chance of winning the quote, as a percentage between 0 and 100. For example, `75` means 75%.\n",
            "minimum": 0,
            "maximum": 100
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "A short label for the probability, for example \"Likely\". It's `null` if there's no label.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the probability is archived. You can't give a quote an archived probability, but quotes that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "probability",
          "description",
          "archived"
        ],
        "additionalProperties": true
      },
      "ConversionProbabilityList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The conversion probabilities on this page.",
                "items": {
                  "$ref": "#/components/schemas/ConversionProbability"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "LostQuoteReason": {
        "type": "object",
        "description": "A reason you record when a quote is lost, such as \"Price too high\".\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the lost-quote reason."
          },
          "name": {
            "type": "string",
            "description": "The reason, for example \"Price too high\"."
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the reason is archived. Quotes that already have an archived reason keep it.\n"
          }
        },
        "required": [
          "id",
          "name",
          "archived"
        ],
        "additionalProperties": true
      },
      "LostQuoteReasonList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The lost-quote reasons on this page.",
                "items": {
                  "$ref": "#/components/schemas/LostQuoteReason"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "CurrencyRate": {
        "type": "object",
        "description": "One of the currencies your organisation trades in, with its current exchange rate. When staff create a document in this currency, Omono's forms fill in this rate. Through the API, you send it yourself as the document's `exchangeRate`.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the currency rate."
          },
          "currencyId": {
            "type": "string",
            "description": "The ID of the currency. Currencies are listed by [List all currencies](#tag/tax-and-currency).\n"
          },
          "rate": {
            "type": "number",
            "exclusiveMinimum": 0,
            "description": "How many units of this currency one unit of your base currency buys. For example, if your base currency is GBP and 1 GBP is worth 1.1682 EUR, the EUR rate is `1.1682`. Every `exchangeRate` field in the API uses the same direction.\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the currency rate is archived. You can't give a company a currency whose rate is archived.\n"
          }
        },
        "required": [
          "id",
          "currencyId",
          "rate",
          "archived"
        ],
        "additionalProperties": true
      },
      "CurrencyRateList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The currency rates on this page.",
                "items": {
                  "$ref": "#/components/schemas/CurrencyRate"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "OrganisationAddress": {
        "type": "object",
        "description": "One of your organisation's own addresses, which a purchase order can use as its delivery address. You can read these addresses but not change them through the API.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the address."
          },
          "companyName": {
            "type": [
              "string",
              "null"
            ],
            "description": "The company name on the address, or `null` if there isn't one.\n"
          },
          "line1": {
            "type": "string",
            "description": "The first line of the street address."
          },
          "line2": {
            "type": [
              "string",
              "null"
            ],
            "description": "The second line of the street address, or `null` if there isn't one.\n"
          },
          "city": {
            "type": "string",
            "description": "The town or city."
          },
          "county": {
            "type": [
              "string",
              "null"
            ],
            "description": "The county, state or province, or `null` if there isn't one.\n"
          },
          "postcode": {
            "type": [
              "string",
              "null"
            ],
            "description": "The postcode or ZIP code, or `null` if there isn't one.\n"
          },
          "countryId": {
            "type": "string",
            "description": "The ID of the address's country. Countries are listed by [List all countries](#tag/tax-and-currency).\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the address is archived, which means your organisation no longer uses it.\n"
          }
        },
        "required": [
          "id",
          "companyName",
          "line1",
          "line2",
          "city",
          "county",
          "postcode",
          "countryId",
          "archived"
        ],
        "additionalProperties": true
      },
      "OrganisationAddressList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The organisation addresses on this page.",
                "items": {
                  "$ref": "#/components/schemas/OrganisationAddress"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "BankAccount": {
        "type": "object",
        "description": "One of your organisation's bank accounts, shown by name and currency only. Account numbers, sort codes, IBANs and SWIFT or BIC codes are never included.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the bank account."
          },
          "displayName": {
            "type": "string",
            "description": "The account's name, as it appears in Omono, for example \"Main current account (GBP)\".\n"
          },
          "currencyId": {
            "type": "string",
            "description": "The ID of the account's currency. A customer's invoice payment account must be in the same currency as the customer. Currencies are listed by [List all currencies](#tag/tax-and-currency).\n"
          },
          "archived": {
            "type": "boolean",
            "description": "Whether the bank account is archived. You can't choose an archived account as a customer's invoice payment account, but customers that already have one keep it.\n"
          }
        },
        "required": [
          "id",
          "displayName",
          "currencyId",
          "archived"
        ],
        "additionalProperties": true
      },
      "BankAccountList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The bank accounts on this page.",
                "items": {
                  "$ref": "#/components/schemas/BankAccount"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "Organisation": {
        "type": "object",
        "description": "The organisation your API key belongs to. Bank details and other settings aren't included.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for your organisation."
          },
          "name": {
            "type": "string",
            "description": "Your organisation's name."
          },
          "countryId": {
            "type": "string",
            "description": "The ID of the country your organisation is based in. Countries are listed by [List all countries](#tag/tax-and-currency).\n"
          },
          "baseCurrencyId": {
            "type": "string",
            "description": "The ID of your base currency, the currency your accounts are kept in. Exchange rates are given relative to it. It's chosen when your organisation is set up and can't change. Currencies are listed by [List all currencies](#tag/tax-and-currency).\n"
          },
          "defaultTaxRateId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the tax rate Omono fills in on a new company, or `null` if there isn't one. Your tax rates are listed by [List all tax rates](#tag/tax-and-currency). The rate may have been archived since, so look it up with `ids` before you send it as a company's `taxRateId`. An archived rate makes the request fail with a `422` error and the code `invalid-reference`.\n"
          },
          "timeZone": {
            "type": "string",
            "description": "Your organisation's time zone, as an IANA name such as `Europe/London`. Omono uses it whenever it needs to know what \"today\" is for you, for example to set the invoice date when a dispatch ships and you don't send one. If your organisation hasn't chosen a time zone, it's the time zone of your organisation's country.\n",
            "examples": [
              "Europe/London"
            ]
          },
          "financialYearEnd": {
            "type": "object",
            "description": "The last day of your financial year, as a day and a month (Accounting Period, under Settings → Company in Omono). The financial year runs from the day after it, a year earlier. When the month doesn't have that day, such as 31 for September, Omono treats it as the month's last day.\n",
            "properties": {
              "day": {
                "type": "integer",
                "minimum": 1,
                "maximum": 31,
                "description": "The day of the month, from 1 to 31."
              },
              "month": {
                "type": "integer",
                "minimum": 1,
                "maximum": 12,
                "description": "The month, from 1 for January to 12 for December."
              }
            },
            "required": [
              "day",
              "month"
            ],
            "additionalProperties": true
          }
        },
        "required": [
          "id",
          "name",
          "countryId",
          "baseCurrencyId",
          "defaultTaxRateId",
          "timeZone",
          "financialYearEnd"
        ],
        "additionalProperties": true
      },
      "SettingsUnitPricing": {
        "type": "object",
        "description": "The number of decimal places Omono rounds unit prices to when you send them. They come from the Unit Pricing setting in Omono, which has separate values for sales and purchasing.\n",
        "properties": {
          "salesDecimalPlaces": {
            "description": "The decimal places, 2 or 4, for sales prices. They apply to `price` and `unitPrice` on quote and sales order line items, `price` on credit note line items, and a stock item's `sellPrice`.\n\nKnown values: `2`, `4`. Omono can add values; handle one you don't recognise.\n",
            "type": "integer",
            "x-known-values": [
              2,
              4
            ]
          },
          "purchasingDecimalPlaces": {
            "description": "The decimal places, 2 or 4, for purchasing prices. They apply to `price` on purchase order line items and a stock item's `cost`.\n\nKnown values: `2`, `4`. Omono can add values; handle one you don't recognise.\n",
            "type": "integer",
            "x-known-values": [
              2,
              4
            ]
          }
        },
        "required": [
          "salesDecimalPlaces",
          "purchasingDecimalPlaces"
        ],
        "additionalProperties": true
      },
      "SettingsSalesOrders": {
        "type": "object",
        "description": "The settings in the Sales Order Settings card in Omono.",
        "properties": {
          "customerOrderNoRequired": {
            "type": "boolean",
            "description": "Whether every sales order needs a customer order reference (\"Set \"Customer Order #\" field as mandatory\" in Omono). When it's `true`, creating a sales order or marking a quote as won without `customerOrderNo` fails with a `422` error and the code `missing-required-field`. So does a `PATCH` that clears an order's `customerOrderNo`, or that sends any field except `lineItems`, `lineItemOrder` and `externalRef` to an order that has none.\n"
          },
          "earlyTrackingEntry": {
            "type": "boolean",
            "description": "Whether you can set a dispatch's `courierId` and `trackingNo` before it ships (\"Allow early entry of courier and tracking details\" in Omono). When it's `true`, you can set them once the dispatch is allocated. When it's `false`, only once it has shipped.\n"
          },
          "duplicateCustomerOrderNoWarning": {
            "type": "boolean",
            "description": "Whether Omono warns staff when they enter a `customerOrderNo` that the same customer already has on another sales order (\"Warn when a customer order number is already used by the same customer\" in Omono). It's only a warning in Omono: the API never refuses an order because of it.\n"
          }
        },
        "required": [
          "customerOrderNoRequired",
          "earlyTrackingEntry",
          "duplicateCustomerOrderNoWarning"
        ],
        "additionalProperties": true
      },
      "SettingsQuoteAutoClose": {
        "type": "object",
        "description": "The Quote Auto-Close card, under Settings → App in Omono. When it's on, Omono marks an Active quote as Lost overnight when its `expectedAwardDate` is more than `daysAfterExpectedAwardDate` days ago and its value in your base currency is below `valueBelow`. If `conversionProbabilityBelow` is set, the quote's conversion probability must also be below it, and a quote with no conversion probability, or one that has been archived, stays Active. So a quote your integration reads as Active can be Lost the next day. To make it Active again, [reactivate it](#tag/quotes/POST/quotes/{id}/reactivate).\n\nWhen Quote Auto-Close is off, or has never been set, `enabled` is `false` and every other field is `null`.\n\nIf `enabled` is `true` but `daysAfterExpectedAwardDate`, `valueBelow` or `lostReasonId` is `null`, Omono closes no quotes.\n",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Whether Omono closes quotes automatically."
          },
          "daysAfterExpectedAwardDate": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The number of days after its `expectedAwardDate` that an Active quote is closed, or `null` when Quote Auto-Close is off."
          },
          "valueBelow": {
            "type": [
              "number",
              "null"
            ],
            "description": "Only quotes whose total, in your base currency, is below this value are closed. It's `null` when Quote Auto-Close is off."
          },
          "conversionProbabilityBelow": {
            "type": [
              "integer",
              "null"
            ],
            "description": "A percentage from 0 to 100. When it's set, only quotes whose [conversion probability](#tag/sales-settings/GET/conversion-probabilities) is below it are closed, and a quote without one stays Active. It's `null` when it isn't set, or when Quote Auto-Close is off.\n"
          },
          "lostReasonId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the [lost-quote reason](#tag/sales-settings/GET/lost-quote-reasons) that Omono gives a quote it closes, or `null` when Quote Auto-Close is off.\n"
          }
        },
        "required": [
          "enabled",
          "daysAfterExpectedAwardDate",
          "valueBelow",
          "conversionProbabilityBelow",
          "lostReasonId"
        ],
        "additionalProperties": true
      },
      "SettingsQuotes": {
        "type": "object",
        "description": "The quote settings that decide which fields a quote must have, and when Omono closes a quote for you.",
        "properties": {
          "chaseByRequired": {
            "type": "boolean",
            "description": "Whether every quote needs a `chaseBy` date (\"Set \"Chase By\" field as mandatory\" in the Sales Quote Settings card). When it's `true`, creating a quote without `chaseBy` fails with a `422` error and the code `missing-required-field`. So does a `PATCH` that clears a quote's `chaseBy`, or that sends any field except `lineItems`, `lineItemOrder` and `externalRef` to a quote that has no `chaseBy`.\n"
          },
          "expectedAwardDateRequired": {
            "type": "boolean",
            "description": "Whether every quote needs an `expectedAwardDate`. It's `true` when Quote Auto-Close is switched on in Omono, because Omono closes quotes by that date. Then creating a quote without `expectedAwardDate` fails with a `422` error and the code `missing-required-field`. So does a `PATCH` that clears a quote's `expectedAwardDate`, or that sends any field except `lineItems`, `lineItemOrder` and `externalRef` to a quote that has none.\n"
          },
          "autoClose": {
            "$ref": "#/components/schemas/SettingsQuoteAutoClose"
          }
        },
        "required": [
          "chaseByRequired",
          "expectedAwardDateRequired",
          "autoClose"
        ],
        "additionalProperties": true
      },
      "SettingsTaskAutomations": {
        "type": "object",
        "description": "The quote tasks Omono creates for you (the Task Automation card in Omono). They also run when you write quotes through the API, so a list of tasks can hold tasks your integration didn't create. They have `isAutomated: true`.\n",
        "properties": {
          "quoteChase": {
            "type": "boolean",
            "description": "Whether Omono creates a task to chase each quote on its `chaseBy` date, and moves or closes it when the date changes or the quote is won or lost."
          },
          "quoteAwardDate": {
            "type": "boolean",
            "description": "Whether Omono creates a task for each quote's `expectedAwardDate`, and moves or closes it in the same way."
          }
        },
        "required": [
          "quoteChase",
          "quoteAwardDate"
        ],
        "additionalProperties": true
      },
      "SettingsAddresses": {
        "type": "object",
        "description": "How Omono lays out addresses.",
        "properties": {
          "localPostalFormat": {
            "type": "boolean",
            "description": "Whether Omono prints each address in the local format of its country, for example with the postcode before the town (\"Address Format\" in the Internationalisation card, under Settings → App in Omono). When it's `false`, every address is printed in the UK order. The rules for each country are in [List all countries](#tag/tax-and-currency/GET/countries).\n"
          }
        },
        "required": [
          "localPostalFormat"
        ],
        "additionalProperties": true
      },
      "SettingsWorkingWeek": {
        "type": "object",
        "description": "The days of the week your organisation works (the Working Week card, under Settings → Company in Omono). A day is `true` when it's a working day. Your [closed days](#tag/organisation/GET/closed-days) are the dates it's closed on top of these. The dashboard counts a day towards a target only when it's a working day that isn't a closed day. An organisation that hasn't set its working week has every day `false`.\n",
        "properties": {
          "monday": {
            "type": "boolean",
            "description": "Whether Monday is a working day."
          },
          "tuesday": {
            "type": "boolean",
            "description": "Whether Tuesday is a working day."
          },
          "wednesday": {
            "type": "boolean",
            "description": "Whether Wednesday is a working day."
          },
          "thursday": {
            "type": "boolean",
            "description": "Whether Thursday is a working day."
          },
          "friday": {
            "type": "boolean",
            "description": "Whether Friday is a working day."
          },
          "saturday": {
            "type": "boolean",
            "description": "Whether Saturday is a working day."
          },
          "sunday": {
            "type": "boolean",
            "description": "Whether Sunday is a working day."
          }
        },
        "required": [
          "monday",
          "tuesday",
          "wednesday",
          "thursday",
          "friday",
          "saturday",
          "sunday"
        ],
        "additionalProperties": true
      },
      "SettingsXero": {
        "type": "object",
        "description": "Your organisation's connection to Xero, which your admins set up in Omono, under Settings → Connect.",
        "properties": {
          "connected": {
            "type": "boolean",
            "description": "Whether your organisation is connected to Xero. When it's `true`, each company you create or change through the API is queued to sync to Xero, as it is when staff save a company in Omono. Check it before a large first load of customers, so that you know whether they reach your accounting software too. It doesn't say whether the last sync worked.\n"
          }
        },
        "required": [
          "connected"
        ],
        "additionalProperties": true
      },
      "Settings": {
        "type": "object",
        "description": "The settings of your organisation that change what the API accepts or does. Your admins change them in Omono, under Settings → App and Settings → Company. You can't change them through the API.\n",
        "properties": {
          "unitPricing": {
            "$ref": "#/components/schemas/SettingsUnitPricing"
          },
          "salesOrders": {
            "$ref": "#/components/schemas/SettingsSalesOrders"
          },
          "quotes": {
            "$ref": "#/components/schemas/SettingsQuotes"
          },
          "taskAutomations": {
            "$ref": "#/components/schemas/SettingsTaskAutomations"
          },
          "addresses": {
            "$ref": "#/components/schemas/SettingsAddresses"
          },
          "workingWeek": {
            "$ref": "#/components/schemas/SettingsWorkingWeek"
          },
          "xero": {
            "$ref": "#/components/schemas/SettingsXero"
          }
        },
        "required": [
          "unitPricing",
          "salesOrders",
          "quotes",
          "taskAutomations",
          "addresses",
          "workingWeek",
          "xero"
        ],
        "additionalProperties": true
      },
      "ClosedDay": {
        "type": "object",
        "description": "A day your organisation is closed, such as a bank holiday. Your admins set closed days in Omono, under Settings → Company → Closed Days.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the closed day."
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "The date your organisation is closed, in the format `YYYY-MM-DD`. It's the date your admins chose in Omono, with no time and no time zone.\n"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why your organisation is closed that day, such as \"Christmas Day\", or `null` if no reason was given."
          },
          "updated": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the closed day was last changed."
          }
        },
        "required": [
          "id",
          "date",
          "reason",
          "updated"
        ],
        "additionalProperties": true
      },
      "ClosedDayList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The closed days on this page, sorted by date.",
                "items": {
                  "$ref": "#/components/schemas/ClosedDay"
                }
              }
            },
            "required": [
              "data"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "EventResource": {
        "description": "The kind of record an event is about, such as `sales_orders` or `contacts`.\n\nKnown values: `companies`, `contacts`, `addresses`, `quotes`, `quote_line_items`, `sales_orders`, `sales_order_line_items`, `dispatches`, `credit_notes`, `credit_note_line_items`, `purchase_orders`, `purchase_order_line_items`, `deliveries`, `stock_items`, `tasks`, `documents`. Omono can add values; handle one you don't recognise.\n",
        "type": "string",
        "x-known-values": [
          "companies",
          "contacts",
          "addresses",
          "quotes",
          "quote_line_items",
          "sales_orders",
          "sales_order_line_items",
          "dispatches",
          "credit_notes",
          "credit_note_line_items",
          "purchase_orders",
          "purchase_order_line_items",
          "deliveries",
          "stock_items",
          "tasks",
          "documents"
        ]
      },
      "KnownEventResource": {
        "description": "The kind of record an event is about, such as `sales_orders` or `contacts`.\n",
        "type": "string",
        "enum": [
          "companies",
          "contacts",
          "addresses",
          "quotes",
          "quote_line_items",
          "sales_orders",
          "sales_order_line_items",
          "dispatches",
          "credit_notes",
          "credit_note_line_items",
          "purchase_orders",
          "purchase_order_line_items",
          "deliveries",
          "stock_items",
          "tasks",
          "documents"
        ]
      },
      "Event": {
        "type": "object",
        "description": "An event records that a record in your organisation was deleted.\n",
        "required": [
          "id",
          "sequence",
          "resource",
          "resourceId",
          "parentId",
          "op",
          "at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the event. If you receive the same event twice, use it to ignore the repeat.\n"
          },
          "sequence": {
            "type": "integer",
            "description": "The event's position in your organisation's list of events. Sequence numbers always increase, but they have gaps, because events your API key can't read are left out.\n",
            "minimum": 1
          },
          "resource": {
            "$ref": "#/components/schemas/EventResource"
          },
          "resourceId": {
            "type": "string",
            "description": "The ID of the record that was deleted. For `tasks`, it can also be a task that someone made private in Omono, which comes back if it's made public again. So for a `tasks` event, retrieve the task first, and delete your copy only if that returns a `404` error. Learn more about [handling deletes](/docs/syncing#deletes).\n"
          },
          "parentId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the record that the deleted record belonged to. It's the sales order for `sales_order_line_items` and `dispatches`, the purchase order for `purchase_order_line_items` and `deliveries`, the credit note for `credit_note_line_items`, the quote for `quote_line_items`, and the company for `contacts` and `addresses`. It's `null` for every other resource.\n"
          },
          "op": {
            "description": "What happened to the record. Today it's always `deleted`. Act only on events whose `op` is `deleted`, and skip any other value. If Omono adds other kinds of event later, you'll get them only if you ask for them with the `op` filter, so the events you get without it never change.\n\nKnown values: `deleted`. Omono can add values; handle one you don't recognise.\n",
            "type": "string",
            "x-known-values": [
              "deleted"
            ]
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "The time the record was deleted."
          }
        },
        "additionalProperties": true
      },
      "EventList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "description": "The events on this page, oldest first.",
                "items": {
                  "$ref": "#/components/schemas/Event"
                }
              },
              "nextCursor": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The cursor for the next page, which you can send as `cursor` instead of sending `nextSince` as `since`. It's `null` when `hasMore` is `false`: to poll for new events later, send `nextSince` as `since`.\n"
              },
              "latestSequence": {
                "type": "integer",
                "description": "The sequence number of your organisation's latest event when the request ran. After an initial load, start from here.\n",
                "minimum": 0
              },
              "nextSince": {
                "type": "integer",
                "minimum": 0,
                "description": "The value to send as `since` on your next call. Omono has checked every event up to this sequence number, whatever its resource. One request checks at most 1,000 events and holds back events less than 10 seconds old, so a page can end early.\n"
              }
            },
            "required": [
              "data",
              "nextCursor",
              "latestSequence",
              "nextSince"
            ],
            "additionalProperties": true
          }
        ],
        "additionalProperties": true
      },
      "ApiKeySelf": {
        "type": "object",
        "description": "The API key that made the request: its name, scopes and expiry, its organisation, and the limits it runs under now. It never includes the key itself.\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the key. Your admins see it on the **API** page of **Settings**, next to the key's request log."
          },
          "name": {
            "type": "string",
            "description": "The key's name, as your admin gave it."
          },
          "last4": {
            "type": "string",
            "description": "The last 4 characters of the key, so you can tell your keys apart."
          },
          "organisationId": {
            "type": "string",
            "description": "The ID of the organisation the key belongs to."
          },
          "scopes": {
            "type": "array",
            "description": "The key's scopes, in alphabetical order. A write scope, such as `sales:write`, includes reading the same kind of record.",
            "items": {
              "type": "string"
            }
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the key expires, or `null` if it doesn't."
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "When the key was created."
          },
          "limits": {
            "type": "object",
            "description": "The rate limits this key runs under now, after any change Omono has made for your organisation. Learn more about [rate limits](/docs/limits).\n",
            "properties": {
              "perMinute": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "The key's requests a minute."
              },
              "perSecond": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "The key's requests a second (the burst limit)."
              },
              "inFlight": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "How many of the key's requests can run at the same time."
              },
              "writesPerMinute": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "The key's writes a minute."
              },
              "perDay": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "The key's requests a day, in UTC."
              },
              "organisationPerMinute": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "The requests a minute that all your organisation's keys share."
              }
            },
            "required": [
              "perMinute",
              "perSecond",
              "inFlight",
              "writesPerMinute",
              "perDay",
              "organisationPerMinute"
            ],
            "additionalProperties": true
          }
        },
        "required": [
          "id",
          "name",
          "last4",
          "organisationId",
          "scopes",
          "expiresAt",
          "created",
          "limits"
        ],
        "additionalProperties": true
      },
      "DashboardPeriodFigures": {
        "type": "object",
        "description": "The figures for a month or a financial year.\n",
        "properties": {
          "actual": {
            "type": "number",
            "description": "The amount so far in the period. It can be negative when the credit notes are worth more than the rest.\n"
          },
          "target": {
            "type": "number",
            "description": "The target for the whole period: the daily target that your settings give each month, added up over the period's working days that aren't closed days. If your organisation started using Omono during the period, it counts from that day.\n"
          },
          "pace": {
            "type": "number",
            "description": "The part of `target` up to and including today. When `actual` is at or above `pace`, you're on course to reach the target.\n"
          }
        },
        "required": [
          "actual",
          "target",
          "pace"
        ],
        "additionalProperties": true
      },
      "DashboardFigures": {
        "type": "object",
        "description": "One dashboard measure for today, this month and this financial year.\n",
        "properties": {
          "day": {
            "type": "object",
            "description": "Today's figures.",
            "properties": {
              "actual": {
                "type": "number",
                "description": "The amount for today. It can be negative when the credit notes are worth more than the rest.\n"
              },
              "target": {
                "type": "number",
                "description": "Today's target: this month's daily target from your settings when today is a working day that isn't a closed day, otherwise `0`.\n"
              }
            },
            "required": [
              "actual",
              "target"
            ],
            "additionalProperties": true
          },
          "month": {
            "$ref": "#/components/schemas/DashboardPeriodFigures",
            "description": "This calendar month's figures, from the first day of the month."
          },
          "year": {
            "$ref": "#/components/schemas/DashboardPeriodFigures",
            "description": "This financial year's figures, from its first day. The financial year runs on whole calendar days in UTC, as it does in Omono's dashboard, while today and the month use your organisation's time zone."
          }
        },
        "required": [
          "day",
          "month",
          "year"
        ],
        "additionalProperties": true
      },
      "Dashboard": {
        "type": "object",
        "description": "Your organisation's sales and output for today, this month and this financial year, against your targets: the figures on the dashboard in Omono. Every amount is net of tax and in your base currency, rounded to 2 decimal places, and covers your whole organisation.\n",
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "description": "The day the figures are for: today in your organisation's time zone, when Omono answered. The month is the month of this day.\n",
            "examples": [
              "2026-11-30"
            ]
          },
          "timeZone": {
            "type": "string",
            "description": "The time zone Omono used to decide what today and this month are: your organisation's time zone, as [Retrieve your organisation](#tag/organisation/GET/organisation) returns it. The dashboard in Omono uses the time zone of each person's browser, so near midnight the two can show different days.\n",
            "examples": [
              "Europe/London"
            ]
          },
          "financialYear": {
            "type": "string",
            "description": "The financial year the `year` figures are for, as Omono labels it: the year, such as `2026`, when your financial year matches the calendar year, otherwise the two years it spans, such as `2026/27`.\n",
            "examples": [
              "2026/27"
            ]
          },
          "currencyId": {
            "type": "string",
            "description": "The ID of your base currency, the currency of every amount. It's the `baseCurrencyId` of [Retrieve your organisation](#tag/organisation/GET/organisation).\n"
          },
          "sales": {
            "$ref": "#/components/schemas/DashboardFigures",
            "description": "What you sold, net of tax: the total of the sales orders created in each period that aren't cancelled, Draft orders included, as Omono's own dashboard counts them, less the complete credit notes created in it. An order counts in the period of the day it was created.\n"
          },
          "output": {
            "$ref": "#/components/schemas/DashboardFigures",
            "description": "What you delivered, net of tax: the total of the dispatches at your final workflow status whose dispatch date is in each period, less the complete credit notes created in it.\n"
          }
        },
        "required": [
          "date",
          "timeZone",
          "financialYear",
          "currencyId",
          "sales",
          "output"
        ],
        "additionalProperties": true
      }
    },
    "responses": {
      "BadRequest": {
        "description": "The request is malformed, and the error code is `malformed-request`. For example, the body isn't valid JSON, or the request uses a query parameter this operation doesn't accept, which `detail` names. A body nested more than 32 levels deep, a query parameter name with square brackets, a path that isn't valid percent-encoding, and an API key in the `X-Request-Id` header all get this error too. Fix the request before you send it again. Learn more about [status codes](/docs/errors#status-codes).\n",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-Client-Request-Id": {
            "$ref": "#/components/headers/XClientRequestId"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "RateLimit": {
            "$ref": "#/components/headers/RateLimit"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://api.omono.co/docs/errors/malformed-request",
              "code": "malformed-request",
              "title": "Malformed request",
              "status": 400,
              "detail": "Unknown query parameter: foo.",
              "requestId": "req_9Jc4TqX2mBv7RkLpW"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Omono couldn't authenticate the request, and the error code is `unauthenticated`. The API key is missing, malformed, unknown, expired or revoked. If Omono recognises the key, `detail` says why it was refused: it's a production or demo key sent to another platform's host, or it was revoked or expired on a given date. A key sent in a URL is revoked at once. Learn more about [authentication](/docs/getting-started#authentication).\n",
        "headers": {
          "WWW-Authenticate": {
            "description": "The authentication scheme the API expects, which is always `Bearer`.\n",
            "schema": {
              "type": "string"
            }
          },
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-Client-Request-Id": {
            "$ref": "#/components/headers/XClientRequestId"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "examples": {
              "generic": {
                "summary": "Missing, malformed or unknown key",
                "value": {
                  "type": "https://api.omono.co/docs/errors/unauthenticated",
                  "code": "unauthenticated",
                  "title": "Unauthenticated",
                  "status": 401,
                  "detail": "The API key is missing, invalid, expired, or revoked.",
                  "requestId": "req_9Jc4TqX2mBv7RkLpW"
                }
              },
              "wrongPlatform": {
                "summary": "A key for another platform",
                "value": {
                  "type": "https://api.omono.co/docs/errors/unauthenticated",
                  "code": "unauthenticated",
                  "title": "Unauthenticated",
                  "status": 401,
                  "detail": "This is a demo-platform key (omk_demo_); send it to https://api-demo.omono.co.",
                  "requestId": "req_9Jc4TqX2mBv7RkLpW"
                }
              },
              "revoked": {
                "summary": "A revoked key",
                "value": {
                  "type": "https://api.omono.co/docs/errors/unauthenticated",
                  "code": "unauthenticated",
                  "title": "Unauthenticated",
                  "status": 401,
                  "detail": "This API key was revoked on 2026-09-21.",
                  "requestId": "req_9Jc4TqX2mBv7RkLpW"
                }
              },
              "revokedExposedInUrl": {
                "summary": "A key revoked because it was sent in a URL",
                "value": {
                  "type": "https://api.omono.co/docs/errors/unauthenticated",
                  "code": "unauthenticated",
                  "title": "Unauthenticated",
                  "status": 401,
                  "detail": "This API key was revoked automatically on 2026-09-21 because it was sent in a URL. Create a new key and send it only in the Authorization header.",
                  "requestId": "req_9Jc4TqX2mBv7RkLpW"
                }
              },
              "expired": {
                "summary": "An expired key",
                "value": {
                  "type": "https://api.omono.co/docs/errors/unauthenticated",
                  "code": "unauthenticated",
                  "title": "Unauthenticated",
                  "status": 401,
                  "detail": "This API key expired on 2026-09-01.",
                  "requestId": "req_9Jc4TqX2mBv7RkLpW"
                }
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "Your API key isn't allowed to make this request. If the key doesn't have the scope this operation needs, the error code is `insufficient-scope`. An admin can add the scope to the key on Settings → API, and the key has it from its next request.\n\nIf API access isn't switched on for your organisation, the error code is `api-access-disabled`, and `detail` says why: Omono hasn't switched the API on yet, an admin has switched it off, or Omono has suspended it. A change to API access takes effect within 30 seconds. Learn more about [access](/docs/getting-started#access).\n",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-Client-Request-Id": {
            "$ref": "#/components/headers/XClientRequestId"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "RateLimit": {
            "$ref": "#/components/headers/RateLimit"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "examples": {
              "insufficientScope": {
                "summary": "The key lacks the scope",
                "value": {
                  "type": "https://api.omono.co/docs/errors/insufficient-scope",
                  "title": "Insufficient scope",
                  "status": 403,
                  "code": "insufficient-scope",
                  "detail": "This operation requires the scope: sales:write.",
                  "requestId": "req_9Jc4TqX2mBv7RkLpW"
                }
              },
              "apiAccessNotSwitchedOn": {
                "summary": "API access not yet switched on by Omono",
                "value": {
                  "type": "https://api.omono.co/docs/errors/api-access-disabled",
                  "title": "API access disabled",
                  "status": 403,
                  "code": "api-access-disabled",
                  "detail": "The Omono API is switched on by request. Ask Omono through the in-app chat to switch it on for your organisation.",
                  "requestId": "req_9Jc4TqX2mBv7RkLpW"
                }
              },
              "apiAccessDisabled": {
                "summary": "API access switched off by your admin",
                "value": {
                  "type": "https://api.omono.co/docs/errors/api-access-disabled",
                  "title": "API access disabled",
                  "status": 403,
                  "code": "api-access-disabled",
                  "detail": "An administrator of your organisation has switched API access off (Settings → API).",
                  "requestId": "req_9Jc4TqX2mBv7RkLpW"
                }
              },
              "apiAccessSuspended": {
                "summary": "API access suspended by Omono",
                "value": {
                  "type": "https://api.omono.co/docs/errors/api-access-disabled",
                  "title": "API access disabled",
                  "status": 403,
                  "code": "api-access-disabled",
                  "detail": "API access for this organisation is suspended by Omono.",
                  "requestId": "req_9Jc4TqX2mBv7RkLpW"
                }
              }
            }
          }
        }
      },
      "Conflict": {
        "description": "The request conflicts with the current state of the record, and `code` says how. If a line item is at fault, `errors[].field` names it. If the document had already been changed, the body includes `appliedLineItems`, which lists the line items that changed (the lists can be empty when only the document's other fields changed). Learn more about [the codes to handle](/docs/errors#the-codes-to-handle).\n",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          },
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-Client-Request-Id": {
            "$ref": "#/components/headers/XClientRequestId"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "RateLimit": {
            "$ref": "#/components/headers/RateLimit"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://api.omono.co/docs/errors/dispatch-not-fully-picked",
              "title": "Dispatch not fully picked",
              "status": 409,
              "code": "dispatch-not-fully-picked",
              "detail": "The dispatch is not fully picked yet, so it cannot move to the final status. Staff finish the picking in Omono and save it.",
              "requestId": "req_9Jc4TqX2mBv7RkLpW"
            }
          }
        }
      },
      "UnprocessableEntity": {
        "description": "The request is well formed, but some of its values aren't valid. The error code says what kind of problem it is, and `errors[]` names the field at fault, with a message that explains the problem. A required field you left out gets the code `missing-required-field`, a value that isn't valid gets `validation-failed`, and an ID you can't use gets `invalid-reference`. If a write includes a field the resource doesn't accept, the error code is `unknown-field`. Omono usually reports only the first problem it finds, so once you fix it, your next attempt can name another field. A `missing-required-field` error is different: it lists every missing field that Omono found at that stage, as [Errors](/docs/errors) explains. Fix the data before you send it again, because the same request will fail again.\n",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-Client-Request-Id": {
            "$ref": "#/components/headers/XClientRequestId"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "RateLimit": {
            "$ref": "#/components/headers/RateLimit"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://api.omono.co/docs/errors/missing-required-field",
              "title": "Missing required field",
              "status": 422,
              "code": "missing-required-field",
              "detail": "chaseBy: your organisation requires a chase-by date.",
              "requestId": "req_9Jc4TqX2mBv7RkLpW",
              "errors": [
                {
                  "field": "chaseBy",
                  "message": "your organisation requires a chase-by date"
                }
              ]
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "You've sent too many requests, and the error code is `rate-limited`. Wait for the number of seconds in `Retry-After`, then retry. If you keep getting this error, back off exponentially, with some randomness. The `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` headers describe the limit that refused the request. Learn more about [rate limits](/docs/limits#the-limits).\n",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "RateLimit": {
            "$ref": "#/components/headers/RateLimit"
          },
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-Client-Request-Id": {
            "$ref": "#/components/headers/XClientRequestId"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://api.omono.co/docs/errors/rate-limited",
              "code": "rate-limited",
              "title": "Rate limited",
              "status": 429,
              "detail": "The per-key sustained limit (120/minute) was exceeded.",
              "requestId": "req_9Jc4TqX2mBv7RkLpW"
            }
          }
        }
      },
      "InternalError": {
        "description": "Something went wrong on Omono's side, and the error code is `internal-error`. Quote the `requestId` when you contact support. What to do next depends on the request, so read [what to do after a 500 error](/docs/errors#after-a-500) before you retry.\n",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-Client-Request-Id": {
            "$ref": "#/components/headers/XClientRequestId"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "RateLimit": {
            "$ref": "#/components/headers/RateLimit"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://api.omono.co/docs/errors/internal-error",
              "code": "internal-error",
              "title": "Internal error",
              "status": 500,
              "detail": "The server could not complete the request. Quote the requestId when reporting it.",
              "requestId": "req_9Jc4TqX2mBv7RkLpW"
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "Omono can't complete the request right now. If the error code is `temporarily-unavailable`, the request didn't change your data. If `detail` says that the ETag changed, read the record again and use its new `ETag` when you retry. If the error code is `request-timeout`, the request took longer than 15 seconds, or one read of your data took longer than 10 seconds, and a write may still complete. In both cases, wait for the number of seconds in `Retry-After`, then retry with the same `Idempotency-Key`.\n\nLearn more about [timeouts](/docs/limits#timeouts) and [responses from the network edge](/docs/errors#responses-from-the-network-edge).\n",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          },
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-Client-Request-Id": {
            "$ref": "#/components/headers/XClientRequestId"
          },
          "RateLimit-Limit": {
            "description": "The number of requests allowed in the rate-limit window that has the fewest requests left, as `RateLimit-Limit` on other responses describes. It's sent on a `503` error that comes after Omono has checked your key, for example when the platform's overall request budget is used up or the request timed out. It isn't sent on a `503` error that comes before that, such as while Omono is being updated or the platform is switched off.\n",
            "schema": {
              "type": "integer"
            }
          },
          "RateLimit-Remaining": {
            "description": "The number of requests you have left in the window that `RateLimit-Limit` describes. It's sent on a `503` error that comes after Omono has checked your key, for example when the platform's overall request budget is used up or the request timed out. It isn't sent on a `503` error that comes before that, such as while Omono is being updated or the platform is switched off.\n",
            "schema": {
              "type": "integer"
            }
          },
          "RateLimit-Reset": {
            "description": "The number of seconds until the window that `RateLimit-Limit` describes starts again. It's sent on a `503` error that comes after Omono has checked your key, for example when the platform's overall request budget is used up or the request timed out. It isn't sent on a `503` error that comes before that, such as while Omono is being updated or the platform is switched off.\n",
            "schema": {
              "type": "integer"
            }
          },
          "RateLimit-Policy": {
            "description": "Every rate-limit window of your key and your organisation that applies to this request, in the same syntax as `RateLimit-Policy` on other responses (`\"<name>\";q=<limit>;w=<window in seconds>`). It's sent with the other `RateLimit-*` headers. The platform's overall request budget is never in it.\n",
            "schema": {
              "type": "string"
            }
          },
          "RateLimit": {
            "description": "The requests you have left in every rate-limit window of your key and your organisation that applies to this request, in the same syntax as `RateLimit` on other responses (`\"<name>\";a=<requests left>;w=<seconds>`). It's sent with the other `RateLimit-*` headers. The platform's overall request budget is never in it, so a `503` error caused by that budget leaves every item as it was; wait for `Retry-After`.\n",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "examples": {
              "draining": {
                "summary": "Deploy drain",
                "value": {
                  "type": "https://api.omono.co/docs/errors/temporarily-unavailable",
                  "code": "temporarily-unavailable",
                  "title": "Temporarily unavailable",
                  "status": 503,
                  "detail": "The API is draining for a deployment. Retry after the indicated delay.",
                  "requestId": "req_9Jc4TqX2mBv7RkLpW"
                }
              },
              "requestTimeout": {
                "summary": "The request did not finish within 15 seconds",
                "value": {
                  "type": "https://api.omono.co/docs/errors/request-timeout",
                  "code": "request-timeout",
                  "title": "Request timed out",
                  "status": 503,
                  "detail": "The request did not finish within 15 seconds; a write may still complete. Retry with the same Idempotency-Key, or re-read first.",
                  "requestId": "req_9Jc4TqX2mBv7RkLpW"
                }
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "No record with that ID exists in your organisation, or your key can't see it, and the error code is `not-found`. An unknown ID in the request body, including a `dispatchId` when you move a dispatch, gives a `422` error with the code `invalid-reference` instead.\n\nOn a create, this error means the new record was deleted before the response was sent, for example because someone deleted the new Draft in Omono.\n\nA path that the API doesn't have, for example one with a typo, other capitals or a trailing slash, gives a `404` error with the code `route-not-found` instead. That code says nothing about any record.\n",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-Client-Request-Id": {
            "$ref": "#/components/headers/XClientRequestId"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "RateLimit": {
            "$ref": "#/components/headers/RateLimit"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://api.omono.co/docs/errors/not-found",
              "code": "not-found",
              "title": "Not found",
              "status": 404,
              "detail": "No resource with that id.",
              "requestId": "req_9Jc4TqX2mBv7RkLpW"
            }
          }
        }
      },
      "PayloadTooLarge": {
        "description": "The request body is too large, and the error code is `payload-too-large`. A JSON body can be up to 1 MB, measured after Omono decompresses it, and an upload up to 20 MB. Nothing was stored.\n",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-Client-Request-Id": {
            "$ref": "#/components/headers/XClientRequestId"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "RateLimit": {
            "$ref": "#/components/headers/RateLimit"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://api.omono.co/docs/errors/payload-too-large",
              "code": "payload-too-large",
              "title": "Payload too large",
              "status": 413,
              "detail": "The JSON body exceeds 1 MB.",
              "requestId": "req_9Jc4TqX2mBv7RkLpW"
            }
          }
        }
      },
      "UnsupportedMediaType": {
        "description": "The request body is in a format the API doesn't accept, and the error code is `unsupported-media-type`. Send JSON bodies as `application/json` in UTF-8, and uploads as `multipart/form-data`. You can compress a JSON body with `gzip`, `deflate` or `br`, but any other `Content-Encoding`, or any `Content-Encoding` on an upload, gets this error too. `detail` says what to change.\n",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-Client-Request-Id": {
            "$ref": "#/components/headers/XClientRequestId"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "RateLimit": {
            "$ref": "#/components/headers/RateLimit"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://api.omono.co/docs/errors/unsupported-media-type",
              "code": "unsupported-media-type",
              "title": "Unsupported media type",
              "status": 415,
              "detail": "Send the body as application/json.",
              "requestId": "req_9Jc4TqX2mBv7RkLpW"
            }
          }
        }
      },
      "NotModified": {
        "description": "The record hasn't changed since the `ETag` you sent in `If-None-Match`. The response has no body: use the copy you already have.\n",
        "headers": {
          "ETag": {
            "$ref": "#/components/headers/ETag"
          },
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-Client-Request-Id": {
            "$ref": "#/components/headers/XClientRequestId"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "RateLimit": {
            "$ref": "#/components/headers/RateLimit"
          }
        }
      },
      "PreconditionFailed": {
        "description": "The record has changed since you read it, so your `If-Match` header doesn't match its current `ETag`, and the error code is `precondition-failed`. You also get this error, even though the record hasn't changed, if you send a weak ETag, which starts with `W/`, or an ETag without its double quotes. Nothing was written. Read the record again, apply your change again, and retry with the new `ETag`. Learn more about [ETags](/docs/writing#etags).\n",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-Client-Request-Id": {
            "$ref": "#/components/headers/XClientRequestId"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "RateLimit": {
            "$ref": "#/components/headers/RateLimit"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://api.omono.co/docs/errors/precondition-failed",
              "code": "precondition-failed",
              "title": "Precondition failed",
              "status": 412,
              "detail": "The resource has changed since the ETag you sent. Re-read it and retry.",
              "requestId": "req_9Jc4TqX2mBv7RkLpW"
            }
          }
        }
      },
      "PreconditionRequired": {
        "description": "A `DELETE`, or a `PATCH` that changes line items or their order, was sent without an `If-Match` header, and the error code is `precondition-required`. Read the record, then send the request again with its `ETag` in `If-Match`. For a dispatch or a delivery, send the `ETag` of its sales order or purchase order.\n",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-Client-Request-Id": {
            "$ref": "#/components/headers/XClientRequestId"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "RateLimit": {
            "$ref": "#/components/headers/RateLimit"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://api.omono.co/docs/errors/precondition-required",
              "code": "precondition-required",
              "title": "Precondition required",
              "status": 428,
              "detail": "A PATCH that carries lineItems must send If-Match.",
              "requestId": "req_9Jc4TqX2mBv7RkLpW"
            }
          }
        }
      },
      "Pdf": {
        "description": "Returns the PDF, as Omono's **Print** and **Download** buttons create it. The body is the PDF file itself, not JSON. Save it, or pass it on, as it is.\n",
        "headers": {
          "Content-Disposition": {
            "description": "`attachment`, with the file name Omono gives the document, such as `INV-1042.pdf` or `SQ-1003-A.pdf`. The name uses only letters, digits, hyphens, underscores and dots.\n",
            "schema": {
              "type": "string"
            },
            "example": "attachment; filename=\"INV-1042.pdf\""
          },
          "Cache-Control": {
            "description": "Always `no-store`. A PDF shows the company, your settings and your logo as they are when you ask for it, so don't cache it in place of asking again.\n",
            "schema": {
              "type": "string"
            },
            "example": "no-store"
          },
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-Client-Request-Id": {
            "$ref": "#/components/headers/XClientRequestId"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "RateLimit": {
            "$ref": "#/components/headers/RateLimit"
          }
        },
        "content": {
          "application/pdf": {
            "schema": {
              "type": "string",
              "format": "binary"
            }
          }
        }
      },
      "Gone": {
        "description": "Your `since` value is too old, or it doesn't belong to your organisation's current event feed, for example because it comes from before a sandbox reset. The error code is `events-expired`. Events are kept for 30 days. Load all your data again, then continue with `since` set to the `latestSequence` in this response. Learn more about [deletes](/docs/syncing#deletes).\n",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-Client-Request-Id": {
            "$ref": "#/components/headers/XClientRequestId"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "RateLimit": {
            "$ref": "#/components/headers/RateLimit"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "example": {
              "type": "https://api.omono.co/docs/errors/events-expired",
              "title": "Events expired",
              "status": 410,
              "code": "events-expired",
              "detail": "Events older than 30 days are not retained. Run a full crawl, then resume from latestSequence.",
              "requestId": "req_9Jc4TqX2mBv7RkLpW",
              "latestSequence": 1042
            }
          }
        }
      }
    }
  },
  "x-tagGroups": [
    {
      "name": "Core resources",
      "tags": [
        "Companies",
        "Contacts",
        "Addresses",
        "Customer prices",
        "Quotes",
        "Sales orders",
        "Dispatches",
        "Credit notes",
        "Purchase orders",
        "Deliveries",
        "Stock items",
        "Tasks",
        "Notes",
        "Documents",
        "Events",
        "Dashboard",
        "API key"
      ]
    },
    {
      "name": "Reference data",
      "tags": [
        "Organisation",
        "Tax and currency",
        "Sales settings",
        "Purchasing and shipping",
        "Task settings"
      ]
    }
  ]
}
