{
  "openapi": "3.0.1",
  "info": {
    "title": "AI Document & Web Analyzer — powered by OpenAI GPT",
    "description": "Summarize, classify or extract JSON from web pages, PDFs, Word files, images, texts and any Apify dataset with OpenAI GPT models. Bring your own OpenAI API key. Token caps, an estimate-only mode and a visual report. Not affiliated with OpenAI.",
    "version": "0.1",
    "x-build-id": "g27PlOWu67uoTE6cj"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/badr_xba~ai-document-web-analyzer-openai/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-badr_xba-ai-document-web-analyzer-openai",
        "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/badr_xba~ai-document-web-analyzer-openai/runs": {
      "post": {
        "operationId": "runs-sync-badr_xba-ai-document-web-analyzer-openai",
        "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/badr_xba~ai-document-web-analyzer-openai/run-sync": {
      "post": {
        "operationId": "run-sync-badr_xba-ai-document-web-analyzer-openai",
        "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": "🌐 Web pages",
            "type": "array",
            "description": "Pages to analyse. Each page is downloaded once with a plain HTTP request (no browser, no JavaScript, no anti-bot bypass); pages that robots.txt disallows are skipped and listed in FAILED_INPUTS. A URL that serves a PDF, Word file or image is analysed as a document or image.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "texts": {
            "title": "📝 Texts",
            "type": "array",
            "description": "Raw texts, one per entry (emails, reviews, transcripts…). Through the API each entry can be a long string with line breaks.",
            "items": {
              "type": "string"
            }
          },
          "documentUrls": {
            "title": "📄 Documents (URLs)",
            "type": "array",
            "description": "Public links to PDF, DOCX, PPTX, XLSX, TXT, MD, CSV or JSON files (50 MB max each). PDFs are sent to OpenAI with their text and page images; Office files as text.",
            "items": {
              "type": "string"
            }
          },
          "imageUrls": {
            "title": "🖼️ Images (URLs)",
            "type": "array",
            "description": "Public PNG, JPEG, WEBP or GIF images analysed with GPT vision (screenshots, receipts, product photos…).",
            "items": {
              "type": "string"
            }
          },
          "datasetIds": {
            "title": "🗂️ Apify datasets",
            "type": "array",
            "description": "IDs of datasets produced by other Actors (Website Content Crawler, Google Maps reviews, Amazon, Instagram…): each item is analysed. Your account must be able to read them.",
            "items": {
              "type": "string"
            }
          },
          "datasetFields": {
            "title": "Dataset fields to analyse",
            "type": "array",
            "description": "Fields of each dataset item to send (dot paths such as \"text\" or \"metadata.description\"). Empty = the usual text fields (title, text, markdown, description, review…).",
            "items": {
              "type": "string"
            }
          },
          "task": {
            "title": "🎯 Task",
            "enum": [
              "summarize",
              "extract",
              "classify",
              "analyze",
              "detect_key_info",
              "compare",
              "report",
              "custom"
            ],
            "type": "string",
            "description": "What the model does with each item. \"Compare\" also adds one comparison row over all items.",
            "default": "summarize"
          },
          "instructions": {
            "title": "Instructions",
            "type": "string",
            "description": "Optional extra instructions in plain words (\"focus on pricing\", \"answer for a lawyer\"). Required in practice for the Custom task."
          },
          "outputSchema": {
            "title": "Output JSON Schema (extract)",
            "type": "object",
            "description": "For the Extract task: the JSON Schema of the fields you want, e.g. {\"type\":\"object\",\"properties\":{\"price\":{\"type\":\"number\"},\"currency\":{\"type\":\"string\"}}}. It is checked before the run against OpenAI Structured Outputs rules; fields not listed as required become nullable."
          },
          "labels": {
            "title": "Labels (classify)",
            "type": "array",
            "description": "Allowed labels for the Classify task, e.g. positive, negative, neutral.",
            "items": {
              "type": "string"
            }
          },
          "multiLabel": {
            "title": "Several labels per item",
            "type": "boolean",
            "description": "Classify: allow more than one label per item.",
            "default": false
          },
          "language": {
            "title": "Output language",
            "type": "string",
            "description": "Language of the answers (e.g. English, French). Empty = the language of each source."
          },
          "analysisLevel": {
            "title": "⚙️ Analysis level",
            "enum": [
              "quick",
              "standard",
              "deep"
            ],
            "type": "string",
            "description": "Quick = GPT-6 Luna, low reasoning (cheapest). Standard = GPT-6.1 Sol, medium reasoning. Deep = GPT-6 Astra, high reasoning (most capable, ~5x Standard). See PRICING in the README.",
            "default": "standard"
          },
          "model": {
            "title": "Model (override)",
            "enum": [
              "gpt-6-luna",
              "gpt-6.1-terra",
              "gpt-6.1-sol",
              "gpt-6-astra"
            ],
            "type": "string",
            "description": "Optional: force a model instead of the level default."
          },
          "reasoningEffort": {
            "title": "Reasoning effort (override)",
            "enum": [
              "none",
              "low",
              "medium",
              "high",
              "xhigh",
              "max"
            ],
            "type": "string",
            "description": "Optional. Higher effort = more (billed) reasoning tokens. Unsupported values for the chosen model fall back to the level default."
          },
          "imageDetail": {
            "title": "Image / PDF page detail",
            "enum": [
              "low",
              "high"
            ],
            "type": "string",
            "description": "low = at most ~308 tokens per image or PDF page; high = at most ~3,000. Empty = level default (Quick: low, others: high)."
          },
          "analyzePageImages": {
            "title": "Also send page images to the model",
            "type": "boolean",
            "description": "Web pages and dataset items: send their (up to 3) images to GPT vision as well. Costs more tokens.",
            "default": false
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum number of items analysed in this run.",
            "default": 50
          },
          "maxInputTokensPerItem": {
            "title": "Max input tokens per item",
            "minimum": 2000,
            "maximum": 922000,
            "type": "integer",
            "description": "Longer content is split into parts and summarised in steps (never cut silently). Above 272,000 OpenAI charges long-context prices.",
            "default": 100000
          },
          "maxOutputTokensPerItem": {
            "title": "Max output tokens per call",
            "minimum": 0,
            "maximum": 128000,
            "type": "integer",
            "description": "Includes reasoning tokens. 0 = level default (6,000 / 16,000 / 32,000).",
            "default": 0
          },
          "maxChunksPerItem": {
            "title": "Max parts per long item",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Cost guard for very long documents: parts beyond this number are not analysed and the row says truncated = true.",
            "default": 10
          },
          "maxTotalTokens": {
            "title": "Max total tokens (run)",
            "minimum": 0,
            "type": "integer",
            "description": "The run stops before a call that could exceed this total (input + output). 0 = no limit.",
            "default": 0
          },
          "maxCostUsd": {
            "title": "Max OpenAI cost (USD, estimate)",
            "minimum": 0,
            "type": "number",
            "description": "The run stops before a call whose worst case could push the estimated OpenAI cost (list prices) above this amount. 0 = no limit.",
            "default": 2
          },
          "estimateOnly": {
            "title": "Estimate only (no AI call)",
            "type": "boolean",
            "description": "Downloads the sources and estimates input tokens and the maximum cost per item, without calling the model.",
            "default": false
          },
          "exactTokenCount": {
            "title": "Exact token count (estimate only)",
            "type": "boolean",
            "description": "With Estimate only and your own key: also ask OpenAI's token-counting endpoint for the exact input tokens of each item.",
            "default": false
          },
          "concurrency": {
            "title": "Parallel items",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Items analysed at the same time. Lower it if your OpenAI rate limits are small.",
            "default": 3
          },
          "itemTimeoutSecs": {
            "title": "Item timeout (seconds)",
            "minimum": 0,
            "maximum": 7200,
            "type": "integer",
            "description": "An item that takes longer is recorded as failed; the run goes on. 0 = automatic: long enough for one answer of the full output budget at a slow 30 tokens/s + 60 s (at least 300 s; deep level ≈ 19 min). Managed key: a shorter value is raised to that minimum, because OpenAI still bills an answer cut by a timeout.",
            "default": 0
          },
          "apiKeyMode": {
            "title": "🔑 API key mode",
            "enum": [
              "own_key",
              "managed"
            ],
            "type": "string",
            "description": "Own key: your OpenAI account pays the tokens; this Actor charges a small fee per analysed item. Managed: no OpenAI account needed, tokens are billed per 1,000 through Apify (paid Apify plans only).",
            "default": "own_key"
          },
          "apiKey": {
            "title": "OpenAI API key",
            "type": "string",
            "description": "Your key from platform.openai.com (stored encrypted by Apify, never logged). Without a key the run only estimates tokens and costs."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}