{
  "openapi": "3.0.1",
  "info": {
    "title": "Grounded Text & Entity Extractor",
    "description": "Extract structured entities, clauses, and facts from text or web pages with exact character-offset citations. Fast LangExtract alternative with zero-LLM mode, Gemini/OpenAI support, hallucination filtering, and interactive HTML highlight reports.",
    "version": "0.1",
    "x-build-id": "hMKtIIxhfQRB72gp6"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/solutionssmart~langextract-grounded-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-solutionssmart-langextract-grounded-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/solutionssmart~langextract-grounded-extractor/runs": {
      "post": {
        "operationId": "runs-sync-solutionssmart-langextract-grounded-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/solutionssmart~langextract-grounded-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-solutionssmart-langextract-grounded-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": {
          "sourceText": {
            "title": "Text to Extract From",
            "type": "string",
            "description": "Paste plain text or document content to extract structured entities from. You can also provide web page URLs below.",
            "default": "Dr. Clara Müller signed Service Agreement SA-2026-04 on 15 March 2026 in München for EUR 48,500."
          },
          "sourceUrls": {
            "title": "Web Page URLs (Optional)",
            "type": "array",
            "description": "Optional list of HTTP/HTTPS URLs to fetch and extract from. Clean text is automatically extracted from each page.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "llmProvider": {
            "title": "Extraction Mode / LLM Provider",
            "enum": [
              "rule_based",
              "gemini",
              "openai",
              "openai_compatible"
            ],
            "type": "string",
            "description": "Use Zero-LLM mode with no API key required, or select an LLM provider for semantic few-shot extraction.",
            "default": "rule_based"
          },
          "promptDescription": {
            "title": "Extraction Prompt (AI Mode)",
            "type": "string",
            "description": "Instructions describing target entity classes, clauses, or facts to extract verbatim when using an LLM provider.",
            "default": "Extract person names, agreement identifiers, dates, locations, and monetary amounts using exact verbatim text from the document."
          },
          "modelId": {
            "title": "Model ID (AI Mode)",
            "type": "string",
            "description": "Model identifier for the chosen LLM provider (e.g. gemini-3.5-flash, gemini-2.5-flash, gpt-4o-mini).",
            "default": "gemini-3.5-flash"
          },
          "apiKey": {
            "title": "LLM API Key (AI Mode)",
            "type": "string",
            "description": "API key for Gemini, OpenAI, or OpenAI-compatible endpoints (not needed in Zero-LLM mode). Also supports GEMINI_API_KEY / OPENAI_API_KEY / LLM_API_KEY env vars."
          },
          "apiBaseUrl": {
            "title": "Custom API Base URL (OpenAI-Compatible)",
            "type": "string",
            "description": "Required only when using an OpenAI-Compatible Endpoint (e.g. https://openrouter.ai/api/v1)."
          },
          "temperature": {
            "title": "Temperature (AI Mode)",
            "enum": [
              "0.0",
              "0.1",
              "0.2",
              "0.3",
              "0.5",
              "0.7",
              "1.0"
            ],
            "type": "string",
            "description": "Sampling temperature (0.0 recommended for deterministic grounded extraction).",
            "default": "0.0"
          },
          "exampleText": {
            "title": "Example Source Text",
            "type": "string",
            "description": "Sample text used as a few-shot example for the LLM. Leave empty to skip few-shot examples."
          },
          "exampleExtractions": {
            "title": "Example Extractions",
            "type": "array",
            "description": "Pairs of entity class and exact verbatim text that appears in Example Source Text.",
            "items": {
              "type": "object",
              "required": [
                "key",
                "value"
              ],
              "properties": {
                "key": {
                  "type": "string",
                  "title": "Key"
                },
                "value": {
                  "type": "string",
                  "title": "Value"
                }
              }
            }
          },
          "customRules": {
            "title": "Custom Regex Rules",
            "type": "array",
            "description": "Define custom entity classes and Unicode regex patterns for Zero-LLM mode.",
            "items": {
              "type": "object",
              "required": [
                "key",
                "value"
              ],
              "properties": {
                "key": {
                  "type": "string",
                  "title": "Key"
                },
                "value": {
                  "type": "string",
                  "title": "Value"
                }
              }
            }
          },
          "rulesCaseInsensitive": {
            "title": "Case-Insensitive Custom Rules",
            "type": "boolean",
            "description": "When enabled, custom regex rules match regardless of letter casing.",
            "default": false
          },
          "generateHtmlReport": {
            "title": "Generate Interactive HTML Highlight Report",
            "type": "boolean",
            "description": "Writes a self-contained interactive HTML highlight report to OUTPUT_HIGHLIGHT.html in the default Key-Value Store.",
            "default": true
          },
          "filterUngrounded": {
            "title": "Filter Out Hallucinations (Ungrounded Spans)",
            "type": "boolean",
            "description": "Automatically filter out extractions that cannot be matched back to the source text (saved separately for review).",
            "default": true
          },
          "requireExactMatch": {
            "title": "Require Exact Character Match",
            "type": "boolean",
            "description": "Only accept exact verbatim matches without whitespace or case-insensitive fallback.",
            "default": false
          },
          "caseInsensitiveFallback": {
            "title": "Case-Insensitive Grounding Fallback",
            "type": "boolean",
            "description": "Allow case-insensitive matching when an exact-case match is not found (ignored if Require Exact Character Match is enabled).",
            "default": true
          },
          "maxCharBuffer": {
            "title": "Max Characters per Chunk",
            "minimum": 200,
            "maximum": 100000,
            "type": "integer",
            "description": "Maximum number of Unicode characters per chunk for long documents.",
            "default": 4000
          },
          "overlapChars": {
            "title": "Chunk Overlap",
            "minimum": 0,
            "maximum": 50000,
            "type": "integer",
            "description": "Number of overlapping characters between consecutive chunks to avoid splitting entities at boundaries.",
            "default": 200
          },
          "extractionPasses": {
            "title": "Extraction Passes (AI Mode)",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "Number of extraction passes per chunk for higher recall on complex documents (1 to 5).",
            "default": 1
          },
          "maxConcurrency": {
            "title": "Max Concurrent Workers",
            "minimum": 1,
            "maximum": 32,
            "type": "integer",
            "description": "Maximum number of concurrent chunk/source workers (automatically bounded by container memory).",
            "default": 4
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}