import os
from meibel import MeibelClient
from meibel.models import SubmitDeepTransformFromDocument
client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])
schema = {
"title": "Invoice",
"type": "object",
"properties": {
"invoice_number": {"type": "string"},
"total_amount": {"type": "number"},
"due_date": {"type": "string", "format": "date"},
},
"required": ["invoice_number", "total_amount"],
}
response = client.documents.submit_deep_transform_from(
SubmitDeepTransformFromDocument(
document_job_id="docjob_8f3a1c2e9b",
schema=schema,
root_name="Invoice",
guidance="Extract line items from the invoice's charges table",
max_pages=10,
)
)
print(f"Submitted deep-transform job: {response.job_id}")import { MeibelClient } from "meibel";
const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY });
const response = await client.documents.submitDeepTransformFrom({
document_job_id: "doc_job_9f8a7b6c5d",
schema: {
title: "Invoice",
type: "object",
properties: {
invoice_number: { type: "string" },
total_amount: { type: "number" },
line_items: {
type: "array",
items: {
type: "object",
properties: {
description: { type: "string" },
quantity: { type: "integer" },
unit_price: { type: "number" },
},
},
},
},
required: ["invoice_number", "total_amount"],
},
root_name: "Invoice",
guidance: "Extract line items exactly as they appear, preserving original ordering",
max_pages: 10,
});
console.log(`Submitted deep-transform job: ${response.job_id}`);package main
import (
"context"
"fmt"
"os"
v2 "github.com/meibel-ai/meibel-go/v2"
)
func main() {
client := v2.NewClient(v2.WithAPIKey(os.Getenv("MEIBEL_API_KEY")))
schema := map[string]any{
"title": "Invoice",
"type": "object",
"properties": map[string]any{
"invoice_number": map[string]any{"type": "string"},
"total_amount": map[string]any{"type": "number"},
"due_date": map[string]any{"type": "string", "format": "date"},
},
"required": []string{"invoice_number", "total_amount"},
}
resp, err := client.Documents.SubmitDeepTransformFrom(context.Background(), v2.SubmitDeepTransformFromDocument{
DocumentJobID: "doc_job_9f8a7b6c5d4e",
Schema: schema,
RootName: v2.String("Invoice"),
Guidance: v2.String("Extract totals from the final summary table, not line items"),
})
if err != nil {
panic(err)
}
fmt.Printf("Submitted deep-transform job: %s\n", resp.JobID)
}curl --request POST \
--url https://api.meibel.ai/v2/documents/deep-transform/from-document \
--header 'Content-Type: application/json' \
--header 'Meibel-API-Key: <api-key>' \
--data '
{
"document_job_id": "<string>",
"schema": {},
"root_name": "<string>",
"guidance": "<string>",
"max_pages": 123
}
'const options = {
method: 'POST',
headers: {'Meibel-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
document_job_id: '<string>',
schema: {},
root_name: '<string>',
guidance: '<string>',
max_pages: 123
})
};
fetch('https://api.meibel.ai/v2/documents/deep-transform/from-document', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.meibel.ai/v2/documents/deep-transform/from-document",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'document_job_id' => '<string>',
'schema' => [
],
'root_name' => '<string>',
'guidance' => '<string>',
'max_pages' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Meibel-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.meibel.ai/v2/documents/deep-transform/from-document")
.header("Meibel-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"document_job_id\": \"<string>\",\n \"schema\": {},\n \"root_name\": \"<string>\",\n \"guidance\": \"<string>\",\n \"max_pages\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meibel.ai/v2/documents/deep-transform/from-document")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Meibel-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"document_job_id\": \"<string>\",\n \"schema\": {},\n \"root_name\": \"<string>\",\n \"guidance\": \"<string>\",\n \"max_pages\": 123\n}"
response = http.request(request)
puts response.read_body{
"job_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Submit a deep-transform extraction reusing a parsed document (async)
Submit an extraction that reuses an already-parsed document (by document_job_id from POST /documents) instead of re-parsing an upload. Returns immediately with a job id. Poll status via GET /documents/deep-transform/ and download artifacts once it succeeds. Submission is idempotent on the (document, schema) pair.
import os
from meibel import MeibelClient
from meibel.models import SubmitDeepTransformFromDocument
client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])
schema = {
"title": "Invoice",
"type": "object",
"properties": {
"invoice_number": {"type": "string"},
"total_amount": {"type": "number"},
"due_date": {"type": "string", "format": "date"},
},
"required": ["invoice_number", "total_amount"],
}
response = client.documents.submit_deep_transform_from(
SubmitDeepTransformFromDocument(
document_job_id="docjob_8f3a1c2e9b",
schema=schema,
root_name="Invoice",
guidance="Extract line items from the invoice's charges table",
max_pages=10,
)
)
print(f"Submitted deep-transform job: {response.job_id}")import { MeibelClient } from "meibel";
const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY });
const response = await client.documents.submitDeepTransformFrom({
document_job_id: "doc_job_9f8a7b6c5d",
schema: {
title: "Invoice",
type: "object",
properties: {
invoice_number: { type: "string" },
total_amount: { type: "number" },
line_items: {
type: "array",
items: {
type: "object",
properties: {
description: { type: "string" },
quantity: { type: "integer" },
unit_price: { type: "number" },
},
},
},
},
required: ["invoice_number", "total_amount"],
},
root_name: "Invoice",
guidance: "Extract line items exactly as they appear, preserving original ordering",
max_pages: 10,
});
console.log(`Submitted deep-transform job: ${response.job_id}`);package main
import (
"context"
"fmt"
"os"
v2 "github.com/meibel-ai/meibel-go/v2"
)
func main() {
client := v2.NewClient(v2.WithAPIKey(os.Getenv("MEIBEL_API_KEY")))
schema := map[string]any{
"title": "Invoice",
"type": "object",
"properties": map[string]any{
"invoice_number": map[string]any{"type": "string"},
"total_amount": map[string]any{"type": "number"},
"due_date": map[string]any{"type": "string", "format": "date"},
},
"required": []string{"invoice_number", "total_amount"},
}
resp, err := client.Documents.SubmitDeepTransformFrom(context.Background(), v2.SubmitDeepTransformFromDocument{
DocumentJobID: "doc_job_9f8a7b6c5d4e",
Schema: schema,
RootName: v2.String("Invoice"),
Guidance: v2.String("Extract totals from the final summary table, not line items"),
})
if err != nil {
panic(err)
}
fmt.Printf("Submitted deep-transform job: %s\n", resp.JobID)
}curl --request POST \
--url https://api.meibel.ai/v2/documents/deep-transform/from-document \
--header 'Content-Type: application/json' \
--header 'Meibel-API-Key: <api-key>' \
--data '
{
"document_job_id": "<string>",
"schema": {},
"root_name": "<string>",
"guidance": "<string>",
"max_pages": 123
}
'const options = {
method: 'POST',
headers: {'Meibel-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
document_job_id: '<string>',
schema: {},
root_name: '<string>',
guidance: '<string>',
max_pages: 123
})
};
fetch('https://api.meibel.ai/v2/documents/deep-transform/from-document', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.meibel.ai/v2/documents/deep-transform/from-document",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'document_job_id' => '<string>',
'schema' => [
],
'root_name' => '<string>',
'guidance' => '<string>',
'max_pages' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Meibel-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.meibel.ai/v2/documents/deep-transform/from-document")
.header("Meibel-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"document_job_id\": \"<string>\",\n \"schema\": {},\n \"root_name\": \"<string>\",\n \"guidance\": \"<string>\",\n \"max_pages\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meibel.ai/v2/documents/deep-transform/from-document")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Meibel-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"document_job_id\": \"<string>\",\n \"schema\": {},\n \"root_name\": \"<string>\",\n \"guidance\": \"<string>\",\n \"max_pages\": 123\n}"
response = http.request(request)
puts response.read_body{
"job_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Body
Reuse an already-parsed document instead of re-parsing an upload.
A document job id returned by POST /documents. Reuses that parse so the document is not parsed again. The document must belong to the calling customer.
JSON Schema of the entities to extract
Name of the root entity in the schema. Optional: when omitted it is resolved from the schema's title or inferred during extraction.
Optional domain guidance for the extraction
Optional cap on the number of pages to process
Response
Successful Response
Poll status via GET /documents/deep-transform/{job_id}
Was this page helpful?