---
title: "PDF Tools API"
method: POST
path: "/v1/pdf-tools"
tags: ["documents"]
---

# PDF Tools API

`POST /v1/pdf-tools`

## Request

- Base URL: `https://agent.pocket.network`
- URL: `https://agent.pocket.network/v1/pdf-tools`
- Auth: none required

Inspect, check, split, merge, extract pages, rotate, linearize, optimize, strip metadata, encrypt, decrypt or repair PDFs from public HTTPS URLs. POST /v1/pdf with operation, input_urls and options. Answers JSON: document facts, and for transforms temporary HTTPS URLs to the result PDFs, kept one hour. Up to 50 MB per input. Pay per request in USDC; no account, no API key.

## Request body

- object: The JSON body of POST /v1/pdf. Each operation's options schema is in the OpenAPI document the backend serves at /openapi.json. Limits: 50 MB per input, 100 MB in total, 500 combined pages.
  - `operation` 'inspect' | 'check' | 'split' | 'merge' | 'extract_pages' | 'rotate' | 'linearize' | 'optimize_structure' | 'remove_metadata' | 'encrypt' | 'decrypt' | 'repair', required: What to do with the PDF.
  - `input_urls` string[], required: Public HTTPS PDFs on port 443. merge takes 2 to 10; every other operation takes exactly one.
  - `options` object: The operation's options. extract_pages needs {pages}; rotate needs {angle: 90, 180 or 270} and takes pages; split takes pages_per_file; encrypt needs owner_password and user_password (8 to 127 bytes, AES-256). Any operation takes password for an encrypted input; merge takes passwords, one per input.

## Response `200`

The upstream response, served after payment settles.

- object: A JSON object with ok, service, operation, data, outputs and notes. data carries the document facts (page_count, pdf_version, encrypted, linearized, structurally_valid, ...); outputs lists each result PDF with url, bytes, page_count and expires_at. A refused request answers ok false with error.code and error.message, e.g. unsafe_url.

## Other responses

- `400`: Malformed request.
- `402`: Payment required. The x402 v2 terms are in the PAYMENT-REQUIRED header and, identically, in this body; sign the chosen option and retry with the PAYMENT-SIGNATURE header. The receipt arrives in PAYMENT-RESPONSE.
- `503`: This service is not currently available to serve.

---

[API](https://skmtc.dev/pocket/apis/pocket-agentic-portal.md) · [All operations](https://skmtc.dev/pocket/apis/pocket-agentic-portal/llms.txt) · [OpenAPI document](https://skmtc.dev/pocket/apis/pocket-agentic-portal/revisions/96d2176db014?raw)
