{
  "openapi": "3.1.0",
  "info": {
    "title": "Launch Day Labs API",
    "version": "1.0.0",
    "description": "Makes barcode images from data, and checks barcode data before anything is drawn.\n\nGS1 data is checked against GS1 format rules (identifiers, lengths, characters, dates and check digits). The service cannot tell whether a number was really issued to you by GS1.\n\n**Keys.** Every address except `GET /types` needs an API key, sent as the header `Authorization: Bearer` followed by the key. The keys of an account made by signing up work once its email address is confirmed; until then the answer is 403 `email_not_confirmed`.\n\n**Request bodies.** A POST body is a JSON object sent with `Content-Type: application/json`. A top-level field the address does not know is refused (`unknown_field`), so a typo is never ignored silently. A body over the size limit is answered with 413 and the header `Connection: close`; the server reads and throws away up to 8 MiB of the extra first, so the client still gets the answer.\n\n**Errors.** Every error is `{ \"error\": { \"code\", \"message\" } }`. The message is one plain sentence. Extra facts (`checks`, `usage`) sit beside `error`, never inside it. Any address can also answer 400 `bad_request` (a request that could not be read at all; when the fault is in the first line or the headers, the connection is closed after the answer), 404 `not_found` (no such address), 405 `method_not_allowed` (with an `Allow` header) and 500 `server_error`.\n\n**Counting.** Only barcodes that are made count against the month's allowance. Checking data (`/validate`, `/gs1/build`), the product register (`/products`) and failed requests are not counted. Months are UTC.\n\n**Plans.** The numbers each plan sets (barcodes a month, file formats, batches, request rate, products, and the price) are not written in this file. `GET /types` returns the live plan table. Plans are bought, changed and cancelled by the signed-in person on the app's Plan page, through the payment service's own pages, not through this API; the account's plan, and so what its keys may do, follows the subscription.\n\n**Headers on every answer.** `Cache-Control: no-store`, `X-Content-Type-Options: nosniff`, `Referrer-Policy: no-referrer`, `X-Frame-Options: DENY` and a `Content-Security-Policy` that allows nothing. There are no CORS headers: the API is called from servers, not from web pages."
  },
  "servers": [
    {
      "url": "https://api.launchdaylabs.com/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Info",
      "description": "What the service makes and how much of the month's allowance is used."
    },
    {
      "name": "Check data",
      "description": "Answers about barcode data. Nothing is drawn and nothing is counted."
    },
    {
      "name": "Make barcodes",
      "description": "Calls that draw images and count against the month's allowance."
    },
    {
      "name": "Products",
      "description": "The account's product register: names, SKUs and product numbers. Nothing here is counted against the month's allowance; each call takes one place in the key's request rate limit."
    }
  ],
  "paths": {
    "/types": {
      "get": {
        "operationId": "listTypes",
        "tags": [
          "Info"
        ],
        "summary": "List barcode types, plans and limits",
        "description": "Needs no API key. Lists every barcode type with the formats and options it takes, the live plan table, and the request size limits.",
        "security": [],
        "responses": {
          "200": {
            "description": "The types, the plans and the limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TypesAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Unreadable"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/usage": {
      "get": {
        "operationId": "getUsage",
        "tags": [
          "Info"
        ],
        "summary": "This month's usage for the account",
        "description": "How many barcodes the account has made this month (UTC), what its plan allows, and when the count starts again. The count belongs to the account, not to one key.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The account's plan and usage.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Unreadable"
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "$ref": "#/components/responses/EmailNotConfirmed"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/validate": {
      "post": {
        "operationId": "validateData",
        "tags": [
          "Check data"
        ],
        "summary": "Check data for a barcode type without drawing it",
        "description": "Reports the same data errors as `POST /barcodes`. Data that is wrong still gets a 200: the call worked and the answer is `ok: false`. Not counted against the month's allowance.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateRequest"
              },
              "example": {
                "type": "ean13",
                "data": "400638133393"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The result of the check.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateAnswer"
                },
                "example": {
                  "ok": true,
                  "data": "4006381333931",
                  "checks": [
                    {
                      "level": "warning",
                      "code": "check_digit_added",
                      "message": "The check digit 1 was added, making the full number 4006381333931."
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadBody"
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "$ref": "#/components/responses/EmailNotConfirmed"
          },
          "413": {
            "$ref": "#/components/responses/BodyTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/JsonRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/gs1/build": {
      "post": {
        "operationId": "buildGs1Data",
        "tags": [
          "Check data"
        ],
        "summary": "Write GS1 data from named fields",
        "description": "Turns named fields (product number, dates, lot and so on) into GS1-128 bracket data or a GS1 Digital Link web address, ready to send to `POST /barcodes`. The fields are checked against GS1 format rules. Fields that are wrong still get a 200, with `ok: false` and `data: null`. Not counted against the month's allowance.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BuildRequest"
              },
              "example": {
                "kind": "gs1-128",
                "fields": {
                  "gtin": "10036000291459",
                  "expiry": "2027-03-31",
                  "lot": "A1B2"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The data that was built, or the reasons it could not be.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BuildAnswer"
                },
                "example": {
                  "ok": true,
                  "data": "(01)10036000291459(17)270331(10)A1B2",
                  "checks": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadBody"
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "$ref": "#/components/responses/EmailNotConfirmed"
          },
          "413": {
            "$ref": "#/components/responses/BodyTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/JsonRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/barcodes": {
      "post": {
        "operationId": "makeBarcode",
        "tags": [
          "Make barcodes"
        ],
        "summary": "Make one barcode",
        "description": "Checks the data and draws one barcode. A barcode that is made counts as one against the month's allowance; a request that fails counts as nothing.\n\n**Two forms of answer.** By default the answer is JSON: the image (base64 for PNG and PDF, plain text for SVG and EPS) with the checks and the facts about the printed size. To get the file itself, send an `Accept` header that lists the image's own type (`image/png`, `image/svg+xml`, `application/pdf` or `application/postscript`) and does not list `application/json`. `Accept: */*`, no `Accept` header, or the type of a different format all get JSON. Errors are always JSON.\n\nThe file answer carries the size in the `Barcode-Width-Mm` and `Barcode-Height-Mm` headers, and the codes of any warnings in `Barcode-Warnings`. The warning messages are only in the JSON form.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Accept",
            "in": "header",
            "required": false,
            "description": "List the image's own type, and not `application/json`, to get the file itself instead of JSON.",
            "schema": {
              "type": "string"
            },
            "example": "image/png"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BarcodeRequest"
              },
              "example": {
                "type": "upca",
                "data": "036000291452",
                "format": "svg"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The barcode was made. JSON by default; the file itself when `Accept` asks for the image's type. The headers below are sent only with the file form.",
            "headers": {
              "Content-Disposition": {
                "description": "File form only. `inline`, with a file name made of the type and the format, such as `upca.png`.",
                "schema": {
                  "type": "string"
                },
                "example": "inline; filename=\"upca.png\""
              },
              "Barcode-Width-Mm": {
                "description": "File form only. The width of the whole image in millimetres, quiet zones included.",
                "schema": {
                  "type": "string"
                },
                "example": "37.29"
              },
              "Barcode-Height-Mm": {
                "description": "File form only. The height of the whole image in millimetres.",
                "schema": {
                  "type": "string"
                },
                "example": "25.94"
              },
              "Barcode-Warnings": {
                "description": "File form only, and only when there are warnings. The codes of the warnings, joined by a comma and a space. A barcode can carry several.",
                "schema": {
                  "type": "string"
                },
                "example": "magnification_low, quiet_zone_off"
              },
              "Barcode-Saved-Id": {
                "description": "File form only, and only with `product_id`: the id of the saved barcode on that product, as `saved.barcode_id` gives it in the JSON form.",
                "schema": {
                  "type": "string",
                  "pattern": "^[0-9]{1,15}$"
                },
                "example": "3"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Made"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/svg+xml": {
                "schema": {
                  "type": "string"
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/postscript": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "The request could not be used: `bad_json`, `bad_body` (the body is not a JSON object), `unknown_field`, `bad_field` (`product_id` is not a whole number from 1 up), or `bad_request`. Nothing was made or counted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "$ref": "#/components/responses/FormatOrEmail"
          },
          "404": {
            "$ref": "#/components/responses/ProductNotFound"
          },
          "409": {
            "$ref": "#/components/responses/TooManySaved"
          },
          "413": {
            "$ref": "#/components/responses/BodyTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/JsonRequired"
          },
          "422": {
            "description": "The data or the options are wrong, so no barcode was made and nothing was counted. `error` is the first error the engine found, and `checks` holds all of them. The codes are the engine's check codes (see the README table).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "bad_length",
                    "message": "A UPC-A number has 11 or 12 digits; this one has 1."
                  },
                  "checks": [
                    {
                      "level": "error",
                      "code": "bad_length",
                      "message": "A UPC-A number has 11 or 12 digits; this one has 1."
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateOrMonthlyLimit"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "501": {
            "$ref": "#/components/responses/NotAvailableYet"
          }
        }
      }
    },
    "/barcodes/pair": {
      "post": {
        "operationId": "makeRetailPair",
        "tags": [
          "Make barcodes"
        ],
        "summary": "Make a retail pair: a UPC-A or EAN-13 and a QR code for the same product",
        "description": "From one product number (12 digits for UPC-A, 13 for EAN-13) and your website's address, draws the retail barcode and a GS1 Digital Link QR code that points to the same product. Counts as two against the month's allowance, both or neither: if the allowance has room for only one, nothing is made. The answer is always JSON.\n\n`format` goes to both barcodes. `options` go to the retail barcode; the QR code gets only the ones its type takes, and keeps its default size.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PairRequest"
              },
              "example": {
                "gtin": "036000291452",
                "base_url": "https://example.com",
                "format": "png"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Both barcodes were made.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PairAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadBody"
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "$ref": "#/components/responses/FormatOrEmail"
          },
          "413": {
            "$ref": "#/components/responses/BodyTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/JsonRequired"
          },
          "422": {
            "description": "The pair could not be made, and nothing was counted. `error` is the first error found, looking in `checks`, then `linear_checks`, then `qr_checks`. `checks` holds the errors about the request as a whole. `linear_checks` and `qr_checks` hold each barcode's own checks; both are null when the request as a whole was wrong and neither barcode was tried.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "bad_length",
                    "message": "A GTIN number has 12 or 13 digits; this one has 1."
                  },
                  "checks": [
                    {
                      "level": "error",
                      "code": "bad_length",
                      "message": "A GTIN number has 12 or 13 digits; this one has 1."
                    }
                  ],
                  "linear_checks": null,
                  "qr_checks": null
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateOrMonthlyLimit"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "501": {
            "$ref": "#/components/responses/NotAvailableYet"
          }
        }
      }
    },
    "/barcodes/batch": {
      "post": {
        "operationId": "makeBatch",
        "tags": [
          "Make barcodes"
        ],
        "summary": "Make many barcodes in one request",
        "description": "Only on plans whose `batch` is true in the plan table (`GET /types`). `items` is a list of barcode requests, each shaped like the body of `POST /barcodes`; the most a batch may hold is `limits.batch_max_items` from `GET /types`.\n\nItems are made one at a time, in order. An item that cannot be made fails alone and the others are still made, so a batch answers 200 even when some or all items failed: read `made`, `failed` and each result's `ok`. Only made items count against the month's allowance. A whole batch uses one place in the request rate limit.\n\nAn account has one batch being made at a time; a second one sent meanwhile gets 429 `batch_in_progress`. The request body may be larger than on other addresses (`limits.batch_body_max_bytes`). One answer carries at most 20 MiB of image data: once that much has been made, the remaining items fail with `batch_output_too_large` and are not counted. If the server is restarted while a batch is being made, the items it had not reached fail with `server_stopping` and are not counted; send those again. The answer is always JSON.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchRequest"
              },
              "example": {
                "items": [
                  {
                    "type": "upca",
                    "data": "036000291452",
                    "format": "svg"
                  },
                  {
                    "type": "qr",
                    "data": "https://example.com",
                    "format": "png"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The batch was worked through. Some items may have failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchAnswer"
                }
              }
            }
          },
          "400": {
            "description": "The request could not be used: `bad_json`, `bad_body` (the body is not a JSON object), `unknown_field` (a top-level field other than `items`), `bad_batch` (`items` is not a list, is empty, or holds too many), or `bad_request`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "description": "`plan_required`: the account's plan does not include batches. Or `email_not_confirmed`: the key belongs to an account made by signing up whose email address is not confirmed yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/BodyTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/JsonRequired"
          },
          "429": {
            "description": "`rate_limited`: too many requests from this key in a short time; `Retry-After` says how many seconds to wait. Or `batch_in_progress`: the account already has a batch being made (no `Retry-After`).",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/products": {
      "get": {
        "operationId": "listProducts",
        "tags": [
          "Products"
        ],
        "summary": "List the account's products",
        "description": "Newest first, one page at a time. `q` finds part of a name, SKU or product number (a whole number also finds the same number written with more or fewer leading zeros); `status` and `level` filter. When `next` is not null, pass it as `after` to get the following page. `count` is about the whole register, whatever the filters: `counted` (products that are not retired, the ones the plan's limit counts), `retired`, `total`, `limit` (the plan's most products that are not retired) and `total_limit` (the most products the account keeps, counting retired ones).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, SKU or product number.",
            "schema": {
              "type": "string"
            },
            "example": "honey"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/ProductStatus"
            }
          },
          {
            "name": "level",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/ProductLevel"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Products on one page, 1 to 200. The default is 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "description": "The `next` value from the page before.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of products, and the counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductList"
                },
                "example": {
                  "products": [
                    {
                      "id": 12,
                      "name": "Honey 12 oz",
                      "sku": "HNY-12",
                      "gtin": "036000291452",
                      "level": "each",
                      "contains_qty": null,
                      "contains_id": null,
                      "status": "active",
                      "notes": null,
                      "created_at": "2026-11-27T10:00:00.000Z",
                      "updated_at": "2026-11-27T10:00:00.000Z"
                    }
                  ],
                  "next": null,
                  "count": {
                    "counted": 1,
                    "retired": 0,
                    "total": 1,
                    "limit": 5,
                    "total_limit": 25
                  }
                }
              }
            }
          },
          "400": {
            "description": "`bad_field`: `limit`, `after`, `status` or `level` is not one the address takes; the message names it. Or `bad_request`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "$ref": "#/components/responses/EmailNotConfirmed"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "post": {
        "operationId": "addProduct",
        "tags": [
          "Products"
        ],
        "summary": "Add a product",
        "description": "Only `name` is needed. A product with a number is `active` unless `status` says otherwise; one without a number is a `draft`, and only a draft may have no number. The number is checked against GS1 format rules and must be whole, check digit included; spaces and dashes are dropped. The service cannot tell whether a number was really issued to you by GS1. One number is held by one product of the account at most, however it is written (`036000291452` and `00036000291452` are the same number).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductInput"
              },
              "example": {
                "name": "Honey 12 oz",
                "sku": "HNY-12",
                "gtin": "036000291452"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The product was added.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ProductProblem"
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "$ref": "#/components/responses/ProductLimit"
          },
          "404": {
            "$ref": "#/components/responses/ProductNotFound"
          },
          "409": {
            "$ref": "#/components/responses/DuplicateNumber"
          },
          "413": {
            "$ref": "#/components/responses/BodyTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/JsonRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/products/export.csv": {
      "get": {
        "operationId": "exportProducts",
        "tags": [
          "Products"
        ],
        "summary": "Download the register as a CSV file",
        "description": "Every product, oldest first, as a CSV file that opens in a spreadsheet: a byte-order mark first (so Excel reads it as UTF-8), commas between cells and CRLF after every row. The first line is the header `name, sku, number, level, quantity, holds_number, status, notes`; `quantity` is `contains_qty`, and `holds_number` is the product number of the product this one holds (empty when it holds nothing, or when that product has no number). Numbers are written as plain digits, leading zeros included; Excel drops leading zeros when it opens a CSV file directly, so open the file through Excel's \"From Text/CSV\" with the number columns set to Text. A cell that starts with `=`, `+`, `-`, `@`, a tab, a carriage return or an apostrophe gets an apostrophe in front, so a spreadsheet does not run it as a formula; the import takes that apostrophe off again. On every plan. Not counted against the month's barcodes.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The CSV file.",
            "headers": {
              "Content-Disposition": {
                "description": "`attachment`, with the file name `products-<YYYY-MM-DD>.csv`, the UTC day of the request.",
                "schema": {
                  "type": "string"
                },
                "example": "attachment; filename=\"products-2026-11-27.csv\""
              }
            },
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                },
                "example": "name,sku,number,level,quantity,holds_number,status,notes\r\nHoney 12 oz,HNY-12,036000291452,each,,,active,\r\n\"Honey 12 oz, case of 12\",,10036000291459,case,12,036000291452,active,\r\n"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "$ref": "#/components/responses/EmailNotConfirmed"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/products/import/preview": {
      "post": {
        "operationId": "previewImport",
        "tags": [
          "Products"
        ],
        "summary": "Check a CSV file of products, saving nothing",
        "description": "Reads the file and checks every row with the same rules as `POST /products`: the number is checked against GS1 format rules, one number belongs to one product, `holds_number` must be the number of a product in the file or already in the register (and a loop is refused), and the plan's limits must hold: the limit on products that are not retired only when the file adds one, as with a single add, and the ceiling on every product always. Nothing is saved, whatever the outcome. The first line is the header; see `ImportResult` for the column names taken. `level` and `status` are read without regard to case. A number in scientific notation (`3.6E+10`, or `3,6E+10`) is refused. Number repairs are listed in each row's `notes`; 7 digits, and 12 digits with a wrong check digit, could each be read two ways and are refused. Needs a plan that imports. Not counted against the month's barcodes.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The result, whether or not the file is ready.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ImportFileProblem"
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "$ref": "#/components/responses/ImportNotInPlan"
          },
          "409": {
            "$ref": "#/components/responses/ImportInProgress"
          },
          "413": {
            "$ref": "#/components/responses/BodyTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/JsonRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/products/import": {
      "post": {
        "operationId": "importProducts",
        "tags": [
          "Products"
        ],
        "summary": "Add the products of a CSV file",
        "description": "The same checks as the preview. When the file is ready (`ok`), every row is added in one go, oldest first in file order, and the links from `holds_number` are made; otherwise nothing at all is saved. The whole import is one transaction. Needs a plan that imports. Not counted against the month's barcodes.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Every row was added.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "added"
                  ],
                  "properties": {
                    "added": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "added": 2
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ImportFileProblem"
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "$ref": "#/components/responses/ImportNotInPlan"
          },
          "409": {
            "$ref": "#/components/responses/ImportInProgress"
          },
          "413": {
            "$ref": "#/components/responses/BodyTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/JsonRequired"
          },
          "422": {
            "description": "`import_has_problems`: a row has a problem, or the plan's limits would be passed, and the message says which and by how many. Nothing was saved. The preview's `ok`, `columns`, `rows`, `summary` and `reason` sit beside `error`.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "$ref": "#/components/schemas/ImportResult"
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/products/{id}": {
      "get": {
        "operationId": "getProduct",
        "parameters": [
          {
            "$ref": "#/components/parameters/ProductId"
          }
        ],
        "tags": [
          "Products"
        ],
        "summary": "Read one product",
        "description": "The product, with `contains` (the product it holds, or null) and `held_by` (the products that hold it, oldest first).",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The product and its links.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductPage"
                },
                "example": {
                  "product": {
                    "id": 12,
                    "name": "Honey 12 oz",
                    "sku": "HNY-12",
                    "gtin": "036000291452",
                    "level": "each",
                    "contains_qty": null,
                    "contains_id": null,
                    "status": "active",
                    "notes": null,
                    "created_at": "2026-11-27T10:00:00.000Z",
                    "updated_at": "2026-11-27T10:00:00.000Z"
                  },
                  "contains": null,
                  "held_by": [
                    {
                      "id": 13,
                      "name": "Honey 12 oz, case of 12",
                      "gtin": "10036000291459",
                      "level": "case",
                      "contains_qty": 12
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Unreadable"
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "404": {
            "$ref": "#/components/responses/ProductNotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "patch": {
        "operationId": "editProduct",
        "parameters": [
          {
            "$ref": "#/components/parameters/ProductId"
          }
        ],
        "tags": [
          "Products"
        ],
        "summary": "Change a product",
        "description": "Only the fields sent change; send null to clear `sku`, `gtin`, `notes`, `contains_qty` or `contains_id`. The same rules as adding apply: an active or retired product needs a number, and a number is held by one product at most. Bringing a retired product back takes a place in the plan's limit, as an add does.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductChange"
              },
              "example": {
                "name": "Honey 16 oz",
                "status": "retired"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The product as it is now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ProductProblem"
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "$ref": "#/components/responses/ProductLimit"
          },
          "404": {
            "$ref": "#/components/responses/ProductNotFound"
          },
          "409": {
            "$ref": "#/components/responses/DuplicateNumber"
          },
          "413": {
            "$ref": "#/components/responses/BodyTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/JsonRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "delete": {
        "operationId": "deleteProduct",
        "parameters": [
          {
            "$ref": "#/components/parameters/ProductId"
          }
        ],
        "tags": [
          "Products"
        ],
        "summary": "Delete a product",
        "description": "Deletes the product for good. Products that held it (`contains_id`) keep existing, with `contains_id` set to null.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The product was deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Unreadable"
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "$ref": "#/components/responses/EmailNotConfirmed"
          },
          "404": {
            "$ref": "#/components/responses/ProductNotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/products/{id}/case-number": {
      "get": {
        "operationId": "getCaseNumber",
        "parameters": [
          {
            "$ref": "#/components/parameters/ProductId"
          },
          {
            "name": "indicator",
            "in": "query",
            "required": true,
            "description": "A whole number from 1 to 8, the first digit of the case number; use a different one for each pack size of the item. 0 is the item itself, and 9 is for items sold by weight or measure, so neither is taken.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 8
            },
            "example": 1
          }
        ],
        "tags": [
          "Products"
        ],
        "summary": "Work out the case number for a product",
        "description": "The 14-digit number for a case of the product, made by putting the indicator in front of the product's number (without its check digit) and working out the check digit again. The product needs a number of 8, 12 or 13 digits. Nothing is saved; to add the case to the register, use `POST /products/{id}/case`. The number is checked against GS1 format rules; whether you may use it is for your GS1 membership to say.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The case number, for an ITF-14 barcode.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseNumber"
                },
                "example": {
                  "gtin": "10036000291459",
                  "indicator": 1,
                  "type": "itf14"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CaseProblem"
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "404": {
            "$ref": "#/components/responses/ProductNotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/products/{id}/case": {
      "post": {
        "operationId": "addCase",
        "parameters": [
          {
            "$ref": "#/components/parameters/ProductId"
          }
        ],
        "tags": [
          "Products"
        ],
        "summary": "Add a case of a product",
        "description": "Adds a new product with the case number for `indicator` (as `GET /products/{id}/case-number` gives it), level `case` unless `level` says `inner` or `pallet`, holding `contains_qty` of this product. With no `name` it is named after the product, such as \"Honey 12 oz, case of 12\". It is an add like any other: the number is held by one product at most, and the case counts against the plan's limit.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseInput"
              },
              "example": {
                "indicator": 1,
                "contains_qty": 12
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The case was added.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CaseProblem"
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "$ref": "#/components/responses/ProductLimit"
          },
          "404": {
            "$ref": "#/components/responses/ProductNotFound"
          },
          "409": {
            "$ref": "#/components/responses/DuplicateNumber"
          },
          "413": {
            "$ref": "#/components/responses/BodyTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/JsonRequired"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/products/{id}/barcodes": {
      "get": {
        "operationId": "listSavedBarcodes",
        "parameters": [
          {
            "$ref": "#/components/parameters/ProductId"
          }
        ],
        "tags": [
          "Products"
        ],
        "summary": "List a product's saved barcodes",
        "description": "The barcodes saved to the product, oldest first. A saved barcode is kept as its settings (type, data and options), not as a file. Not counted.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The saved barcodes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedBarcodeList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "404": {
            "$ref": "#/components/responses/ProductNotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "post": {
        "operationId": "saveBarcode",
        "parameters": [
          {
            "$ref": "#/components/parameters/ProductId"
          }
        ],
        "tags": [
          "Products"
        ],
        "summary": "Save a barcode to a product",
        "description": "Saves barcode settings to the product, to be drawn again whenever they are downloaded. With an empty body the barcode is the standard one for the product's number: `data` is the number and `type` follows its length (8 digits `ean8`, 12 `upca`, 13 `ean13`, 14 `itf14`). The engine must accept the settings; if it does not, the answer is 422 with its checks and nothing is saved. The format and the PNG dpi are not saved: they are chosen at each download. Saving counts as one barcode against the month, exactly as `POST /barcodes` does: the place is taken before the settings are drawn and given back if the engine refuses them or the save fails, and when the month is used up the answer is 429 `monthly_limit_reached` and nothing is saved. (A save from the signed-in app is not counted.) Downloads of a saved barcode are never counted. Each product keeps a limited number of saved barcodes; the answer says the limit when it is reached.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SavedBarcodeInput"
              },
              "example": {
                "options": {
                  "size": 120
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The barcode was saved. `checks` and `facts` are the engine's, for the settings drawn as SVG.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedBarcodeAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/SavedProblem"
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "$ref": "#/components/responses/EmailNotConfirmed"
          },
          "404": {
            "$ref": "#/components/responses/ProductNotFound"
          },
          "409": {
            "$ref": "#/components/responses/TooManySaved"
          },
          "413": {
            "$ref": "#/components/responses/BodyTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/JsonRequired"
          },
          "422": {
            "$ref": "#/components/responses/EngineRefused"
          },
          "429": {
            "$ref": "#/components/responses/RateOrMonthlyLimit"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/products/{id}/barcodes/{file}": {
      "get": {
        "operationId": "downloadSavedBarcode",
        "parameters": [
          {
            "$ref": "#/components/parameters/ProductId"
          },
          {
            "name": "file",
            "in": "path",
            "required": true,
            "description": "The saved barcode's id and the format, such as `3.png`: the id is 1 to 15 digits, the format `png`, `svg`, `pdf` or `eps` in any case. Anything else, and the id of a barcode saved to another product, is answered 404 `barcode_not_found`.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{1,15}\\.([Pp][Nn][Gg]|[Ss][Vv][Gg]|[Pp][Dd][Ff]|[Ee][Pp][Ss])$"
            },
            "example": "3.png"
          },
          {
            "name": "dpi",
            "in": "query",
            "required": false,
            "description": "PNG only: dots per inch, written in digits. The default is 300. The engine's dpi rule applies; a value it does not take is answered 422 `bad_option`.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "example": "600"
          }
        ],
        "tags": [
          "Products"
        ],
        "summary": "Download a saved barcode",
        "description": "Draws the saved settings again in the format asked for and answers with the file itself. The same settings give the same file each time. Not counted. The file answer carries the same size and warning headers as `POST /barcodes`.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The barcode file.",
            "headers": {
              "Content-Disposition": {
                "description": "`attachment`, with a file name made of the type and the data's letters and digits (every other run of characters one dash, at most 40), such as `upca-036000291452.png`; `<type>-barcode.<format>` when the data has no letters or digits.",
                "schema": {
                  "type": "string"
                },
                "example": "attachment; filename=\"upca-036000291452.png\""
              },
              "Barcode-Width-Mm": {
                "description": "The width of the whole image in millimetres, quiet zones included.",
                "schema": {
                  "type": "string"
                },
                "example": "37.29"
              },
              "Barcode-Height-Mm": {
                "description": "The height of the whole image in millimetres.",
                "schema": {
                  "type": "string"
                },
                "example": "25.94"
              },
              "Barcode-Warnings": {
                "description": "Only when there are warnings: their codes, joined by a comma and a space.",
                "schema": {
                  "type": "string"
                },
                "example": "magnification_low"
              }
            },
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/svg+xml": {
                "schema": {
                  "type": "string"
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/postscript": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadDpi"
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "description": "`format_not_in_plan`: the account's plan does not make this file format. The message names the formats it does make.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/BarcodeNotFound"
          },
          "422": {
            "$ref": "#/components/responses/EngineRefused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      },
      "delete": {
        "operationId": "deleteSavedBarcode",
        "parameters": [
          {
            "$ref": "#/components/parameters/ProductId"
          },
          {
            "name": "file",
            "in": "path",
            "required": true,
            "description": "For a delete, the saved barcode's id alone: 1 to 15 digits, with no format, such as `3`. Any other id, and the id of a barcode saved to another product, is answered 404 `barcode_not_found`.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{1,15}$"
            },
            "example": "3"
          }
        ],
        "tags": [
          "Products"
        ],
        "summary": "Delete a saved barcode",
        "description": "Deletes the saved barcode for good. Deleting a product deletes its saved barcodes too.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The saved barcode was deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deleted"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "$ref": "#/components/responses/EmailNotConfirmed"
          },
          "404": {
            "$ref": "#/components/responses/BarcodeNotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/products/{id}/handoff.zip": {
      "get": {
        "operationId": "downloadHandoffPack",
        "parameters": [
          {
            "$ref": "#/components/parameters/ProductId"
          },
          {
            "name": "barcode",
            "in": "query",
            "required": false,
            "description": "The id of the saved barcode to use, 1 to 15 digits. It must be a UPC-A, EAN-13, EAN-8 or ITF-14 whose data is the product's number (the same number written with leading zeros counts); another saved barcode of the product is answered 409 `barcode_not_for_pack`. Left out, the pack uses the newest saved barcode that holds the number. An id that is not one of this product's saved barcodes is answered 404 `barcode_not_found`.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{1,15}$"
            },
            "example": "3"
          }
        ],
        "tags": [
          "Products"
        ],
        "summary": "Download the printer handoff pack",
        "description": "One zip to send to a printer, drawn from the product's saved barcode. It holds `<name>.pdf`, `<name>.eps`, `<name>.svg`, `<name>-<dpi>dpi.png` (a high-resolution PNG, named for its resolution, such as `-600dpi.png`) and `<name>-spec-sheet.pdf` (a one-page A4 sheet with the name, the number the bars hold, the printed sizes the engine reported, any warnings and notes for the printer), in that order, `<name>` being the product's name in lower-case letters, digits and dashes (cut to a set length; `product` when nothing is left). Then, for each product that holds this one at level `case`, has a number and is not retired (the newest ones, as many as the server's `handoff.casesMax` setting allows, newest first), a folder `case-<its name>/` (with the case's id added when two cases would share a folder name) with the same five files, drawn from that case's own newest saved barcode for its number, or else the standard ITF-14 for it. The sheet's sizes are checked against GS1 format rules only; scan a printed proof before the full run. On plans with `handoff` in the plan table. Never counted against the month's barcodes. An account has one pack being made at a time.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The zip file.",
            "headers": {
              "Content-Disposition": {
                "description": "`attachment`, with the file name `<name>-handoff.zip`: letters, digits, dots and dashes only.",
                "schema": {
                  "type": "string"
                },
                "example": "attachment; filename=\"honey-12-oz-handoff.zip\""
              }
            },
            "content": {
              "application/zip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/KeyProblem"
          },
          "403": {
            "description": "`handoff_not_in_plan`: the account's plan does not include the handoff pack; the message names the plans that do. Or `email_not_confirmed`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/BarcodeNotFound"
          },
          "409": {
            "description": "`nothing_saved`: no `barcode` was named and the product has no saved barcode for its number; save one first. Or `barcode_not_for_pack`: the saved barcode named does not hold the product's number. Or `pack_in_progress`: another pack for this account is still being made; wait for it to finish, then ask again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "`pack_too_large`: the zip would be larger than one download may be; save the barcode at a smaller size.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "`pack_could_not_be_drawn`: the engine refused one of the files from the saved settings. `checks` beside `error` holds what the engine found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: too many requests from this key in a short time. Or `daily_pack_limit`: the account has made as many packs today as the server's `handoff.packsPerDay` setting allows; `limit` sits beside `error`, and the count starts again at midnight UTC. Both carry `Retry-After`: the seconds to wait, or the seconds until midnight UTC.",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "description": "`server_stopping`: the server was restarting before the pack was finished, so nothing was sent; ask for it again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "ProductId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "The product's id: 1 to 15 digits. Any other id, and the id of another account's product, is answered 404 `product_not_found`.",
        "schema": {
          "type": "string",
          "pattern": "^[0-9]{1,15}$"
        },
        "example": "12"
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key: `bk_` followed by 43 letters, digits, `-` or `_`. Send it as `Authorization: Bearer` followed by the key."
      }
    },
    "headers": {
      "RetryAfter": {
        "description": "How many whole seconds to wait before trying again.",
        "schema": {
          "type": "string"
        },
        "example": "2"
      }
    },
    "responses": {
      "Unreadable": {
        "description": "`bad_request`: the request could not be read (a broken web address or first line, headers that are too large, or a request that took too long to arrive).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "BadBody": {
        "description": "The request could not be used: `bad_json` (the body is not valid JSON), `bad_body` (the body is not a JSON object), `unknown_field` (a top-level field this address does not accept), or `bad_request` (the request could not be read at all).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "KeyProblem": {
        "description": "`missing_key` (no `Authorization` header; the answer carries `WWW-Authenticate: Bearer`), `bad_key` (not a key the service knows) or `key_revoked` (the key has been switched off).",
        "headers": {
          "WWW-Authenticate": {
            "description": "Sent with `missing_key` only.",
            "schema": {
              "type": "string"
            },
            "example": "Bearer"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "EmailNotConfirmed": {
        "description": "`email_not_confirmed`: the key belongs to an account made by signing up whose email address is not confirmed yet. Its keys work once the address is confirmed.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "FormatOrEmail": {
        "description": "`format_not_in_plan`: the account's plan does not make this file format. The message names the formats it does make. Or `email_not_confirmed`: the key belongs to an account made by signing up whose email address is not confirmed yet. Nothing was counted.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ImportFileProblem": {
        "description": "The file cannot be read: `csv_not_text` (not UTF-8 text, such as a UTF-16 file), `csv_empty` (no rows of products, or a header alone), `csv_no_name_column`, `csv_unclosed_quote`, or `csv_too_many_rows` (more rows than one import takes; the message says how many). Or the body is not `{ \"csv\": \"...\" }`: `bad_body`, `unknown_field`, `missing_field` or `bad_field`. Or `bad_json`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ImportNotInPlan": {
        "description": "`import_not_in_plan`: the account's plan does not add products from a file; the message names the plans that do. Or `email_not_confirmed`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ImportInProgress": {
        "description": "`import_in_progress`: a preview or an import for this account is still being checked; each account has one at a time. Wait for it to finish, then send this one again.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "BodyTooLarge": {
        "description": "`body_too_large`: the request body is over this address's limit (`limits` in `GET /types`). The server reads and throws away the rest of the body, up to 8 MiB, before it answers, and then closes the connection.",
        "headers": {
          "Connection": {
            "description": "Always `close`.",
            "schema": {
              "type": "string"
            },
            "example": "close"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "JsonRequired": {
        "description": "`json_required`: the request did not say `Content-Type: application/json`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimited": {
        "description": "`rate_limited`: too many requests from this key in a short time. `Retry-After` says how many seconds to wait.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateOrMonthlyLimit": {
        "description": "`rate_limited`: too many requests from this key in a short time. Or `monthly_limit_reached`: this request would go past the month's allowance, so nothing was made; `usage` sits beside `error`. Both carry `Retry-After`: the seconds to wait, or the seconds until the next month starts.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "monthly_limit_reached",
                "message": "This request would go past the 50 barcodes the Free plan gives each month; the count starts again on 1 December 2026."
              },
              "usage": {
                "month": "2026-11",
                "used": 50,
                "limit": 50,
                "resets_at": "2026-12-01T00:00:00Z"
              }
            }
          }
        }
      },
      "ServerError": {
        "description": "`server_error`: something went wrong inside the service, such as the drawing engine failing. Nothing was counted. Trying again later is safe.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ProductProblem": {
        "description": "The product could not be saved, and nothing changed: `bad_json`, `bad_body` (not a JSON object), `unknown_field` (a field the register does not keep), `missing_field` (no `name` on an add), `bad_field` (a field of the wrong kind or length; the message names it and says what it must be), `bad_number` (the product number is not a whole GTIN-8, -12, -13 or -14 with the right check digit; the message says what is wrong), `number_needed` (an active or retired product with no number), `bad_link` (a product set to hold itself, or to hold a product that holds it in turn, or a chain of more than 10 products below the link), or `bad_request`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "CaseProblem": {
        "description": "No case number, and nothing changed: `bad_indicator` (the indicator is not a whole number from 1 to 8; 9 has its own sentence, as it is for items sold by weight or measure), `no_case_for_this_number` (the product has no number, or one of 14 digits, which is already a case number), or, when adding the case, `bad_json`, `bad_body`, `unknown_field`, `missing_field` (no `contains_qty`), `bad_field` (the message names the field) or `bad_link`. Or `bad_request`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ProductLimit": {
        "description": "`product_limit_reached`: the plan's most products that are not retired are already in the register; retire or delete one first. Or `register_full`: the account keeps the most products it may, counting retired ones; delete retired ones to make room. Or `email_not_confirmed`: the key belongs to an account made by signing up whose email address is not confirmed yet.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ProductNotFound": {
        "description": "`product_not_found`: there is no product with this id on the account (or, for `contains_id`, no product with that id). Another account's product is answered exactly the same as one that does not exist.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "DuplicateNumber": {
        "description": "`duplicate_number`: another product of the account already has this number. `existing` beside `error` names that product.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "duplicate_number",
                "message": "Another product on your account already has this number; open that product, or check the number for a typing mistake."
              },
              "existing": {
                "id": 12,
                "name": "Honey 12 oz"
              }
            }
          }
        }
      },
      "NotAvailableYet": {
        "description": "`not_available_yet`: the request sent `save` with a value other than false, or (on a pair, or an item of a batch) `product_id`. Saving to a product works only for a single barcode, with `product_id`. Nothing was made or counted.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "SavedProblem": {
        "description": "Nothing was saved: `bad_json`, `bad_body` (not a JSON object), `unknown_field` (only `type`, `data` and `options` are taken), `missing_field` (no `data` for a product with no number, or no `type` for data that is not a whole product number), `bad_field` (a field of the wrong kind, or `options` holding `format` or `dpi`, which are chosen at download), or `bad_request`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "TooManySaved": {
        "description": "`too_many_saved`: the product already keeps the most saved barcodes it may, and the message says how many that is; delete one first. Nothing was saved (and, for `POST /barcodes` with `product_id`, nothing was made or counted).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "BarcodeNotFound": {
        "description": "`barcode_not_found`: the product has no saved barcode with this id, or the address does not name a format the service makes. Or `product_not_found`: there is no product with this id on the account. Another account's product or saved barcode is answered exactly as one that does not exist.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "BadDpi": {
        "description": "`bad_field`: `dpi` is not written in digits. Or `bad_request`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "EngineRefused": {
        "description": "The engine does not accept the settings, so nothing was drawn or saved. `error` is the first error the engine found, and `checks` holds all of them. The codes are the engine's check codes (see the README table).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "bad_check_digit",
                "message": "The last digit of this UPC-A number is 3 but should be 2; correct it, or check the other digits for a typing mistake."
              },
              "checks": [
                {
                  "level": "error",
                  "code": "bad_check_digit",
                  "message": "The last digit of this UPC-A number is 3 but should be 2; correct it, or check the other digits for a typing mistake."
                }
              ]
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "description": "Every error answer. Extra facts sit beside `error`, never inside it.",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "A short fixed name for the error, for programs to act on. The server's own codes are listed in `x-server-codes`; the payment codes (from `billing_off` to `bad_signature`) come only from the app's own pages and the payment service's webhook, never from this API, and the connector codes (`connector_off`, `request_expired`, `connection_not_found`) only from the connector's own addresses (`/mcp`, its download links `/d/`) and the pages that connect an AI app. A 422 answer (and a failed item in a batch) carries one of the engine's check codes instead, such as `bad_check_digit`; those are listed in the \"Check codes\" table of README.md.",
                "x-server-codes": [
                  "bad_request",
                  "not_found",
                  "method_not_allowed",
                  "json_required",
                  "bad_json",
                  "bad_body",
                  "unknown_field",
                  "body_too_large",
                  "missing_key",
                  "bad_key",
                  "key_revoked",
                  "email_not_confirmed",
                  "too_many_keys",
                  "key_not_found",
                  "bad_name",
                  "sign_in_required",
                  "bad_origin",
                  "missing_field",
                  "bad_email",
                  "weak_password",
                  "link_expired",
                  "already_confirmed",
                  "bad_sign_in",
                  "wrong_password",
                  "sign_in_locked",
                  "bad_code",
                  "code_expired",
                  "too_many_codes",
                  "code_wait",
                  "use_app_code",
                  "nothing_to_confirm",
                  "two_step_already_on",
                  "two_step_not_on",
                  "rate_limited",
                  "monthly_limit_reached",
                  "format_not_in_plan",
                  "daily_file_limit",
                  "daily_preview_limit",
                  "plan_required",
                  "bad_batch",
                  "batch_in_progress",
                  "batch_output_too_large",
                  "server_stopping",
                  "not_available_yet",
                  "product_not_found",
                  "duplicate_number",
                  "product_limit_reached",
                  "register_full",
                  "bad_number",
                  "bad_field",
                  "number_needed",
                  "bad_link",
                  "bad_indicator",
                  "no_case_for_this_number",
                  "barcode_not_found",
                  "too_many_saved",
                  "import_not_in_plan",
                  "import_has_problems",
                  "import_in_progress",
                  "csv_not_text",
                  "csv_empty",
                  "csv_no_name_column",
                  "csv_unclosed_quote",
                  "csv_too_many_rows",
                  "number_was_changed_by_spreadsheet",
                  "duplicate_in_file",
                  "number_already_in_register",
                  "holds_number_not_found",
                  "handoff_not_in_plan",
                  "nothing_saved",
                  "barcode_not_for_pack",
                  "pack_in_progress",
                  "daily_pack_limit",
                  "pack_could_not_be_drawn",
                  "pack_too_large",
                  "billing_off",
                  "billing_unavailable",
                  "bad_plan",
                  "bad_period",
                  "already_subscribed",
                  "billing_busy",
                  "no_billing",
                  "bad_session",
                  "payment_pending",
                  "bad_signature",
                  "connector_off",
                  "request_expired",
                  "connection_not_found",
                  "server_error"
                ],
                "externalDocs": {
                  "description": "Check codes",
                  "url": "README.md#check-codes"
                }
              },
              "message": {
                "type": "string",
                "description": "One plain sentence saying what is wrong and what to do about it."
              }
            }
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Check"
            },
            "description": "With a 422: everything the engine found. For a pair, the checks about the request as a whole."
          },
          "linear_checks": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/Check"
            },
            "description": "With a 422 from `/barcodes/pair` only: the retail barcode's own checks, or null when it was not tried."
          },
          "qr_checks": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/Check"
            },
            "description": "With a 422 from `/barcodes/pair` only: the QR code's own checks, or null when it was not tried."
          },
          "usage": {
            "$ref": "#/components/schemas/MonthUsage"
          },
          "existing": {
            "type": "object",
            "description": "With `duplicate_number` only: the product that already has the number.",
            "required": [
              "id",
              "name"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            }
          }
        }
      },
      "ProductLevel": {
        "type": "string",
        "enum": [
          "each",
          "inner",
          "case",
          "pallet"
        ],
        "description": "What the product is: one item (`each`), an inner pack, a case or a pallet."
      },
      "ProductStatus": {
        "type": "string",
        "enum": [
          "draft",
          "active",
          "retired"
        ],
        "description": "`draft` may have no number. Products that are not retired count against the plan's limit."
      },
      "Product": {
        "type": "object",
        "description": "One product in the register.",
        "required": [
          "id",
          "name",
          "sku",
          "gtin",
          "level",
          "contains_qty",
          "contains_id",
          "status",
          "notes",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "description": "The product's id, for `/products/{id}`."
          },
          "name": {
            "type": "string",
            "description": "1 to 200 characters.",
            "example": "Honey 12 oz"
          },
          "sku": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your own code for the product, up to 64 characters.",
            "example": "HNY-12"
          },
          "gtin": {
            "type": [
              "string",
              "null"
            ],
            "description": "The product number, digits only, as it was given without spaces or dashes. Always a string, so leading zeros are kept.",
            "example": "036000291452"
          },
          "level": {
            "$ref": "#/components/schemas/ProductLevel"
          },
          "contains_qty": {
            "type": [
              "integer",
              "null"
            ],
            "description": "How many of `contains_id` this product holds, 1 to 1,000,000."
          },
          "contains_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The id of another of the account's products that this one holds, such as the item inside a case."
          },
          "status": {
            "$ref": "#/components/schemas/ProductStatus"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ],
            "description": "Up to 2,000 characters; may hold line breaks."
          },
          "created_at": {
            "type": "string",
            "description": "When it was added, UTC.",
            "example": "2026-11-27T10:00:00.000Z"
          },
          "updated_at": {
            "type": "string",
            "description": "When it last changed, UTC.",
            "example": "2026-11-27T10:00:00.000Z"
          }
        }
      },
      "ProductInput": {
        "type": "object",
        "description": "A product to add. Any field not listed here is refused with `unknown_field`. Text is trimmed.",
        "required": [
          "name"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "description": "1 to 200 characters, at least one of them visible."
          },
          "sku": {
            "type": [
              "string",
              "null"
            ]
          },
          "gtin": {
            "type": [
              "string",
              "null"
            ],
            "description": "8, 12, 13 or 14 digits with the check digit last; spaces and dashes are dropped. Send it as text."
          },
          "level": {
            "$ref": "#/components/schemas/ProductLevel"
          },
          "contains_qty": {
            "type": [
              "integer",
              "null"
            ]
          },
          "contains_id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/ProductStatus"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ProductChange": {
        "type": "object",
        "description": "The fields to change; the same fields as an add, all optional. Any other field is refused with `unknown_field`.",
        "additionalProperties": false,
        "properties": {
          "name": {
            "$ref": "#/components/schemas/ProductInput/properties/name"
          },
          "sku": {
            "$ref": "#/components/schemas/ProductInput/properties/sku"
          },
          "gtin": {
            "$ref": "#/components/schemas/ProductInput/properties/gtin"
          },
          "level": {
            "$ref": "#/components/schemas/ProductLevel"
          },
          "contains_qty": {
            "$ref": "#/components/schemas/ProductInput/properties/contains_qty"
          },
          "contains_id": {
            "$ref": "#/components/schemas/ProductInput/properties/contains_id"
          },
          "status": {
            "$ref": "#/components/schemas/ProductStatus"
          },
          "notes": {
            "$ref": "#/components/schemas/ProductInput/properties/notes"
          }
        }
      },
      "ProductAnswer": {
        "type": "object",
        "required": [
          "product"
        ],
        "properties": {
          "product": {
            "$ref": "#/components/schemas/Product"
          }
        }
      },
      "ProductPage": {
        "type": "object",
        "description": "One product with its links.",
        "required": [
          "product",
          "contains",
          "held_by"
        ],
        "properties": {
          "product": {
            "$ref": "#/components/schemas/Product"
          },
          "contains": {
            "type": [
              "object",
              "null"
            ],
            "description": "The product this one holds (`contains_id`), or null.",
            "required": [
              "id",
              "name",
              "gtin"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              },
              "gtin": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "held_by": {
            "type": "array",
            "description": "The products that hold this one, oldest first.",
            "items": {
              "type": "object",
              "required": [
                "id",
                "name",
                "gtin",
                "level",
                "contains_qty"
              ],
              "properties": {
                "id": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "gtin": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "level": {
                  "$ref": "#/components/schemas/ProductLevel"
                },
                "contains_qty": {
                  "type": [
                    "integer",
                    "null"
                  ]
                }
              }
            }
          }
        }
      },
      "CaseNumber": {
        "type": "object",
        "required": [
          "gtin",
          "indicator",
          "type"
        ],
        "properties": {
          "gtin": {
            "type": "string",
            "description": "The 14-digit case number, check digit last.",
            "example": "10036000291459"
          },
          "indicator": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8
          },
          "type": {
            "type": "string",
            "enum": [
              "itf14"
            ],
            "description": "The barcode type to draw it with."
          }
        }
      },
      "CaseInput": {
        "type": "object",
        "description": "The case to add. Any other field is refused with `unknown_field`.",
        "required": [
          "indicator",
          "contains_qty"
        ],
        "additionalProperties": false,
        "properties": {
          "indicator": {
            "type": [
              "integer",
              "string"
            ],
            "description": "A whole number from 1 to 8, or the same as one digit of text."
          },
          "contains_qty": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "description": "How many of the product one case holds."
          },
          "name": {
            "type": "string",
            "description": "1 to 200 characters. With none, the product's name and the quantity, such as \"Honey 12 oz, case of 12\"."
          },
          "level": {
            "type": "string",
            "enum": [
              "inner",
              "case",
              "pallet"
            ],
            "description": "`case` when not sent."
          }
        }
      },
      "ImportRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "csv"
        ],
        "properties": {
          "csv": {
            "type": "string",
            "description": "The whole text of the CSV file. Comma, semicolon and tab files are recognised (or a first line `sep=;`), with or without a byte-order mark; save from a spreadsheet as \"CSV UTF-8\". The whole request body may hold up to 1,048,576 bytes and the file up to 2,000 rows of products (the server's `register.importMaxBytes` and `register.importMaxRows`)."
          }
        },
        "example": {
          "csv": "name,sku,number\nHoney 12 oz,HNY-12,036000291452\n"
        }
      },
      "ImportNote": {
        "type": "object",
        "required": [
          "field",
          "code",
          "message"
        ],
        "properties": {
          "field": {
            "type": "string",
            "description": "The column, in the file's terms: `name`, `sku`, `number`, `level`, `quantity`, `holds_number`, `status` or `notes`."
          },
          "code": {
            "type": "string",
            "description": "For a problem, an error code (`bad_number`, `bad_field`, `missing_field`, `number_needed`, `bad_link`, `number_was_changed_by_spreadsheet`, `duplicate_in_file`, `number_already_in_register`, `holds_number_not_found`); for a note, `decimal_removed` or `leading_zero_restored`."
          },
          "message": {
            "type": "string",
            "description": "One plain sentence."
          },
          "existing": {
            "type": "object",
            "description": "Only with `number_already_in_register`: the product that has the number.",
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            }
          }
        }
      },
      "ImportRow": {
        "type": "object",
        "required": [
          "line",
          "values",
          "problems",
          "notes"
        ],
        "properties": {
          "line": {
            "type": "integer",
            "description": "The line of the file the row starts on, as a text editor counts lines: the header's line is 1, and blank lines and line breaks inside quoted cells are counted."
          },
          "values": {
            "type": "object",
            "description": "What the row would become: the cells as read (an apostrophe a spreadsheet guard put in front taken off, spaces at the ends trimmed) and repaired, with the defaults the register fills in. Empty cells are null. `level` and `status` are read without regard to case (`Case` is `case`).",
            "properties": {
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sku": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "number": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "level": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "quantity": {
                "type": [
                  "integer",
                  "string",
                  "null"
                ]
              },
              "holds_number": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "problems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImportNote"
            },
            "description": "Why the row cannot be added. Any problem stops the whole import."
          },
          "notes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImportNote"
            },
            "description": "Repairs made to the row's numbers: a trailing `.0` (or `,0`, as a semicolon file from a European spreadsheet writes it) taken off (`decimal_removed`), and an 11-digit number that is a right UPC-A with a zero in front given that zero back (`leading_zero_restored`)."
          }
        }
      },
      "ImportResult": {
        "type": "object",
        "required": [
          "ok",
          "columns",
          "rows",
          "summary",
          "reason"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "description": "True only when no row has a problem and the plan's limits hold."
          },
          "reason": {
            "type": "string",
            "description": "Why the file cannot be imported as it is, in words, as it follows \"because\" in the message of `import_has_problems`: the rows with problems, and each limit of the plan that would be passed (the limit on products that are not retired, or the ceiling on every product, retired ones included), with the count and by how many. Empty when `ok` is true."
          },
          "columns": {
            "type": "object",
            "properties": {
              "matched": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                },
                "description": "Each field found, with the header it was found under. Headers are matched without regard to case, spaces or underscores: `name` (also `product`, `product name`, `title`), `sku`, `number` (also `gtin`, `upc`, `ean`, `barcode`), `level` (also `packaging`, `packaging level`), `quantity` (also `qty`, `contains`), `holds_number`, `status`, `notes`."
              },
              "ignored": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Headers that are not one of those, or name a field a column before them already has; their cells are skipped."
              }
            }
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImportRow"
            },
            "description": "Every data row, in file order. Rows whose cells are all empty are skipped."
          },
          "summary": {
            "type": "object",
            "required": [
              "rows",
              "ready",
              "with_problems",
              "would_have",
              "would_total",
              "limit",
              "total_limit",
              "over_limit",
              "over_by"
            ],
            "properties": {
              "rows": {
                "type": "integer"
              },
              "ready": {
                "type": "integer",
                "description": "Rows with no problem."
              },
              "with_problems": {
                "type": "integer"
              },
              "would_have": {
                "type": "integer",
                "description": "Products that are not retired once the ready rows are added."
              },
              "would_total": {
                "type": "integer",
                "description": "Every product, retired ones included, once the ready rows are added."
              },
              "limit": {
                "type": "integer",
                "description": "The plan's most products that are not retired."
              },
              "total_limit": {
                "type": "integer",
                "description": "The most products the account keeps, counting retired ones."
              },
              "over_limit": {
                "type": "boolean",
                "description": "True when `would_total` passes `total_limit`, or when `would_have` passes `limit` and the file adds a product that is not retired: as with a single add, an account already over its limit may still add retired products."
              },
              "over_by": {
                "type": "integer",
                "description": "By how many the larger of the two limits that apply is passed; 0 when neither is."
              }
            }
          }
        }
      },
      "ProductList": {
        "type": "object",
        "required": [
          "products",
          "next",
          "count"
        ],
        "properties": {
          "products": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Product"
            }
          },
          "next": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Pass as `after` for the following page; null on the last page."
          },
          "count": {
            "type": "object",
            "required": [
              "counted",
              "retired",
              "total",
              "limit",
              "total_limit"
            ],
            "properties": {
              "counted": {
                "type": "integer",
                "description": "Products that are not retired: the ones the plan's limit counts."
              },
              "retired": {
                "type": "integer",
                "description": "Retired products."
              },
              "total": {
                "type": "integer",
                "description": "Every product, retired ones included."
              },
              "limit": {
                "type": "integer",
                "description": "The plan's most products that are not retired."
              },
              "total_limit": {
                "type": "integer",
                "description": "The most products the account keeps, retired ones included."
              }
            }
          }
        }
      },
      "Deleted": {
        "type": "object",
        "required": [
          "deleted"
        ],
        "properties": {
          "deleted": {
            "const": true
          }
        }
      },
      "Check": {
        "type": "object",
        "description": "One thing the engine found. An error stops the barcode. A warning comes with a barcode that was made but may not scan well.",
        "required": [
          "level",
          "code",
          "message"
        ],
        "properties": {
          "level": {
            "type": "string",
            "enum": [
              "error",
              "warning"
            ]
          },
          "code": {
            "type": "string",
            "description": "One of the engine's check codes; see the \"Check codes\" table of README.md.",
            "example": "check_digit_added"
          },
          "message": {
            "type": "string",
            "description": "One plain sentence."
          }
        }
      },
      "Image": {
        "type": "object",
        "description": "A barcode image inside a JSON answer.",
        "required": [
          "format",
          "mime",
          "encoding",
          "body"
        ],
        "properties": {
          "format": {
            "$ref": "#/components/schemas/Format"
          },
          "mime": {
            "type": "string",
            "enum": [
              "image/png",
              "image/svg+xml",
              "application/pdf",
              "application/postscript"
            ]
          },
          "encoding": {
            "type": "string",
            "enum": [
              "base64",
              "utf8"
            ],
            "description": "`base64` for PNG and PDF, `utf8` (plain text) for SVG and EPS."
          },
          "body": {
            "type": "string",
            "description": "The file's contents, in the encoding named beside it."
          }
        }
      },
      "Facts": {
        "type": "object",
        "description": "What was drawn, and its printed size.",
        "required": [
          "data",
          "type",
          "width_mm",
          "height_mm",
          "bar_height_mm",
          "module_mm",
          "magnification",
          "px_per_module",
          "bar_width_reduction_mm",
          "wide_ratio",
          "bearer_mm"
        ],
        "properties": {
          "data": {
            "type": "string",
            "description": "The data in the barcode, with any added check digit."
          },
          "type": {
            "type": "string",
            "description": "The barcode type's id."
          },
          "width_mm": {
            "type": "number",
            "description": "Width of the whole image in millimetres, quiet zones included."
          },
          "height_mm": {
            "type": "number",
            "description": "Height of the whole image in millimetres."
          },
          "bar_height_mm": {
            "type": [
              "number",
              "null"
            ],
            "description": "Height of the bars in millimetres; null for the 2D types."
          },
          "module_mm": {
            "type": "number",
            "description": "Width of the narrowest bar, or of one square, in millimetres."
          },
          "magnification": {
            "type": [
              "number",
              "null"
            ],
            "description": "Size in percent for UPC-A, EAN-13 and EAN-8; null for the other types."
          },
          "px_per_module": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Pixels across the narrowest bar or one square, for PNG; null for the other formats."
          },
          "bar_width_reduction_mm": {
            "type": "number",
            "description": "The bar width reduction applied, 0 when none."
          },
          "wide_ratio": {
            "type": [
              "number",
              "null"
            ],
            "description": "ITF-14 only: how many times wider the wide bars are than the narrow ones."
          },
          "bearer_mm": {
            "type": [
              "number",
              "null"
            ],
            "description": "ITF-14 only: the thickness of the frame around the bars, in millimetres."
          }
        }
      },
      "Format": {
        "type": "string",
        "enum": [
          "png",
          "svg",
          "pdf",
          "eps"
        ],
        "description": "The file format. Which formats an account may ask for depends on its plan."
      },
      "Options": {
        "type": "object",
        "description": "Optional settings. Each type takes its own set (`GET /types` lists them); an unknown setting, or a value out of bounds, is a 422 `bad_option`. README.md explains each one.",
        "properties": {
          "size": {
            "type": "number",
            "description": "UPC-A, EAN-13, EAN-8: the magnification in percent, 20 to 400. Every other type: the width of the narrowest bar or one square in millimetres, 0.05 to 5."
          },
          "height_mm": {
            "type": "number",
            "description": "Height of the bars in millimetres. Not for the 2D types."
          },
          "dpi": {
            "type": "number",
            "description": "PNG only: dots per inch, 72 to 2400. The default is 300."
          },
          "text": {
            "type": "boolean",
            "description": "Show the digits under the bars. Not for the 2D types."
          },
          "bar_color": {
            "type": "string",
            "description": "A hex color of 3 or 6 digits.",
            "example": "#000000"
          },
          "background": {
            "type": "string",
            "description": "A hex color of 3 or 6 digits.",
            "example": "#ffffff"
          },
          "quiet_zone": {
            "type": "boolean",
            "description": "False turns the blank margins off. ITF-14 does not take false."
          },
          "bar_width_reduction_mm": {
            "type": "number",
            "description": "How much to narrow each bar, in millimetres, to allow for ink spread."
          }
        }
      },
      "BarcodeRequest": {
        "type": "object",
        "description": "One barcode to make. Any field not listed here is refused with `unknown_field`.",
        "required": [
          "type",
          "data",
          "format"
        ],
        "additionalProperties": false,
        "properties": {
          "type": {
            "type": "string",
            "description": "The barcode type's id, from `GET /types`.",
            "example": "upca"
          },
          "data": {
            "type": "string",
            "description": "What the barcode holds. Always a string, so leading zeros are kept.",
            "example": "036000291452"
          },
          "format": {
            "$ref": "#/components/schemas/Format"
          },
          "options": {
            "$ref": "#/components/schemas/Options"
          },
          "product_id": {
            "type": "integer",
            "minimum": 1,
            "description": "The id of one of your products: the barcode is made and counted as usual and its settings are also saved to the product (without `format` and `dpi`, which are chosen at each download); the JSON answer then carries `saved`. A product that is not yours is 404 `product_not_found`, and a product that already keeps the most saved barcodes it may is 409 `too_many_saved`; either way nothing is made or counted. Not taken in an item of a batch, where it is answered with `not_available_yet`."
          },
          "save": {
            "description": "Not available yet. Any value other than false is answered with 501 `not_available_yet`."
          }
        }
      },
      "SavedBarcode": {
        "type": "object",
        "description": "A barcode saved to a product: its settings, drawn again at each download.",
        "required": [
          "id",
          "type",
          "data",
          "options",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "type": {
            "type": "string",
            "description": "The barcode type's id.",
            "example": "upca"
          },
          "data": {
            "type": "string",
            "example": "036000291452"
          },
          "options": {
            "$ref": "#/components/schemas/Options",
            "description": "The saved settings; never `format` or `dpi`."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SavedBarcodeInput": {
        "type": "object",
        "description": "The settings to save; all optional. Left out, `data` is the product's number and `type` follows its length. Any other field is refused with `unknown_field`.",
        "additionalProperties": false,
        "properties": {
          "type": {
            "type": "string",
            "description": "The barcode type's id, from `GET /types`.",
            "example": "qr"
          },
          "data": {
            "type": "string",
            "description": "What the barcode holds.",
            "example": "https://example.com/honey"
          },
          "options": {
            "$ref": "#/components/schemas/Options",
            "description": "Settings for the type, or null. `format` and `dpi` are refused with `bad_field`: they are chosen at each download."
          }
        }
      },
      "SavedBarcodeAnswer": {
        "type": "object",
        "required": [
          "barcode",
          "checks",
          "facts"
        ],
        "properties": {
          "barcode": {
            "$ref": "#/components/schemas/SavedBarcode"
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Check"
            },
            "description": "Warnings only; empty when there is nothing to report."
          },
          "facts": {
            "$ref": "#/components/schemas/Facts"
          }
        }
      },
      "SavedBarcodeList": {
        "type": "object",
        "required": [
          "barcodes"
        ],
        "properties": {
          "barcodes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SavedBarcode"
            }
          }
        }
      },
      "PairRequest": {
        "type": "object",
        "description": "A retail pair to make. Any field not listed here is refused with `unknown_field`.",
        "required": [
          "gtin",
          "base_url",
          "format"
        ],
        "additionalProperties": false,
        "properties": {
          "gtin": {
            "type": "string",
            "description": "The product number: 12 digits for a UPC-A, 13 for an EAN-13.",
            "example": "036000291452"
          },
          "base_url": {
            "type": "string",
            "description": "The web address the QR code points to, starting with http:// or https://. The product number is added after it.",
            "example": "https://example.com"
          },
          "format": {
            "$ref": "#/components/schemas/Format"
          },
          "options": {
            "$ref": "#/components/schemas/Options"
          },
          "product_id": {
            "description": "Not available yet. Sending it, with any value, is answered with 501 `not_available_yet`."
          },
          "save": {
            "description": "Not available yet. Any value other than false is answered with 501 `not_available_yet`."
          }
        }
      },
      "Made": {
        "type": "object",
        "description": "One barcode that was made.",
        "required": [
          "image",
          "checks",
          "facts"
        ],
        "properties": {
          "image": {
            "$ref": "#/components/schemas/Image"
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Check"
            },
            "description": "Warnings only; empty when there is nothing to report."
          },
          "facts": {
            "$ref": "#/components/schemas/Facts"
          },
          "saved": {
            "type": "object",
            "description": "Only from `POST /barcodes` with `product_id`: where the settings were saved.",
            "required": [
              "product_id",
              "barcode_id"
            ],
            "properties": {
              "product_id": {
                "type": "integer"
              },
              "barcode_id": {
                "type": "integer"
              }
            }
          }
        }
      },
      "PairAnswer": {
        "type": "object",
        "required": [
          "linear",
          "qr"
        ],
        "properties": {
          "linear": {
            "$ref": "#/components/schemas/Made",
            "description": "The UPC-A or EAN-13."
          },
          "qr": {
            "$ref": "#/components/schemas/Made",
            "description": "The GS1 Digital Link QR code."
          }
        }
      },
      "BatchRequest": {
        "type": "object",
        "required": [
          "items"
        ],
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "minItems": 1,
            "description": "The barcodes to make. The most a batch may hold is `limits.batch_max_items` from `GET /types`.",
            "items": {
              "$ref": "#/components/schemas/BarcodeRequest"
            }
          }
        }
      },
      "BatchAnswer": {
        "type": "object",
        "required": [
          "made",
          "failed",
          "results"
        ],
        "properties": {
          "made": {
            "type": "integer",
            "description": "How many items were made. This many were counted against the month's allowance."
          },
          "failed": {
            "type": "integer",
            "description": "How many items were not made."
          },
          "results": {
            "type": "array",
            "description": "One result for each item, in the order they were sent.",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/BatchItemMade"
                },
                {
                  "$ref": "#/components/schemas/BatchItemFailed"
                }
              ]
            }
          }
        }
      },
      "BatchItemMade": {
        "type": "object",
        "required": [
          "index",
          "ok",
          "image",
          "checks",
          "facts"
        ],
        "properties": {
          "index": {
            "type": "integer",
            "description": "The item's place in `items`, counting from 0."
          },
          "ok": {
            "const": true
          },
          "image": {
            "$ref": "#/components/schemas/Image"
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Check"
            }
          },
          "facts": {
            "$ref": "#/components/schemas/Facts"
          }
        }
      },
      "BatchItemFailed": {
        "type": "object",
        "description": "An item that was not made and not counted. `error` is what the same request would have got from `POST /barcodes`: an engine check code with `checks` beside it, `monthly_limit_reached` with `usage` beside it, `format_not_in_plan`, `unknown_field`, `bad_body` (the item is not a JSON object), `not_available_yet`, or `server_error`. An item skipped because the answer is already full has `batch_output_too_large`. An item the server did not reach because it was restarting has `server_stopping`; send it again.",
        "required": [
          "index",
          "ok",
          "error"
        ],
        "properties": {
          "index": {
            "type": "integer",
            "description": "The item's place in `items`, counting from 0."
          },
          "ok": {
            "const": false
          },
          "error": {
            "$ref": "#/components/schemas/Error/properties/error"
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Check"
            }
          },
          "usage": {
            "$ref": "#/components/schemas/MonthUsage"
          }
        }
      },
      "MonthUsage": {
        "type": "object",
        "description": "Sent beside `error` with `monthly_limit_reached`: where the account's count stands.",
        "required": [
          "month",
          "used",
          "limit",
          "resets_at"
        ],
        "properties": {
          "month": {
            "type": "string",
            "description": "The month being counted, UTC.",
            "example": "2026-11"
          },
          "used": {
            "type": "integer",
            "description": "Barcodes made so far this month."
          },
          "limit": {
            "type": "integer",
            "description": "The plan's barcodes a month."
          },
          "resets_at": {
            "type": "string",
            "description": "When the count starts again: the first moment of next month, UTC.",
            "example": "2026-12-01T00:00:00Z"
          }
        }
      },
      "UsageAnswer": {
        "type": "object",
        "required": [
          "plan",
          "month",
          "used",
          "limit",
          "remaining",
          "resets_at",
          "formats",
          "batch"
        ],
        "properties": {
          "plan": {
            "type": "string",
            "description": "The account's plan id, as a key of `plans` in `GET /types`.",
            "example": "pro"
          },
          "month": {
            "type": "string",
            "description": "The month being counted, UTC.",
            "example": "2026-11"
          },
          "used": {
            "type": "integer",
            "description": "Barcodes made so far this month."
          },
          "limit": {
            "type": "integer",
            "description": "The plan's barcodes a month."
          },
          "remaining": {
            "type": "integer",
            "description": "How many more can be made this month; never below 0."
          },
          "resets_at": {
            "type": "string",
            "description": "When the count starts again: the first moment of next month, UTC.",
            "example": "2026-12-01T00:00:00Z"
          },
          "formats": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Format"
            },
            "description": "The file formats the plan makes."
          },
          "batch": {
            "type": "boolean",
            "description": "Whether the plan includes `POST /barcodes/batch`."
          }
        }
      },
      "TypesAnswer": {
        "type": "object",
        "required": [
          "types",
          "plans",
          "limits"
        ],
        "properties": {
          "types": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BarcodeType"
            }
          },
          "plans": {
            "type": "object",
            "description": "The live plan table, keyed by plan id. These are the numbers the server enforces. Each plan also carries `price`: what it costs in US cents, as `{ monthly, yearly }`, or null for a plan that is not sold.",
            "additionalProperties": {
              "$ref": "#/components/schemas/Plan"
            }
          },
          "limits": {
            "type": "object",
            "required": [
              "batch_max_items",
              "body_max_bytes",
              "batch_body_max_bytes"
            ],
            "properties": {
              "batch_max_items": {
                "type": "integer",
                "description": "The most items one batch may hold."
              },
              "body_max_bytes": {
                "type": "integer",
                "description": "The most bytes a request body may hold, on every address but the batch."
              },
              "batch_body_max_bytes": {
                "type": "integer",
                "description": "The most bytes a batch request body may hold."
              }
            }
          }
        }
      },
      "BarcodeType": {
        "type": "object",
        "required": [
          "id",
          "label",
          "family",
          "gs1",
          "formats",
          "options"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "What to send as `type`.",
            "example": "upca"
          },
          "label": {
            "type": "string",
            "example": "UPC-A"
          },
          "family": {
            "type": "string",
            "description": "The group the type belongs to.",
            "example": "retail"
          },
          "gs1": {
            "type": "boolean",
            "description": "True when the type's data is checked against GS1 format rules."
          },
          "formats": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Format"
            },
            "description": "The formats the type can be drawn in. An account's plan may allow fewer."
          },
          "options": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The names of the settings the type takes."
          }
        }
      },
      "Plan": {
        "type": "object",
        "required": [
          "label",
          "monthly",
          "formats",
          "batch",
          "burst",
          "per_sec"
        ],
        "properties": {
          "label": {
            "type": "string",
            "description": "The plan's name as it is shown to people."
          },
          "monthly": {
            "type": "integer",
            "description": "Barcodes a month for the whole account."
          },
          "formats": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Format"
            },
            "description": "The file formats the plan makes."
          },
          "batch": {
            "type": "boolean",
            "description": "Whether the plan includes `POST /barcodes/batch`."
          },
          "burst": {
            "type": "integer",
            "description": "How many requests one key may send at once before it is told to wait."
          },
          "per_sec": {
            "type": "number",
            "description": "How many requests a second one key may keep sending after that."
          },
          "handoff": {
            "type": "boolean",
            "description": "Whether the plan includes `GET /products/{id}/handoff.zip`, the printer handoff pack."
          },
          "price": {
            "type": [
              "object",
              "null"
            ],
            "description": "What the plan costs in US cents, paid monthly or yearly; null for a plan that is not sold.",
            "required": [
              "monthly",
              "yearly"
            ],
            "properties": {
              "monthly": {
                "type": "integer",
                "description": "US cents a month, paid monthly.",
                "example": 900
              },
              "yearly": {
                "type": "integer",
                "description": "US cents a year, paid yearly.",
                "example": 9000
              }
            }
          }
        }
      },
      "ValidateRequest": {
        "type": "object",
        "required": [
          "type",
          "data"
        ],
        "additionalProperties": false,
        "properties": {
          "type": {
            "type": "string",
            "description": "The barcode type's id, from `GET /types`.",
            "example": "ean13"
          },
          "data": {
            "type": "string",
            "description": "The data to check. Always a string, so leading zeros are kept.",
            "example": "400638133393"
          }
        }
      },
      "ValidateAnswer": {
        "type": "object",
        "required": [
          "ok",
          "data",
          "checks"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "description": "True when the data can go into a barcode of this type."
          },
          "data": {
            "type": [
              "string",
              "null"
            ],
            "description": "The data as it would be encoded, with any added check digit; null when it is wrong."
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Check"
            }
          }
        }
      },
      "BuildRequest": {
        "type": "object",
        "required": [
          "kind",
          "fields"
        ],
        "additionalProperties": false,
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "gs1-128",
              "digital-link"
            ],
            "description": "`gs1-128` writes bracket data; `digital-link` writes a web address."
          },
          "fields": {
            "type": "object",
            "description": "The named values. Each is a string. A name that does not exist is reported as `unknown_ai`.",
            "properties": {
              "sscc": {
                "type": "string",
                "description": "A shipping container number. Not for `digital-link`."
              },
              "gtin": {
                "type": "string",
                "description": "The product number."
              },
              "production_date": {
                "type": "string",
                "description": "YYYY-MM-DD."
              },
              "best_before": {
                "type": "string",
                "description": "YYYY-MM-DD."
              },
              "expiry": {
                "type": "string",
                "description": "YYYY-MM-DD."
              },
              "lot": {
                "type": "string"
              },
              "serial": {
                "type": "string"
              },
              "count": {
                "type": "string"
              }
            }
          },
          "base_url": {
            "type": "string",
            "description": "For `digital-link`: your website's address, starting with http:// or https://.",
            "example": "https://example.com"
          }
        }
      },
      "BuildAnswer": {
        "type": "object",
        "required": [
          "ok",
          "data",
          "checks"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "description": "True when `data` was built."
          },
          "data": {
            "type": [
              "string",
              "null"
            ],
            "description": "The GS1 data, ready to send as `data` to `POST /barcodes`; null when the fields are wrong."
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Check"
            }
          }
        }
      }
    }
  }
}
