{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/serpkite-com/json-schema/serpkite-com-batch-create-response-schema.json",
  "title": "BatchCreateResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/serpkite-com-batches-api-openapi.yml#/components/schemas/BatchCreateResponse",
  "type": "object",
  "required": [
    "batches"
  ],
  "properties": {
    "batches": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "$ref": "#/$defs/Batch"
          },
          {
            "$ref": "#/$defs/Error"
          }
        ]
      }
    }
  },
  "$defs": {
    "Batch": {
      "type": "object",
      "required": [
        "id",
        "status",
        "endpoint",
        "created_at",
        "poll_url"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "status": {
          "type": "string",
          "enum": [
            "queued",
            "running",
            "done",
            "failed"
          ]
        },
        "endpoint": {
          "type": "string"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "completed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "credits_used": {
          "type": "number"
        },
        "poll_url": {
          "type": "string"
        },
        "webhook_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "webhook_status": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "pending",
            "delivered",
            "failed",
            null
          ]
        },
        "error": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            }
          }
        },
        "result": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": true,
          "description": "Present when done; kept 24h. The endpoint's response body, or {markdown, meta} for format=markdown jobs"
        }
      }
    },
    "Error": {
      "type": "object",
      "required": [
        "error"
      ],
      "properties": {
        "error": {
          "type": "object",
          "required": [
            "code",
            "message"
          ],
          "properties": {
            "code": {
              "type": "string",
              "description": "403: spend_cap_reached, key_limit_reached, account_restricted, forbidden. 409/422: idempotency_key_reused. 422: target_unavailable (the URL you asked for failed: its site answered 404, its domain doesn't resolve; resending won't help), no_pages. 429: rate_limited, daily_limit_reached. 503: upstream_error, upstream_blocked, upstream_timeout, unavailable (the API never sends 502 or 504)"
            },
            "message": {
              "type": "string"
            },
            "request_id": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}