Structured extraction
curl --request POST \
--url https://api.pdfbase.dev/v1/extract/structured \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": {},
"preset": "<string>",
"schema": {},
"pages": "<string>"
}
'import requests
url = "https://api.pdfbase.dev/v1/extract/structured"
payload = {
"source": {},
"preset": "<string>",
"schema": {},
"pages": "<string>"
}
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({source: {}, preset: '<string>', schema: {}, pages: '<string>'})
};
fetch('https://api.pdfbase.dev/v1/extract/structured', 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.pdfbase.dev/v1/extract/structured",
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([
'source' => [
],
'preset' => '<string>',
'schema' => [
],
'pages' => '<string>'
]),
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.pdfbase.dev/v1/extract/structured"
payload := strings.NewReader("{\n \"source\": {},\n \"preset\": \"<string>\",\n \"schema\": {},\n \"pages\": \"<string>\"\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.pdfbase.dev/v1/extract/structured")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {},\n \"preset\": \"<string>\",\n \"schema\": {},\n \"pages\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pdfbase.dev/v1/extract/structured")
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 \"source\": {},\n \"preset\": \"<string>\",\n \"schema\": {},\n \"pages\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"confidence": 123,
"data": {}
}Extract
Structured extraction
Extract structured data from PDFs using AI. Turns invoices, receipts, and documents into typed JSON.
POST
/
v1
/
extract
/
structured
Structured extraction
curl --request POST \
--url https://api.pdfbase.dev/v1/extract/structured \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": {},
"preset": "<string>",
"schema": {},
"pages": "<string>"
}
'import requests
url = "https://api.pdfbase.dev/v1/extract/structured"
payload = {
"source": {},
"preset": "<string>",
"schema": {},
"pages": "<string>"
}
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({source: {}, preset: '<string>', schema: {}, pages: '<string>'})
};
fetch('https://api.pdfbase.dev/v1/extract/structured', 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.pdfbase.dev/v1/extract/structured",
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([
'source' => [
],
'preset' => '<string>',
'schema' => [
],
'pages' => '<string>'
]),
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.pdfbase.dev/v1/extract/structured"
payload := strings.NewReader("{\n \"source\": {},\n \"preset\": \"<string>\",\n \"schema\": {},\n \"pages\": \"<string>\"\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.pdfbase.dev/v1/extract/structured")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {},\n \"preset\": \"<string>\",\n \"schema\": {},\n \"pages\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pdfbase.dev/v1/extract/structured")
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 \"source\": {},\n \"preset\": \"<string>\",\n \"schema\": {},\n \"pages\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"confidence": 123,
"data": {}
}Phase
Phase 3 — Ships only if $1K+ MRR. Requires LLM infrastructure.Request
object
required
The PDF to extract from. Same source options as other endpoints:
{ "pdf_id": "pdf_abc123" }{ "url": "https://example.com/invoice.pdf" }{ "base64": "JVBERi0x..." }
string
Use a built-in extraction preset. Mutually exclusive with
schema. Available presets:invoice— Extracts: vendor, customer, line items, subtotal, tax, total, invoice number, dates.receipt— Extracts: merchant, items, total, payment method, date.contract— Extracts: parties, effective date, termination date, key terms, signatures.resume— Extracts: name, contact, experience, education, skills.
object
Custom extraction schema. Define the exact fields you want extracted. Mutually exclusive with
preset.{
"vendor_name": "string",
"total_amount": "number",
"currency": "string",
"line_items": [{
"description": "string",
"quantity": "number",
"unit_price": "number"
}]
}
string
default:"all"
Pages to extract from.
Response
{
"id": "ext_struct1",
"object": "extraction",
"status": "completed",
"method": "ai",
"preset": "invoice",
"data": {
"vendor_name": "Acme Corp",
"customer_name": "Globex Industries",
"invoice_number": "INV-2026-0042",
"invoice_date": "2026-05-01",
"due_date": "2026-06-01",
"line_items": [
{
"description": "Widget Pro (Annual License)",
"quantity": 10,
"unit_price": 50.00,
"total": 500.00
},
{
"description": "Premium Support",
"quantity": 1,
"unit_price": 200.00,
"total": 200.00
}
],
"subtotal": 700.00,
"tax": 63.00,
"total": 763.00,
"currency": "USD"
},
"confidence": 0.96,
"created_at": "2026-05-19T14:00:00Z"
}
number
AI confidence score. Range: 0.0 to 1.0. Below 0.8 suggests ambiguous or low-quality source document.
object
Extracted data matching the preset or custom schema. Field types match what was specified.
Example
# Using a preset
curl -X POST https://api.pdfbase.dev/v1/extract/structured \
-H "Authorization: Bearer pk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"source": { "pdf_id": "pdf_invoice" },
"preset": "invoice"
}'
# Using a custom schema
curl -X POST https://api.pdfbase.dev/v1/extract/structured \
-H "Authorization: Bearer pk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"source": { "url": "https://example.com/report.pdf" },
"schema": {
"company_name": "string",
"revenue": "number",
"quarter": "string",
"highlights": ["string"]
}
}'