Skip to main content
POST
/
api
/
v1
/
llm
/
extract
/
schema
/
{schema_id}
Python (SDK)
from mka1 import SDK


with SDK(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:

    res = sdk.llm.extract.extract_with_schema(schema_id="schema_invoice_123", model="meetkai:functionary-urdu-mini-pak", file={
        "file_name": "example.file",
        "content": open("example.file", "rb"),
    }, prompt="Extract the structured invoice fields.")

    # Handle response
    print(res)
{
  "success": true,
  "data": {
    "invoice_number": "INV-2024-001",
    "vendor_name": "Acme Corporation",
    "total_amount": 1250,
    "date": "2024-01-15"
  },
  "metadata": {
    "model": "meetkai:functionary-urdu-mini-pak",
    "filename": "invoice.pdf",
    "fileSize": 125000,
    "extractedAt": "2024-01-15T10:30:00Z",
    "schemaId": "schema_invoice_123",
    "schemaName": "Invoice Extraction"
  }
}

Authorizations

Authorization
string
header
required

Gateway auth: send Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, you can also send X-On-Behalf-Of: <external-user-id>.

Path Parameters

schema_id
string
required

The unique identifier of the extraction schema to use for this extraction

Body

multipart/form-data
model
string
required

ID of the model to use for extraction

file
file
required

The file to extract structured data from

prompt
string

Optional custom system prompt to guide extraction

Response

200 - application/json

OK

Response from the extraction endpoint containing the extracted structured data and metadata about the extraction process.

success
boolean
required

Indicates whether the extraction request was successful

metadata
object
required

Metadata about the extraction request and execution

data
any

The extracted structured data conforming to the provided JSON Schema. This is the result of analyzing the file and extracting information according to the schema definition.