{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/theirstack-com/json-schema/theirstack-com-webhook-response-v0-schema.json",
  "title": "WebhookResponseV0",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/theirstack-com-openapi.json#/components/schemas/WebhookResponseV0",
  "properties": {
    "url": {
      "type": "string",
      "maxLength": 2083,
      "minLength": 1,
      "format": "uri",
      "title": "Url",
      "description": "URL of the webhook"
    },
    "search_id": {
      "type": "integer",
      "title": "Search Id",
      "description": "ID of the search that the webhook is listening to."
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Description",
      "description": "Description of the webhook"
    },
    "listening_start_time": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Listening Start Time",
      "description": "Date when the webhook started listening for events. If listening_start_time is None, the webhook will listen to all events matching the search query regardless of when they occurred."
    },
    "trigger_once_per_company": {
      "type": "boolean",
      "title": "Trigger Once Per Company",
      "description": "Only for webhook type ='job.new'. If true, Company A with 5 jobs → 1 event triggered. If false, Company A with 5 jobs → 5 events triggered",
      "default": false
    },
    "active_event_types": {
      "items": {
        "$ref": "#/$defs/WebhookEventType"
      },
      "type": "array",
      "title": "Active Event Types"
    },
    "max_events_per_day": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 1.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Max Events Per Day",
      "description": "Most new records the webhook takes on per UTC day, or null for no cap. A job webhook counts jobs: each can send its job.new and, when it closes, its job.closed, so a job costs at most two credits. Records over it are dropped, never sent, charged or queued for the next day. Minimum 1: to send nothing, disable the webhook."
    },
    "id": {
      "type": "integer",
      "title": "Id"
    },
    "user_id": {
      "type": "integer",
      "title": "User Id"
    },
    "team_id": {
      "type": "integer",
      "title": "Team Id"
    },
    "is_active": {
      "type": "boolean",
      "title": "Is Active"
    },
    "is_archived": {
      "type": "boolean",
      "title": "Is Archived"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "title": "Updated At"
    },
    "search_name": {
      "type": "string",
      "title": "Search Name"
    },
    "webhook_type": {
      "type": "string",
      "enum": [
        "jobs",
        "companies"
      ],
      "title": "Webhook Type"
    },
    "scanning_frequency": {
      "type": "string",
      "title": "Scanning Frequency",
      "description": "Scanning frequency for the webhook",
      "default": "10m"
    },
    "has_secret": {
      "type": "boolean",
      "title": "Has Secret",
      "readOnly": true
    },
    "event_type": {
      "$ref": "#/$defs/WebhookEventType",
      "description": "Deprecated: use active_event_types. Primary event type derived from webhook_type.",
      "deprecated": true,
      "readOnly": true
    }
  },
  "type": "object",
  "required": [
    "url",
    "search_id",
    "active_event_types",
    "id",
    "user_id",
    "team_id",
    "is_active",
    "is_archived",
    "created_at",
    "updated_at",
    "search_name",
    "webhook_type",
    "has_secret",
    "event_type"
  ],
  "$defs": {
    "WebhookEventType": {
      "type": "string",
      "enum": [
        "job_new",
        "company_new",
        "job_closed"
      ],
      "title": "WebhookEventType"
    }
  }
}