Logo
Extraction

Data Extractor

View Docs

API Reference

POST
/api/agent/data_extractor

Authorization

ApiKeyAuth
access-key<token>

Your unique access-key generated from the platform UI

In: header

Request Body

application/json

doc_process_ids*array<string>

Array of document IDs to extract entities from (obtained from Upload or List Documents APIs). Only documents with status 'processed' can be used.

entity_list?array<string>

List of entity types to extract (e.g., 'People', 'Organisations', 'Dates', 'Amounts'). Leave empty to skip extraction

model_data*

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.k-v.ai/api/agent/data_extractor" \  -H "Content-Type: application/json" \  -d '{    "doc_process_ids": [      "your_doc_id"    ],    "entity_list": [      "Organisations",      "People"    ],    "model_data": {      "model_name": "gpt-5.1",      "api_key": ""    }  }'
{
  "value": {
    "data": {
      "entities": [
        {
          "file_name": "Settlement Agreement (1).pdf",
          "doc_hash": "264dfa262b748d15ccbeaada89430c68",
          "entity_table": [
            {
              "entity_type": "Organisations",
              "values": [
                "Widget Corporation (Defendant)",
                "Dewey, Cheatum & Howe LLP",
                "ABC Software Corporation (Plaintiff)",
                "Propel Software Corporation (Plaintiff)"
              ]
            },
            {
              "entity_type": "People",
              "values": [
                "Joe Average (CEO of ABC Software Corporation, Plaintiff)",
                "James Smith, Esq. (Attorney for Plaintiff)"
              ]
            }
          ],
          "tokens": {
            "input": 1208,
            "output": 78,
            "total": 1286
          }
        }
      ],
      "tokens": {
        "input": 1208,
        "output": 78,
        "total": 1286
      }
    },
    "message": "Entities extracted successfully"
  }
}
{
  "value": {
    "data": {},
    "message": "Invalid docs selected"
  }
}
{
  "value": {
    "data": {},
    "message": "Invalid or missing access key"
  }
}
{
  "value": {
    "detail": [
      {
        "type": "literal_error",
        "loc": [
          "body",
          "model_data",
          "model_name"
        ],
        "msg": "Input should be 'gpt-5-chat-latest', 'gpt-5.1', 'gpt-5-mini', 'claude-sonnet-4-5-20250929', 'gemini/gemini-2.5-flash-lite', 'mistral/mistral-small-latest', 'mistral/mistral-medium-latest', 'gemini/gemini-2.5-pro', 'gemini/gemini-3-pro-preview' or 'llama3.1-70b'",
        "input": "",
        "ctx": {
          "expected": "'gpt-5-chat-latest', 'gpt-5.1', 'gpt-5-mini', 'claude-sonnet-4-5-20250929', 'gemini/gemini-2.5-flash-lite', 'mistral/mistral-small-latest', 'mistral/mistral-medium-latest', 'gemini/gemini-2.5-pro', 'gemini/gemini-3-pro-preview' or 'llama3.1-70b'"
        }
      }
    ]
  }
}

{
  "data": {},
  "message": "litellm.AuthenticationError: AuthenticationError: OpenAIException - Incorrect API key provided: tyrdfuih**uhf7. You can find your API key at https://platform.openai.com/account/api-keys."
}