{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/shelfatlas-com/json-schema/shelfatlas-com-observation-request-schema.json",
  "title": "ObservationRequest",
  "description": "Exactly one of `ean` or `offer_id` is required — the other is omitted.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/shelfatlas-com-observations-api-openapi.yml#/components/schemas/ObservationRequest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "store_id",
    "stock_status"
  ],
  "oneOf": [
    {
      "required": [
        "ean"
      ]
    },
    {
      "required": [
        "offer_id"
      ]
    }
  ],
  "properties": {
    "ean": {
      "type": "string",
      "minLength": 1,
      "description": "EAN/GTIN of a curated product. Required if offer_id is omitted."
    },
    "offer_id": {
      "type": "string",
      "format": "uuid",
      "description": "A CatalogOffer id. Required if ean is omitted."
    },
    "store_id": {
      "type": "string",
      "format": "uuid"
    },
    "stock_status": {
      "type": "string",
      "enum": [
        "in_stock",
        "low_stock",
        "out_of_stock"
      ]
    },
    "price_cents": {
      "type": "integer",
      "minimum": 1,
      "description": "The observed price, in cents."
    },
    "currency": {
      "type": "string",
      "minLength": 3,
      "maxLength": 3,
      "default": "DKK"
    },
    "consent_tier": {
      "type": "string",
      "enum": [
        "anonymous_aggregate",
        "identifiable"
      ],
      "default": "anonymous_aggregate"
    },
    "reporter_clerk_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "description": "Attributes the observation to an end-user your surface has already verified server-side. Honoured only for API-key auth."
    },
    "device_token": {
      "type": "string",
      "format": "uuid",
      "description": "Vouches for an anonymous end-user's device id instead of a Clerk id. Honoured only for API-key auth, and mutually exclusive with reporter_clerk_id."
    },
    "observed_at": {
      "type": "string",
      "format": "date-time",
      "description": "When the shelf was actually seen, for a report submitted after the fact (e.g. a next-day follow-up) instead of the request's own \"now\". Must not be more than 5 minutes in the future (clock-skew allowance) or more than 48 hours in the past; omit to stamp the current time, unchanged from before this field existed."
    }
  }
}