Papyrio
On this page▾

API reference

Papyrio PDF API

PDF processing over plain HTTP. Post a multipart/form-data upload, get the processed file back in the response body. One request, one file. You never poll a job queue or register a callback.

We hold your file in memory, process it, and drop it when the response goes out. We keep no copy and share nothing. Uploads stop at 50 MB, and most requests finish in 2–7 seconds depending on the file and the operation.

Base URL
https://api.papyrio.net
Endpoints
12 operations
Free tier
50 requests / month

Quickstart

  1. 1Subscribe to a plan on RapidAPI. The Basic plan is free and needs no card.
  2. 2Copy your key from Apps → Authorization in the RapidAPI dashboard and export it as RAPIDAPI_KEY.
  3. 3Send a file. The response body is the result.
curl -X POST "https://papyrio-pdf-tools.p.rapidapi.com/compress" \  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \  -H "X-RapidAPI-Host: papyrio-pdf-tools.p.rapidapi.com" \  -F "file=@document.pdf" \  -F "level=medium" \  --output output.pdf

Authentication

The RapidAPI gateway authenticates every request. Send two headers:

X-RapidAPI-Key
Your subscription key, from Apps → Authorization in the RapidAPI dashboard. Keep it in an environment variable. Anyone who reads your client-side bundle can spend your quota.
X-RapidAPI-Host
Always papyrio-pdf-tools.p.rapidapi.com.

Through the gateway we meter by subscriber rather than by IP, so a shared office address or a NAT costs you nothing. Calling https://api.papyrio.net without these headers still works, but it counts as ordinary free web traffic and gets the guest limit of three operations a day per IP address, not your subscription. Sending a X-RapidAPI-User header without the matching proxy secret returns 403 forbidden.

Requests and responses

  • Every processing endpoint is POST with a multipart/form-data body. Let your HTTP client write the Content-Type header. Setting it by hand breaks the multipart boundary, which is the most common cause of a 400.
  • On success you get the file itself in the body. Read Content-Type to see what arrived, then write the bytes to disk as binary.
  • Errors come back as JSON, shaped {"error":{"code","message"}}. Branch on code. We reword message whenever it reads badly, so do not parse it.
  • Requests run synchronously. Give your client a timeout of 120 seconds or more, since OCR and large conversions are the slowest operations.

Rate limits and plans

Each subscription carries its own quota. Go past the monthly quota or the hourly rate and you get 429 with a Retry-After header in seconds.

PlanPriceQuotaRate
BasicFree50 requests / month10 / hour
ProPopular$9.991,000 requests / month120 / hour
Ultra$29.995,000 requests / month120 / hour
Mega$99.9925,000 requests / month120 / hour

The rate column shows what you can sustain. RapidAPI’s plan page says 1,000 requests per hour on the paid tiers because the platform gives a provider no way to lower that number; our own limit is 120 per hour per subscription. A larger plan raises your monthly quota and leaves the hourly rate where it is, so write to us instead if you need more throughput.

Apart from your plan, we cap how many conversions run at once across all users. Hit that cap and the request returns 503 capacity_exceeded with Retry-After. Retry with backoff and it clears in seconds.

Errors

CodeHTTPMeaningWhat to do
bad_request400Wrong file type, corrupt PDF, or a missing required field.Check the field names against the endpoint reference and confirm the file opens locally.
forbidden403The request carried RapidAPI headers without the matching proxy secret.Call the RapidAPI host and let the gateway set those headers for you.
file_too_large413The upload exceeds the 50 MB limit.Compress or split the file before sending it.
unsupported_media_type415The body arrived as something other than multipart/form-data.Let your HTTP client set the multipart boundary; do not set Content-Type by hand.
method_not_allowed405Wrong HTTP method for this path.Every processing endpoint is POST. Only /health is GET.
rate_limit_exceeded429You have used up the hourly limit on your subscription.Read the Retry-After header and wait that many seconds, or move to a higher plan.
capacity_exceeded503Too many conversions are running at once across all users.Wait the number of seconds in Retry-After and send it again. It clears in seconds.
processing_failed500The file reached the converter but could not be processed.The file is probably malformed. Run it through /repair on the web app, or send it to us.

