{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/searlo-tech/json-schema/searlo-tech-async-task-spec-schema.json",
  "title": "AsyncTaskSpec",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/searlo-tech-openapi.yaml#/components/schemas/AsyncTaskSpec",
  "type": "object",
  "required": [
    "endpoint"
  ],
  "properties": {
    "endpoint": {
      "type": "string",
      "description": "What to run. keywords/*, domain/*, ai/aimode and ai/grok also pass validation, but those endpoints are switched off in production, and ai/perplexity is paused.\n",
      "enum": [
        "serp",
        "news/serp",
        "rankings/check",
        "ai/chatgpt",
        "ai/perplexity",
        "ai/copilot",
        "ai/gemini",
        "web",
        "maps",
        "shopping",
        "goto"
      ]
    },
    "request": {
      "type": "object",
      "additionalProperties": true,
      "description": "The endpoint's parameters. Must include `q` (ai/* tasks also accept `prompt`), except for goto, which takes `url` or `urls`. rankings/check reads `keyword` and `domain` but still needs `q`. web reads the search service's own names (`num`, `start`, `country`, `language`); maps and shopping read `num` for the result count. For serp, news/serp and rankings/check a country `location` is applied as gl; a city or state fails the task at once (CITY_LOCATION_UNAVAILABLE, refunded).\n"
    },
    "priority": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100,
      "default": 50,
      "description": "Higher runs first."
    },
    "idempotencyKey": {
      "type": "string",
      "maxLength": 128,
      "description": "A repeat returns the existing task with no new charge."
    },
    "webhook": {
      "type": "object",
      "required": [
        "url"
      ],
      "description": "POSTed when the task completes or fails. Any 2xx is delivered; otherwise it is retried after 5 minutes, 30 minutes, 2 hours and 12 hours.\n",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "description": "HTTPS, resolving to a public address."
        },
        "secret": {
          "type": "string",
          "maxLength": 256,
          "description": "Signs each delivery: X-Searlo-Signature is v1= followed by the hex HMAC-SHA256 of \"<X-Searlo-Timestamp>.<raw body>\".\n"
        }
      }
    }
  }
}