API 06 · Vercel + optional worker
PDF Parser
Parses PDFs up to 3 MiB in pure Rust: document metadata, per-page text, and JSON or Markdown output. Parsing runs on an isolated blocking thread with a 25-second limit; malformed files fail safely. Pages with almost no text are flagged as scanned; with `ocr: true`, their embedded JPEG images are sent to the worker for Tesseract OCR.
POST https://dev.itsozy.lol/api/v1/pdf/parseAuthentication
Send Authorization: Bearer ozy_… with an API key that includes the pdf permission (or *). Signed-in dashboard sessions work in the playground. Each call costs 10 units.
Parameters
| Name | Type | Description | |
|---|---|---|---|
file | multipart file | optional | The PDF (or use data / url) |
data | string | optional | Base64 PDF |
url | string | optional | Public URL of a PDF |
format | string | optional | json (default) or markdown |
max_pages | integer | optional | 1-200 (default 50) |
ocr | boolean | optional | OCR scanned pages through the worker |
Example request
curl -X POST https://dev.itsozy.lol/api/v1/pdf/parse \
-H "Authorization: Bearer $OZY_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf", "format": "markdown"}'
Example response (illustrative)
{
"markdown": "# dummy\n\n## Page 1\n\nDummy PDF file\n\n",
"metadata": {
"title": "dummy"
},
"ocr_status": "not_needed",
"page_count": 1,
"pages_returned": 1,
"scanned_pages": 0,
"version": "1.4"
}
Errors
Errors use one envelope: {"error": {"code": "…", "message": "…"}}.
| Status | Code | Meaning |
|---|---|---|
| 422 | pdf_unprocessable | The file is encrypted, malformed or could not be parsed safely |
| 422 | pdf_timeout | Parsing exceeded 25 seconds |
| 400 | invalid_input | A parameter is missing or invalid |
| 401 | unauthorized | No valid API key or session |
| 403 | permission_denied | The key does not include this API's permission |
| 429 | quota_exceeded | Free-tier quota reached (20 units/min, 100 units/day) |
| 503 | database_unavailable | Persistent storage is temporarily unavailable |
Rate limits
20 units per minute and 100 units per day per account; outbound fetches to the same host are spaced at least one second apart. Exceeding a limit returns 429.