Skip to content

PDFella API · v1

PDF tools for your own app

Merge, split, rotate, watermark, number, protect, unlock and extract text from PDFs with a simple REST API. It runs the same engine as PDFella, so every improvement to our tools reaches your integration automatically.

Quick start

Send files as multipart/form-data. The processed file comes back in the response body, so there's nothing to poll or download separately.

curl https://api.pdfella.com/v1/merge \
  -H "Authorization: Bearer $PDFELLA_API_KEY" \
  -F "files=@first.pdf" \
  -F "files=@second.pdf" \
  -o merged.pdf
// Node.js 18+
const form = new FormData();
form.append("file", new Blob([await fs.promises.readFile("report.pdf")]), "report.pdf");
form.append("text", "CONFIDENTIAL");

const res = await fetch("https://api.pdfella.com/v1/watermark", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.PDFELLA_API_KEY}` },
  body: form,
});
if (!res.ok) throw new Error((await res.json()).error.message);
await fs.promises.writeFile("report-watermarked.pdf", Buffer.from(await res.arrayBuffer()));

Prefer a GUI? Import the OpenAPI spec into Postman or Insomnia (Import → Link) to get a ready-made collection of every endpoint.

Authentication

Every request needs your API key in the Authorization header: Bearer pdfella_sk_…. Keys are secret: call the API from your server, never from a browser or mobile app where users could read the key. If a key leaks, tell us and we'll revoke it and issue a new one.

GET /v1/me returns your key's name, rate limit and request counts for the last 30 days.

Limits

File size50 MB per file, 100 MB per request
Files per request50
Rate limit60 requests per minute per key (higher on request). Responses include X-RateLimit-Limit and X-RateLimit-Remaining.
Data retentionNone. Files are processed in memory and discarded when the response is sent. We log only the endpoint, status, size and timing.

Errors

Errors return JSON: { "error": { "code": "…", "message": "…" } }. The message is written for developers and safe to log.

StatusCodeMeaning
401unauthorizedMissing or invalid API key.
403key_revokedThis API key has been revoked.
404not_foundNo such endpoint.
400invalid_requestA file or parameter is missing or invalid. message says which.
415unsupported_typeA file isn't the type the endpoint accepts (checked from its contents, not its name).
413too_largeA file or the whole request is over the size limit.
422password_requiredThe PDF needs a password to open; send it as password.
422wrong_passwordThe password doesn't open this PDF.
422damagedThe PDF couldn't be read. Try /repair first.
429rate_limitedToo many requests. Wait for the number of seconds in Retry-After.
500internalSomething went wrong on our side.

Versioning

The API is versioned in the path (/v1). Within a version we only make backwards-compatible changes: new endpoints, new optional fields and better output from the same engine as PDFella. Anything that could break an integration ships as a new version, announced well in advance. Every response carries an X-PDFella-API-Version header.

Password-protected PDFs: every endpoint that reads a PDF accepts an optional password field. PDFs that only restrict printing or copying open without one.

Endpoints

Organise

POST /v1/merge

Combine several PDFs into one, in the order they are sent.

FieldTypeDescription
files[]*files: PDFTwo or more PDFs, merged in the order given.
passwordstringPassword to open the input PDF, if it needs one.

Returns application/pdf: The merged PDF.

curl https://api.pdfella.com/v1/merge \
  -H "Authorization: Bearer $PDFELLA_API_KEY" \
  -F "files=@first.pdf" \
  -F "files=@second.pdf" \
  -o output.pdf

POST /v1/split

Divide a PDF into several files by page ranges, every N pages, or odd and even pages.

FieldTypeDescription
file*file: PDFThe PDF to process.
moderanges | every | odd-evenHow to split. Default every.
rangesstringWith mode=ranges: page ranges separated by ;, one output file each, e.g. 1-3;4-6;7-.
everyintegerWith mode=every: pages per output file. Default 1.
passwordstringPassword to open the input PDF, if it needs one.

Returns application/zip: A ZIP archive with one PDF per part.

curl https://api.pdfella.com/v1/split \
  -H "Authorization: Bearer $PDFELLA_API_KEY" \
  -F "file=@document.pdf" \
  -F "ranges=1-3;4-" \
  -o output.zip

POST /v1/extract-pages

Create a new PDF from selected pages, in the order given.

FieldTypeDescription
file*file: PDFThe PDF to process.
pages*page rangesPages to keep, in order, e.g. 3,1-2.
passwordstringPassword to open the input PDF, if it needs one.

Returns application/pdf: A PDF with only the selected pages.

curl https://api.pdfella.com/v1/extract-pages \
  -H "Authorization: Bearer $PDFELLA_API_KEY" \
  -F "file=@document.pdf" \
  -F "pages=1-3,5" \
  -o output.pdf

POST /v1/delete-pages

Remove pages from a PDF.

FieldTypeDescription
file*file: PDFThe PDF to process.
pages*page rangesPages to remove, e.g. 2,5-7.
passwordstringPassword to open the input PDF, if it needs one.

Returns application/pdf: The PDF without the removed pages.

curl https://api.pdfella.com/v1/delete-pages \
  -H "Authorization: Bearer $PDFELLA_API_KEY" \
  -F "file=@document.pdf" \
  -F "pages=1-3,5" \
  -o output.pdf

POST /v1/rotate

Rotate pages clockwise by 90, 180 or 270 degrees.

FieldTypeDescription
file*file: PDFThe PDF to process.
angle90 | 180 | 270Clockwise rotation in degrees. Default 90.
pagespage rangesPages to apply this to, e.g. 1-3,5,8-. Defaults to every page.
passwordstringPassword to open the input PDF, if it needs one.

Returns application/pdf: The rotated PDF.

curl https://api.pdfella.com/v1/rotate \
  -H "Authorization: Bearer $PDFELLA_API_KEY" \
  -F "file=@document.pdf" \
  -F "pages=1-3,5" \
  -o output.pdf

POST /v1/reorder

Put pages in a new order. Pages you leave out are removed.

FieldTypeDescription
file*file: PDFThe PDF to process.
order*page rangesThe new page order, e.g. 3,1,2,4-.
passwordstringPassword to open the input PDF, if it needs one.

Returns application/pdf: The reordered PDF.

curl https://api.pdfella.com/v1/reorder \
  -H "Authorization: Bearer $PDFELLA_API_KEY" \
  -F "file=@document.pdf" \
  -F "order=3,1,2,4-" \
  -o output.pdf

Stamp

POST /v1/watermark

Stamp text or an image (PNG/JPG) on pages, once or tiled.

FieldTypeDescription
file*file: PDFThe PDF to process.
imagefile: PNG, JPGImage watermark. Send this or text.
textstringText watermark. Send this or an image file.
fontHelvetica | Times | CourierText font. Default Helvetica.
boldbooleanBold text. Default true.
sizenumberFont size in points. Default 48.
color#rrggbbText colour as #rrggbb. Default #d1242f.
opacitynumberOpacity from 0 to 1. Default 0.3.
rotationnumberCounter-clockwise rotation in degrees. Default 45.
positiontop-left | top-center | top-right | middle-left | center | middle-right | bottom-left | bottom-center | bottom-right | tileWhere to place it; tile repeats it across the page. Default center.
image_scalenumberImage watermark scale (1 = image pixels as points). Default 0.3.
layerover | underDraw over or under the page content. Default over.
pagespage rangesPages to apply this to, e.g. 1-3,5,8-. Defaults to every page.
passwordstringPassword to open the input PDF, if it needs one.

Returns application/pdf: The watermarked PDF.

curl https://api.pdfella.com/v1/watermark \
  -H "Authorization: Bearer $PDFELLA_API_KEY" \
  -F "file=@document.pdf" \
  -F "text=CONFIDENTIAL" \
  -F "pages=1-3,5" \
  -o output.pdf

Add page numbers

Same as the PDFella tool

POST /v1/page-numbers

Number pages with a format of your choice.

FieldTypeDescription
file*file: PDFThe PDF to process.
formatstringText to stamp. Tokens: {page}, {pages}, {date}, {name}. Default {page}.
positiontop-left | top-center | top-right | bottom-left | bottom-center | bottom-rightWhere on the page. Default bottom-center.
sizenumberFont size in points. Default 11.
color#rrggbbText colour as #rrggbb. Default #15171c.
marginnumberDistance from the page edge in points. Default 28.
start_atintegerNumber of the first numbered page. Default 1.
pagespage rangesPages to number, e.g. 2-. Defaults to every page.
passwordstringPassword to open the input PDF, if it needs one.

Returns application/pdf: The numbered PDF.

curl https://api.pdfella.com/v1/page-numbers \
  -H "Authorization: Bearer $PDFELLA_API_KEY" \
  -F "file=@document.pdf" \
  -F "format=Page {page} of {pages}" \
  -F "pages=1-3,5" \
  -o output.pdf

Convert

POST /v1/images-to-pdf

Turn JPG and PNG images into a PDF, one image per page.

FieldTypeDescription
files[]*files: PNG, JPGJPG or PNG images, one page each, in the order given.
page_sizefit | a4 | letterfit makes each page the size of its image. Default fit.
orientationauto | portrait | landscapePage orientation for A4 and Letter. Default auto.
marginnumberMargin around each image in points. Default 0.

Returns application/pdf: A PDF with one page per image.

curl https://api.pdfella.com/v1/images-to-pdf \
  -H "Authorization: Bearer $PDFELLA_API_KEY" \
  -F "files=@first.png" \
  -F "files=@second.png" \
  -o output.pdf

POST /v1/pdf-to-text

Extract the text of every page. Scanned pages without a text layer return no text.

FieldTypeDescription
file*file: PDFThe PDF to process.
passwordstringPassword to open the input PDF, if it needs one.

Returns text/plain: Plain text, with a divider line before each page.

curl https://api.pdfella.com/v1/pdf-to-text \
  -H "Authorization: Bearer $PDFELLA_API_KEY" \
  -F "file=@document.pdf" \
  -o output.txt

POST /v1/flatten

Bake form fields into the page so they can no longer be edited.

FieldTypeDescription
file*file: PDFThe PDF to process.
passwordstringPassword to open the input PDF, if it needs one.

Returns application/pdf: The flattened PDF.

curl https://api.pdfella.com/v1/flatten \
  -H "Authorization: Bearer $PDFELLA_API_KEY" \
  -F "file=@document.pdf" \
  -o output.pdf

Security

POST /v1/protect

Encrypt a PDF with a password (AES-256).

FieldTypeDescription
file*file: PDFThe PDF to process.
new_password*stringPassword needed to open the output (1–128 characters).
allow_printbooleanAllow printing. Default true.
allow_copybooleanAllow copying text and images. Default false.
allow_editbooleanAllow editing. Default false.
passwordstringPassword to open the input PDF, if it needs one.

Returns application/pdf: The encrypted PDF.

curl https://api.pdfella.com/v1/protect \
  -H "Authorization: Bearer $PDFELLA_API_KEY" \
  -F "file=@document.pdf" \
  -F "new_password=" \
  -o output.pdf

POST /v1/unlock

Remove the password and printing/copying restrictions from a PDF.

FieldTypeDescription
file*file: PDFThe PDF to process.
passwordstringPassword to open the input PDF, if it needs one.

Returns application/pdf: The PDF without encryption.

curl https://api.pdfella.com/v1/unlock \
  -H "Authorization: Bearer $PDFELLA_API_KEY" \
  -F "file=@document.pdf" \
  -o output.pdf

POST /v1/repair

Rebuild a damaged PDF's structure so it opens again.

FieldTypeDescription
file*file: PDFThe PDF to process.
passwordstringPassword to open the input PDF, if it needs one.

Returns application/pdf: The repaired PDF.

curl https://api.pdfella.com/v1/repair \
  -H "Authorization: Bearer $PDFELLA_API_KEY" \
  -F "file=@document.pdf" \
  -o output.pdf

Ready to integrate?

Tell us about your project and we'll send you a key.

Request an API key