{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pepbank-io/json-schema/pepbank-io-export-job-schema.json",
  "title": "ExportJob",
  "description": "Bulk export job. The file is ready when status is complete.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pepbank-io-exports-api-openapi.yml#/components/schemas/ExportJob",
  "type": "object",
  "properties": {
    "credit": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "enum": [
            "Data from PepBank"
          ]
        },
        "line": {
          "type": "string",
          "description": "Credit sentence. Copy it as written."
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "PepBank page for this result. The home page applies when no single page fits."
        },
        "license_url": {
          "type": "string",
          "enum": [
            "https://creativecommons.org/licenses/by/4.0/"
          ]
        }
      },
      "required": [
        "text",
        "url",
        "license_url"
      ]
    },
    "record_type": {
      "type": "string",
      "enum": [
        "export"
      ]
    },
    "export_id": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "running",
        "complete",
        "failed"
      ]
    },
    "entity": {
      "type": "string"
    },
    "format": {
      "type": "string"
    },
    "request": {
      "type": "object",
      "additionalProperties": {}
    },
    "data_seq": {
      "type": [
        "integer",
        "null"
      ]
    },
    "row_count": {
      "type": [
        "integer",
        "null"
      ]
    },
    "bytes": {
      "type": [
        "integer",
        "null"
      ]
    },
    "sha256": {
      "type": [
        "string",
        "null"
      ]
    },
    "query_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "result_set_hash": {
      "type": [
        "string",
        "null"
      ]
    },
    "created_at": {
      "type": "string"
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ]
    },
    "download_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "usage": {
      "type": "object",
      "properties": {
        "units_charged": {
          "type": "number",
          "minimum": 0,
          "description": "Units that this request used."
        },
        "meter": {
          "type": "string",
          "enum": [
            "query",
            "live_lookups",
            "chat_messages",
            "exports"
          ],
          "description": "Meter that counted this request."
        },
        "remaining": {
          "type": [
            "number",
            "null"
          ],
          "description": "Units left in the current window. Null means no limit."
        },
        "window_resets_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "When the current window ends (ISO 8601)."
        }
      },
      "required": [
        "units_charged",
        "meter",
        "remaining",
        "window_resets_at"
      ],
      "description": "Usage of this request. REST also sends these values in RateLimit headers."
    }
  },
  "required": [
    "credit",
    "record_type",
    "export_id",
    "status",
    "entity",
    "format",
    "request",
    "data_seq",
    "row_count",
    "bytes",
    "sha256",
    "query_id",
    "result_set_hash",
    "created_at",
    "completed_at",
    "download_url"
  ]
}