{
  "openapi": "3.1.0",
  "info": {
    "title": "Seedlink API (Public)",
    "version": "0.1.0",
    "description": "Unified Cannabis Compliance API — connect to Metrc, BioTrack, and other state track-and-trace systems through a single integration.\n\nThis is the public developer API. It excludes SeedLink's internal dashboard/organization-management endpoints, which require dashboard session auth and aren't part of the integration surface.",
    "contact": {
      "name": "Seedlink Support",
      "url": "https://docs.seedlink.dev"
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "sl_at_*",
        "description": "OAuth 2.0 access token (obtain via POST /v1/oauth/token with client_credentials grant)"
      },
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "sl_at_*",
        "description": "OAuth 2.0 access token for API authentication"
      },
      "oauth2": {
        "type": "oauth2",
        "description": "OAuth 2.0 client credentials flow",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "/v1/oauth/token",
            "scopes": {
              "sandbox": "Access sandbox resources"
            }
          }
        }
      }
    },
    "schemas": {
      "Facility": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "SeedLink facility identifier"
          },
          "name": {
            "type": "string",
            "description": "Licensed facility name"
          },
          "display_name": {
            "type": "string",
            "nullable": true,
            "description": "Display name shown in provider UIs (may differ from license name)"
          },
          "alias": {
            "type": "string",
            "nullable": true,
            "description": "Optional facility alias/nickname"
          },
          "license_number": {
            "type": "string",
            "description": "State-issued license number"
          },
          "license_type": {
            "type": "string",
            "description": "License type (e.g. AU Dispensary, Craft Grower, Testing Facility)"
          },
          "license_start_date": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 date when the license became active"
          },
          "license_end_date": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 date when the license expires"
          },
          "address": {
            "type": "string",
            "nullable": true,
            "description": "Street address of the facility"
          },
          "city": {
            "type": "string",
            "nullable": true,
            "description": "City where the facility is located"
          },
          "state": {
            "type": "string",
            "description": "Two-letter US state code"
          },
          "zip": {
            "type": "string",
            "nullable": true,
            "description": "ZIP code of the facility"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive"
            ],
            "description": "Whether the facility is currently active"
          },
          "credentialed_date": {
            "type": "string",
            "nullable": true,
            "description": "ISO date when the integrator was credentialed for this facility"
          },
          "support_activation_date": {
            "type": "string",
            "nullable": true,
            "description": "ISO date when integrator support activates"
          },
          "support_expiration_date": {
            "type": "string",
            "nullable": true,
            "description": "ISO date when integrator support expires"
          },
          "provider": {
            "type": "string",
            "enum": [
              "metrc",
              "biotrack"
            ],
            "description": "Supported traceability system provider"
          },
          "provider_facility_id": {
            "type": "string",
            "description": "Facility identifier in the provider system"
          },
          "user_permissions": {
            "allOf": [
              {
                "$ref": "#/components/schemas/FacilityUserPermissions"
              }
            ],
            "nullable": true,
            "description": "Permissions the connected user has at this facility"
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "High-level capability tags (e.g. cultivation, harvests, packages, sales, sales_deliveries, labs, transfers, patients)"
          },
          "facility_type": {
            "type": "object",
            "additionalProperties": {},
            "nullable": true,
            "description": "Provider-specific facility-type capability flags (e.g. Metrc's FacilityType object)"
          }
        },
        "required": [
          "id",
          "name",
          "display_name",
          "alias",
          "license_number",
          "license_type",
          "license_start_date",
          "license_end_date",
          "address",
          "city",
          "state",
          "zip",
          "status",
          "credentialed_date",
          "support_activation_date",
          "support_expiration_date",
          "provider",
          "provider_facility_id",
          "user_permissions",
          "capabilities",
          "facility_type"
        ],
        "additionalProperties": false
      },
      "FacilityUserPermissions": {
        "type": "object",
        "properties": {
          "is_owner": {
            "type": "boolean",
            "description": "Connected user is the facility owner"
          },
          "is_manager": {
            "type": "boolean",
            "description": "Connected user is a facility manager"
          },
          "is_financial_contact": {
            "type": "boolean",
            "description": "Connected user is the financial contact"
          },
          "occupations": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Occupation tags assigned to the user at this facility"
          }
        },
        "required": [
          "is_owner",
          "is_manager",
          "is_financial_contact",
          "occupations"
        ],
        "additionalProperties": false
      },
      "Package": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "SeedLink package identifier"
          },
          "tag": {
            "type": "string",
            "description": "RFID tag number from the state tracking system"
          },
          "source_tag": {
            "type": "string",
            "nullable": true,
            "description": "Tag of the source package, if derived from another package"
          },
          "item_name": {
            "type": "string",
            "description": "Name of the product item in this package"
          },
          "item_category": {
            "type": "string",
            "description": "Product category (e.g. Flower, Concentrate, Edible)"
          },
          "item_strain": {
            "type": "string",
            "nullable": true,
            "description": "Cannabis strain name, if applicable"
          },
          "quantity": {
            "type": "number",
            "description": "Current quantity in the package"
          },
          "unit_of_measure": {
            "type": "string",
            "description": "Unit of measurement (e.g. Grams, Each, Ounces)"
          },
          "lab_testing_state": {
            "type": "string",
            "nullable": true,
            "description": "Current lab testing status (e.g. TestPassed, NotSubmitted)"
          },
          "is_on_hold": {
            "type": "boolean",
            "description": "Whether the package is currently on administrative hold"
          },
          "packaged_date": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 date when the package was created"
          },
          "expiration_date": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 expiration date, if applicable"
          },
          "facility_id": {
            "type": "string",
            "description": "ID of the facility that holds this package"
          },
          "provider": {
            "type": "string",
            "enum": [
              "metrc",
              "biotrack"
            ],
            "description": "Supported traceability system provider"
          },
          "provider_package_id": {
            "type": "string",
            "description": "Package identifier in the provider system"
          },
          "source_harvest_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "IDs of harvests that contributed to this package"
          },
          "source_package_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "IDs of source packages that contributed to this package"
          },
          "lab_results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LabResult"
            },
            "description": "Lab test results associated with this package"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {},
            "description": "Provider-specific metadata"
          }
        },
        "required": [
          "id",
          "tag",
          "source_tag",
          "item_name",
          "item_category",
          "item_strain",
          "quantity",
          "unit_of_measure",
          "lab_testing_state",
          "is_on_hold",
          "packaged_date",
          "expiration_date",
          "facility_id",
          "provider",
          "provider_package_id",
          "source_harvest_ids",
          "source_package_ids",
          "lab_results",
          "metadata"
        ],
        "additionalProperties": false
      },
      "LabResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "SeedLink lab result identifier"
          },
          "package_id": {
            "type": "string",
            "description": "ID of the package that was tested"
          },
          "lab_name": {
            "type": "string",
            "description": "Name of the testing laboratory"
          },
          "lab_license": {
            "type": "string",
            "nullable": true,
            "description": "License number of the testing laboratory"
          },
          "test_date": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 date when the test was performed"
          },
          "result_date": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 date when results were reported"
          },
          "overall_passed": {
            "type": "boolean",
            "description": "Whether all tests in the batch passed"
          },
          "test_type": {
            "type": "string",
            "description": "Type of testing performed (e.g. ComplianceTesting, ResearchTesting)"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LabTestResult"
            },
            "description": "Individual test results within this lab report"
          },
          "provider": {
            "type": "string",
            "enum": [
              "metrc",
              "biotrack"
            ],
            "description": "Supported traceability system provider"
          },
          "provider_result_id": {
            "type": "string",
            "description": "Lab result identifier in the provider system"
          }
        },
        "required": [
          "id",
          "package_id",
          "lab_name",
          "lab_license",
          "test_date",
          "result_date",
          "overall_passed",
          "test_type",
          "results",
          "provider",
          "provider_result_id"
        ],
        "additionalProperties": false
      },
      "LabTestResult": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Name of the individual test (e.g. THC, CBD, Pesticides)"
          },
          "category": {
            "type": "string",
            "description": "Test category (e.g. potency, contaminants, microbials)"
          },
          "value": {
            "type": "number",
            "nullable": true,
            "description": "Numeric test result value, null if pass/fail only"
          },
          "unit": {
            "type": "string",
            "nullable": true,
            "description": "Unit of measurement (e.g. %, ppm, CFU/g)"
          },
          "passed": {
            "type": "boolean",
            "description": "Whether this individual test passed"
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "description": "Additional notes or observations from the lab"
          }
        },
        "required": [
          "name",
          "category",
          "value",
          "unit",
          "passed",
          "notes"
        ],
        "additionalProperties": false
      },
      "Plant": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "SeedLink plant identifier"
          },
          "tag": {
            "type": "string",
            "description": "RFID tag number from the state tracking system"
          },
          "strain_name": {
            "type": "string",
            "description": "Cannabis strain name"
          },
          "growth_phase": {
            "type": "string",
            "enum": [
              "clone",
              "vegetative",
              "flowering"
            ],
            "description": "Current growth phase of the plant"
          },
          "plant_batch_id": {
            "type": "string",
            "nullable": true,
            "description": "ID of the plant batch this plant belongs to"
          },
          "location": {
            "type": "string",
            "nullable": true,
            "description": "Current location within the facility (e.g. room, zone)"
          },
          "planted_date": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 date when the plant was planted or cloned"
          },
          "vegetative_date": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 date when the plant entered vegetative phase"
          },
          "flowering_date": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 date when the plant entered flowering phase"
          },
          "harvest_date": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 date when the plant was harvested"
          },
          "facility_id": {
            "type": "string",
            "description": "ID of the facility that holds this plant"
          },
          "provider": {
            "type": "string",
            "enum": [
              "metrc",
              "biotrack"
            ],
            "description": "Supported traceability system provider"
          },
          "provider_plant_id": {
            "type": "string",
            "description": "Plant identifier in the provider system"
          }
        },
        "required": [
          "id",
          "tag",
          "strain_name",
          "growth_phase",
          "plant_batch_id",
          "location",
          "planted_date",
          "vegetative_date",
          "flowering_date",
          "harvest_date",
          "facility_id",
          "provider",
          "provider_plant_id"
        ],
        "additionalProperties": false
      },
      "Transfer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "SeedLink transfer identifier"
          },
          "manifest_number": {
            "type": "string",
            "description": "State-issued manifest or transfer number"
          },
          "transfer_type": {
            "type": "string",
            "description": "Type of transfer (e.g. wholesale, distribution)"
          },
          "shipper_facility": {
            "type": "string",
            "description": "Name or ID of the shipping facility"
          },
          "recipient_facility": {
            "type": "string",
            "description": "Name or ID of the receiving facility"
          },
          "packages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TransferPackage"
            },
            "description": "List of packages included in this transfer"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "in_transit",
              "received",
              "rejected"
            ],
            "description": "Current status of the transfer"
          },
          "estimated_departure": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 estimated departure time"
          },
          "estimated_arrival": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 estimated arrival time"
          },
          "actual_departure": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 actual departure time"
          },
          "actual_arrival": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 actual arrival time"
          },
          "transporter": {
            "type": "string",
            "nullable": true,
            "description": "Name of the transport company"
          },
          "driver_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the driver"
          },
          "vehicle_info": {
            "type": "string",
            "nullable": true,
            "description": "Vehicle description or license plate"
          },
          "provider": {
            "type": "string",
            "enum": [
              "metrc",
              "biotrack"
            ],
            "description": "Supported traceability system provider"
          },
          "provider_transfer_id": {
            "type": "string",
            "description": "Transfer identifier in the provider system"
          }
        },
        "required": [
          "id",
          "manifest_number",
          "transfer_type",
          "shipper_facility",
          "recipient_facility",
          "packages",
          "status",
          "estimated_departure",
          "estimated_arrival",
          "actual_departure",
          "actual_arrival",
          "transporter",
          "driver_name",
          "vehicle_info",
          "provider",
          "provider_transfer_id"
        ],
        "additionalProperties": false
      },
      "TransferPackage": {
        "type": "object",
        "properties": {
          "package_id": {
            "type": "string",
            "description": "ID of the package being transferred"
          },
          "tag": {
            "type": "string",
            "description": "RFID tag of the package"
          },
          "item_name": {
            "type": "string",
            "description": "Name of the product item"
          },
          "quantity": {
            "type": "number",
            "description": "Quantity being transferred"
          },
          "unit_of_measure": {
            "type": "string",
            "description": "Unit of measurement for the quantity"
          }
        },
        "required": [
          "package_id",
          "tag",
          "item_name",
          "quantity",
          "unit_of_measure"
        ],
        "additionalProperties": false
      },
      "Sale": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "SeedLink sale identifier"
          },
          "receipt_number": {
            "type": "string",
            "description": "POS receipt or transaction number"
          },
          "sale_date": {
            "type": "string",
            "description": "ISO 8601 date and time of the sale"
          },
          "customer_type": {
            "type": "string",
            "description": "Type of customer (e.g. Consumer, Patient, Caregiver)"
          },
          "patient_license": {
            "type": "string",
            "nullable": true,
            "description": "Patient license number for medical sales"
          },
          "caregiver_license": {
            "type": "string",
            "nullable": true,
            "description": "Caregiver license number, if applicable"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SaleItem"
            },
            "description": "Line items included in this sale"
          },
          "total_price": {
            "type": "number",
            "description": "Total sale amount before discounts"
          },
          "total_discount": {
            "type": "number",
            "description": "Total discount applied to the sale"
          },
          "facility_id": {
            "type": "string",
            "description": "ID of the facility where the sale occurred"
          },
          "provider": {
            "type": "string",
            "enum": [
              "metrc",
              "biotrack"
            ],
            "description": "Supported traceability system provider"
          },
          "provider_sale_id": {
            "type": "string",
            "description": "Sale identifier in the provider system"
          }
        },
        "required": [
          "id",
          "receipt_number",
          "sale_date",
          "customer_type",
          "patient_license",
          "caregiver_license",
          "items",
          "total_price",
          "total_discount",
          "facility_id",
          "provider",
          "provider_sale_id"
        ],
        "additionalProperties": false
      },
      "SaleItem": {
        "type": "object",
        "properties": {
          "package_id": {
            "type": "string",
            "description": "ID of the package sold"
          },
          "tag": {
            "type": "string",
            "description": "RFID tag of the package"
          },
          "item_name": {
            "type": "string",
            "description": "Name of the product item sold"
          },
          "quantity": {
            "type": "number",
            "description": "Quantity sold"
          },
          "unit_of_measure": {
            "type": "string",
            "description": "Unit of measurement for the quantity"
          },
          "unit_price": {
            "type": "number",
            "description": "Price per unit before discounts"
          },
          "discount": {
            "type": "number",
            "description": "Discount amount applied to this line item"
          },
          "total": {
            "type": "number",
            "description": "Total price after discount for this line item"
          }
        },
        "required": [
          "package_id",
          "tag",
          "item_name",
          "quantity",
          "unit_of_measure",
          "unit_price",
          "discount",
          "total"
        ],
        "additionalProperties": false
      },
      "Harvest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "SeedLink harvest identifier"
          },
          "harvest_name": {
            "type": "string",
            "description": "Name or batch identifier for the harvest"
          },
          "harvest_type": {
            "type": "string",
            "description": "Type of harvest (e.g. WholePlant, Manicure)"
          },
          "strain_name": {
            "type": "string",
            "description": "Cannabis strain name"
          },
          "harvested_date": {
            "type": "string",
            "description": "ISO 8601 date when the harvest occurred"
          },
          "current_weight": {
            "type": "number",
            "description": "Current weight of the harvest"
          },
          "unit_of_measure": {
            "type": "string",
            "description": "Unit of measurement for weight (e.g. Grams, Pounds)"
          },
          "total_waste_weight": {
            "type": "number",
            "description": "Total waste weight recorded for this harvest"
          },
          "plant_count": {
            "type": "number",
            "description": "Number of plants included in the harvest"
          },
          "source_plant_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "IDs of plants that were harvested"
          },
          "facility_id": {
            "type": "string",
            "description": "ID of the facility where the harvest occurred"
          },
          "provider": {
            "type": "string",
            "enum": [
              "metrc",
              "biotrack"
            ],
            "description": "Supported traceability system provider"
          },
          "provider_harvest_id": {
            "type": "string",
            "description": "Harvest identifier in the provider system"
          }
        },
        "required": [
          "id",
          "harvest_name",
          "harvest_type",
          "strain_name",
          "harvested_date",
          "current_weight",
          "unit_of_measure",
          "total_waste_weight",
          "plant_count",
          "source_plant_ids",
          "facility_id",
          "provider",
          "provider_harvest_id"
        ],
        "additionalProperties": false
      },
      "Item": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "SeedLink item identifier"
          },
          "name": {
            "type": "string",
            "description": "Product item name"
          },
          "category": {
            "type": "string",
            "description": "Item category (e.g. Flower, Concentrate, Edible)"
          },
          "strain": {
            "type": "string",
            "nullable": true,
            "description": "Associated cannabis strain name"
          },
          "unit_of_measure": {
            "type": "string",
            "description": "Default unit of measurement for this item"
          },
          "unit_weight": {
            "type": "number",
            "nullable": true,
            "description": "Default unit weight, if applicable"
          },
          "facility_id": {
            "type": "string",
            "description": "ID of the facility that owns this item definition"
          },
          "provider": {
            "type": "string",
            "enum": [
              "metrc",
              "biotrack"
            ],
            "description": "Supported traceability system provider"
          },
          "provider_item_id": {
            "type": "string",
            "description": "Item identifier in the provider system"
          }
        },
        "required": [
          "id",
          "name",
          "category",
          "strain",
          "unit_of_measure",
          "unit_weight",
          "facility_id",
          "provider",
          "provider_item_id"
        ],
        "additionalProperties": false
      },
      "Strain": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "SeedLink strain identifier"
          },
          "name": {
            "type": "string",
            "description": "Strain name"
          },
          "indica_percentage": {
            "type": "number",
            "nullable": true,
            "description": "Indica percentage (0-100)"
          },
          "sativa_percentage": {
            "type": "number",
            "nullable": true,
            "description": "Sativa percentage (0-100)"
          },
          "genetics": {
            "type": "string",
            "nullable": true,
            "description": "Genetic lineage description"
          },
          "facility_id": {
            "type": "string",
            "description": "ID of the facility that registered this strain"
          },
          "provider": {
            "type": "string",
            "enum": [
              "metrc",
              "biotrack"
            ],
            "description": "Supported traceability system provider"
          },
          "provider_strain_id": {
            "type": "string",
            "description": "Strain identifier in the provider system"
          }
        },
        "required": [
          "id",
          "name",
          "indica_percentage",
          "sativa_percentage",
          "genetics",
          "facility_id",
          "provider",
          "provider_strain_id"
        ],
        "additionalProperties": false
      },
      "Location": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "SeedLink location identifier"
          },
          "name": {
            "type": "string",
            "description": "Location name"
          },
          "location_type": {
            "type": "string",
            "nullable": true,
            "description": "Location type (e.g. Default Location Type)"
          },
          "facility_id": {
            "type": "string",
            "description": "ID of the facility this location belongs to"
          },
          "provider": {
            "type": "string",
            "enum": [
              "metrc",
              "biotrack"
            ],
            "description": "Supported traceability system provider"
          },
          "provider_location_id": {
            "type": "string",
            "description": "Location identifier in the provider system"
          }
        },
        "required": [
          "id",
          "name",
          "location_type",
          "facility_id",
          "provider",
          "provider_location_id"
        ],
        "additionalProperties": false
      },
      "Patient": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "SeedLink patient identifier"
          },
          "patient_license_number": {
            "type": "string",
            "nullable": true,
            "description": "State-issued medical patient license number"
          },
          "license_effective_start_date": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 date the patient license became active"
          },
          "license_effective_end_date": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 date the patient license expires"
          },
          "recommended_plants_count": {
            "type": "number",
            "nullable": true,
            "description": "Physician-recommended plant count limit"
          },
          "recommended_smokable_quantity": {
            "type": "number",
            "nullable": true,
            "description": "Physician-recommended smokable quantity limit"
          },
          "has_sales_limit_exemption": {
            "type": "boolean",
            "description": "Whether this patient is exempt from standard sales limits"
          },
          "facility_id": {
            "type": "string",
            "description": "ID of the facility this patient is registered at"
          },
          "provider": {
            "type": "string",
            "enum": [
              "metrc",
              "biotrack"
            ],
            "description": "Supported traceability system provider"
          },
          "provider_patient_id": {
            "type": "string",
            "description": "Patient identifier in the provider system"
          }
        },
        "required": [
          "id",
          "patient_license_number",
          "license_effective_start_date",
          "license_effective_end_date",
          "recommended_plants_count",
          "recommended_smokable_quantity",
          "has_sales_limit_exemption",
          "facility_id",
          "provider",
          "provider_patient_id"
        ],
        "additionalProperties": false
      },
      "SalesDelivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "SeedLink sales delivery identifier"
          },
          "recipient_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the delivery recipient"
          },
          "recipient_city": {
            "type": "string",
            "nullable": true,
            "description": "City of the delivery recipient"
          },
          "recipient_state": {
            "type": "string",
            "nullable": true,
            "description": "State of the delivery recipient"
          },
          "delivery_date": {
            "type": "string",
            "nullable": true,
            "description": "ISO 8601 date and time of the delivery"
          },
          "customer_type": {
            "type": "string",
            "description": "Type of customer (e.g. Consumer, Patient)"
          },
          "patient_license": {
            "type": "string",
            "nullable": true,
            "description": "Patient license number for medical deliveries"
          },
          "status": {
            "type": "string",
            "nullable": true,
            "description": "Provider-reported delivery status"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SalesDeliveryItem"
            },
            "description": "Line items included in this delivery"
          },
          "facility_id": {
            "type": "string",
            "description": "ID of the facility the delivery originated from"
          },
          "provider": {
            "type": "string",
            "enum": [
              "metrc",
              "biotrack"
            ],
            "description": "Supported traceability system provider"
          },
          "provider_delivery_id": {
            "type": "string",
            "description": "Sales delivery identifier in the provider system"
          }
        },
        "required": [
          "id",
          "recipient_name",
          "recipient_city",
          "recipient_state",
          "delivery_date",
          "customer_type",
          "patient_license",
          "status",
          "items",
          "facility_id",
          "provider",
          "provider_delivery_id"
        ],
        "additionalProperties": false
      },
      "SalesDeliveryItem": {
        "type": "object",
        "properties": {
          "package_id": {
            "type": "string",
            "description": "ID of the package included in the delivery"
          },
          "item_name": {
            "type": "string",
            "description": "Name of the product item"
          },
          "quantity": {
            "type": "number",
            "description": "Quantity delivered"
          },
          "unit_of_measure": {
            "type": "string",
            "description": "Unit of measurement for the quantity"
          }
        },
        "required": [
          "package_id",
          "item_name",
          "quantity",
          "unit_of_measure"
        ],
        "additionalProperties": false
      }
    }
  },
  "paths": {
    "/v1/oauth/token": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "description": "OAuth 2.0 token endpoint — supports client_credentials and refresh_token grants",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "grant_type": {
                    "type": "string",
                    "description": "OAuth grant type (client_credentials or refresh_token)"
                  },
                  "client_id": {
                    "type": "string",
                    "description": "OAuth client ID"
                  },
                  "client_secret": {
                    "type": "string",
                    "description": "OAuth client secret"
                  },
                  "refresh_token": {
                    "type": "string",
                    "description": "Refresh token for the refresh_token grant type"
                  },
                  "scope": {
                    "type": "string",
                    "description": "Space-separated list of requested scopes"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "access_token": {
                      "type": "string",
                      "description": "Bearer access token for API authentication"
                    },
                    "token_type": {
                      "type": "string",
                      "enum": [
                        "Bearer"
                      ],
                      "description": "Token type (always Bearer)"
                    },
                    "expires_in": {
                      "type": "integer",
                      "description": "Token lifetime in seconds"
                    },
                    "refresh_token": {
                      "type": "string",
                      "description": "Refresh token for obtaining new access tokens"
                    },
                    "scope": {
                      "type": "string",
                      "description": "Granted scopes, space-separated"
                    }
                  },
                  "required": [
                    "access_token",
                    "token_type",
                    "expires_in"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "OAuth error code per RFC 6749 (e.g. invalid_client, invalid_grant)"
                    },
                    "error_description": {
                      "type": "string",
                      "description": "Human-readable description of the error"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "OAuth error code per RFC 6749 (e.g. invalid_client, invalid_grant)"
                    },
                    "error_description": {
                      "type": "string",
                      "description": "Human-readable description of the error"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "OAuth error code per RFC 6749 (e.g. invalid_client, invalid_grant)"
                    },
                    "error_description": {
                      "type": "string",
                      "description": "Human-readable description of the error"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/link/token/create": {
      "post": {
        "tags": [
          "Link"
        ],
        "description": "Create a temporary link token for the Connect SDK",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {},
                    "description": "Custom metadata to pass through the Connect flow"
                  },
                  "redirect_uri": {
                    "type": "string",
                    "description": "URL to redirect the user after completing the Connect flow"
                  },
                  "state": {
                    "type": "string",
                    "description": "Opaque state value returned in the redirect callback"
                  },
                  "external_id": {
                    "type": "string",
                    "description": "Your own identifier for the resulting connection (e.g. your internal customer/user ID). Carried through to the connection once the flow completes."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "link_token": {
                          "type": "string",
                          "description": "Short-lived token to initialize the Connect SDK"
                        },
                        "expires_at": {
                          "type": "string",
                          "description": "ISO 8601 expiration timestamp for the link token"
                        }
                      },
                      "required": [
                        "link_token",
                        "expires_at"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/link/token/exchange": {
      "post": {
        "tags": [
          "Link"
        ],
        "description": "Exchange a public token from the Connect SDK for connection details",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "public_token": {
                    "type": "string",
                    "description": "Public token received after a successful Connect flow"
                  }
                },
                "required": [
                  "public_token"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "connection_id": {
                          "type": "string",
                          "description": "ID of the newly created connection"
                        },
                        "connection_token": {
                          "type": "string",
                          "description": "Credential scoped to exactly this connection -- use it as a Bearer token on /v1/connections/{id}/* calls instead of your org-level access token. Only present the first time this connection is exchanged; store it now, it is never shown again."
                        },
                        "provider": {
                          "type": "string",
                          "description": "Provider for the new connection"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code for the new connection"
                        },
                        "status": {
                          "type": "string",
                          "description": "Initial connection status"
                        },
                        "client_state": {
                          "type": "string",
                          "description": "Opaque state value passed through from the link token"
                        }
                      },
                      "required": [
                        "connection_id",
                        "provider",
                        "state",
                        "status"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/": {
      "get": {
        "tags": [
          "Connections"
        ],
        "description": "List all connections for the authenticated organization",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number to retrieve (default: 1)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "per_page",
            "required": false,
            "description": "Number of items per page (default: 25, max: 100)"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "SeedLink connection identifier"
                          },
                          "external_id": {
                            "type": "string",
                            "nullable": true,
                            "description": "Your own identifier for this connection, if you set one"
                          },
                          "provider": {
                            "type": "string",
                            "description": "Traceability provider (e.g. metrc, biotrack)"
                          },
                          "state": {
                            "type": "string",
                            "description": "Two-letter US state code for this connection"
                          },
                          "status": {
                            "type": "string",
                            "description": "Connection status (active, inactive, error, pending)"
                          },
                          "is_sandbox": {
                            "type": "boolean",
                            "description": "Whether this is a sandbox connection"
                          },
                          "capabilities": {
                            "type": "object",
                            "properties": {
                              "plant_batches": {
                                "type": "boolean",
                                "description": "Plant batch tracking supported"
                              },
                              "mother_plants": {
                                "type": "boolean",
                                "description": "Mother plant growth phase supported"
                              },
                              "vegetative": {
                                "type": "boolean",
                                "description": "Vegetative growth phase supported"
                              },
                              "flowering": {
                                "type": "boolean",
                                "description": "Flowering growth phase supported"
                              },
                              "harvests": {
                                "type": "boolean",
                                "description": "Harvest tracking supported"
                              },
                              "packages": {
                                "type": "boolean",
                                "description": "Package tracking supported"
                              },
                              "items": {
                                "type": "boolean",
                                "description": "Item/product catalog supported"
                              },
                              "strains": {
                                "type": "boolean",
                                "description": "Strain registry supported"
                              },
                              "labs": {
                                "type": "boolean",
                                "description": "Lab result tracking supported"
                              },
                              "sales": {
                                "type": "boolean",
                                "description": "Sales/receipt tracking supported"
                              },
                              "sales_deliveries": {
                                "type": "boolean",
                                "description": "Off-site sales deliveries supported -- gates the /sales_deliveries endpoint"
                              },
                              "retailer_deliveries": {
                                "type": "boolean",
                                "description": "Retailer-to-retailer deliveries supported"
                              },
                              "patient_lookup": {
                                "type": "boolean",
                                "description": "Registered patient lookup supported -- gates the /patients endpoint"
                              },
                              "get_transfers": {
                                "type": "boolean",
                                "description": "Transfer manifest reads supported"
                              },
                              "transfer_templates": {
                                "type": "boolean",
                                "description": "Reusable transfer templates supported"
                              },
                              "external_incoming": {
                                "type": "boolean",
                                "description": "Incoming transfers from out-of-state facilities supported"
                              },
                              "closed_loop": {
                                "type": "boolean",
                                "description": "Whether this state runs closed-loop (plant batches created via packages, not directly)"
                              }
                            },
                            "required": [
                              "plant_batches",
                              "mother_plants",
                              "vegetative",
                              "flowering",
                              "harvests",
                              "packages",
                              "items",
                              "strains",
                              "labs",
                              "sales",
                              "sales_deliveries",
                              "retailer_deliveries",
                              "patient_lookup",
                              "get_transfers",
                              "transfer_templates",
                              "external_incoming",
                              "closed_loop"
                            ],
                            "additionalProperties": false,
                            "nullable": true,
                            "description": "What this (provider, state) pair actually supports. Null for providers without a capability matrix yet (e.g. BioTrack). Check this before assuming an empty list from a gated endpoint (like /patients) means \"no data\" rather than \"not supported here\"."
                          },
                          "last_synced_at": {
                            "type": "string",
                            "nullable": true,
                            "description": "ISO 8601 timestamp of the last successful sync"
                          },
                          "error_message": {
                            "type": "string",
                            "nullable": true,
                            "description": "Most recent error message, if status is error"
                          },
                          "created_at": {
                            "type": "string",
                            "description": "ISO 8601 timestamp when the connection was created"
                          },
                          "updated_at": {
                            "type": "string",
                            "description": "ISO 8601 timestamp when the connection was last updated"
                          }
                        },
                        "required": [
                          "id",
                          "external_id",
                          "provider",
                          "state",
                          "status",
                          "is_sandbox",
                          "capabilities",
                          "last_synced_at",
                          "error_message",
                          "created_at",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{id}": {
      "get": {
        "tags": [
          "Connections"
        ],
        "description": "Get connection details by ID",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "Connection identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "SeedLink connection identifier"
                        },
                        "external_id": {
                          "type": "string",
                          "nullable": true,
                          "description": "Your own identifier for this connection, if you set one"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "Two-letter US state code for this connection"
                        },
                        "status": {
                          "type": "string",
                          "description": "Connection status (active, inactive, error, pending)"
                        },
                        "is_sandbox": {
                          "type": "boolean",
                          "description": "Whether this is a sandbox connection"
                        },
                        "capabilities": {
                          "type": "object",
                          "properties": {
                            "plant_batches": {
                              "type": "boolean",
                              "description": "Plant batch tracking supported"
                            },
                            "mother_plants": {
                              "type": "boolean",
                              "description": "Mother plant growth phase supported"
                            },
                            "vegetative": {
                              "type": "boolean",
                              "description": "Vegetative growth phase supported"
                            },
                            "flowering": {
                              "type": "boolean",
                              "description": "Flowering growth phase supported"
                            },
                            "harvests": {
                              "type": "boolean",
                              "description": "Harvest tracking supported"
                            },
                            "packages": {
                              "type": "boolean",
                              "description": "Package tracking supported"
                            },
                            "items": {
                              "type": "boolean",
                              "description": "Item/product catalog supported"
                            },
                            "strains": {
                              "type": "boolean",
                              "description": "Strain registry supported"
                            },
                            "labs": {
                              "type": "boolean",
                              "description": "Lab result tracking supported"
                            },
                            "sales": {
                              "type": "boolean",
                              "description": "Sales/receipt tracking supported"
                            },
                            "sales_deliveries": {
                              "type": "boolean",
                              "description": "Off-site sales deliveries supported -- gates the /sales_deliveries endpoint"
                            },
                            "retailer_deliveries": {
                              "type": "boolean",
                              "description": "Retailer-to-retailer deliveries supported"
                            },
                            "patient_lookup": {
                              "type": "boolean",
                              "description": "Registered patient lookup supported -- gates the /patients endpoint"
                            },
                            "get_transfers": {
                              "type": "boolean",
                              "description": "Transfer manifest reads supported"
                            },
                            "transfer_templates": {
                              "type": "boolean",
                              "description": "Reusable transfer templates supported"
                            },
                            "external_incoming": {
                              "type": "boolean",
                              "description": "Incoming transfers from out-of-state facilities supported"
                            },
                            "closed_loop": {
                              "type": "boolean",
                              "description": "Whether this state runs closed-loop (plant batches created via packages, not directly)"
                            }
                          },
                          "required": [
                            "plant_batches",
                            "mother_plants",
                            "vegetative",
                            "flowering",
                            "harvests",
                            "packages",
                            "items",
                            "strains",
                            "labs",
                            "sales",
                            "sales_deliveries",
                            "retailer_deliveries",
                            "patient_lookup",
                            "get_transfers",
                            "transfer_templates",
                            "external_incoming",
                            "closed_loop"
                          ],
                          "additionalProperties": false,
                          "nullable": true,
                          "description": "What this (provider, state) pair actually supports. Null for providers without a capability matrix yet (e.g. BioTrack). Check this before assuming an empty list from a gated endpoint (like /patients) means \"no data\" rather than \"not supported here\"."
                        },
                        "last_synced_at": {
                          "type": "string",
                          "nullable": true,
                          "description": "ISO 8601 timestamp of the last successful sync"
                        },
                        "error_message": {
                          "type": "string",
                          "nullable": true,
                          "description": "Most recent error message, if status is error"
                        },
                        "created_at": {
                          "type": "string",
                          "description": "ISO 8601 timestamp when the connection was created"
                        },
                        "updated_at": {
                          "type": "string",
                          "description": "ISO 8601 timestamp when the connection was last updated"
                        },
                        "metadata": {
                          "type": "object",
                          "additionalProperties": {},
                          "nullable": true,
                          "description": "Provider-specific metadata for this connection"
                        }
                      },
                      "required": [
                        "id",
                        "external_id",
                        "provider",
                        "state",
                        "status",
                        "is_sandbox",
                        "capabilities",
                        "last_synced_at",
                        "error_message",
                        "created_at",
                        "updated_at",
                        "metadata"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities": {
      "get": {
        "tags": [
          "Facilities"
        ],
        "description": "List all facilities for a connection",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Facility"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities/{facility_id}": {
      "get": {
        "tags": [
          "Facilities"
        ],
        "description": "Get a specific facility by ID",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true,
            "description": "Facility identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Facility"
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities/{facility_id}/packages": {
      "get": {
        "tags": [
          "Packages"
        ],
        "description": "List all packages for a facility",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number (default: 1)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "per_page",
            "required": false,
            "description": "Items per page (default: 25, max: 100)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "status",
            "required": false,
            "description": "Filter by package status (e.g. active, on_hold)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "category",
            "required": false,
            "description": "Filter by item category"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true,
            "description": "Facility identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Package"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Packages"
        ],
        "description": "Create a package (sandbox only)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "item_name": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Name of the product item"
                  },
                  "item_category": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Product category (e.g. Flower, Concentrate)"
                  },
                  "item_strain": {
                    "type": "string",
                    "description": "Cannabis strain name"
                  },
                  "quantity": {
                    "type": "number",
                    "minimum": 0,
                    "description": "Initial quantity in the package"
                  },
                  "unit_of_measure": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Unit of measurement (e.g. Grams, Each)"
                  },
                  "source_harvest_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "IDs of source harvests"
                  },
                  "source_package_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "IDs of source packages"
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {},
                    "description": "Additional metadata to attach to the package"
                  }
                },
                "required": [
                  "item_name",
                  "item_category",
                  "quantity",
                  "unit_of_measure"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true,
            "description": "Facility identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Package"
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities/{facility_id}/packages/{package_id}": {
      "get": {
        "tags": [
          "Packages"
        ],
        "description": "Get a specific package by ID",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "package_id",
            "required": true
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Package"
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Packages"
        ],
        "description": "Update a package (sandbox only)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "quantity": {
                    "type": "number",
                    "minimum": 0,
                    "description": "Updated quantity"
                  },
                  "is_on_hold": {
                    "type": "boolean",
                    "description": "Set administrative hold status"
                  },
                  "item_name": {
                    "type": "string",
                    "description": "Updated product item name"
                  },
                  "item_category": {
                    "type": "string",
                    "description": "Updated product category"
                  },
                  "item_strain": {
                    "type": "string",
                    "nullable": true,
                    "description": "Updated strain name"
                  },
                  "lab_testing_state": {
                    "type": "string",
                    "description": "Updated lab testing status"
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {},
                    "description": "Metadata fields to merge"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "package_id",
            "required": true
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Package"
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities/{facility_id}/plants": {
      "get": {
        "tags": [
          "Plants"
        ],
        "description": "List all plants for a facility",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number (default: 1)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "per_page",
            "required": false,
            "description": "Items per page (default: 25, max: 100)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "growth_phase",
            "required": false,
            "description": "Filter by growth phase (clone, vegetative, flowering)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true,
            "description": "Facility identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Plant"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities/{facility_id}/plants/{plant_id}": {
      "get": {
        "tags": [
          "Plants"
        ],
        "description": "Get a specific plant by ID",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "plant_id",
            "required": true
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Plant"
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities/{facility_id}/harvests": {
      "get": {
        "tags": [
          "Harvests"
        ],
        "description": "List all harvests for a facility",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number to retrieve (default: 1)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "per_page",
            "required": false,
            "description": "Number of items per page (default: 25, max: 100)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true,
            "description": "Facility identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Harvest"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities/{facility_id}/harvests/{harvest_id}": {
      "get": {
        "tags": [
          "Harvests"
        ],
        "description": "Get a specific harvest by ID",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "harvest_id",
            "required": true
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Harvest"
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities/{facility_id}/transfers": {
      "get": {
        "tags": [
          "Transfers"
        ],
        "description": "List all transfers for a facility",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number (default: 1)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "per_page",
            "required": false,
            "description": "Items per page (default: 25, max: 100)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "direction",
            "required": false,
            "description": "Filter by transfer direction (incoming, outgoing)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "status",
            "required": false,
            "description": "Filter by status (pending, in_transit, received, rejected)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true,
            "description": "Facility identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Transfer"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Transfers"
        ],
        "description": "Create a transfer (sandbox only)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "transfer_type": {
                    "type": "string",
                    "description": "Type of transfer (e.g. wholesale, distribution)"
                  },
                  "shipper_facility": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Name or ID of the shipping facility"
                  },
                  "recipient_facility": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Name or ID of the receiving facility"
                  },
                  "packages": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/TransferPackage"
                    },
                    "description": "Packages to include in the transfer"
                  },
                  "estimated_departure": {
                    "type": "string",
                    "description": "ISO 8601 estimated departure time"
                  },
                  "estimated_arrival": {
                    "type": "string",
                    "description": "ISO 8601 estimated arrival time"
                  },
                  "transporter": {
                    "type": "string",
                    "description": "Name of the transport company"
                  },
                  "driver_name": {
                    "type": "string",
                    "description": "Name of the driver"
                  },
                  "vehicle_info": {
                    "type": "string",
                    "description": "Vehicle description or license plate"
                  }
                },
                "required": [
                  "shipper_facility",
                  "recipient_facility",
                  "packages"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true,
            "description": "Facility identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Transfer"
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities/{facility_id}/transfers/{transfer_id}": {
      "get": {
        "tags": [
          "Transfers"
        ],
        "description": "Get a specific transfer by ID",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "transfer_id",
            "required": true
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Transfer"
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities/{facility_id}/sales": {
      "get": {
        "tags": [
          "Sales"
        ],
        "description": "List all sales for a facility",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number (default: 1)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "per_page",
            "required": false,
            "description": "Items per page (default: 25, max: 100)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "start_date",
            "required": false,
            "description": "Filter sales on or after this ISO 8601 date"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "end_date",
            "required": false,
            "description": "Filter sales on or before this ISO 8601 date"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true,
            "description": "Facility identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Sale"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Sales"
        ],
        "description": "Record a sale (sandbox only)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "customer_type": {
                    "type": "string",
                    "description": "Type of customer (e.g. Consumer, Patient)"
                  },
                  "patient_license": {
                    "type": "string",
                    "description": "Patient license number for medical sales"
                  },
                  "caregiver_license": {
                    "type": "string",
                    "description": "Caregiver license number"
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/SaleItem"
                    },
                    "description": "Line items in the sale"
                  }
                },
                "required": [
                  "items"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true,
            "description": "Facility identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Sale"
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities/{facility_id}/lab_results": {
      "get": {
        "tags": [
          "Lab Results"
        ],
        "description": "List all lab results for a facility",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number (default: 1)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "per_page",
            "required": false,
            "description": "Items per page (default: 25, max: 100)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "package_id",
            "required": false,
            "description": "Filter lab results by package ID"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true,
            "description": "Facility identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LabResult"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Lab Results"
        ],
        "description": "Add a lab result (sandbox only)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "package_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "ID of the package to add lab results for"
                  },
                  "lab_name": {
                    "type": "string",
                    "description": "Name of the testing laboratory"
                  },
                  "lab_license": {
                    "type": "string",
                    "description": "License number of the testing laboratory"
                  },
                  "test_date": {
                    "type": "string",
                    "description": "ISO 8601 date when the test was performed"
                  },
                  "overall_passed": {
                    "type": "boolean",
                    "description": "Whether the overall test passed"
                  },
                  "test_type": {
                    "type": "string",
                    "description": "Type of testing (e.g. ComplianceTesting)"
                  },
                  "results": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/LabTestResult"
                    },
                    "description": "Individual test results"
                  }
                },
                "required": [
                  "package_id",
                  "overall_passed",
                  "results"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true,
            "description": "Facility identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/LabResult"
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities/{facility_id}/items": {
      "get": {
        "tags": [
          "Items"
        ],
        "description": "List all items for a facility",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number to retrieve (default: 1)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "per_page",
            "required": false,
            "description": "Number of items per page (default: 25, max: 100)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true,
            "description": "Facility identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Item"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities/{facility_id}/strains": {
      "get": {
        "tags": [
          "Strains"
        ],
        "description": "List all strains for a facility",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number to retrieve (default: 1)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "per_page",
            "required": false,
            "description": "Number of items per page (default: 25, max: 100)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true,
            "description": "Facility identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Strain"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities/{facility_id}/locations": {
      "get": {
        "tags": [
          "Locations"
        ],
        "description": "List all locations for a facility",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number to retrieve (default: 1)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "per_page",
            "required": false,
            "description": "Number of items per page (default: 25, max: 100)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true,
            "description": "Facility identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Location"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities/{facility_id}/patients": {
      "get": {
        "tags": [
          "Patients"
        ],
        "description": "List registered patients for a facility (only populated where the provider/state supports patient lookup)",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number to retrieve (default: 1)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "per_page",
            "required": false,
            "description": "Number of items per page (default: 25, max: 100)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true,
            "description": "Facility identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Patient"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/{connection_id}/facilities/{facility_id}/sales_deliveries": {
      "get": {
        "tags": [
          "Sales Deliveries"
        ],
        "description": "List sales deliveries for a facility (only populated where the provider/state supports sales deliveries)",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number to retrieve (default: 1)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "per_page",
            "required": false,
            "description": "Number of items per page (default: 25, max: 100)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connection_id",
            "required": true,
            "description": "Connection identifier"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "facility_id",
            "required": true,
            "description": "Facility identifier"
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SalesDelivery"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "request_id": {
                          "type": "string",
                          "description": "Unique identifier for this API request"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "ISO 8601 timestamp of when the request was processed"
                        },
                        "provider": {
                          "type": "string",
                          "description": "Traceability provider that served this request (e.g. metrc, biotrack)"
                        },
                        "state": {
                          "type": "string",
                          "description": "US state code associated with this request"
                        }
                      },
                      "required": [
                        "request_id",
                        "timestamp"
                      ],
                      "additionalProperties": false
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Current page number (1-indexed)"
                        },
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "description": "Number of items per page"
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of items across all pages"
                        },
                        "total_pages": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of pages available"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total",
                        "total_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "meta",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "502": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "Error type category (e.g. validation_error, authentication_error)"
                        },
                        "code": {
                          "type": "string",
                          "description": "Machine-readable error code (e.g. invalid_parameter, unauthorized)"
                        },
                        "message": {
                          "type": "string",
                          "description": "Human-readable error description"
                        },
                        "request_id": {
                          "type": "string",
                          "description": "Unique request ID for support reference"
                        }
                      },
                      "required": [
                        "type",
                        "code",
                        "message",
                        "request_id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "http://localhost:3000",
      "description": "Local development"
    }
  ],
  "tags": [
    {
      "name": "Authentication",
      "description": "Register an organization, then mint and revoke OAuth 2.0 access tokens"
    },
    {
      "name": "Link",
      "description": "Create a link token for the Connect SDK, then exchange it for a connection"
    },
    {
      "name": "Connections",
      "description": "Manage provider connections"
    },
    {
      "name": "Facilities",
      "description": "Licensed facilities on a connection"
    },
    {
      "name": "Packages",
      "description": "Trackable inventory packages (product, weight, tag)"
    },
    {
      "name": "Plants",
      "description": "Plants and their growth phase"
    },
    {
      "name": "Harvests",
      "description": "Harvest batches and source plants"
    },
    {
      "name": "Transfers",
      "description": "Manifests moving packages between facilities"
    },
    {
      "name": "Sales",
      "description": "Point-of-sale transactions"
    },
    {
      "name": "Lab Results",
      "description": "Lab test results for packages"
    },
    {
      "name": "Items",
      "description": "Product catalog items"
    },
    {
      "name": "Strains",
      "description": "Strain catalog"
    },
    {
      "name": "Locations",
      "description": "Locations within a facility (rooms, zones)"
    },
    {
      "name": "Patients",
      "description": "Registered medical patients (facilities with the patientLookup capability)"
    },
    {
      "name": "Sales Deliveries",
      "description": "Delivery sales (facilities with the salesDeliveries capability)"
    }
  ],
  "x-tagGroups": []
}
