{
  "openapi": "3.0.1",
  "info": {
    "title": "PDF & Image AI Extractor: OCR to Markdown, Text & JSON (Gemini)",
    "description": "Turn PDFs, scans and photos into Markdown with real tables, plain text or structured JSON (invoices, receipts, CVs, bank statements or your own fields) with Google Gemini. Digital pages are read locally at a fraction of the price; only scans use AI. Pay only for pages that return content.",
    "version": "1.0",
    "x-build-id": "ynizctiIMDKdj1nPp"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/itzcloud~pdf-ai-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-itzcloud-pdf-ai-extractor",
        "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/itzcloud~pdf-ai-extractor/runs": {
      "post": {
        "operationId": "runs-sync-itzcloud-pdf-ai-extractor",
        "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/itzcloud~pdf-ai-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-itzcloud-pdf-ai-extractor",
        "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",
        "properties": {
          "startUrls": {
            "title": "PDF or image URLs",
            "type": "array",
            "description": "Direct links to PDF, PNG, JPEG, WebP or HEIC files (up to 50 MB each). Google Drive and Dropbox share links are converted automatically; the file must be shared as \"anyone with the link\".",
            "default": [
              {
                "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
              }
            ],
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "outputFormat": {
            "title": "Output",
            "enum": [
              "markdown",
              "text",
              "json"
            ],
            "type": "string",
            "description": "<b>Markdown</b>: headings, lists and tables, ready for RAG and LLMs. <b>Plain text</b>: reading order without markup. <b>Structured JSON</b>: one object per document with the fields you choose (invoices, receipts, CVs, bank statements, contracts or your own fields).",
            "default": "markdown"
          },
          "engine": {
            "title": "Engine",
            "enum": [
              "auto",
              "ai",
              "fast"
            ],
            "type": "string",
            "description": "<b>Auto</b> (recommended): pages with a real text layer are read locally (text-page price) and only scanned or image-only pages go to Gemini (AI-page price). <b>AI on every page</b>: best layout and table fidelity. <b>Text layer only</b>: no AI; scanned pages come back empty and are not charged. Structured JSON always uses AI.",
            "default": "auto"
          },
          "extractionPreset": {
            "title": "Document type",
            "enum": [
              "invoice",
              "receipt",
              "resume",
              "bank_statement",
              "contract",
              "custom"
            ],
            "type": "string",
            "description": "Fields to extract when the output is Structured JSON. Choose <b>Custom</b> to define your own below.",
            "default": "invoice"
          },
          "fields": {
            "title": "Custom fields",
            "type": "array",
            "description": "One per line, as <code>name (type): description</code>. Types: string, number, integer, boolean, date, list. Example: <code>total (number): grand total including tax</code>.",
            "items": {
              "type": "string"
            }
          },
          "jsonSchema": {
            "title": "Custom JSON Schema (advanced)",
            "type": "object",
            "description": "Instead of the field list, paste a full JSON Schema (type, properties, items, enum, description). Takes priority over Custom fields."
          },
          "instructions": {
            "title": "Extra instructions (optional)",
            "type": "string",
            "description": "Plain-language hints for the AI, e.g. \"Amounts are in Colombian pesos\" or \"Ignore the cover page\"."
          },
          "maxPagesPerDocument": {
            "title": "Max pages per document",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "Process only the first N pages of each PDF. 0 = all pages (up to 1,000).",
            "default": 0
          },
          "includePages": {
            "title": "Include per-page results",
            "type": "boolean",
            "description": "Adds a <code>pages</code> array with each page's content and how it was read (text layer or AI). Useful for citations and RAG chunks.",
            "default": true
          },
          "maxDocuments": {
            "title": "Max documents",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many documents. 0 = no limit.",
            "default": 0
          },
          "model": {
            "title": "Gemini model",
            "enum": [
              "gemini-3.1-flash-lite",
              "gemini-3.5-flash-lite",
              "gemini-3.8-flash"
            ],
            "type": "string",
            "description": "Flash-Lite is fast and accurate for transcription. Pick Flash for hard handwriting or very dense tables. The price per page is the same.",
            "default": "gemini-3.1-flash-lite"
          },
          "geminiApiKey": {
            "title": "Your Gemini API key (optional)",
            "type": "string",
            "description": "Bring your own key from <a href='https://aistudio.google.com/apikey' target='_blank'>Google AI Studio</a> and AI pages are charged at the much lower bring-your-own-key price; Google bills you directly for tokens. Leave empty to use ours."
          },
          "maxConcurrency": {
            "title": "Max parallel documents",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Leave empty for automatic (based on memory)."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}