{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/reqbeat-com/json-schema/reqbeat-com-create-watch-request-schema.json",
  "title": "CreateWatchRequest",
  "description": "Scope the watch with exactly one of `company_id` (one company) or\n`criteria` (a saved search).\n\n`event_types` names which events fire it, at least one of:\n`opened` (a req seen for the first time), `reobserved` (a known req seen\nagain on a later day), `reposted` (a req that came back after it was\ngone), `closed` (a req verified gone from its source),\n`role_hard_to_fill` (an employer's own role pulled and put back, or pulled\nafter 30+ days unfilled; the webhook `detail` carries the reason and\ncount), `sponsor_added` (the company joined the UK register of licensed\nsponsors), `officer_appointed` and `officer_resigned` (a Companies House\nofficer change, delivered with its `role`, `date` and `company_number`). Any\nother value is a 422 and creates nothing.",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/reqbeat-com-openapi.json#/components/schemas/CreateWatchRequest",
  "properties": {
    "company_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Company Id"
    },
    "criteria": {
      "anyOf": [
        {
          "$ref": "#/$defs/Criteria"
        },
        {
          "type": "null"
        }
      ]
    },
    "event_types": {
      "items": {
        "type": "string",
        "enum": [
          "opened",
          "reobserved",
          "reposted",
          "closed",
          "role_hard_to_fill",
          "sponsor_added",
          "officer_appointed",
          "officer_resigned"
        ]
      },
      "type": "array",
      "minItems": 1,
      "title": "Event Types"
    },
    "webhook_endpoint_id": {
      "type": "integer",
      "title": "Webhook Endpoint Id"
    }
  },
  "type": "object",
  "required": [
    "event_types",
    "webhook_endpoint_id"
  ],
  "$defs": {
    "Criteria": {
      "properties": {
        "event": {
          "$ref": "#/$defs/CriteriaEvent"
        },
        "req": {
          "$ref": "#/$defs/CriteriaReq"
        },
        "company": {
          "$ref": "#/$defs/CriteriaCompany"
        },
        "max_fires_per_hour": {
          "type": "integer",
          "maximum": 10000.0,
          "minimum": 1.0,
          "title": "Max Fires Per Hour"
        },
        "dedup_window_days": {
          "type": "integer",
          "maximum": 90.0,
          "minimum": 1.0,
          "title": "Dedup Window Days"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "Criteria",
      "description": "A closed AND-of-ORs over three namespaced groups. At least one field must be constrained."
    },
    "CriteriaCompany": {
      "properties": {
        "industry": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Industry"
        },
        "company_kind": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Company Kind"
        },
        "country": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Country"
        },
        "headcount_band": {
          "items": {
            "type": "string",
            "enum": [
              "1-10",
              "11-50",
              "51-200",
              "201-500",
              "501-1000",
              "1001-5000",
              "5001+"
            ]
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Headcount Band"
        },
        "industry_terms": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Industry Terms"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "CriteriaCompany",
      "description": "The `company` criteria group: AND across fields, OR within a field."
    },
    "CriteriaEvent": {
      "properties": {
        "company_id": {
          "items": {
            "type": "integer"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Company Id"
        },
        "event_type": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Event Type"
        },
        "board": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Board"
        },
        "source_type": {
          "items": {
            "type": "string",
            "enum": [
              "ats_tenant",
              "board"
            ]
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Source Type"
        },
        "ats_vendor": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Ats Vendor"
        },
        "function": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Function"
        },
        "country": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Country"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "CriteriaEvent",
      "description": "The `event` criteria group: AND across fields, OR within a field."
    },
    "CriteriaReq": {
      "properties": {
        "seniority_level": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Seniority Level"
        },
        "function": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Function"
        },
        "remote_type": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Remote Type"
        },
        "skills": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Skills"
        },
        "q": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Q"
        },
        "location": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Location"
        },
        "q_excludes": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 64,
          "minItems": 1,
          "title": "Q Excludes"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "CriteriaReq",
      "description": "The `req` criteria group: AND across fields, OR within a field."
    }
  }
}