curl --request POST \
--url https://api.autype.com/api/v1/dev/tools/lens/extract \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileId": "550e8400-e29b-41d4-a716-446655440000",
"fields": {
"invoiceNumber": {
"type": "string",
"description": "Invoice number"
},
"totalAmount": {
"type": "number",
"description": "Total amount including VAT"
},
"date": {
"type": "date",
"description": "Invoice date"
},
"lineItems": {
"type": "array",
"description": "List of line items with description and amount"
}
},
"pages": [
"1",
"3-5"
],
"webhook": {
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"headerName": "X-API-Key",
"headerValue": "my-secret-key",
"basicAuthUsername": "user",
"basicAuthPassword": "pass"
}
}
}
'import requests
url = "https://api.autype.com/api/v1/dev/tools/lens/extract"
payload = {
"fileId": "550e8400-e29b-41d4-a716-446655440000",
"fields": {
"invoiceNumber": {
"type": "string",
"description": "Invoice number"
},
"totalAmount": {
"type": "number",
"description": "Total amount including VAT"
},
"date": {
"type": "date",
"description": "Invoice date"
},
"lineItems": {
"type": "array",
"description": "List of line items with description and amount"
}
},
"pages": ["1", "3-5"],
"webhook": {
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"headerName": "X-API-Key",
"headerValue": "my-secret-key",
"basicAuthUsername": "user",
"basicAuthPassword": "pass"
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fileId: '550e8400-e29b-41d4-a716-446655440000',
fields: {
invoiceNumber: {type: 'string', description: 'Invoice number'},
totalAmount: {type: 'number', description: 'Total amount including VAT'},
date: {type: 'date', description: 'Invoice date'},
lineItems: {type: 'array', description: 'List of line items with description and amount'}
},
pages: ['1', '3-5'],
webhook: {
webhookUrl: 'https://example.com/webhook',
webhookAuth: {
headerName: 'X-API-Key',
headerValue: 'my-secret-key',
basicAuthUsername: 'user',
basicAuthPassword: 'pass'
}
}
})
};
fetch('https://api.autype.com/api/v1/dev/tools/lens/extract', 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.autype.com/api/v1/dev/tools/lens/extract",
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([
'fileId' => '550e8400-e29b-41d4-a716-446655440000',
'fields' => [
'invoiceNumber' => [
'type' => 'string',
'description' => 'Invoice number'
],
'totalAmount' => [
'type' => 'number',
'description' => 'Total amount including VAT'
],
'date' => [
'type' => 'date',
'description' => 'Invoice date'
],
'lineItems' => [
'type' => 'array',
'description' => 'List of line items with description and amount'
]
],
'pages' => [
'1',
'3-5'
],
'webhook' => [
'webhookUrl' => 'https://example.com/webhook',
'webhookAuth' => [
'headerName' => 'X-API-Key',
'headerValue' => 'my-secret-key',
'basicAuthUsername' => 'user',
'basicAuthPassword' => 'pass'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.autype.com/api/v1/dev/tools/lens/extract"
payload := strings.NewReader("{\n \"fileId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"fields\": {\n \"invoiceNumber\": {\n \"type\": \"string\",\n \"description\": \"Invoice number\"\n },\n \"totalAmount\": {\n \"type\": \"number\",\n \"description\": \"Total amount including VAT\"\n },\n \"date\": {\n \"type\": \"date\",\n \"description\": \"Invoice date\"\n },\n \"lineItems\": {\n \"type\": \"array\",\n \"description\": \"List of line items with description and amount\"\n }\n },\n \"pages\": [\n \"1\",\n \"3-5\"\n ],\n \"webhook\": {\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"headerName\": \"X-API-Key\",\n \"headerValue\": \"my-secret-key\",\n \"basicAuthUsername\": \"user\",\n \"basicAuthPassword\": \"pass\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.autype.com/api/v1/dev/tools/lens/extract")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fileId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"fields\": {\n \"invoiceNumber\": {\n \"type\": \"string\",\n \"description\": \"Invoice number\"\n },\n \"totalAmount\": {\n \"type\": \"number\",\n \"description\": \"Total amount including VAT\"\n },\n \"date\": {\n \"type\": \"date\",\n \"description\": \"Invoice date\"\n },\n \"lineItems\": {\n \"type\": \"array\",\n \"description\": \"List of line items with description and amount\"\n }\n },\n \"pages\": [\n \"1\",\n \"3-5\"\n ],\n \"webhook\": {\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"headerName\": \"X-API-Key\",\n \"headerValue\": \"my-secret-key\",\n \"basicAuthUsername\": \"user\",\n \"basicAuthPassword\": \"pass\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.autype.com/api/v1/dev/tools/lens/extract")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fileId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"fields\": {\n \"invoiceNumber\": {\n \"type\": \"string\",\n \"description\": \"Invoice number\"\n },\n \"totalAmount\": {\n \"type\": \"number\",\n \"description\": \"Total amount including VAT\"\n },\n \"date\": {\n \"type\": \"date\",\n \"description\": \"Invoice date\"\n },\n \"lineItems\": {\n \"type\": \"array\",\n \"description\": \"List of line items with description and amount\"\n }\n },\n \"pages\": [\n \"1\",\n \"3-5\"\n ],\n \"webhook\": {\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"headerName\": \"X-API-Key\",\n \"headerValue\": \"my-secret-key\",\n \"basicAuthUsername\": \"user\",\n \"basicAuthPassword\": \"pass\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"action": "pdf.merge",
"status": "PENDING",
"inputFileIds": [
"file-id-1"
],
"outputFileId": null,
"error": null,
"createdAt": "2023-11-07T05:31:56Z",
"startedAt": {},
"completedAt": {},
"result": {},
"metadata": {}
}Extract structured data
Extract structured data from a document based on a user-defined field schema. Define field names, types (string, number, boolean, date, array), and optional descriptions. The AI reads the document and returns a JSON object with the extracted values. For PDF files, you can optionally specify which pages to process. Cost: 14 credits per processed page.
curl --request POST \
--url https://api.autype.com/api/v1/dev/tools/lens/extract \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileId": "550e8400-e29b-41d4-a716-446655440000",
"fields": {
"invoiceNumber": {
"type": "string",
"description": "Invoice number"
},
"totalAmount": {
"type": "number",
"description": "Total amount including VAT"
},
"date": {
"type": "date",
"description": "Invoice date"
},
"lineItems": {
"type": "array",
"description": "List of line items with description and amount"
}
},
"pages": [
"1",
"3-5"
],
"webhook": {
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"headerName": "X-API-Key",
"headerValue": "my-secret-key",
"basicAuthUsername": "user",
"basicAuthPassword": "pass"
}
}
}
'import requests
url = "https://api.autype.com/api/v1/dev/tools/lens/extract"
payload = {
"fileId": "550e8400-e29b-41d4-a716-446655440000",
"fields": {
"invoiceNumber": {
"type": "string",
"description": "Invoice number"
},
"totalAmount": {
"type": "number",
"description": "Total amount including VAT"
},
"date": {
"type": "date",
"description": "Invoice date"
},
"lineItems": {
"type": "array",
"description": "List of line items with description and amount"
}
},
"pages": ["1", "3-5"],
"webhook": {
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"headerName": "X-API-Key",
"headerValue": "my-secret-key",
"basicAuthUsername": "user",
"basicAuthPassword": "pass"
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fileId: '550e8400-e29b-41d4-a716-446655440000',
fields: {
invoiceNumber: {type: 'string', description: 'Invoice number'},
totalAmount: {type: 'number', description: 'Total amount including VAT'},
date: {type: 'date', description: 'Invoice date'},
lineItems: {type: 'array', description: 'List of line items with description and amount'}
},
pages: ['1', '3-5'],
webhook: {
webhookUrl: 'https://example.com/webhook',
webhookAuth: {
headerName: 'X-API-Key',
headerValue: 'my-secret-key',
basicAuthUsername: 'user',
basicAuthPassword: 'pass'
}
}
})
};
fetch('https://api.autype.com/api/v1/dev/tools/lens/extract', 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.autype.com/api/v1/dev/tools/lens/extract",
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([
'fileId' => '550e8400-e29b-41d4-a716-446655440000',
'fields' => [
'invoiceNumber' => [
'type' => 'string',
'description' => 'Invoice number'
],
'totalAmount' => [
'type' => 'number',
'description' => 'Total amount including VAT'
],
'date' => [
'type' => 'date',
'description' => 'Invoice date'
],
'lineItems' => [
'type' => 'array',
'description' => 'List of line items with description and amount'
]
],
'pages' => [
'1',
'3-5'
],
'webhook' => [
'webhookUrl' => 'https://example.com/webhook',
'webhookAuth' => [
'headerName' => 'X-API-Key',
'headerValue' => 'my-secret-key',
'basicAuthUsername' => 'user',
'basicAuthPassword' => 'pass'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.autype.com/api/v1/dev/tools/lens/extract"
payload := strings.NewReader("{\n \"fileId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"fields\": {\n \"invoiceNumber\": {\n \"type\": \"string\",\n \"description\": \"Invoice number\"\n },\n \"totalAmount\": {\n \"type\": \"number\",\n \"description\": \"Total amount including VAT\"\n },\n \"date\": {\n \"type\": \"date\",\n \"description\": \"Invoice date\"\n },\n \"lineItems\": {\n \"type\": \"array\",\n \"description\": \"List of line items with description and amount\"\n }\n },\n \"pages\": [\n \"1\",\n \"3-5\"\n ],\n \"webhook\": {\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"headerName\": \"X-API-Key\",\n \"headerValue\": \"my-secret-key\",\n \"basicAuthUsername\": \"user\",\n \"basicAuthPassword\": \"pass\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.autype.com/api/v1/dev/tools/lens/extract")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fileId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"fields\": {\n \"invoiceNumber\": {\n \"type\": \"string\",\n \"description\": \"Invoice number\"\n },\n \"totalAmount\": {\n \"type\": \"number\",\n \"description\": \"Total amount including VAT\"\n },\n \"date\": {\n \"type\": \"date\",\n \"description\": \"Invoice date\"\n },\n \"lineItems\": {\n \"type\": \"array\",\n \"description\": \"List of line items with description and amount\"\n }\n },\n \"pages\": [\n \"1\",\n \"3-5\"\n ],\n \"webhook\": {\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"headerName\": \"X-API-Key\",\n \"headerValue\": \"my-secret-key\",\n \"basicAuthUsername\": \"user\",\n \"basicAuthPassword\": \"pass\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.autype.com/api/v1/dev/tools/lens/extract")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fileId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"fields\": {\n \"invoiceNumber\": {\n \"type\": \"string\",\n \"description\": \"Invoice number\"\n },\n \"totalAmount\": {\n \"type\": \"number\",\n \"description\": \"Total amount including VAT\"\n },\n \"date\": {\n \"type\": \"date\",\n \"description\": \"Invoice date\"\n },\n \"lineItems\": {\n \"type\": \"array\",\n \"description\": \"List of line items with description and amount\"\n }\n },\n \"pages\": [\n \"1\",\n \"3-5\"\n ],\n \"webhook\": {\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"headerName\": \"X-API-Key\",\n \"headerValue\": \"my-secret-key\",\n \"basicAuthUsername\": \"user\",\n \"basicAuthPassword\": \"pass\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"action": "pdf.merge",
"status": "PENDING",
"inputFileIds": [
"file-id-1"
],
"outputFileId": null,
"error": null,
"createdAt": "2023-11-07T05:31:56Z",
"startedAt": {},
"completedAt": {},
"result": {},
"metadata": {}
}Authorizations
Short-lived, Developer-API-audience token obtained by the trusted MCP service through token exchange (mcp_at_...). Raw MCP resource tokens are rejected.
Body
File ID of the document to extract data from (PDF, DOCX, ODT, or Markdown)
"550e8400-e29b-41d4-a716-446655440000"
Fields to extract from the document. Keys are field names, values define the expected type and optional description. Maximum 30 fields.
{
"invoiceNumber": {
"type": "string",
"description": "Invoice number"
},
"totalAmount": {
"type": "number",
"description": "Total amount including VAT"
},
"date": {
"type": "date",
"description": "Invoice date"
},
"lineItems": {
"type": "array",
"description": "List of line items with description and amount"
}
}
Page specifications (e.g. "1", "2-5", "3-"). If omitted, all pages are processed (up to 50 pages). Only applicable to PDF files.
["1", "3-5"]
Optional webhook configuration
Show child attributes
Show child attributes
Response
Extraction job created
Job ID
"550e8400-e29b-41d4-a716-446655440000"
Action that was performed
"pdf.merge"
Current job status
PENDING, PROCESSING, COMPLETED, FAILED "PENDING"
Input file IDs used for this job
["file-id-1"]
Output file ID (available when COMPLETED)
null
Error message (available when FAILED)
null
Job creation timestamp
Job start timestamp
Job completion timestamp
Structured job result data (e.g. OCR markdown/JSON, generated filename, PDF metadata, form fields). Available when the job produces a direct result instead of an output file.
Deprecated — use result instead. Additional metadata, duplicated from result for backward compatibility.
