{
  "openapi": "3.0.1",
  "info": {
    "title": "Structured Web Extractor - JSON Schema with Evidence",
    "description": "Turn public web pages into records that match your JSON Schema. Every value carries its evidence: the JSON-LD path or the exact quote it came from. Values without evidence are rejected, and required facts that are missing leave the record partial.",
    "version": "0.0",
    "x-build-id": "oUXyMithYO8PTafiT"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/leadproof~structured-web-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-leadproof-structured-web-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/leadproof~structured-web-extractor/runs": {
      "post": {
        "operationId": "runs-sync-leadproof-structured-web-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/leadproof~structured-web-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-leadproof-structured-web-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": {
          "sourceMode": {
            "title": "Source",
            "enum": [
              "urls",
              "records",
              "dataset"
            ],
            "type": "string",
            "description": "Where the page content comes from. Only the selected source is used.",
            "default": "urls"
          },
          "urls": {
            "title": "Page URLs",
            "type": "array",
            "description": "Public http(s) pages, one request each (static HTML, no browser). robots.txt is respected by default. Private, local and cloud-metadata addresses are refused, including after redirects.",
            "items": {
              "type": "string"
            }
          },
          "records": {
            "title": "Page records or text",
            "type": "array",
            "description": "Objects with url (absolute, used as the evidence source) and at least one of text, markdown, html (up to 2 MB) or structuredData; optional inputId and title. PageRecord v1 objects are accepted as they are."
          },
          "datasetId": {
            "title": "Dataset ID",
            "type": "string",
            "description": "Dataset of PageRecord v1 items, for example a page reader run's output. Declared as a dataset resource with READ permission, so a limited-permission run can read the dataset you select."
          },
          "datasetOffset": {
            "title": "Dataset offset",
            "minimum": 0,
            "type": "integer",
            "description": "Skip this many dataset items first.",
            "default": 0
          },
          "schemaPreset": {
            "title": "Schema preset",
            "enum": [
              "product",
              "local-business",
              "custom"
            ],
            "type": "string",
            "description": "Built-in schemas with deterministic bindings. Choose custom to use your own schema."
          },
          "extractionSchema": {
            "title": "Extraction schema (custom)",
            "type": "object",
            "description": "JSON Schema subset: object root; types string, number, integer, boolean, object, array, and [type, \"null\"]; keywords properties, required, items, enum, format (email, uri, date, date-time), minimum, maximum, minLength, maxLength, minItems, maxItems, title, description, x-extract. Refused: $ref, anyOf/oneOf/allOf, pattern, default, const, examples, open objects. Limits: 16 KB, depth 5, 80 properties, 60 fields. See README."
          },
          "mode": {
            "title": "Extraction mode",
            "enum": [
              "deterministic",
              "llm",
              "auto"
            ],
            "type": "string",
            "description": "Deterministic never calls a model. LLM and auto call the selected model, bounded by the LLM budget. Every AI value must quote the page or it is rejected.",
            "default": "deterministic"
          },
          "llmProvider": {
            "title": "AI provider",
            "enum": [
              "apify-openrouter",
              "openrouter"
            ],
            "type": "string",
            "description": "The Apify proxy uses this run's own Apify token and bills token usage to the account that runs the Actor. With openrouter, your key is sent only to openrouter.ai.",
            "default": "apify-openrouter"
          },
          "llmModel": {
            "title": "Model",
            "type": "string",
            "description": "OpenRouter model ID with structured output support and a fixed token price. Checked against the provider catalog before any call.",
            "default": "openai/gpt-4.1-mini"
          },
          "llmApiKey": {
            "title": "OpenRouter API key",
            "type": "string",
            "description": "Only for provider openrouter. Stored encrypted by Apify."
          },
          "maxLlmCostUsd": {
            "title": "LLM budget per run (USD)",
            "minimum": 0.01,
            "maximum": 20,
            "type": "number",
            "description": "Each model call reserves its worst-case price first; calls that would exceed this budget are not sent and their records are skipped. This budget is separate from the Actor's maximum charge per run.",
            "default": 0.25
          },
          "maxInputChars": {
            "title": "Page characters sent to the model",
            "minimum": 1000,
            "maximum": 60000,
            "type": "integer",
            "description": "Longer pages are cut at a line boundary and flagged content_truncated.",
            "default": 20000
          },
          "maxOutputTokens": {
            "title": "Max output tokens per call",
            "minimum": 200,
            "maximum": 4000,
            "type": "integer",
            "description": "Output that hits this limit is reported as model_output_truncated, never repaired.",
            "default": 1500
          },
          "interpretedValues": {
            "title": "Interpreted values",
            "enum": [
              "separate",
              "include"
            ],
            "type": "string",
            "description": "A boolean such as inStock, or an enum value the page words differently, is the model's reading of a quote, not text found on the page. It is checked (the quote must be about the field and must not contradict the value) but never proven.",
            "default": "separate"
          },
          "recordTimeoutSecs": {
            "title": "Time limit per record (seconds)",
            "minimum": 20,
            "maximum": 600,
            "type": "integer",
            "description": "Reading plus extraction of one record, including model retries. A record over the limit fails with record_timeout; the run continues.",
            "default": 120
          },
          "maxRecords": {
            "title": "Maximum records",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Hard limit for the selected source, API and Console alike.",
            "default": 50
          },
          "concurrency": {
            "title": "Concurrency",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Pages processed at once. Requests to one host are spaced at least 1 second apart.",
            "default": 4
          },
          "requestTimeoutSecs": {
            "title": "Request timeout (seconds)",
            "minimum": 5,
            "maximum": 60,
            "type": "integer",
            "description": "Per page request, including redirects.",
            "default": 30
          },
          "maxPageBytes": {
            "title": "Maximum page size (bytes)",
            "minimum": 50000,
            "maximum": 5000000,
            "type": "integer",
            "description": "Larger responses fail with response_too_large.",
            "default": 2000000
          },
          "respectRobotsTxt": {
            "title": "Respect robots.txt",
            "type": "boolean",
            "description": "Skip URLs that the site's robots.txt disallows.",
            "default": true
          },
          "saveSourceRecords": {
            "title": "Save source page records",
            "type": "boolean",
            "description": "Store each source PageRecord as PAGE-<inputId> in the key-value store, so every recordPath in the evidence can be audited. Adds storage use.",
            "default": false
          },
          "readerActorId": {
            "title": "Page reader Actor (optional)",
            "type": "string",
            "description": "Read URLs through a PageRecord v1 reader Actor instead of the built-in fetcher. It runs as a separate run on your account."
          },
          "readerUrlsField": {
            "title": "Reader URL field",
            "type": "string",
            "description": "Input field name the reader Actor expects for its URL list.",
            "default": "urls"
          },
          "readerMaxTotalChargeUsd": {
            "title": "Reader Actor budget per run (USD)",
            "minimum": 0,
            "maximum": 100,
            "type": "number",
            "description": "Maximum this run lets the reader Actor charge. It is a separate run with its own price, so this run's maximum charge does not cover it. 0 means the reader may not charge at all.",
            "default": 1
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}