{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/realtimesportsapi-com/json-schema/realtimesportsapi-com-webhook-schema.json",
  "title": "Webhook",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/realtimesportsapi-com-webhooks-api-openapi.yml#/components/schemas/Webhook",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "events": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/WebhookEventType"
      }
    },
    "leagues": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      },
      "description": "League slugs to filter on; null = all leagues."
    },
    "frequency": {
      "$ref": "#/$defs/WebhookFrequency"
    },
    "active": {
      "type": "boolean"
    },
    "consecutiveFailures": {
      "type": "integer"
    },
    "deactivatedReason": {
      "type": [
        "string",
        "null"
      ]
    },
    "deactivatedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "createdAt": {
      "type": "string"
    },
    "updatedAt": {
      "type": "string"
    }
  },
  "$defs": {
    "WebhookEventType": {
      "type": "string",
      "enum": [
        "event.live",
        "event.score_change",
        "event.status_change",
        "event.play",
        "event.final",
        "event.play_corrected"
      ],
      "description": "event.play_corrected (opt-in) is sent when the provider revises a play we already sent: same payload as event.play with corrected: true and the original play id, delivered immediately. Replace the stored play with that id."
    },
    "WebhookFrequency": {
      "type": "string",
      "enum": [
        "asap",
        "30s",
        "1m",
        "5m",
        "10m",
        "30m"
      ],
      "description": "Delivery frequency (same rules on WebSocket subscriptions). 'asap' (default) delivers everything immediately. Any other value conflates only repeating updates per game: event.status_change where status.state is unchanged (clock/period/detail) and event.odds_change are held and the latest one per game is delivered at the next fixed tick (at most one per game per window). event.play, event.score_change, event.live, event.final and status changes where status.state changes (e.g. pre to in, in to post, Postponed) are always delivered immediately; a state change discards that game's held update. Each delivery counts once toward usage."
    }
  }
}