Quickstart
Set the base URL and your key once. The base URL is the one of your region.
export PDFLUENT_API_URL="<the API base URL of your region>"export PDFLUENT_API_KEY="<your API key>"Send the key in the x-api-key header (or as a bearer token), then call any operation. This one turns a PDF into Markdown:
curl -sS -f -X POST "$PDFLUENT_API_URL/v1/extract/markdown" \ -H "x-api-key: $PDFLUENT_API_KEY" \ -o result.mdimport jsonimport os
import requests
parts = [ ("file", ("structured.pdf", open("structured.pdf", "rb"))),]
response = requests.post( os.environ["PDFLUENT_API_URL"] + "/v1/extract/markdown", headers={"x-api-key": os.environ["PDFLUENT_API_KEY"]}, files=parts,)response.raise_for_status()
with open("result.md", "wb") as out: out.write(response.content)import { openAsBlob } from 'node:fs';import { writeFile } from 'node:fs/promises';
const form = new FormData();form.append('file', await openAsBlob("structured.pdf"), "structured.pdf");
const response = await fetch(process.env.PDFLUENT_API_URL + "/v1/extract/markdown", { method: 'POST', headers: { 'x-api-key': process.env.PDFLUENT_API_KEY }, body: form,});if (!response.ok) throw new Error(`${response.status} ${await response.text()}`);
await writeFile("result.md", Buffer.from(await response.arrayBuffer()));A successful call returns the result as the body. The response headers x-pdfluent-pages and x-pdfluent-credits tell you how many pages were read and how many credits the call cost.
- Authentication
- Credits and pricing: what the call above cost, and how to try the API for USD 1.
- API reference: the other operations.
- Errors: what a failed call returns.