PDF Data Extraction
Extract structured data from a PDF supplied as a URL or file. Returns JSON fields shaped by your instructions.
pdf-extract Example
{
"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
} {
"data": {
"pages": 1,
"title": "Dummy PDF file",
"content": [
{
"page": 1,
"text": "Dummy PDF file"
}
],
"metadata": {
"total_pages": 1,
"has_structured_data": false
},
"document_type": "PDF"
},
"source_url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
} Inputs
| Field | Type | Required | What it is |
|---|---|---|---|
url | string | No | URL to a PDF file |
base64 | string | No | Base64-encoded PDF |
extract | string | No | What data to extract (natural language) |
Output fields
How reliably each field appears in a successful answer.
| Field | Type | Appears |
|---|---|---|
data | object | Always (present in every successful answer) |
source_url | string | Always (present in every successful answer) |
How to call it
The same tool through each route. MCP clients reach it through Strale’s server at https://api.strale.io/mcp; the call below is what the agent sends.
# Needs an API key. max_price_cents caps what this call may cost.
curl -X POST https://api.strale.io/v1/do \
-H "Authorization: Bearer $STRALE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"capability_slug": "pdf-extract",
"inputs": {
"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
},
"max_price_cents": 30
}' {
"tool": "strale_execute",
"arguments": {
"slug": "pdf-extract",
"inputs": {
"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
},
"max_price_cents": 30
}
} import { Strale } from "straleio";
const strale = new Strale({ apiKey: process.env.STRALE_API_KEY! });
const result = await strale.do({
capability_slug: "pdf-extract",
inputs: {
"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
},
max_price_cents: 30,
}); import os
from straleio import Strale, DoRequest
strale = Strale(api_key=os.environ["STRALE_API_KEY"])
result = strale.do(DoRequest(
capability_slug="pdf-extract",
inputs={
"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
},
max_price_cents=30,
)) # No account. The first request answers 402 with the price in USDC;
# an x402 client pays it from your wallet and repeats the request.
curl -i -X POST https://api.strale.io/x402/v2/pdf-extract \
-H 'Content-Type: application/json' \
-d '{
"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
}' Limitations
Scanned PDFs have lower extraction accuracy
AI extraction from PDFs — scanned documents (image PDFs) have lower accuracy than native text PDFs
What to do instead: For scanned documents, use image-to-text on individual pages for better OCR control
Protected or encrypted PDFs cannot be processed
Password-protected or DRM-encrypted PDFs cannot be processed
What to do instead: Remove password protection before submitting, or extract text using a local PDF library with the document password
Input documents are limited to 8 MiB decoded
Documents supplied by URL or base64 are refused above 8 MiB of decoded data, with a caller_input error naming the input field and no charge. Reduce the document size or split it before submitting.