{
  "openapi": "3.0.3",
  "info": {
    "title": "Allavus programmable API — local source",
    "version": "1.0.0",
    "description": "Provider and activation remain separately gated. Receipt-only certified recovery is a separate contract."
  },
  "servers": [
    {
      "url": "https://machine-api.dev.allavus.com/v1"
    }
  ],
  "paths": {
    "/sites": {
      "get": {
        "operationId": "listSites",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Curated result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SitePage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Bearer authentication required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable object or grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting request or source identity",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Finite local capacity exhausted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          }
        ]
      }
    },
    "/sites/{siteId}/products": {
      "get": {
        "operationId": "listSiteProducts",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Curated result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Bearer authentication required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable object or grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting request or source identity",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Finite local capacity exhausted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "siteId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          }
        ]
      }
    },
    "/sites/{siteId}/locations": {
      "get": {
        "operationId": "listSiteLocations",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Curated result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LocationPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Bearer authentication required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable object or grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting request or source identity",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Finite local capacity exhausted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "siteId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          }
        ]
      }
    },
    "/sites/{siteId}/lots": {
      "get": {
        "operationId": "listSiteLots",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Curated result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LotPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Bearer authentication required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable object or grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting request or source identity",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Finite local capacity exhausted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "siteId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          }
        ]
      }
    },
    "/lots/{lotId}": {
      "get": {
        "operationId": "getLot",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Curated result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Lot"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Bearer authentication required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable object or grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting request or source identity",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Finite local capacity exhausted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "lotId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ]
      }
    },
    "/lots/{lotId}/lineage": {
      "get": {
        "operationId": "getLotLineage",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Curated result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Lineage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Bearer authentication required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable object or grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting request or source identity",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Finite local capacity exhausted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "lotId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "depth",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5,
              "default": 5
            }
          }
        ]
      }
    },
    "/inventory-receipts": {
      "post": {
        "operationId": "createInventoryReceipt",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Curated result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptOutcome"
                }
              }
            }
          },
          "201": {
            "description": "First acceptance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptOutcome"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Bearer authentication required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable object or grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting request or source identity",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Finite local capacity exhausted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReceiptInput"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[\\x21-\\x7e]+$"
            }
          }
        ]
      }
    },
    "/inventory-receipts/{receiptId}": {
      "get": {
        "operationId": "getInventoryReceipt",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Curated result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptOutcome"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Bearer authentication required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable object or grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting request or source identity",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Finite local capacity exhausted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "receiptId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ]
      }
    },
    "/events": {
      "get": {
        "operationId": "listCertifiedReceiptEvents",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Curated recovery result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventsPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Bearer authentication required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable object or grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting request or source identity",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Finite local capacity exhausted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "siteId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          }
        ]
      }
    },
    "/snapshots": {
      "post": {
        "operationId": "createReceiptSnapshot",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Curated recovery result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SnapshotCreated"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Bearer authentication required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable object or grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting request or source identity",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Finite local capacity exhausted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "siteId": {
                    "type": "string",
                    "format": "uuid"
                  }
                },
                "required": [
                  "siteId"
                ]
              }
            }
          }
        }
      }
    },
    "/snapshots/{snapshotId}": {
      "get": {
        "operationId": "getReceiptSnapshot",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Curated recovery result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SnapshotPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Bearer authentication required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable object or grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting request or source identity",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Finite local capacity exhausted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "snapshotId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "siteId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          }
        ]
      }
    },
    "/subscriptions": {
      "get": {
        "operationId": "listReceiptSubscriptions",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Curated recovery result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionsPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Bearer authentication required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable object or grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting request or source identity",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Finite local capacity exhausted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "siteId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          }
        ]
      },
      "post": {
        "operationId": "createReceiptSubscription",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "Curated recovery result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionCreated"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Bearer authentication required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable object or grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting request or source identity",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Finite local capacity exhausted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscriptionCreate"
              }
            }
          }
        }
      }
    },
    "/subscriptions/{subscriptionId}": {
      "patch": {
        "operationId": "updateReceiptSubscription",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Curated recovery result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionUpdated"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Bearer authentication required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable object or grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting request or source identity",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Finite local capacity exhausted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "subscriptionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscriptionPatch"
              }
            }
          }
        }
      }
    },
    "/subscriptions/{subscriptionId}/deliveries": {
      "get": {
        "operationId": "listReceiptDeliveryHistory",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Curated recovery result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryHistory"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Bearer authentication required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable object or grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting request or source identity",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Finite local capacity exhausted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "subscriptionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "siteId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          }
        ]
      }
    },
    "/subscriptions/{subscriptionId}/replay": {
      "post": {
        "operationId": "replayReceiptDeliveries",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Curated recovery result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReplayResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Bearer authentication required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Unavailable object or grant",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting request or source identity",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Finite local capacity exhausted",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "subscriptionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplayRequest"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Trusted RS256 backend access token mapped to an active Allavus installation. Default JWT_AUDIENCE requires exact aud. Explicit COGNITO_CLIENT_CREDENTIALS requires token_use=access, sub=client_id, exact API resource scope and lifetime <=300 seconds; a present aud must match the API resource. Current Organization/Site/action grants remain mandatory."
      }
    },
    "schemas": {
      "Problem": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "title",
          "status",
          "requestId"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "requestId": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "Site": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ]
      },
      "Product": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "associationId": {
            "type": "string",
            "format": "uuid"
          },
          "masterId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "primaryUnitId": {
            "type": "string",
            "format": "uuid"
          },
          "primaryUnitType": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "associationId",
          "masterId",
          "name",
          "primaryUnitId",
          "primaryUnitType"
        ]
      },
      "Location": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "parentId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Active same-Site visible parent reference; null when absent or unavailable."
          }
        },
        "required": [
          "id",
          "name",
          "parentId"
        ]
      },
      "Lot": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "siteId": {
            "type": "string",
            "format": "uuid"
          },
          "productId": {
            "type": "string",
            "format": "uuid"
          },
          "quantity": {
            "type": "string",
            "pattern": "^[0-9]+(?:\\.[0-9]+)?$"
          },
          "unitId": {
            "type": "string",
            "format": "uuid",
            "description": "Required unit from GLOBAL, current Organization or current Site namespace; invalid legacy references fail closed with 404."
          },
          "locationId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Active same-Site location visible under current action grants; null when absent or unavailable."
          },
          "expiryDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "siteId",
          "productId",
          "quantity",
          "unitId",
          "locationId",
          "expiryDate",
          "updatedAt"
        ]
      },
      "ReceiptOutcome": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "receiptId": {
            "type": "string",
            "format": "uuid"
          },
          "siteId": {
            "type": "string",
            "format": "uuid"
          },
          "lotId": {
            "type": "string",
            "format": "uuid"
          },
          "productId": {
            "type": "string",
            "format": "uuid"
          },
          "unitId": {
            "type": "string",
            "format": "uuid"
          },
          "quantity": {
            "type": "string",
            "pattern": "^[0-9]+(?:\\.[0-9]+)?$"
          }
        },
        "required": [
          "receiptId",
          "siteId",
          "lotId",
          "productId",
          "unitId",
          "quantity"
        ]
      },
      "RecordedCost": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "sourceReference": {
            "description": "Invoice or recorded cost evidence; may be reused by separate deliveries. Financial identity follows the accepted receipt command, not this reference.",
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "materials": {
            "type": "string",
            "pattern": "^\\d+(?:\\.\\d{1,18})?$",
            "nullable": true
          },
          "packaging": {
            "type": "string",
            "pattern": "^\\d+(?:\\.\\d{1,18})?$",
            "nullable": true
          },
          "labour": {
            "type": "string",
            "pattern": "^\\d+(?:\\.\\d{1,18})?$",
            "nullable": true
          },
          "overhead": {
            "type": "string",
            "pattern": "^\\d+(?:\\.\\d{1,18})?$",
            "nullable": true
          },
          "landedCosts": {
            "type": "string",
            "pattern": "^\\d+(?:\\.\\d{1,18})?$",
            "nullable": true
          }
        },
        "required": [
          "currency",
          "sourceReference"
        ]
      },
      "ReceiptInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "siteId": {
            "type": "string",
            "format": "uuid"
          },
          "productId": {
            "type": "string",
            "format": "uuid"
          },
          "locationId": {
            "type": "string",
            "format": "uuid"
          },
          "unitId": {
            "type": "string",
            "format": "uuid"
          },
          "quantity": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,9}$",
            "description": "Positive integer at most 1000000000; canonical primary unit only."
          },
          "lotCode": {
            "description": "New Allavus physical identifier, unique among codes throughout the Organization, including other Sites/products. Not a reusable external supplier-lot reference; duplicate codes return 409.",
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "expiryDate": {
            "type": "string",
            "format": "date-time"
          },
          "supplierId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "sourceNamespace": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "sourceReceiptId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "recordedCost": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RecordedCost"
              }
            ],
            "nullable": true
          }
        },
        "required": [
          "siteId",
          "productId",
          "locationId",
          "unitId",
          "quantity",
          "lotCode",
          "expiryDate",
          "sourceNamespace",
          "sourceReceiptId"
        ]
      },
      "Lineage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "rootLotId": {
            "type": "string",
            "format": "uuid"
          },
          "nodes": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "required": [
                "id"
              ]
            }
          },
          "edges": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "from": {
                  "type": "string",
                  "format": "uuid"
                },
                "to": {
                  "type": "string",
                  "format": "uuid"
                },
                "relationship": {
                  "type": "string",
                  "enum": [
                    "SOURCE_LOT",
                    "MOTHER_LOT"
                  ]
                }
              },
              "required": [
                "from",
                "to",
                "relationship"
              ]
            }
          },
          "truncated": {
            "type": "boolean"
          },
          "completeness": {
            "type": "string",
            "enum": [
              "LEGACY_INCOMPLETE"
            ]
          },
          "coverage": {
            "type": "string"
          }
        },
        "required": [
          "rootLotId",
          "nodes",
          "edges",
          "truncated",
          "completeness",
          "coverage"
        ]
      },
      "SitePage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/Site"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          },
          "consistency": {
            "type": "string",
            "enum": [
              "MUTABLE_LIST"
            ]
          }
        },
        "required": [
          "items",
          "nextCursor",
          "consistency"
        ]
      },
      "ProductPage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/Product"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          },
          "consistency": {
            "type": "string",
            "enum": [
              "MUTABLE_LIST"
            ]
          }
        },
        "required": [
          "items",
          "nextCursor",
          "consistency"
        ]
      },
      "LocationPage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/Location"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          },
          "consistency": {
            "type": "string",
            "enum": [
              "MUTABLE_LIST"
            ]
          }
        },
        "required": [
          "items",
          "nextCursor",
          "consistency"
        ]
      },
      "LotPage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/Lot"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          },
          "consistency": {
            "type": "string",
            "enum": [
              "MUTABLE_LIST"
            ]
          }
        },
        "required": [
          "items",
          "nextCursor",
          "consistency"
        ]
      },
      "ReceiptEvent": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "position": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "payload": {
            "$ref": "#/components/schemas/ReceiptEventPayload"
          },
          "recordedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "position",
          "payload",
          "recordedAt"
        ]
      },
      "EventsPage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/ReceiptEvent"
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "cursor": {
            "type": "string",
            "maxLength": 4096
          },
          "coverage": {
            "type": "string",
            "enum": [
              "certified-receipts-only"
            ]
          },
          "recovery": {
            "type": "string"
          }
        },
        "required": [
          "items",
          "hasMore",
          "cursor",
          "coverage",
          "recovery"
        ]
      },
      "SnapshotCreated": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "snapshotId": {
            "type": "string",
            "format": "uuid"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "itemCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000
          },
          "checkpoint": {
            "type": "string",
            "maxLength": 4096
          },
          "coverage": {
            "type": "string",
            "enum": [
              "current-lots-and-certified-receipt-checkpoint"
            ]
          }
        },
        "required": [
          "snapshotId",
          "expiresAt",
          "itemCount",
          "checkpoint",
          "coverage"
        ]
      },
      "SnapshotPage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "snapshotId": {
            "type": "string",
            "format": "uuid"
          },
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/Lot"
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "cursor": {
            "type": "string",
            "maxLength": 4096,
            "nullable": true
          },
          "checkpoint": {
            "type": "string",
            "maxLength": 4096
          }
        },
        "required": [
          "snapshotId",
          "items",
          "hasMore",
          "cursor",
          "checkpoint"
        ]
      },
      "Subscription": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "siteId": {
            "type": "string",
            "format": "uuid"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "keyId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,128}$"
          },
          "state": {
            "type": "string",
            "enum": [
              "PENDING",
              "ACTIVE",
              "SUSPENDED"
            ]
          },
          "checkpoint": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "version": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "id",
          "siteId",
          "callbackUrl",
          "keyId",
          "state",
          "checkpoint",
          "version"
        ]
      },
      "SubscriptionsPage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/Subscription"
            }
          },
          "cursor": {
            "type": "string",
            "maxLength": 4096,
            "nullable": true
          }
        },
        "required": [
          "items",
          "cursor"
        ]
      },
      "SubscriptionCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "siteId": {
            "type": "string",
            "format": "uuid"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "description": "Public HTTPS only, port443, no credentials/fragments, connection-time DNS/TLS checks."
          },
          "keyId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,128}$"
          }
        },
        "required": [
          "siteId",
          "callbackUrl",
          "keyId"
        ]
      },
      "SubscriptionPatch": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "siteId": {
            "type": "string",
            "format": "uuid"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "description": "Public HTTPS only, port443, no credentials/fragments, connection-time DNS/TLS checks."
          },
          "keyId": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,128}$"
          },
          "state": {
            "type": "string",
            "enum": [
              "PENDING",
              "SUSPENDED"
            ]
          }
        },
        "required": [
          "siteId"
        ]
      },
      "SubscriptionCreated": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "PENDING"
            ]
          },
          "ownershipVerification": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "state",
          "ownershipVerification"
        ]
      },
      "SubscriptionUpdated": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "PENDING",
              "ACTIVE",
              "SUSPENDED"
            ]
          },
          "version": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "state",
          "version"
        ]
      },
      "DeliveryAttempt": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deliveryId": {
            "type": "string",
            "format": "uuid"
          },
          "attempt": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string"
          },
          "errorCode": {
            "type": "string",
            "nullable": true
          },
          "recordedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "deliveryId",
          "attempt",
          "status",
          "errorCode",
          "recordedAt"
        ]
      },
      "DeliveryHistory": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/DeliveryAttempt"
            }
          },
          "cursor": {
            "type": "string",
            "maxLength": 4096,
            "nullable": true
          },
          "listSemantics": {
            "type": "string"
          }
        },
        "required": [
          "items",
          "cursor",
          "listSemantics"
        ]
      },
      "ReplayRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "siteId": {
            "type": "string",
            "format": "uuid"
          },
          "cursor": {
            "type": "string",
            "maxLength": 4096
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 25
          }
        },
        "required": [
          "siteId"
        ]
      },
      "ReplayResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "queued": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "cursor": {
            "type": "string",
            "maxLength": 4096
          },
          "deliverySemantics": {
            "type": "string"
          }
        },
        "required": [
          "queued",
          "cursor",
          "deliverySemantics"
        ]
      },
      "ReceiptEventPayload": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "receipt.recorded"
            ]
          },
          "eventId": {
            "type": "string",
            "format": "uuid"
          },
          "commandId": {
            "type": "string",
            "format": "uuid"
          },
          "lotId": {
            "type": "string",
            "format": "uuid"
          },
          "productId": {
            "type": "string",
            "format": "uuid"
          },
          "quantity": {
            "type": "string"
          },
          "unitId": {
            "type": "string",
            "format": "uuid"
          },
          "siteId": {
            "type": "string",
            "format": "uuid"
          },
          "actor": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "USER",
                  "INTEGRATION"
                ]
              },
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "subject": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id",
              "subject"
            ]
          },
          "source": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "namespace": {
                "type": "string"
              },
              "receiptId": {
                "type": "string"
              }
            },
            "required": [
              "namespace",
              "receiptId"
            ]
          },
          "eventTime": {
            "type": "string",
            "format": "date-time"
          },
          "recordedTime": {
            "type": "string",
            "format": "date-time"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "CERTIFIED_RECEIPTS_ONLY"
            ]
          },
          "historicalCompleteness": {
            "type": "string",
            "enum": [
              "INCOMPLETE"
            ]
          }
        },
        "required": [
          "version",
          "type",
          "eventId",
          "commandId",
          "lotId",
          "productId",
          "quantity",
          "unitId",
          "siteId",
          "actor",
          "source",
          "eventTime",
          "recordedTime",
          "coverage",
          "historicalCompleteness"
        ]
      },
      "ReceiptWebhook": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "inventory.receipt.recorded"
            ]
          },
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "payload": {
            "$ref": "#/components/schemas/ReceiptEventPayload"
          }
        },
        "required": [
          "id",
          "type",
          "version",
          "payload"
        ]
      }
    }
  }
}
