{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/soldgraph-com/json-schema/soldgraph-com-batch-schema.json",
  "title": "Batch",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/soldgraph-com-openapi.json#/components/schemas/Batch",
  "type": "object",
  "required": [
    "batch_id",
    "status",
    "created_at",
    "counts",
    "credits",
    "items"
  ],
  "properties": {
    "batch_id": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "complete"
      ],
      "description": "complete once no search is pending."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "counts": {
      "type": "object",
      "required": [
        "pending",
        "complete",
        "failed",
        "rejected"
      ],
      "properties": {
        "pending": {
          "type": "integer"
        },
        "complete": {
          "type": "integer"
        },
        "failed": {
          "type": "integer"
        },
        "rejected": {
          "type": "integer"
        }
      }
    },
    "credits": {
      "type": "integer",
      "description": "Requests this batch has cost so far."
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "index",
          "endpoint",
          "q",
          "request_id",
          "status",
          "cached",
          "credits"
        ],
        "properties": {
          "index": {
            "type": "integer",
            "description": "Position in the batch, after `pages` is expanded."
          },
          "endpoint": {
            "type": "string",
            "description": "The search route, like ebay/sold."
          },
          "q": {
            "type": [
              "string",
              "null"
            ]
          },
          "request_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The search's own job. Read it at /v1/jobs/{id}. Null when the search was rejected."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "complete",
              "failed",
              "rejected"
            ]
          },
          "cached": {
            "type": "boolean"
          },
          "credits": {
            "type": "integer",
            "description": "1 when the search completed, else 0."
          },
          "rows": {
            "type": "integer",
            "description": "Rows in the result. Complete searches only."
          },
          "summary": {
            "type": "object",
            "description": "The result's price summary, where the marketplace has one."
          },
          "result": {
            "type": "object",
            "description": "The full result. Only with include=results."
          },
          "error": {
            "type": "object",
            "required": [
              "code"
            ],
            "properties": {
              "code": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}