{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/faxforagents/json-schema/faxforagents-extraction-schema.json",
  "title": "Extraction",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/faxforagents-api-openapi.json#/components/schemas/Extraction",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id"
    },
    "kind": {
      "type": "string",
      "enum": [
        "extract",
        "classify",
        "summarize"
      ],
      "title": "Kind"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "queued",
        "running",
        "completed",
        "failed"
      ],
      "title": "Status"
    },
    "environment": {
      "type": "string",
      "enum": [
        "live",
        "test"
      ],
      "title": "Environment"
    },
    "document_id": {
      "type": "string",
      "title": "Document Id"
    },
    "inbox_item_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Inbox Item Id"
    },
    "schema_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Schema Id"
    },
    "schema": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Schema"
    },
    "options": {
      "additionalProperties": true,
      "type": "object",
      "title": "Options"
    },
    "pages_requested": {
      "type": "integer",
      "title": "Pages Requested"
    },
    "pages_processed": {
      "type": "integer",
      "title": "Pages Processed"
    },
    "pages_escalated": {
      "type": "integer",
      "title": "Pages Escalated"
    },
    "document_pages": {
      "type": "integer",
      "title": "Document Pages",
      "description": "The document's page count. Above pages_processed on a completed row means the cap left pages unread; output.truncated and a warning say so."
    },
    "confidence": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Confidence"
    },
    "pages": {
      "items": {
        "$ref": "#/$defs/ExtractionPage"
      },
      "type": "array",
      "title": "Pages"
    },
    "output": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Output"
    },
    "models": {
      "additionalProperties": true,
      "type": "object",
      "title": "Models"
    },
    "price_micro": {
      "type": "integer",
      "title": "Price Micro"
    },
    "provider_cost_micro": {
      "type": "integer",
      "title": "Provider Cost Micro"
    },
    "currency": {
      "type": "string",
      "title": "Currency"
    },
    "error_code": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Error Code"
    },
    "created_by": {
      "type": "string",
      "title": "Created By"
    },
    "created_at": {
      "type": "string",
      "title": "Created At"
    },
    "started_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Started At"
    },
    "completed_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Completed At"
    },
    "corrections": {
      "anyOf": [
        {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Corrections"
    }
  },
  "additionalProperties": true,
  "type": "object",
  "required": [
    "id",
    "kind",
    "status",
    "environment",
    "document_id",
    "inbox_item_id",
    "schema_id",
    "options",
    "pages_requested",
    "pages_processed",
    "pages_escalated",
    "document_pages",
    "confidence",
    "pages",
    "output",
    "models",
    "price_micro",
    "provider_cost_micro",
    "currency",
    "error_code",
    "created_by",
    "created_at",
    "started_at",
    "completed_at"
  ],
  "$defs": {
    "ExtractionPage": {
      "properties": {
        "page": {
          "type": "integer",
          "title": "Page"
        },
        "text": {
          "type": "string",
          "title": "Text"
        },
        "confidence": {
          "type": "number",
          "title": "Confidence"
        },
        "language": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Language"
        },
        "status": {
          "type": "string",
          "title": "Status"
        },
        "model": {
          "type": "string",
          "title": "Model"
        },
        "escalated": {
          "type": "boolean",
          "title": "Escalated",
          "default": false
        },
        "warnings": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Warnings",
          "default": []
        }
      },
      "additionalProperties": true,
      "type": "object",
      "required": [
        "page",
        "text",
        "confidence",
        "status",
        "model"
      ],
      "title": "ExtractionPage"
    }
  }
}