{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/companyenrich/json-schema/companyenrich-batch-status-response-schema.json",
  "title": "BatchStatusResponse",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/companyenrich-openapi.json#/components/schemas/BatchStatusResponse",
  "required": [
    "id",
    "kind",
    "status",
    "progress",
    "creditsCharged",
    "createdAt",
    "statusUrl",
    "resultsUrl",
    "rawResultsUrl"
  ],
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The batch ID.",
      "format": "uuid"
    },
    "kind": {
      "type": "string",
      "description": "The task represented by the batch."
    },
    "status": {
      "$ref": "#/$defs/HttpBatchState"
    },
    "progress": {
      "$ref": "#/$defs/BatchProgressResponse"
    },
    "creditsCharged": {
      "type": "number",
      "description": "The credits charged so far, in user-visible credits.",
      "format": "double"
    },
    "recordCount": {
      "type": [
        "integer",
        "null"
      ],
      "description": "For a search export, the number of records its settled pages returned.",
      "format": "int32"
    },
    "recordLimit": {
      "type": [
        "integer",
        "null"
      ],
      "description": "For a search export, the most search results it requests. Results whose record is unavailable are skipped, so `recordCount` can end below it.",
      "format": "int32"
    },
    "createdAt": {
      "type": "string",
      "description": "When the batch was created.",
      "format": "date-time"
    },
    "completedAt": {
      "type": [
        "string",
        "null"
      ],
      "description": "When the batch completed or was cancelled, if terminal.",
      "format": "date-time"
    },
    "statusUrl": {
      "type": "string",
      "description": "The authenticated URL for checking batch status and progress."
    },
    "resultsUrl": {
      "type": "string",
      "description": "The download URL for the task's projected results. It is signed, so it works without credentials for one hour; after that, use the owner's credentials or a URL from a new status response."
    },
    "rawResultsUrl": {
      "type": "string",
      "description": "The download URL for raw HTTP outcomes in NDJSON format, signed like `resultsUrl`."
    }
  },
  "$defs": {
    "BatchProgressResponse": {
      "required": [
        "total",
        "pending",
        "running",
        "succeeded",
        "failed",
        "unknown",
        "cancelled"
      ],
      "type": "object",
      "properties": {
        "total": {
          "type": "integer",
          "description": "The number of requests. A search export adds one for each page as the previous page settles.",
          "format": "int32"
        },
        "pending": {
          "type": "integer",
          "description": "Requests awaiting dispatch, including retries.",
          "format": "int32"
        },
        "running": {
          "type": "integer",
          "description": "Requests still being processed, including saved results not yet settled.",
          "format": "int32"
        },
        "succeeded": {
          "type": "integer",
          "description": "Requests that returned a successful HTTP response.",
          "format": "int32"
        },
        "failed": {
          "type": "integer",
          "description": "Requests that returned an HTTP error response.",
          "format": "int32"
        },
        "unknown": {
          "type": "integer",
          "description": "Requests whose execution outcome could not be confirmed.",
          "format": "int32"
        },
        "cancelled": {
          "type": "integer",
          "description": "Requests cancelled before their results were published.",
          "format": "int32"
        }
      },
      "description": "The number of requests in each state."
    },
    "HttpBatchState": {
      "enum": [
        "pending",
        "running",
        "completed",
        "cancelling",
        "cancelled"
      ],
      "description": "The current batch state."
    }
  }
}