Skip to main content
POST
/
api
/
v1
/
llm
/
extract
/
schema
/
{schema_id}
Typescript (SDK)
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.extract.extractWithSchema({
    schemaId: "schema_invoice_123",
    requestBody: {
      model: "meetkai:functionary-urdu-mini-pak",
      file: "(binary)",
      prompt: "Extract the structured invoice fields.",
    },
  });

  console.log(result);
}

run();
{
  "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

Authenticate with your MKA1 API key at the API gateway: Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, also send X-On-Behalf-Of to identify the end user making the request.

Headers

X-On-Behalf-Of
string

Optional external user identifier for multi-user server-side integrations. Use this when acting on behalf of one of your end users.

Path Parameters

schema_id
string
required

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

Body

The extraction request parameters

model
string
required

ID of the model to use for extraction. You can use provider:model format or just the model name with a default provider. Vision-capable models are recommended for processing images and PDFs.

Minimum string length: 1
file
string
required

The file to extract structured data from. Supports various formats including images and documents. The file content will be analyzed by the model according to the referenced extraction schema.

prompt
string

Optional custom system prompt to guide the extraction process. Use this to provide specific instructions about how to interpret the file or handle edge cases.

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.