{
  "openapi": "3.0.1",
  "info": {
    "title": "AI Data Extraction",
    "description": "Extract custom data from PDF, DOCX, and images using AI. Turn invoices, forms, and other documents into structured, validated JSON. Simply provide document URLs and define the fields you need.",
    "version": "0.0",
    "x-build-id": "uEfZLKkOZ0OWa3sIS"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/obaskly~AI-Data-Extraction-API/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-obaskly-AI-Data-Extraction-API",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/obaskly~AI-Data-Extraction-API/runs": {
      "post": {
        "operationId": "runs-sync-obaskly-AI-Data-Extraction-API",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/obaskly~AI-Data-Extraction-API/run-sync": {
      "post": {
        "operationId": "run-sync-obaskly-AI-Data-Extraction-API",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "documents",
          "fields"
        ],
        "properties": {
          "documents": {
            "title": "Documents",
            "type": "array",
            "description": "Documents to process. Each item needs a publicly accessible HTTPS `url` and may have an optional `filename`. Supported: PDF, DOCX, JPG, JPEG, PNG, WEBP. Free Apify plan: runs are limited to 3 documents and 10 pages in total (documents beyond that are skipped, not charged). You pay only for documents that are successfully extracted; see the Pricing section."
          },
          "fields": {
            "title": "Fields to extract",
            "type": "array",
            "description": "The information you want from every document. Each item has a `name` (letters, digits, underscore), an optional `description` that tells the AI what to look for, and a `type`: string, number, integer, boolean, date, array or object. For array/object fields, describe the structure in the description."
          },
          "language": {
            "title": "Document language",
            "type": "string",
            "description": "Use `auto` to detect the language automatically, or give a code such as `en`, `fr`, `de`, `es`. It improves OCR for scanned documents.",
            "default": "auto"
          },
          "include_confidence": {
            "title": "Include confidence estimates",
            "type": "boolean",
            "description": "Add a per-field confidence estimate (0 to 1). These are the model's own estimates, not statistically calibrated probabilities.",
            "default": true
          },
          "include_source_references": {
            "title": "Include source references",
            "type": "boolean",
            "description": "Add the page number and the supporting text for each extracted value. A reference is marked `text_verified` only when the quoted text was found in the document's extracted text.",
            "default": true
          },
          "vision_mode": {
            "title": "Visual reading of pages",
            "enum": [
              "auto",
              "never",
              "always"
            ],
            "type": "string",
            "description": "`auto`: scanned pages are sent to the AI as an image plus OCR text (most accurate for tables), text pages as text only. `never`: text and OCR only (cheapest, may miss table content in scans). `always`: every page is also sent as an image (highest accuracy and cost).",
            "default": "auto"
          },
          "max_file_size_mb": {
            "title": "Maximum file size (MB)",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "Documents larger than this are rejected without being processed.",
            "default": 20
          },
          "max_pages": {
            "title": "Maximum pages per PDF",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "PDFs with more pages than this are rejected. Higher limits increase processing time and AI cost.",
            "default": 30
          },
          "max_output_tokens": {
            "title": "Maximum AI output tokens",
            "minimum": 256,
            "maximum": 16000,
            "type": "integer",
            "description": "Upper bound on the AI reply per document. Leave empty to size it automatically from the number of fields (about 120 tokens per field, up to 16,000). Reasoning tokens count towards this limit. If a document fails with `AI_OUTPUT_TRUNCATED`, raise this or request fewer fields."
          },
          "output_format": {
            "title": "Output format",
            "enum": [
              "json"
            ],
            "type": "string",
            "description": "Format of the extracted data. Only JSON is currently supported.",
            "default": "json"
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}