Optimize

Compress a PDF

POST/compress

Downsamples embedded images and rebuilds the file with Ghostscript. Fonts stay fonts, so the text stays selectable. Image-heavy files shrink 30–80%. On a file that is already optimized the rebuild can come out bigger, and we send back your original untouched.

Body — multipart/form-data

filefilerequired

PDF file, 50 MB maximum.

levelstringoptional

Compression strength. low keeps images at 300 DPI, medium uses 150 DPI, high uses 72 DPI.

One of low, medium, high — defaults to medium

Returns

Compressed PDF

application/pdf
curl -X POST "https://papyrio-pdf-tools.p.rapidapi.com/compress" \  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \  -H "X-RapidAPI-Host: papyrio-pdf-tools.p.rapidapi.com" \  -F "file=@document.pdf" \  -F "level=medium" \  --output output.pdf

Organize

Merge PDFs into one

POST/merge

Combines 2–10 PDFs into one document in upload order. Total size across all files has to stay under 200 MB. Unlock password-protected files before you send them.

Body — multipart/form-data

filesfile[]required

Two to ten PDF files, merged in the order sent.

Returns

Merged PDF

application/pdf
curl -X POST "https://papyrio-pdf-tools.p.rapidapi.com/merge" \  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \  -H "X-RapidAPI-Host: papyrio-pdf-tools.p.rapidapi.com" \  -F "files=@first.pdf" \  -F "files=@second.pdf" \  --output output.pdf

Split a PDF into single pages

POST/split-pdf

Separates every page into its own PDF and returns them as a ZIP archive.

Body — multipart/form-data

filefilerequired

PDF file, 50 MB maximum.

Returns

ZIP archive, one PDF per page

application/zip
curl -X POST "https://papyrio-pdf-tools.p.rapidapi.com/split-pdf" \  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \  -H "X-RapidAPI-Host: papyrio-pdf-tools.p.rapidapi.com" \  -F "file=@document.pdf" \  --output pages.zip

Convert to PDF

Convert an Office document to PDF

POST/convert

Converts Word (.doc, .docx, .odt), PowerPoint (.ppt, .pptx) and Excel (.xls, .xlsx) to PDF with LibreOffice, keeping fonts, tables, images and page layout.

Body — multipart/form-data

filefilerequired

Office document, 50 MB maximum.

Returns

Converted PDF

application/pdf
curl -X POST "https://papyrio-pdf-tools.p.rapidapi.com/convert" \  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \  -H "X-RapidAPI-Host: papyrio-pdf-tools.p.rapidapi.com" \  -F "file=@report.docx" \  --output output.pdf

Convert an image to PDF

POST/image-to-pdf

Wraps a JPG, PNG or WebP image in a PDF page.

Body — multipart/form-data

filefilerequired

JPG, PNG or WebP image.

Returns

PDF containing the image

application/pdf
curl -X POST "https://papyrio-pdf-tools.p.rapidapi.com/image-to-pdf" \  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \  -H "X-RapidAPI-Host: papyrio-pdf-tools.p.rapidapi.com" \  -F "file=@scan.jpg" \  --output output.pdf

Render a web page as PDF

POST/html-to-pdf

Fetches a URL and renders it to PDF in a headless browser. This one takes a URL rather than a file upload.

Body — multipart/form-data

urlstringrequired

Publicly reachable page URL.

Returns

Rendered PDF

application/pdf
curl -X POST "https://papyrio-pdf-tools.p.rapidapi.com/html-to-pdf" \  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \  -H "X-RapidAPI-Host: papyrio-pdf-tools.p.rapidapi.com" \  -F "url=https://example.com" \  --output output.pdf

Extract from PDF

Convert PDF to Word

POST/pdf-to-word

