{
  "openapi": "3.1.0",
  "info": {
    "title": "Serialis public API",
    "version": "1.0.0",
    "description": "Serialized inventory for Shopify. Authentication: `Authorization: Bearer srl_…` API key created in the app (Settings › API keys), with scopes. `Idempotency-Key` is required on every POST (replayed 24 h, 409 when the body differs); `If-Match` with the ETag on the routes that change a versioned resource (412 when stale); cursor pagination (`limit` ≤ 250); errors as problem+json (RFC 9457) with a stable `code`; 20 requests per second per key with a burst of 100 (`RateLimit-*` headers, 429 with `Retry-After`). Additive changes without notice; an incompatible change is a new major version, the previous one kept 12 months."
  },
  "servers": [
    {
      "url": "https://api.serialis.dev/v1"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/tracked-items": {
      "get": {
        "operationId": "listTrackedItems",
        "summary": "List tracked items",
        "x-required-scope": "units:read",
        "security": [
          {
            "apiKey": [
              "units:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "variant",
            "in": "query",
            "required": false,
            "description": "Variant GID",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "product",
            "in": "query",
            "required": false,
            "description": "Product GID",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor returned as `nextCursor` by the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size, 1 to 250 (default 50).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List tracked items",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrackedItemPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "trackItems",
        "summary": "Activate (or deactivate with `action: \"untrack\"`) the tracking of variants",
        "x-required-scope": "admin",
        "security": [
          {
            "apiKey": [
              "admin"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TrackItemsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Activate (or deactivate with `action: \"untrack\"`) the tracking of variants",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrackedItemPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/units": {
      "get": {
        "operationId": "listUnits",
        "summary": "List units",
        "x-required-scope": "units:read",
        "security": [
          {
            "apiKey": [
              "units:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "variant",
            "in": "query",
            "required": false,
            "description": "Variant GID",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "location",
            "in": "query",
            "required": false,
            "description": "Location GID",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "One or more states, repeated or comma separated",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Identifier search (normalized)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor returned as `nextCursor` by the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size, 1 to 250 (default 50).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List units",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnitPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createUnit",
        "summary": "Create one unit (same rules as the atomic batch)",
        "x-required-scope": "units:write",
        "security": [
          {
            "apiKey": [
              "units:write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUnitRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Create one unit (same rules as the atomic batch)",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unit"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/units/{id}": {
      "get": {
        "operationId": "getUnit",
        "summary": "Read a unit (ETag from its version)",
        "x-required-scope": "units:read",
        "security": [
          {
            "apiKey": [
              "units:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Read a unit (ETag from its version)",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unit"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/units/{id}/remove": {
      "post": {
        "operationId": "removeUnit",
        "summary": "Remove a ref for good (the unit leaves the stock and keeps its history; the ref can be entered again)",
        "x-required-scope": "units:write",
        "security": [
          {
            "apiKey": [
              "units:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RemoveUnitRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Remove a ref for good (the unit leaves the stock and keeps its history; the ref can be entered again)",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unit"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "412": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/units/batch": {
      "post": {
        "operationId": "createUnitsBatch",
        "summary": "Create up to 1,000 units of one variant at one location (atomic or per item)",
        "x-required-scope": "units:write",
        "security": [
          {
            "apiKey": [
              "units:write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUnitsBatchRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Create up to 1,000 units of one variant at one location (atomic or per item)",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateUnitsBatchResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/units/batch/check": {
      "post": {
        "operationId": "checkUnitsBatch",
        "summary": "Check a batch without writing anything",
        "x-required-scope": "units:write",
        "security": [
          {
            "apiKey": [
              "units:write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUnitsBatchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Check a batch without writing anything",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckUnitsBatchResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/lookup": {
      "get": {
        "operationId": "lookup",
        "summary": "Find a unit by any identifier",
        "x-required-scope": "units:read",
        "security": [
          {
            "apiKey": [
              "units:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "identifier",
            "in": "query",
            "required": true,
            "description": "Identifier value",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Find a unit by any identifier",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LookupResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/units/{id}/events": {
      "get": {
        "operationId": "unitEvents",
        "summary": "History of a unit",
        "x-required-scope": "units:read",
        "security": [
          {
            "apiKey": [
              "units:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor returned as `nextCursor` by the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size, 1 to 250 (default 50).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "History of a unit",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnitEventPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/orders/{orderId}/allocations": {
      "get": {
        "operationId": "orderAllocations",
        "summary": "Units of an order, line by line",
        "x-required-scope": "allocations:read",
        "security": [
          {
            "apiKey": [
              "allocations:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Units of an order, line by line",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderAllocationsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/allocations": {
      "post": {
        "operationId": "createAllocation",
        "summary": "Allocate a unit to an order line",
        "x-required-scope": "allocations:write",
        "security": [
          {
            "apiKey": [
              "allocations:write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAllocationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Allocate a unit to an order line",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Allocation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/allocations/{id}": {
      "delete": {
        "operationId": "deleteAllocation",
        "summary": "Remove an allocated unit before shipping",
        "x-required-scope": "allocations:write",
        "security": [
          {
            "apiKey": [
              "allocations:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "responses": {
          "204": {
            "description": "Remove an allocated unit before shipping",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "412": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/allocations/{id}/replace": {
      "post": {
        "operationId": "replaceAllocation",
        "summary": "Replace an allocated unit",
        "x-required-scope": "allocations:write",
        "security": [
          {
            "apiKey": [
              "allocations:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplaceAllocationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Replace an allocated unit",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Allocation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "412": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/allocations/{id}/confirm-shipped": {
      "post": {
        "operationId": "confirmShipped",
        "summary": "Designate the unit really shipped",
        "x-required-scope": "allocations:write",
        "security": [
          {
            "apiKey": [
              "allocations:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfirmShippedRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Designate the unit really shipped",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Allocation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "412": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/returns/{returnId}/identify": {
      "post": {
        "operationId": "identifyReturn",
        "summary": "Identify the unit received in a return",
        "x-required-scope": "units:write",
        "security": [
          {
            "apiKey": [
              "units:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "returnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IdentifyReturnRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Identify the unit received in a return",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/anomalies": {
      "get": {
        "operationId": "listAnomalies",
        "summary": "List anomalies",
        "x-required-scope": "anomalies:read",
        "security": [
          {
            "apiKey": [
              "anomalies:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "open, acknowledged or resolved",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "severity",
            "in": "query",
            "required": false,
            "description": "critical, warning or info",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Anomaly type (12.7)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor returned as `nextCursor` by the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size, 1 to 250 (default 50).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List anomalies",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnomalyPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/anomalies/{id}/acknowledge": {
      "post": {
        "operationId": "acknowledgeAnomaly",
        "summary": "Acknowledge an anomaly",
        "x-required-scope": "anomalies:write",
        "security": [
          {
            "apiKey": [
              "anomalies:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Acknowledge an anomaly",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Anomaly"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/anomalies/{id}/resolve": {
      "post": {
        "operationId": "resolveAnomaly",
        "summary": "Resolve an anomaly (a resolution that writes the Shopify stock requires the `admin` scope)",
        "x-required-scope": "anomalies:write",
        "security": [
          {
            "apiKey": [
              "anomalies:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResolveAnomalyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Resolve an anomaly (a resolution that writes the Shopify stock requires the `admin` scope)",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Anomaly"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/locations": {
      "get": {
        "operationId": "listLocations",
        "summary": "Locations known to the app",
        "x-required-scope": "units:read",
        "security": [
          {
            "apiKey": [
              "units:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Locations known to the app",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LocationPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/settings": {
      "get": {
        "operationId": "getSettings",
        "summary": "Settings of a scope with their origin",
        "x-required-scope": "admin",
        "security": [
          {
            "apiKey": [
              "admin"
            ]
          }
        ],
        "parameters": [
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "description": "`shop`, `location:<id>` or `tracked_item:<id>`",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Settings of a scope with their origin",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettingsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "patchSettings",
        "summary": "Change settings",
        "x-required-scope": "admin",
        "security": [
          {
            "apiKey": [
              "admin"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchSettingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Change settings",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettingsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "412": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/settings/simulate": {
      "post": {
        "operationId": "simulateSettings",
        "summary": "Simulate a change of \"simulation\" settings (id valid 10 minutes)",
        "x-required-scope": "admin",
        "security": [
          {
            "apiKey": [
              "admin"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SimulateSettingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Simulate a change of \"simulation\" settings (id valid 10 minutes)",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettingsSimulation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/imports": {
      "post": {
        "operationId": "createImport",
        "summary": "Simulate a CSV import",
        "x-required-scope": "units:write",
        "security": [
          {
            "apiKey": [
              "units:write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateImportRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Simulate a CSV import",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/imports/{id}": {
      "get": {
        "operationId": "getImport",
        "summary": "Import report",
        "x-required-scope": "units:read",
        "security": [
          {
            "apiKey": [
              "units:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Import report",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/imports/{id}/confirm": {
      "post": {
        "operationId": "confirmImport",
        "summary": "Confirm a simulated import",
        "x-required-scope": "units:write",
        "security": [
          {
            "apiKey": [
              "units:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Confirm a simulated import",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/automation/pause": {
      "post": {
        "operationId": "pause",
        "summary": "Emergency stop: suspend automatic allocation",
        "x-required-scope": "admin",
        "security": [
          {
            "apiKey": [
              "admin"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Emergency stop: suspend automatic allocation",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationStateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/automation/resume": {
      "post": {
        "operationId": "resume",
        "summary": "Resume automatic allocation",
        "x-required-scope": "admin",
        "security": [
          {
            "apiKey": [
              "admin"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Resume automatic allocation",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Burst size of the key (100)."
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests left in the bucket."
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bucket is full again."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationStateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "srl_<version>_<location>_<shop>_<prefix>_<seal>.<secret>",
        "description": "Scopes: units:read, units:write, allocations:read, allocations:write, anomalies:read, anomalies:write, admin."
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "1 to 255 characters; the response is replayed for 24 h.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      },
      "IfMatch": {
        "name": "If-Match",
        "in": "header",
        "required": false,
        "description": "ETag of the resource read before the change.",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "Problem": {
        "description": "Error (problem+json)",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "Unauthenticated": {
        "description": "Missing, malformed, unknown or revoked API key",
        "headers": {
          "WWW-Authenticate": {
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Too many requests",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            }
          },
          "RateLimit-Limit": {
            "schema": {
              "type": "integer"
            },
            "description": "Burst size of the key (100)."
          },
          "RateLimit-Remaining": {
            "schema": {
              "type": "integer"
            },
            "description": "Requests left in the bucket."
          },
          "RateLimit-Reset": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds until the bucket is full again."
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      }
    },
    "schemas": {
      "Problem": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "code": {
            "type": "string",
            "enum": [
              "unauthenticated",
              "forbidden",
              "not_found",
              "validation_failed",
              "idempotency_conflict",
              "precondition_failed",
              "rate_limited",
              "unit_not_available",
              "identifier_conflict",
              "invalid_transition",
              "variant_mismatch",
              "location_mismatch",
              "ambiguous_ref",
              "unknown_ref",
              "not_tracked",
              "emergency_stop",
              "simulation_expired",
              "incompatible_settings"
            ]
          },
          "detail": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "field": {
                  "type": "string"
                },
                "code": {
                  "type": "string",
                  "enum": [
                    "unauthenticated",
                    "forbidden",
                    "not_found",
                    "validation_failed",
                    "idempotency_conflict",
                    "precondition_failed",
                    "rate_limited",
                    "unit_not_available",
                    "identifier_conflict",
                    "invalid_transition",
                    "variant_mismatch",
                    "location_mismatch",
                    "ambiguous_ref",
                    "unknown_ref",
                    "not_tracked",
                    "emergency_stop",
                    "simulation_expired",
                    "incompatible_settings"
                  ]
                },
                "detail": {
                  "type": "string"
                }
              },
              "required": [
                "code"
              ]
            }
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "code"
        ]
      },
      "Identifier": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "primary": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "type",
          "value",
          "primary"
        ]
      },
      "Unit": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "variantGid": {
            "type": "string"
          },
          "locationId": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "INCOMING",
              "AVAILABLE",
              "HELD",
              "ALLOCATED",
              "QUALITY_CONTROL",
              "DAMAGED",
              "IN_TRANSIT",
              "SHIPPED",
              "RETURN_PENDING",
              "TO_VERIFY",
              "LOST",
              "SCRAPPED",
              "UNTRACKED"
            ]
          },
          "identifiers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Identifier"
            }
          },
          "ref": {
            "type": "string"
          },
          "receivedAt": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderGid": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderName": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "version": {
            "type": "integer"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "variantGid",
          "locationId",
          "state",
          "identifiers",
          "ref",
          "receivedAt",
          "orderGid",
          "orderName",
          "version",
          "createdAt",
          "updatedAt"
        ]
      },
      "UnitPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Unit"
            }
          },
          "nextCursor": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items",
          "nextCursor"
        ]
      },
      "CreateUnitRequest": {
        "type": "object",
        "properties": {
          "variantGid": {
            "type": "string"
          },
          "locationId": {
            "type": "string"
          },
          "ref": {
            "type": "string"
          },
          "alreadyCounted": {
            "type": "boolean"
          }
        },
        "required": [
          "variantGid",
          "locationId",
          "ref"
        ]
      },
      "CreateUnitsBatchRequest": {
        "type": "object",
        "properties": {
          "variantGid": {
            "type": "string"
          },
          "locationId": {
            "type": "string"
          },
          "refs": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "maxItems": 1000
          },
          "alreadyCounted": {
            "type": "boolean"
          },
          "mode": {
            "type": "string",
            "enum": [
              "atomic",
              "per_item"
            ]
          }
        },
        "required": [
          "variantGid",
          "locationId",
          "refs",
          "alreadyCounted"
        ]
      },
      "CreateUnitsBatchResponse": {
        "type": "object",
        "properties": {
          "created": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Unit"
            }
          },
          "rejected": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "ref": {
                  "type": "string"
                },
                "code": {
                  "type": "string",
                  "enum": [
                    "unauthenticated",
                    "forbidden",
                    "not_found",
                    "validation_failed",
                    "idempotency_conflict",
                    "precondition_failed",
                    "rate_limited",
                    "unit_not_available",
                    "identifier_conflict",
                    "invalid_transition",
                    "variant_mismatch",
                    "location_mismatch",
                    "ambiguous_ref",
                    "unknown_ref",
                    "not_tracked",
                    "emergency_stop",
                    "simulation_expired",
                    "incompatible_settings"
                  ]
                },
                "detail": {
                  "type": "string"
                }
              },
              "required": [
                "index",
                "ref",
                "code"
              ]
            }
          }
        },
        "required": [
          "created",
          "rejected"
        ]
      },
      "CheckUnitsBatchResponse": {
        "type": "object",
        "properties": {
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "ref": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "ready",
                    "duplicate_in_list",
                    "already_known",
                    "invalid_format",
                    "beyond_gap"
                  ]
                },
                "detail": {
                  "type": "string"
                }
              },
              "required": [
                "index",
                "ref",
                "status"
              ]
            }
          },
          "ready": {
            "type": "integer"
          },
          "stockWrite": {
            "type": "integer"
          },
          "gapBefore": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "rows",
          "ready",
          "stockWrite",
          "gapBefore"
        ]
      },
      "LookupResponse": {
        "type": "object",
        "properties": {
          "unit": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Unit"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "unit"
        ]
      },
      "UnitEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "actor": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "fromState": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "INCOMING",
                  "AVAILABLE",
                  "HELD",
                  "ALLOCATED",
                  "QUALITY_CONTROL",
                  "DAMAGED",
                  "IN_TRANSIT",
                  "SHIPPED",
                  "RETURN_PENDING",
                  "TO_VERIFY",
                  "LOST",
                  "SCRAPPED",
                  "UNTRACKED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "toState": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "INCOMING",
                  "AVAILABLE",
                  "HELD",
                  "ALLOCATED",
                  "QUALITY_CONTROL",
                  "DAMAGED",
                  "IN_TRANSIT",
                  "SHIPPED",
                  "RETURN_PENDING",
                  "TO_VERIFY",
                  "LOST",
                  "SCRAPPED",
                  "UNTRACKED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "reason": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "stockEffect": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "stockDelta": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "stockQuantity": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "at",
          "actor",
          "type",
          "fromState",
          "toState",
          "reason",
          "stockEffect"
        ]
      },
      "UnitEventPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UnitEvent"
            }
          },
          "nextCursor": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items",
          "nextCursor"
        ]
      },
      "TrackedItem": {
        "type": "object",
        "properties": {
          "variantGid": {
            "type": "string"
          },
          "productGid": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "variantTitle": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "sku": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "interchangeable"
            ]
          },
          "initializing": {
            "type": "boolean"
          },
          "activatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "stock": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "locationId": {
                  "type": "string"
                },
                "shopifyOnHand": {
                  "type": "integer"
                },
                "registeredUnits": {
                  "type": "integer"
                },
                "availableUnits": {
                  "type": "integer"
                },
                "toRegister": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "required": [
                "locationId",
                "shopifyOnHand",
                "registeredUnits",
                "availableUnits"
              ]
            }
          }
        },
        "required": [
          "variantGid",
          "productGid",
          "title",
          "variantTitle",
          "sku",
          "mode",
          "initializing",
          "activatedAt",
          "stock"
        ]
      },
      "TrackedItemPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TrackedItem"
            }
          },
          "nextCursor": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items",
          "nextCursor"
        ]
      },
      "TrackItemsRequest": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "track",
              "untrack"
            ]
          },
          "variantGids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "applyToOpenOrders": {
            "type": "boolean"
          }
        },
        "required": [
          "variantGids"
        ]
      },
      "Allocation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "unitId": {
            "type": "string"
          },
          "ref": {
            "type": "string"
          },
          "orderGid": {
            "type": "string"
          },
          "lineItemGid": {
            "type": "string"
          },
          "variantGid": {
            "type": "string"
          },
          "locationId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "fulfilled",
              "released",
              "returned"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "auto",
              "pick",
              "pos",
              "draft",
              "api",
              "late",
              "migration"
            ]
          },
          "toConfirm": {
            "type": "boolean"
          },
          "allocatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "unitState": {
            "type": "string",
            "enum": [
              "INCOMING",
              "AVAILABLE",
              "HELD",
              "ALLOCATED",
              "QUALITY_CONTROL",
              "DAMAGED",
              "IN_TRANSIT",
              "SHIPPED",
              "RETURN_PENDING",
              "TO_VERIFY",
              "LOST",
              "SCRAPPED",
              "UNTRACKED"
            ]
          }
        },
        "required": [
          "id",
          "unitId",
          "ref",
          "orderGid",
          "lineItemGid",
          "variantGid",
          "locationId",
          "status",
          "source",
          "toConfirm",
          "allocatedAt",
          "unitState"
        ]
      },
      "OrderAllocationsResponse": {
        "type": "object",
        "properties": {
          "orderGid": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "lineItemGid": {
                  "type": "string"
                },
                "variantGid": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "tracked": {
                  "type": "boolean"
                },
                "quantity": {
                  "type": "integer"
                },
                "orderedQuantity": {
                  "type": "integer"
                },
                "allocations": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Allocation"
                  }
                },
                "missing": {
                  "type": "integer"
                }
              },
              "required": [
                "lineItemGid",
                "variantGid",
                "title",
                "tracked",
                "quantity",
                "orderedQuantity",
                "allocations",
                "missing"
              ]
            }
          },
          "syncState": {
            "type": "string",
            "enum": [
              "pending",
              "synced",
              "error"
            ]
          },
          "syncedAt": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "automationPaused": {
            "type": "boolean"
          },
          "toVerify": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "anomalyId": {
                  "type": "string"
                },
                "unitId": {
                  "type": "string"
                },
                "ref": {
                  "type": "string"
                },
                "lineItemGid": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "canRestock": {
                  "type": "boolean"
                }
              },
              "required": [
                "anomalyId",
                "unitId",
                "ref",
                "lineItemGid",
                "canRestock"
              ]
            }
          },
          "questions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderQuestion"
            }
          }
        },
        "required": [
          "orderGid",
          "lines",
          "syncState",
          "syncedAt"
        ]
      },
      "OrderQuestion": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "removed",
              "shipped",
              "returned"
            ]
          },
          "anomalyId": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "enum": [
              "designate_removed",
              "confirm_shipped",
              "identify"
            ]
          },
          "lineItemGid": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "quantity": {
            "type": "integer"
          },
          "restocked": {
            "type": "boolean"
          },
          "candidates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "unitId": {
                  "type": "string"
                },
                "ref": {
                  "type": "string"
                }
              },
              "required": [
                "unitId",
                "ref"
              ]
            }
          }
        },
        "required": [
          "kind",
          "anomalyId",
          "action",
          "lineItemGid",
          "quantity",
          "candidates"
        ]
      },
      "CreateAllocationRequest": {
        "type": "object",
        "properties": {
          "orderGid": {
            "type": "string"
          },
          "lineItemGid": {
            "type": "string"
          },
          "unitId": {
            "type": "string"
          },
          "ref": {
            "type": "string"
          }
        },
        "required": [
          "orderGid",
          "lineItemGid"
        ]
      },
      "ReplaceAllocationRequest": {
        "type": "object",
        "properties": {
          "unitId": {
            "type": "string"
          },
          "ref": {
            "type": "string"
          }
        },
        "required": []
      },
      "ConfirmShippedRequest": {
        "type": "object",
        "properties": {
          "ref": {
            "type": "string"
          }
        },
        "required": [
          "ref"
        ]
      },
      "RemoveUnitRequest": {
        "type": "object",
        "properties": {
          "adjustStock": {
            "type": "boolean"
          }
        },
        "required": []
      },
      "IdentifyReturnRequest": {
        "type": "object",
        "properties": {
          "returnLineItemGid": {
            "type": "string"
          },
          "ref": {
            "type": "string"
          }
        },
        "required": [
          "returnLineItemGid",
          "ref"
        ]
      },
      "Anomaly": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "severity": {
            "type": "string",
            "enum": [
              "critical",
              "warning",
              "info"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "acknowledged",
              "resolved"
            ]
          },
          "orderGid": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderName": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "variantGid": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "unitId": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "locationId": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "summary": {
            "type": "string"
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "action": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "writesStock": {
                  "type": "boolean"
                },
                "needsRef": {
                  "type": "boolean"
                }
              },
              "required": [
                "action",
                "label",
                "writesStock",
                "needsRef"
              ]
            }
          },
          "openedAt": {
            "type": "string",
            "format": "date-time"
          },
          "resolvedAt": {
            "oneOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "remaining": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "id",
          "type",
          "severity",
          "status",
          "orderGid",
          "orderName",
          "variantGid",
          "unitId",
          "locationId",
          "summary",
          "actions",
          "openedAt",
          "resolvedAt",
          "remaining"
        ]
      },
      "AnomalyPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Anomaly"
            }
          },
          "nextCursor": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items",
          "nextCursor"
        ]
      },
      "ResolveAnomalyRequest": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string"
          },
          "params": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "action"
        ]
      },
      "Location": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "active"
        ]
      },
      "LocationPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Location"
            }
          },
          "nextCursor": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items",
          "nextCursor"
        ]
      },
      "SettingValue": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "value": {
            "type": [
              "string",
              "number",
              "boolean"
            ]
          },
          "origin": {
            "type": "string",
            "enum": [
              "default",
              "shop",
              "location",
              "tracked_item",
              "fixed"
            ]
          },
          "changeRule": {
            "type": "string",
            "enum": [
              "immediate",
              "simulation"
            ]
          }
        },
        "required": [
          "key",
          "value",
          "origin",
          "changeRule"
        ]
      },
      "SettingsResponse": {
        "type": "object",
        "properties": {
          "scope": {
            "type": "string"
          },
          "values": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SettingValue"
            }
          }
        },
        "required": [
          "scope",
          "values"
        ]
      },
      "SimulateSettingsRequest": {
        "type": "object",
        "properties": {
          "scope": {
            "type": "string"
          },
          "values": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            }
          }
        },
        "required": [
          "scope",
          "values"
        ]
      },
      "PatchSettingsRequest": {
        "type": "object",
        "properties": {
          "scope": {
            "type": "string"
          },
          "values": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            }
          },
          "simulationId": {
            "type": "string"
          }
        },
        "required": [
          "scope",
          "values"
        ]
      },
      "SettingsSimulation": {
        "type": "object",
        "properties": {
          "simulationId": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "effects": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "count": {
                  "type": "integer"
                },
                "summary": {
                  "type": "string"
                }
              },
              "required": [
                "key",
                "count",
                "summary"
              ]
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "simulationId",
          "expiresAt",
          "effects",
          "warnings"
        ]
      },
      "CreateImportRequest": {
        "type": "object",
        "properties": {
          "filename": {
            "type": "string"
          },
          "csv": {
            "type": "string"
          }
        },
        "required": [
          "csv"
        ]
      },
      "ImportReport": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "simulated",
              "confirmed",
              "failed"
            ]
          },
          "rows": {
            "type": "integer"
          },
          "valid": {
            "type": "integer"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "row": {
                  "type": "integer"
                },
                "code": {
                  "type": "string",
                  "enum": [
                    "unauthenticated",
                    "forbidden",
                    "not_found",
                    "validation_failed",
                    "idempotency_conflict",
                    "precondition_failed",
                    "rate_limited",
                    "unit_not_available",
                    "identifier_conflict",
                    "invalid_transition",
                    "variant_mismatch",
                    "location_mismatch",
                    "ambiguous_ref",
                    "unknown_ref",
                    "not_tracked",
                    "emergency_stop",
                    "simulation_expired",
                    "incompatible_settings"
                  ]
                },
                "detail": {
                  "type": "string"
                }
              },
              "required": [
                "row",
                "code",
                "detail"
              ]
            }
          },
          "beyondGap": {
            "type": "integer"
          },
          "stockWrites": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "status",
          "rows",
          "valid",
          "errors"
        ]
      },
      "AutomationStateResponse": {
        "type": "object",
        "properties": {
          "emergencyStop": {
            "type": "boolean"
          }
        },
        "required": [
          "emergencyStop"
        ]
      }
    }
  }
}