{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/yelp/json-schema/yelp-generic-attribution-webhook-request-schema.json",
  "title": "GenericAttributionWebhookRequest",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/yelp-webhooks-api-openapi.yml#/components/schemas/GenericAttributionWebhookRequest",
  "type": "object",
  "properties": {
    "yelp_token": {
      "type": "string",
      "description": "The Base64 encoded string passed by query parameter of linkout URL, and stored by the partner.\nHas to be included in the webhook event associated with the original linkout.\nFood ordering partners may instead send the click id Yelp appended to the linkout URL.\n"
    },
    "event_type": {
      "type": "string",
      "description": "Booking event type",
      "enum": [
        "confirmed",
        "canceled",
        "rescheduled"
      ]
    },
    "event_timestamp": {
      "type": "integer",
      "description": "Epoch timestamp of event, in milliseconds"
    },
    "external_id": {
      "type": "string",
      "description": "External id in the partner domain representing the booking"
    },
    "original_external_id": {
      "type": "string",
      "description": "For \"rescheduled\" events, this will be the original booking id if a new one has been created"
    },
    "external_business_id": {
      "type": "string",
      "description": "For events where a user decided to still go through with the booking, but with a different biz.\nThis is the partner encoded biz id, which will be associated with Yelp biz id server-side.\n"
    },
    "booking_details_url": {
      "type": "string",
      "description": "Callback URL for Yelp to directly retrieve the details of the booking"
    },
    "booked_services": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/BookedService"
      }
    },
    "metadata": {
      "type": "object",
      "additionalProperties": true,
      "description": "Optional partner-specific details about the booking, e.g. party size or seating area. Stored for reporting and not validated."
    }
  },
  "required": [
    "yelp_token",
    "event_type",
    "event_timestamp",
    "external_id"
  ],
  "$defs": {
    "BookedService": {
      "description": "Formatted booking details",
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "description": "The service name"
        },
        "provider": {
          "type": "string",
          "description": "The service provider name"
        },
        "duration_minutes": {
          "type": "integer",
          "description": "Duration of the appointment, in minutes"
        },
        "start_datetime": {
          "type": "integer",
          "description": "Start datetime of the appointment, Epoch timestamp in milliseconds"
        },
        "order_value": {
          "$ref": "#/$defs/OrderValue"
        }
      }
    },
    "OrderValue": {
      "description": "Gross Order Value (GOV) of the service",
      "type": "object",
      "properties": {
        "price": {
          "type": "number",
          "description": "Order value"
        },
        "currency": {
          "type": "string",
          "description": "ISO-4217 currency code, \"USD\" by default"
        }
      },
      "required": [
        "price"
      ]
    }
  }
}