Rebuilds the document structure as .docx. PDFs exported from Word, Google Docs or InDesign come through well. A scanned PDF is a picture of a page, so run /ocr-pdf on it first.

Body — multipart/form-data

filefilerequired

PDF file, 50 MB maximum.

Returns

Word document (.docx)

application/vnd.openxmlformats-officedocument.wordprocessingml.document
curl -X POST "https://papyrio-pdf-tools.p.rapidapi.com/pdf-to-word" \  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \  -H "X-RapidAPI-Host: papyrio-pdf-tools.p.rapidapi.com" \  -F "file=@document.pdf" \  --output output.docx

Extract plain text from a PDF

POST/pdf-to-text

Returns the text layer as UTF-8. Fast and exact when the PDF already carries selectable text. A scanned PDF has no text layer, so use /ocr-pdf instead.

Body — multipart/form-data

filefilerequired

PDF file, 50 MB maximum.

Returns

Extracted text

text/plain
curl -X POST "https://papyrio-pdf-tools.p.rapidapi.com/pdf-to-text" \  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \  -H "X-RapidAPI-Host: papyrio-pdf-tools.p.rapidapi.com" \  -F "file=@document.pdf" \  --output output.txt

Convert PDF pages to JPG images

POST/pdf-to-jpg

Renders every page as a JPG and returns them as a ZIP archive.

Body — multipart/form-data

filefilerequired

PDF file, 50 MB maximum.

Returns

ZIP archive, one JPG per page

application/zip
curl -X POST "https://papyrio-pdf-tools.p.rapidapi.com/pdf-to-jpg" \  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \  -H "X-RapidAPI-Host: papyrio-pdf-tools.p.rapidapi.com" \  -F "file=@document.pdf" \  --output pages.zip

Make a scanned PDF searchable

POST/ocr-pdf

Runs Tesseract over every page at 300 DPI and adds a text layer, which makes the document searchable and selectable. Scan quality drives the result: 300 DPI or higher reads well, below 150 DPI falls apart.

Body — multipart/form-data

filefilerequired

PDF file, 50 MB maximum.

Returns

Searchable PDF with a text layer

application/pdf
curl -X POST "https://papyrio-pdf-tools.p.rapidapi.com/ocr-pdf" \  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \  -H "X-RapidAPI-Host: papyrio-pdf-tools.p.rapidapi.com" \  -F "file=@scanned.pdf" \  --output output.pdf

Secure

Password-protect a PDF

POST/protect-pdf

Encrypts the document with AES-256 using the password you supply.

Body — multipart/form-data

filefilerequired

PDF file, 50 MB maximum.

passwordstringrequired

Password required to open the resulting PDF.

Returns

Encrypted PDF

application/pdf
curl -X POST "https://papyrio-pdf-tools.p.rapidapi.com/protect-pdf" \  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \  -H "X-RapidAPI-Host: papyrio-pdf-tools.p.rapidapi.com" \  -F "file=@document.pdf" \  -F "password=s3cret" \  --output output.pdf

Remove a PDF password

POST/unlock-pdf

Decrypts a password-protected PDF. You supply the correct password; this does not break encryption.

Body — multipart/form-data

filefilerequired

PDF file, 50 MB maximum.

passwordstringrequired

Current password of the PDF.

Returns

Decrypted PDF

application/pdf
curl -X POST "https://papyrio-pdf-tools.p.rapidapi.com/unlock-pdf" \  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \  -H "X-RapidAPI-Host: papyrio-pdf-tools.p.rapidapi.com" \  -F "file=@locked.pdf" \  -F "password=s3cret" \  --output output.pdf

Health check

GET/health

Reports API and rendering-engine status. We do not rate limit it, so point an uptime monitor at it.

{  "status": "ok",  "gotenberg": "ok",  "error": ""}

Support

Write to hello@papyrio.net with questions, a file that will not convert, or a quota that does not fit your volume. Tell us the endpoint and the error code, and send the file if you can share it.

The same operations run free in a browser at papyrio.net/tools, with no account.