Send documents from your own code and get back clean JSON: extracted text, tables, key values and the AI report. Included with Pro and Enterprise.
Create a key on your profile page and send it as a bearer token on every request:
Authorization: Bearer pdfs_xxxxxxxxxxxxxxxxxxxxxxxx
Keys are shown once. Revoke a key at any time and it stops working immediately.
| POST | /api/public/v1/documents | Upload a document (multipart field 'file') |
| GET | /api/public/v1/documents | List your most recent documents |
| GET | /api/public/v1/documents/{id} | Fetch status, extracted data and the report |
Accepted files: PDF, DOCX, JPG, PNG, up to 20 MB. Rate limit: 60 requests per minute. Every processed document counts towards your monthly allowance, exactly like uploads in the app.
curl -X POST https://project--80784737-4ea2-4e89-acea-fda75f707986.lovable.app/api/public/v1/documents \
-H "Authorization: Bearer $PDFSTREAM_API_KEY" \
-F "file=@invoice.pdf"
# -> {"id":"7c2f...","status":"queued","file_name":"invoice.pdf"}
curl https://project--80784737-4ea2-4e89-acea-fda75f707986.lovable.app/api/public/v1/documents/7c2f... \
-H "Authorization: Bearer $PDFSTREAM_API_KEY"const form = new FormData();
form.set("file", new File([await fs.readFile("invoice.pdf")], "invoice.pdf", {
type: "application/pdf",
}));
const created = await fetch("https://project--80784737-4ea2-4e89-acea-fda75f707986.lovable.app/api/public/v1/documents", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PDFSTREAM_API_KEY}` },
body: form,
}).then((res) => res.json());
// Poll until the document is completed
let result;
do {
await new Promise((r) => setTimeout(r, 3000));
result = await fetch(`https://project--80784737-4ea2-4e89-acea-fda75f707986.lovable.app/api/public/v1/documents/${created.id}`, {
headers: { Authorization: `Bearer ${process.env.PDFSTREAM_API_KEY}` },
}).then((res) => res.json());
} while (result.document.status === "queued" || result.document.status === "processing");
console.log(result.report.summary, result.extracted.key_values);import os, time, requests
BASE = "https://project--80784737-4ea2-4e89-acea-fda75f707986.lovable.app/api/public/v1"
headers = {"Authorization": f"Bearer {os.environ['PDFSTREAM_API_KEY']}"}
with open("invoice.pdf", "rb") as fh:
created = requests.post(
f"{BASE}/documents",
headers=headers,
files={"file": ("invoice.pdf", fh, "application/pdf")},
).json()
while True:
result = requests.get(f"{BASE}/documents/{created['id']}", headers=headers).json()
if result["document"]["status"] in ("completed", "error"):
break
time.sleep(3)
print(result["report"]["summary"])
print(result["extracted"]["key_values"])| 202 | Accepted | Document queued for processing |
| 401 | Unauthorized | Missing, revoked or invalid API key |
| 402 | Limit reached | Monthly document allowance used up |
| 413 | Too large | File exceeds 20 MB |
| 415 | Unsupported | File type not supported |
| 429 | Rate limited | More than 60 requests in a minute |