{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/serpresult-com/json-schema/serpresult-com-bulk-response-schema.json",
  "title": "BulkResponse",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/serpresult-com-openapi.json#/components/schemas/BulkResponse",
  "type": "object",
  "required": [
    "batch_id",
    "total",
    "succeeded",
    "failed",
    "results"
  ],
  "properties": {
    "batch_id": {
      "type": "string",
      "description": "`bat_` plus 32 hex characters. Every row's log entry carries it.",
      "pattern": "^bat_[0-9a-f]{32}$"
    },
    "total": {
      "type": "integer",
      "minimum": 1,
      "maximum": 50
    },
    "succeeded": {
      "type": "integer",
      "minimum": 0
    },
    "failed": {
      "type": "integer",
      "minimum": 0
    },
    "results": {
      "type": "array",
      "description": "One entry per input row, in input order.",
      "items": {
        "$ref": "#/$defs/BulkResult"
      }
    }
  },
  "$defs": {
    "BulkResult": {
      "oneOf": [
        {
          "$ref": "#/$defs/BulkResultOk"
        },
        {
          "$ref": "#/$defs/BulkResultError"
        }
      ]
    },
    "BulkResultError": {
      "type": "object",
      "description": "A row that was refused or failed. Carries no `request_id` of its own; the batch's is in the `X-Request-Id` header.",
      "required": [
        "status",
        "error",
        "message"
      ],
      "properties": {
        "status": {
          "type": "string",
          "const": "error"
        },
        "error": {
          "type": "string",
          "description": "`invalid_request`, `unsupported_geo` and `unsupported_parameter` for a row that did not validate (not charged); `upstream_error` and `upstream_timeout` for a row that ran and failed (charged); `internal_error` for a fault on our side (not charged).",
          "enum": [
            "invalid_request",
            "unsupported_geo",
            "unsupported_parameter",
            "upstream_error",
            "upstream_timeout",
            "internal_error"
          ]
        },
        "message": {
          "type": "string"
        }
      }
    },
    "BulkResultOk": {
      "type": "object",
      "description": "A served row, in the same shape as a `GET /v1/query` response plus `status`.",
      "required": [
        "status",
        "id",
        "target",
        "query",
        "geo",
        "locale",
        "page",
        "results"
      ],
      "properties": {
        "status": {
          "type": "string",
          "const": "ok"
        },
        "id": {
          "type": "string",
          "pattern": "^qry_[0-9a-f]{32}$"
        },
        "target": {
          "$ref": "#/$defs/Target"
        },
        "query": {
          "type": "string"
        },
        "geo": {
          "$ref": "#/$defs/Geo"
        },
        "locale": {
          "$ref": "#/$defs/Locale"
        },
        "page": {
          "type": "integer",
          "minimum": 1
        },
        "results": {
          "type": "object",
          "required": [
            "organic"
          ],
          "properties": {
            "organic": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/OrganicResult"
              }
            }
          }
        }
      }
    },
    "Geo": {
      "type": "string",
      "description": "A supported country, as an ISO 3166-1 alpha-2 code. Results are\nlocalized to this country, the same ones a user searching there would\nsee, and the code also picks the default `locale`.\n",
      "enum": [
        "us",
        "in",
        "gb",
        "ca",
        "au",
        "de",
        "fr",
        "sg",
        "ae",
        "jp",
        "ad",
        "af",
        "ag",
        "al",
        "am",
        "ao",
        "ar",
        "at",
        "aw",
        "az",
        "ba",
        "bb",
        "bd",
        "be",
        "bf",
        "bg",
        "bh",
        "bi",
        "bj",
        "bn",
        "bo",
        "br",
        "bs",
        "bw",
        "by",
        "bz",
        "cd",
        "cg",
        "ch",
        "ci",
        "cl",
        "cm",
        "cn",
        "co",
        "cr",
        "cu",
        "cv",
        "cy",
        "cz",
        "dk",
        "do",
        "dz",
        "ec",
        "ee",
        "eg",
        "es",
        "et",
        "fi",
        "fj",
        "fm",
        "fo",
        "ga",
        "gd",
        "ge",
        "gf",
        "gg",
        "gh",
        "gm",
        "gp",
        "gq",
        "gr",
        "gt",
        "gu",
        "gy",
        "hk",
        "hn",
        "hr",
        "ht",
        "hu",
        "id",
        "ie",
        "il",
        "iq",
        "ir",
        "is",
        "it",
        "jm",
        "jo",
        "ke",
        "kg",
        "kh",
        "km",
        "kn",
        "kr",
        "kw",
        "ky",
        "kz",
        "la",
        "lb",
        "lc",
        "lk",
        "lr",
        "ls",
        "lt",
        "lu",
        "lv",
        "ly",
        "ma",
        "md",
        "me",
        "mg",
        "mk",
        "ml",
        "mm",
        "mn",
        "mo",
        "mp",
        "mq",
        "mr",
        "mt",
        "mu",
        "mv",
        "mw",
        "mx",
        "my",
        "mz",
        "na",
        "nc",
        "ne",
        "ng",
        "ni",
        "nl",
        "no",
        "np",
        "nz",
        "om",
        "pa",
        "pe",
        "pf",
        "pg",
        "ph",
        "pk",
        "pl",
        "pr",
        "ps",
        "pt",
        "pw",
        "py",
        "qa",
        "re",
        "ro",
        "rs",
        "ru",
        "rw",
        "sa",
        "sb",
        "sd",
        "se",
        "si",
        "sk",
        "sl",
        "sn",
        "so",
        "sr",
        "st",
        "sv",
        "sy",
        "sz",
        "td",
        "tg",
        "th",
        "tj",
        "tl",
        "tn",
        "to",
        "tr",
        "tt",
        "tw",
        "tz",
        "ua",
        "ug",
        "uy",
        "uz",
        "vc",
        "ve",
        "vg",
        "vi",
        "vn",
        "vu",
        "ye",
        "za",
        "zm",
        "zw"
      ],
      "default": "us"
    },
    "Locale": {
      "type": "string",
      "description": "A language-region tag, `xx-yy`.",
      "pattern": "^[A-Za-z]{2}-[A-Za-z]{2}$"
    },
    "OrganicResult": {
      "type": "object",
      "description": "One organic result. `x-hub-fields` is the flat row every marketplace wrapper exposes: these organic fields plus the request echo (`query`, `target`, `geo`, `locale`, `page`), with `request_id` taken from the response `id`. It is paired with the fixtures in `docs/api/fixtures/`.",
      "x-hub-fields": [
        "position",
        "title",
        "url",
        "domain",
        "snippet",
        "query",
        "target",
        "geo",
        "locale",
        "page",
        "request_id"
      ],
      "required": [
        "position",
        "title",
        "url",
        "domain",
        "snippet"
      ],
      "properties": {
        "position": {
          "type": "integer",
          "minimum": 1,
          "description": "1-based rank within the answered page, after de-duplication."
        },
        "title": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "domain": {
          "type": "string",
          "description": "The registrable domain of `url` (`example.co.uk`), or the hostname when it has no public suffix."
        },
        "snippet": {
          "type": "string",
          "description": "The engine's description text. Empty when the engine gave none."
        }
      }
    },
    "Target": {
      "type": "string",
      "description": "The engine to search.\n- `google_search`: pages 1–5, `num` up to 20, safe search supported.\n- `bing_search`: page 1 only, `num` up to 20, safe search supported.\n- `duckduckgo_search`: page 1 only, `num` up to 10, no safe search.\n- `yahoo_search`: page 1 only, `num` up to 10, safe search supported.\n- `brave_search`: pages 1–5, `num` up to 20, safe search supported.\n- `yandex_search`: pages 1–5, `num` up to 10, no safe search.\n",
      "enum": [
        "google_search",
        "bing_search",
        "duckduckgo_search",
        "yahoo_search",
        "brave_search",
        "yandex_search"
      ],
      "default": "google_search"
    }
  }
}