Developers
The PDF API that respects your time
Simple multipart uploads, asynchronous jobs, signed result URLs and webhooks. Documentation generated from the live API contract.
Quickstart
1. Create a job
curl -X POST https://www.docsgreen.com/api/v1/jobs \ -H "Authorization: Bearer $PL_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -F tool=merge-pdf \ -F file=@part-1.pdf -F file=@part-2.pdf \ -F 'options={"bookmarks":true}'2. Poll the job (or receive a webhook)
curl https://www.docsgreen.com/api/v1/jobs/JOB_ID -H "Authorization: Bearer $PL_API_KEY" { "id": "…", "status": "succeeded", "files": [{ "name": "merged.pdf", "size": 48213, "sha256": "…", "url": "https://…/api/files/…" }] }3. Download the result
Result URLs are signed, time-limited and need no API key. Files are deleted when the job expires.
Verify webhooks
Every delivery carries x-webhook-id (use it to de-duplicate) and x-webhook-signature: t=<unix>,v1=<hex>, an HMAC-SHA256 of t.body with your endpoint secret. Failed deliveries are retried with backoff for about a day.
import crypto from "node:crypto";
export function verify(secret, rawBody, header) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;
const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1 ?? ""));
}Scoped keys
Idempotent
Clear limits
Webhooks
Tenant isolation
OpenAPI 3.1
Available tools (23)
| tool | Description | Credits |
|---|---|---|
| merge-pdf | Combine multiple PDFs into a single document in the order you choose, with optional bookmarks and a table of contents. | 1 |
| split-pdf | Split a PDF by custom page ranges, every N pages, into single pages, or into parts under a maximum file size. | 1 |
| extract-pages | Create a new PDF that contains only the pages you select. | 1 |
| delete-pages | Remove unwanted pages from a PDF by page number or range. | 1 |
| rotate-pdf | Rotate all pages or selected pages by 90, 180 or 270 degrees permanently. | 1 |
| reverse-pdf | Reverse the page order of a PDF — useful for documents scanned back to front. | 1 |
| add-page-numbers | Number pages with your choice of position, format, starting number, font size and color. | 1 |
| resize-pdf | Change page dimensions to A4, Letter, Legal or a custom size, scaling content to fit. | 1 |
| pdf-to-text | Extract the text layer of a PDF as plain text or as JSON with page references. | 1 |
| jpg-to-pdf | Convert JPG photos into a PDF — combine many images into one document or create one PDF per image. | 1 |
| png-to-pdf | Convert PNG images, including screenshots with transparency, into PDF. | 1 |
| webp-to-pdf | Convert WebP images into a PDF document. | 1 |
| tiff-to-pdf | Convert single and multi-page TIFF scans into PDF. | 1 |
| image-to-pdf | Combine JPG, PNG, WebP, GIF, BMP and TIFF images into one PDF. | 1 |
| add-watermark | Stamp text or an image watermark over or behind your pages with adjustable opacity, rotation and position. | 1 |
| edit-metadata | Change the title, author, subject, keywords and language stored in a PDF. | 1 |
| protect-pdf | Encrypt a PDF with a password and control printing, copying and editing permissions. | 1 |
| unlock-pdf | Remove password protection from a PDF when you know the password. | 1 |
| sanitize-pdf | Strip metadata, JavaScript, embedded files and optionally annotations and links before sharing. | 1 |
| repair-pdf | Rebuild the internal structure of a damaged PDF so it opens reliably. | 1 |
| pdf-info | Inspect page count, dimensions, orientation, metadata, encryption, permissions, fonts and whether a PDF is scanned. | 1 |
| extract-text | Extract text with page references as structured JSON. | 1 |
| flatten-pdf | Flatten form fields into regular page content so they can't be changed. | 1 |
Versioning & deprecation
The API is versioned in the path (/api/v1). Additive changes (new fields, tools, options) ship without a version bump. Breaking changes ship in a new version; the previous version remains available for at least 12 months after a deprecation notice by email and in the changelog.
Changelog
- v1.0 — jobs, usage, webhooks, tools listing, OpenAPI spec.