Structured Extraction
Extract structured data from the input text, PDF, HTML, EML, MBOX, MS Office document or image.#
/lmkit/v1/extract-structured-dataAnalyzes the provided content to extract structured data using the specified or default extraction model. Optional extraction parameters, such as additional guidance text and a JSON extraction scheme, can be provided. Returns the extracted structured data as a JSON representation defined in the response model. If processing exceeds the configured timeout, returns 202 Accepted with a job_id. Poll GET /lmkit/v1/jobs/ for status and results.
Request body
application/json ·
| Property | Type | Description |
|---|---|---|
model | string | The identifier of the language model to be used for structured extraction. If not provided, the default model is used. |
inputrequired | object | Either a single string (plain text or Base64-encoded file). |
input_format | The format of the input data. Only used when “input” is a single string. | |
jsonSchemarequired | Configures the text extraction elements by parsing a JSON schema.
| |
enable_ocr | boolean | Whether to use OCR for pages that contain no extractable text (e.g., scanned images). Requires an OCR provider to be configured on the server. Defaults to true. |
guidance | string | Additional guidance text that can influence the extraction process (e.g., focusing on certain themes). |
include_elements | boolean | Whether to include the per-field element details (confidence, entity validation, human-verification flag, page index and bounds) in the response. Defaults to false. |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | OK | |
| 202 | Accepted | |
| 400 | Bad Request | |
| 500 | application/json | Internal Server Error |
| 404 | Not Found |
curl -X POST "$LMKIT_ONE_URL/lmkit/v1/extract-structured-data" \
-H "Authorization: Bearer $LMKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "",
"input": "",
"input_format": "PlainText",
"jsonSchema": {},
"enable_ocr": true,
"guidance": ""
}'