Docs.
Everything needed to call the API: one key, a bearer header, and the endpoint. Interactive reference at /docs/api; AI agents start at /docs/mcp.
Authentication
One key, one header
Get a key on /signup (free tier, no card). Send it as a bearer token on every request; X-Api-Key is also accepted. Base URL: https://api.preteworks.com.
Authorization: Bearer sk_pw_…
Keys are shown once at issue. Lost it? Issue a new free-tier key on /signup; paid keys: /account or contact us.
Quickstart
Up and running in one call
# Any URL → clean Markdown ($0.004) curl https://api.preteworks.com/v1/web/markdown \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"url":"https://example.com/article"}' # Merge two PDFs ($0.002) curl https://api.preteworks.com/v1/pdf/merge \ -H "Authorization: Bearer YOUR_API_KEY" \ -F files=@a.pdf -F files=@b.pdf -o merged.pdf # How much have I used this month? curl https://api.preteworks.com/v1/usage -H "Authorization: Bearer YOUR_API_KEY"
Responses are the file (PDF/PNG), text (Markdown), or JSON. Errors are always JSON: {"error": "code", "message": "text"}.
AI agents
Use it over MCP
The same operations are exposed as MCP tools at https://api.preteworks.com/mcp (Streamable HTTP), authenticated with the same key and metered on the same cap.
claude mcp add --transport http preteworks https://api.preteworks.com/mcp --header "Authorization: Bearer YOUR_API_KEY"
Full MCP setup — Claude Code, Claude Desktop, Cursor, and the tool list →
Endpoints
Documents & data
| Endpoint | What it does | Price |
|---|---|---|
| POST /v1/pdf/html | Render an HTML document to a pixel-accurate PDF. HTML body, or {html} JSON. External subresources are blocked — inline assets as data: URIs. | $0.01 |
| POST /v1/pdf/merge | Combine two or more PDFs into one, in order. multipart files (2–20, ≤25 MB total). | $0.002 |
| POST /v1/pdf/select | Keep exactly the pages you want. multipart file + pages=1,3,5-7. | $0.002 |
| POST /v1/pdf/rotate | Rotate every page by 90, 180 or 270 degrees. multipart file + degrees=90|180|270. | $0.002 |
| POST /v1/pdf/watermark | Stamp a diagonal text watermark across every page. multipart file + text=CONFIDENTIAL. | $0.002 |
| POST /v1/pdf/extract | Pull clean text (and metadata) out of a PDF — for RAG, search and agents. multipart file + optional perPage=true. | $0.002 |
| POST /v1/pdf/from-markdown | Render Markdown to a clean, print-styled PDF — for reports and agent output. JSON {markdown, title?} or a raw Markdown body. | $0.01 |
| POST /v1/pdf/from-images | Combine PNG/JPEG images into a PDF, one image per page. multipart files (1–20 images). | $0.002 |
| POST /v1/pdf/split | Split one PDF into many — one file per page, or by page ranges. multipart file + optional ranges=1-3;4-6. Returns download links. | $0.002 |
| POST /v1/pdf/form-read | List a PDF's form fields — names, types, values and options. multipart file. | $0.002 |
| POST /v1/pdf/form-fill | Fill a PDF's form fields from a JSON map; optionally flatten. multipart file + fields (JSON) + optional flatten=true. | $0.002 |
| POST /v1/pdf/number | Stamp page numbers on every page — position, start value and format are yours. multipart file + optional position, start, format ({n}/{total}). | $0.002 |
| POST /v1/pdf/info | Read a PDF's metadata and structure — title, author, page count and size. multipart file. | $0.002 |
| POST /v1/pdf/metadata | Set a PDF's title, author, subject, keywords or creator. multipart file + any of title, author, subject, keywords, creator. | $0.002 |
| POST /v1/docx/text | Extract clean text from a Word .docx — for RAG, search and agents. multipart file (.docx). | $0.002 |
| POST /v1/docx/pdf | Convert a Word .docx into a clean, print-styled PDF. multipart file (.docx). | $0.01 |
| POST /v1/data/spreadsheet | Turn rows of JSON into a downloadable XLSX or CSV — the generation mirror of File → Markdown. JSON {rows[], format?, sheet?} — rows: array of objects or arrays; format: xlsx (default) · csv. | $0.002 |
| POST /v1/file/markdown | Convert a Word (.docx), Excel (.xlsx) or CSV file into clean Markdown — for RAG, agents and pipelines. multipart file (.docx / .xlsx / .csv); optional format hint. | $0.002 |
| POST /v1/document | Render a branded PDF from a named template — invoice, receipt or report. Money computed for you. JSON {template, data} — template: invoice · receipt · report; data carries the template fields (money computed server-side). | $0.01 |
| POST /v1/extract | Name the fields you want — from a URL, PDF or Office file (.docx/.xlsx/.csv) — and get them back as structured JSON. JSON {fields[], url?|pdf?} — fields is the list of keys to pull; source is a url or a base64 pdf. | from $0.02 |
| POST /v1/summarize | AI summary of a web page, PDF, Office file or raw text — grounded, no fabrication. JSON {url?|pdf?|file?|text?, max_words?}. | varies |
| POST /v1/answer | Ask a question and get an answer grounded ONLY in a URL, PDF, Office file or text. JSON {question, url?|pdf?|file?|text?}. | varies |
Web operations
| Endpoint | What it does | Price |
|---|---|---|
| POST /v1/web/markdown | Render the live page and return clean, readable Markdown — for RAG, notes and agents. JSON {url}. | $0.004 |
| POST /v1/web/scrape | One render → rendered HTML, every link, and page metadata. JSON {url, formats?} — formats: html, links, metadata. | $0.006 |
| POST /v1/web/pdf | Snapshot the live, rendered page as a pixel-faithful PDF. JSON {url}. | $0.01 |
| POST /v1/web/screenshot | Capture the live page as a PNG — viewport or full scroll height. JSON {url, fullPage?}. | $0.01 |
| POST /v1/web/batch | Markdown for up to 10 URLs in one call. JSON {urls[]} (≤10). | $0.004 per URL |
| POST /v1/web/crawl | The root page plus same-origin pages, all as Markdown. JSON {url, limit?} (limit ≤8, default 5). | $0.006 + $0.004 per page |
| POST /v1/web/map | Discover the same-origin URLs on a page — the site map, no content fetched. JSON {url}. | $0.006 |
| GET /v1/usage | This key's usage this month against its cap. — | free |
Every parameter, schema and response, with try-it-out: /docs/api. Machine-readable: /openapi.json · /llms.txt. Prices: /pricing.
Errors & limits
What can go wrong
| 400 / 422 | Bad input — missing URL, unparsable PDF, invalid page range. |
| 401 | Missing, unknown or revoked key. |
| 402 | Monthly cap reached (free: 500 units; pay as you go: 100,000). Resets on the 1st, or upgrade / ask for a raise. |
| 413 | Too large: 25 MB per file, 3 MB HTML, batch ≤10 URLs, crawl ≤8 pages. |
| 429 | More than 60 requests a minute on one key. |
| 502 | The target page could not be fetched or rendered. |
| 503 | Daily rendering capacity reached (see /status). Browser-backed operations resume at 00:00 UTC. |
Every URL-fetching operation blocks private and internal hosts (SSRF-guarded). HTML→PDF blocks external subresources — inline images and fonts as data: URIs. Rendered files returned by MCP tools are downloadable for one hour.
Legacy base URL https://pdf.preteworks.com keeps working for existing integrations; new ones should use https://api.preteworks.com.