curl --request POST \
--url https://api.autype.com/api/v1/dev/tools/lens/ocr \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileId": "550e8400-e29b-41d4-a716-446655440000",
"pages": [
"1",
"3-5"
],
"outputFormat": "md",
"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/ocr"
payload = {
"fileId": "550e8400-e29b-41d4-a716-446655440000",
"pages": ["1", "3-5"],
"outputFormat": "md",
"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',
pages: ['1', '3-5'],
outputFormat: 'md',
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/ocr', 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/ocr",
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',
'pages' => [
'1',
'3-5'
],
'outputFormat' => 'md',
'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/ocr"
payload := strings.NewReader("{\n \"fileId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"pages\": [\n \"1\",\n \"3-5\"\n ],\n \"outputFormat\": \"md\",\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/ocr")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fileId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"pages\": [\n \"1\",\n \"3-5\"\n ],\n \"outputFormat\": \"md\",\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/ocr")
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 \"pages\": [\n \"1\",\n \"3-5\"\n ],\n \"outputFormat\": \"md\",\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": {},
"downloadUrl": "https://api.autype.com/api/v1/dev/tools/files/output-file-id/download?token=signed-token",
"result": {},
"metadata": {}
}Lens OCR
Extract text from a document using AI. Supports PDF, DOCX, ODT, and Markdown files. Output formats: “md” (raw standard markdown, 2 credits per page), “mdd” (Autype extended markdown, 18 credits per page), and “json” (full Autype document JSON, 18 credits per page). For PDF files with “md” format you can optionally specify which pages to process.
curl --request POST \
--url https://api.autype.com/api/v1/dev/tools/lens/ocr \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileId": "550e8400-e29b-41d4-a716-446655440000",
"pages": [
"1",
"3-5"
],
"outputFormat": "md",
"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/ocr"
payload = {
"fileId": "550e8400-e29b-41d4-a716-446655440000",
"pages": ["1", "3-5"],
"outputFormat": "md",
"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',
pages: ['1', '3-5'],
outputFormat: 'md',
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/ocr', 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/ocr",
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',
'pages' => [
'1',
'3-5'
],
'outputFormat' => 'md',
'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/ocr"
payload := strings.NewReader("{\n \"fileId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"pages\": [\n \"1\",\n \"3-5\"\n ],\n \"outputFormat\": \"md\",\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/ocr")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fileId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"pages\": [\n \"1\",\n \"3-5\"\n ],\n \"outputFormat\": \"md\",\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/ocr")
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 \"pages\": [\n \"1\",\n \"3-5\"\n ],\n \"outputFormat\": \"md\",\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": {},
"downloadUrl": "https://api.autype.com/api/v1/dev/tools/files/output-file-id/download?token=signed-token",
"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 process (PDF, DOCX, ODT, or Markdown)
"550e8400-e29b-41d4-a716-446655440000"
Page specifications (e.g. "1", "2-5", "3-"). If omitted, all pages are processed. Only applicable to PDF files with "md" output format.
["1", "3-5"]
Output format. "md" returns raw standard markdown (Mistral OCR). "mdd" returns Autype extended markdown with document settings and defaults. "json" returns full Autype document JSON with sections. Note: "mdd" and "json" formats are only supported for PDF files — DOCX, ODT, and Markdown files always return "md" regardless of this setting.
md, mdd, json "md"
Optional webhook configuration
Show child attributes
Show child attributes
Response
Lens OCR 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
Signed, time-limited browser download URL for the output file (available when COMPLETED). An API key may also be used on the same endpoint.
"https://api.autype.com/api/v1/dev/tools/files/output-file-id/download?token=signed-token"
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.
