{
  "openapi": "3.1.0",
  "info": {
    "title": "QR Code 42 API",
    "version": "1.0.0",
    "description": "Everything an org API key can do: inspect org & entitlements, claim GS1 identifiers, manage products and links, export print-ready QR/barcode labels (SVG & PNG), bulk-import CSV links, manage landing pages and short links, and read scan analytics. Keys are minted in the dashboard (API Keys tab), are scoped to one org, need a plan with API access, and are rate-limited to 120 requests/min per key (`X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`, `Retry-After`). Webhook management is session-only; the webhook payloads are described under `webhooks`. Prose guide: https://qrcode42.com/docs/api"
  },
  "servers": [
    {
      "url": "https://qrcode42.com"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/api/v1/org": {
      "get": {
        "operationId": "getOrg",
        "summary": "Inspect the API key's org, granted scopes, and live plan entitlements",
        "description": "Available to any valid active API key regardless of scopes — ideal for connection checks (Zapier/Make/n8n/CI) and reading remaining quota.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "*",
        "responses": {
          "200": {
            "description": "Org, key metadata, and entitlements",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgInfo"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-API-key rate limit exceeded (default 120 requests/min); inspect Retry-After and X-RateLimit-* headers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/gtins": {
      "post": {
        "operationId": "claimIdentifier",
        "summary": "Claim a GS1 identifier (GTIN, GLN, GIAI, GRAI or SSCC)",
        "description": "Claims an identifier on a host. On the shared hosts the claim is `pending` until it is reviewed; on your own verified brand host it verifies itself.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "gtins:write",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "gtin14",
                  "hostname"
                ],
                "properties": {
                  "gtin14": {
                    "type": "string",
                    "description": "The identifier for the chosen keyAi: 14-digit GTIN (01), 13-digit GLN (414), 4–30 char GIAI (8004), 14-digit+optional-serial GRAI (8003), or 18-digit SSCC (00)"
                  },
                  "keyAi": {
                    "type": "string",
                    "enum": [
                      "01",
                      "414",
                      "8004",
                      "8003",
                      "00"
                    ],
                    "default": "01",
                    "description": "01 = GTIN, 414 = GLN (a location), 8004 = GIAI (an asset), 8003 = GRAI (a returnable asset), 00 = SSCC (a shipment)"
                  },
                  "hostname": {
                    "type": "string",
                    "description": "qr-42.com, qr42.link, or a verified brand host your org owns"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "shared",
                      "brand"
                    ],
                    "default": "shared"
                  },
                  "evidenceUrl": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created claim",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClaimCreated"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-API-key rate limit exceeded (default 120 requests/min); inspect Retry-After and X-RateLimit-* headers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listClaims",
        "summary": "List your claims and their status",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "gtins:read",
        "responses": {
          "200": {
            "description": "Claims",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "claims": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Claim"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products": {
      "post": {
        "operationId": "upsertProduct",
        "summary": "Create or update a product",
        "description": "A real upsert: call again with the same identifier to change `name` or `brandName` (an omitted field is left alone). 201 the first time, 200 after.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "gtins:write",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "gtin14"
                ],
                "properties": {
                  "gtin14": {
                    "type": "string"
                  },
                  "keyAi": {
                    "type": "string",
                    "enum": [
                      "01",
                      "414",
                      "8004",
                      "8003",
                      "00"
                    ],
                    "default": "01"
                  },
                  "name": {
                    "type": "string"
                  },
                  "brandName": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-API-key rate limit exceeded (default 120 requests/min); inspect Retry-After and X-RateLimit-* headers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listProducts",
        "summary": "List your products",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "gtins:read",
        "responses": {
          "200": {
            "description": "Products",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "products": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Product"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products/{id}/links": {
      "get": {
        "operationId": "listLinks",
        "summary": "List a product's links",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "links:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Product id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The product's links",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkList"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such product",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "addLink",
        "summary": "Add a link",
        "description": "Needs a verified claim for this identifier on the host. Live on the resolver within seconds. Adding an identical link returns 200 idempotently.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "links:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Product id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/LinkInput"
                  },
                  {
                    "type": "object",
                    "required": [
                      "hostname",
                      "linkType",
                      "href",
                      "title"
                    ],
                    "properties": {
                      "hostname": {
                        "type": "string"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Identical link already exists; product's full link list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkList"
                }
              }
            }
          },
          "201": {
            "description": "The product's full link list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such product",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-API-key rate limit exceeded (default 120 requests/min); inspect Retry-After and X-RateLimit-* headers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Saved in database, but publishing to one or more resolver hosts failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products/{id}/links/{linkId}": {
      "patch": {
        "operationId": "editLink",
        "summary": "Edit a link",
        "description": "Only the fields you send change; `null` clears an optional field. `isDefault: true` makes this the product's one default and clears the flag on the others. Republished on every host the product is verified on.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "links:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Product id",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "linkId",
            "in": "path",
            "required": true,
            "description": "Link id, from a links response",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LinkInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The product's full link list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such product, or the link isn't on it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-API-key rate limit exceeded (default 120 requests/min); inspect Retry-After and X-RateLimit-* headers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Saved in database, but publishing to one or more resolver hosts failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteLink",
        "summary": "Remove a link",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "links:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Product id",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "linkId",
            "in": "path",
            "required": true,
            "description": "Link id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The remaining links",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkList"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such product, or the link isn't on it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Removed in database, but publishing to one or more resolver hosts failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/short-links": {
      "get": {
        "operationId": "listShortLinks",
        "summary": "List your short links",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "shortlinks:read",
        "responses": {
          "200": {
            "description": "Short links",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "shortLinks": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ShortLink"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createShortLink",
        "summary": "Create a short link",
        "description": "Answers on qr42.link/{code} and qr-42.com/s/{code}. Limited by plan.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "shortlinks:write",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "code",
                  "targetUrl"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "pattern": "^[a-z0-9-]{3,64}$"
                  },
                  "targetUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "expiresAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "hostname": {
                    "type": "string",
                    "description": "Omit for the QR Code 42 domains; or a verified brand host you own"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The short link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShortLink"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-API-key rate limit exceeded (default 120 requests/min); inspect Retry-After and X-RateLimit-* headers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/short-links/{id}": {
      "patch": {
        "operationId": "editShortLink",
        "summary": "Change a short link's target, expiry or on/off state",
        "description": "The code never changes: it is what's printed.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "shortlinks:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Short link id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "targetUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "expiresAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "active": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The short link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShortLink"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such short link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-API-key rate limit exceeded (default 120 requests/min); inspect Retry-After and X-RateLimit-* headers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteShortLink",
        "summary": "Delete a short link",
        "description": "Stops redirecting (410) and frees the plan slot; the code stays reserved so no one else can take it over.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "shortlinks:write",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Short link id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such short link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products/{id}/label": {
      "get": {
        "operationId": "getProductLabel",
        "summary": "Export print-ready QR & 1D barcode SVGs plus minimum print size guidance",
        "description": "Requires a verified claim for this product on `hostname`. Non-GTIN identifiers return `barcodeSvg: null`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "gtins:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Product id",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hostname",
            "in": "query",
            "required": true,
            "description": "Verified host (e.g. qr-42.com or your brand host)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SVG artwork and size calculator output",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabelExport"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such product",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-API-key rate limit exceeded (default 120 requests/min); inspect Retry-After and X-RateLimit-* headers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products/{id}/label/qr.png": {
      "get": {
        "operationId": "getProductLabelQrPng",
        "summary": "Download the GS1 Digital Link QR code as PNG",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "gtins:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Product id",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hostname",
            "in": "query",
            "required": true,
            "description": "Verified host",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PNG QR code image",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such product",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-API-key rate limit exceeded (default 120 requests/min); inspect Retry-After and X-RateLimit-* headers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products/{id}/label/barcode.png": {
      "get": {
        "operationId": "getProductLabelBarcodePng",
        "summary": "Download the matching 1D barcode (UPC-A / EAN-13 / ITF-14) as PNG",
        "description": "Only available for GTIN (`keyAi: '01'`) products.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "gtins:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Product id",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hostname",
            "in": "query",
            "required": true,
            "description": "Verified host",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PNG 1D barcode image",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such product",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-API-key rate limit exceeded (default 120 requests/min); inspect Retry-After and X-RateLimit-* headers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/landing-pages": {
      "get": {
        "operationId": "listLandingPages",
        "summary": "List your hosted landing pages",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "landingpages:read",
        "responses": {
          "200": {
            "description": "Landing pages",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "landingPages": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LandingPage"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-API-key rate limit exceeded (default 120 requests/min); inspect Retry-After and X-RateLimit-* headers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "publishLandingPage",
        "summary": "Create or update a hosted /l/{slug} landing page",
        "description": "Supports light/dark themes, custom brand names, and hex accent colors. Live on the resolver immediately.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "landingpages:write",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "hostname",
                  "slug",
                  "title"
                ],
                "properties": {
                  "hostname": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string",
                    "pattern": "^[a-z0-9-]{3,64}$"
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "bodyText": {
                    "type": "string",
                    "maxLength": 10000
                  },
                  "imageUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "ctaText": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "ctaHref": {
                    "type": "string",
                    "format": "uri"
                  },
                  "brandName": {
                    "type": "string",
                    "maxLength": 80
                  },
                  "theme": {
                    "type": "string",
                    "enum": [
                      "dark",
                      "light"
                    ]
                  },
                  "accentColor": {
                    "type": "string",
                    "pattern": "^#[0-9a-fA-F]{6}$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Published landing page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LandingPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-API-key rate limit exceeded (default 120 requests/min); inspect Retry-After and X-RateLimit-* headers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/landing-pages/{id}": {
      "get": {
        "operationId": "getLandingPage",
        "summary": "Get a single hosted landing page",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "landingpages:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Landing page id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Landing page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LandingPage"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such landing page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-API-key rate limit exceeded (default 120 requests/min); inspect Retry-After and X-RateLimit-* headers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/bulk-import": {
      "post": {
        "operationId": "bulkImportLinks",
        "summary": "Bulk import product links from CSV",
        "description": "Publishes links in batch for identifiers that already hold verified claims. Returns 200 when all rows succeed, or 207 Multi-Status on partial success with per-line errors.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "links:write",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "csv"
                ],
                "properties": {
                  "csv": {
                    "type": "string",
                    "description": "UTF-8 CSV with header row (gtin14,hostname,linkType,href,title,...)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "All rows imported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkImportResult"
                }
              }
            }
          },
          "207": {
            "description": "Partial import with skipped row errors",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkImportResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-API-key rate limit exceeded (default 120 requests/min); inspect Retry-After and X-RateLimit-* headers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/analytics": {
      "get": {
        "operationId": "getOrgAnalytics",
        "summary": "Scan analytics for this API key's org",
        "description": "Shorthand for `/api/v1/orgs/{orgId}/analytics` — automatically scoped to the key's org. Aggregates only: no IP addresses or individual scans. Retention by plan: Free/Starter 30d, Lifetime Tier 1 90d, Growth/Scale/Lifetime Tiers 2–3 365d, Enterprise/Lifetime Tier 4 730d.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "analytics:read",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "One GTIN-14, `{ai}:{id}` for non-GTIN keys (e.g. `414:{gln}`), or a short-link code"
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Narrow to the last N days (never widens past the plan)"
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Start of an exact UTC-day range"
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "End of the range, inclusive"
          }
        ],
        "responses": {
          "200": {
            "description": "Analytics",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Analytics"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`id` isn't one of your identifiers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-API-key rate limit exceeded (default 120 requests/min); inspect Retry-After and X-RateLimit-* headers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Analytics isn't configured on this deployment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Analytics query failed upstream",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{orgId}/analytics": {
      "get": {
        "operationId": "getAnalytics",
        "summary": "Scan analytics (explicit orgId)",
        "description": "Aggregates only: no IP addresses and no individual scans. Retention by plan: Free/Starter 30d, Lifetime Tier 1 90d, Growth/Scale/Lifetime Tiers 2–3 365d, Enterprise/Lifetime Tier 4 730d.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scope": "analytics:read",
        "parameters": [
          {
            "name": "orgId",
            "in": "path",
            "required": true,
            "description": "Your org id (a key can only read its own)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "One GTIN-14, `{ai}:{id}` for non-GTIN keys (e.g. `414:{gln}`), or a short-link code"
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Narrow to the last N days (never widens past the plan)"
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Start of an exact UTC-day range"
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "End of the range, inclusive"
          }
        ],
        "responses": {
          "200": {
            "description": "Analytics",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Analytics"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the scope, belongs to another org, or the plan doesn't allow it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`id` isn't one of your identifiers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-API-key rate limit exceeded (default 120 requests/min); inspect Retry-After and X-RateLimit-* headers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Analytics isn't configured on this deployment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Analytics query failed upstream",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "scan.daily": {
      "post": {
        "summary": "Daily scan summary",
        "description": "Any 2xx response counts as delivered; anything else is retried after 5 min, 30 min, 2 h, 12 h and 24 h (six attempts) with the identical body.",
        "parameters": [
          {
            "name": "X-QR42-Event",
            "in": "header",
            "required": true,
            "description": "The event name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-QR42-Delivery",
            "in": "header",
            "required": true,
            "description": "Same as the payload `id`; use it to ignore a repeat",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-QR42-Signature",
            "in": "header",
            "required": true,
            "description": "`t=<unix seconds>,v1=<hex HMAC-SHA256 of '<t>.<raw body>'>`, keyed with the endpoint's signing secret",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScanDailyPayload"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received"
          }
        }
      }
    },
    "claim.verified": {
      "post": {
        "summary": "A claim was verified",
        "description": "Any 2xx response counts as delivered; anything else is retried after 5 min, 30 min, 2 h, 12 h and 24 h (six attempts) with the identical body.",
        "parameters": [
          {
            "name": "X-QR42-Event",
            "in": "header",
            "required": true,
            "description": "The event name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-QR42-Delivery",
            "in": "header",
            "required": true,
            "description": "Same as the payload `id`; use it to ignore a repeat",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-QR42-Signature",
            "in": "header",
            "required": true,
            "description": "`t=<unix seconds>,v1=<hex HMAC-SHA256 of '<t>.<raw body>'>`, keyed with the endpoint's signing secret",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClaimEventPayload"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received"
          }
        }
      }
    },
    "claim.rejected": {
      "post": {
        "summary": "A claim was rejected",
        "description": "Any 2xx response counts as delivered; anything else is retried after 5 min, 30 min, 2 h, 12 h and 24 h (six attempts) with the identical body.",
        "parameters": [
          {
            "name": "X-QR42-Event",
            "in": "header",
            "required": true,
            "description": "The event name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-QR42-Delivery",
            "in": "header",
            "required": true,
            "description": "Same as the payload `id`; use it to ignore a repeat",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-QR42-Signature",
            "in": "header",
            "required": true,
            "description": "`t=<unix seconds>,v1=<hex HMAC-SHA256 of '<t>.<raw body>'>`, keyed with the endpoint's signing secret",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClaimEventPayload"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "`Authorization: Bearer qr42_live_...`. Scopes: links:read, links:write, gtins:read, gtins:write, shortlinks:read, shortlinks:write, landingpages:read, landingpages:write, analytics:read."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ]
      },
      "OrgInfo": {
        "type": "object",
        "properties": {
          "org": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "plan": {
                "type": "string"
              },
              "planLabel": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "comped": {
                "type": "boolean"
              }
            }
          },
          "key": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "prefix": {
                "type": "string"
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "entitlements": {
            "type": "object",
            "properties": {
              "planLabel": {
                "type": "string"
              },
              "isLtd": {
                "type": "boolean"
              },
              "activeClaims": {
                "type": "integer"
              },
              "maxActiveGtins": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "shortLinks": {
                "type": "integer"
              },
              "maxShortLinks": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "landingPages": {
                "type": "integer"
              },
              "maxLandingPages": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "brandHosts": {
                "type": "integer"
              },
              "maxBrandHosts": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "members": {
                "type": "integer"
              },
              "maxMembers": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "analyticsWindowDays": {
                "type": "integer"
              },
              "apiAccess": {
                "type": "boolean"
              },
              "bulkImport": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "LabelExport": {
        "type": "object",
        "properties": {
          "uri": {
            "type": "string",
            "format": "uri"
          },
          "qrSvg": {
            "type": "string"
          },
          "barcodeSvg": {
            "type": [
              "string",
              "null"
            ]
          },
          "size": {
            "type": "object",
            "properties": {
              "qrVersion": {
                "type": "integer"
              },
              "moduleCount": {
                "type": "integer"
              },
              "minPrintSizeMmStandalone": {
                "type": "number"
              },
              "minPrintSizeMmNear1D": {
                "type": "number"
              },
              "brandIsLargerThanShared": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "LandingPage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "org_id": {
            "type": "string"
          },
          "host_id": {
            "type": "string"
          },
          "hostname": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "template": {
            "type": "string"
          },
          "content_json": {
            "type": "string"
          },
          "published_at": {
            "type": "string"
          }
        }
      },
      "BulkImportResult": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "imported": {
            "type": "integer"
          },
          "productsUpdated": {
            "type": "integer"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "line": {
                  "type": "integer"
                },
                "gtin14": {
                  "type": "string"
                },
                "hostname": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "ClaimCreated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "org_id": {
            "type": "string"
          },
          "gtin14": {
            "type": "string",
            "description": "The identifier for the chosen key_ai (GTIN-14, GLN-13, GIAI, GRAI or SSCC-18)"
          },
          "key_ai": {
            "type": "string",
            "enum": [
              "01",
              "414",
              "8004",
              "8003",
              "00"
            ]
          },
          "host_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "verified",
              "rejected",
              "revoked"
            ]
          },
          "evidence_ref": {
            "type": [
              "string",
              "null"
            ]
          },
          "verified_by": {
            "type": [
              "string",
              "null"
            ]
          },
          "verified_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          }
        }
      },
      "Claim": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "gtin14": {
            "type": "string",
            "description": "The identifier for the chosen key_ai (GTIN-14, GLN-13, GIAI, GRAI or SSCC-18)"
          },
          "key_ai": {
            "type": "string",
            "enum": [
              "01",
              "414",
              "8004",
              "8003",
              "00"
            ]
          },
          "hostname": {
            "type": "string"
          },
          "host_kind": {
            "type": "string",
            "enum": [
              "shared",
              "brand"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "verified",
              "rejected",
              "revoked"
            ]
          },
          "evidence_ref": {
            "type": [
              "string",
              "null"
            ]
          },
          "verified_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          }
        }
      },
      "Product": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "gtin14": {
            "type": "string"
          },
          "key_ai": {
            "type": "string",
            "enum": [
              "01",
              "414",
              "8004",
              "8003",
              "00"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "brand_name": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "LinkInput": {
        "type": "object",
        "properties": {
          "linkType": {
            "type": "string",
            "description": "A GS1 link type like gs1:pip, or a full https URI"
          },
          "href": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "lang": {
            "type": [
              "string",
              "null"
            ],
            "description": "BCP-47 tag"
          },
          "country": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 3166-1 alpha-2"
          },
          "mediaType": {
            "type": [
              "string",
              "null"
            ]
          },
          "isDefault": {
            "type": "boolean"
          },
          "scope": {
            "type": [
              "object",
              "null"
            ],
            "description": "Qualifier scope: cpv, lot, serial for a GTIN; ext for a GLN. A key from the wrong family is a 400.",
            "properties": {
              "cpv": {
                "type": "string"
              },
              "lot": {
                "type": "string"
              },
              "serial": {
                "type": "string"
              },
              "ext": {
                "type": "string"
              }
            }
          }
        }
      },
      "Link": {
        "allOf": [
          {
            "$ref": "#/components/schemas/LinkInput"
          },
          {
            "type": "object",
            "required": [
              "id",
              "linkType",
              "href",
              "title"
            ],
            "properties": {
              "id": {
                "type": "string"
              }
            }
          }
        ]
      },
      "LinkList": {
        "type": "object",
        "description": "A GTIN product carries `gtin14`; any other key carries `key`.",
        "properties": {
          "gtin14": {
            "type": "string"
          },
          "key": {
            "type": "object",
            "properties": {
              "ai": {
                "type": "string"
              },
              "id": {
                "type": "string"
              }
            }
          },
          "links": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Link"
            }
          }
        },
        "required": [
          "links"
        ]
      },
      "ShortLink": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "target_url": {
            "type": "string"
          },
          "active": {
            "type": "integer",
            "enum": [
              0,
              1
            ]
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "hostname": {
            "type": "string"
          },
          "urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          }
        }
      },
      "Bucket": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string"
          },
          "scans": {
            "type": "integer"
          }
        }
      },
      "Analytics": {
        "type": "object",
        "properties": {
          "windowDays": {
            "type": "integer"
          },
          "from": {
            "type": "string",
            "format": "date",
            "description": "Present when from/to were sent"
          },
          "to": {
            "type": "string",
            "format": "date"
          },
          "hasIds": {
            "type": "boolean"
          },
          "totalScans": {
            "type": "integer"
          },
          "byDay": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "day": {
                  "type": "string",
                  "format": "date"
                },
                "scans": {
                  "type": "integer"
                }
              }
            }
          },
          "byLinkType": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Bucket"
            }
          },
          "byCountry": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Bucket"
            }
          }
        }
      },
      "ScanDailyPayload": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "event": {
            "const": "scan.daily"
          },
          "day": {
            "type": "string",
            "format": "date"
          },
          "orgId": {
            "type": "string"
          },
          "totalScans": {
            "type": "integer"
          },
          "byIdentifier": {
            "type": "array",
            "description": "Top 100",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "scans": {
                  "type": "integer"
                }
              }
            }
          },
          "otherScans": {
            "type": "integer",
            "description": "Scans on identifiers beyond the top 100"
          },
          "byLinkType": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Bucket"
            }
          },
          "byCountry": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Bucket"
            }
          },
          "test": {
            "const": true,
            "description": "Present only on a sample sent by the Send test button"
          }
        }
      },
      "ClaimEventPayload": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "event": {
            "enum": [
              "claim.verified",
              "claim.rejected"
            ]
          },
          "orgId": {
            "type": "string"
          },
          "claim": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "keyAi": {
                "type": "string"
              },
              "identifier": {
                "type": "string"
              },
              "hostname": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "reviewedAt": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      }
    }
  }
}