Edit the text inside a PDF that already exists.

One API call changes the words and leaves everything else exactly where it was: the fonts the document embeds, the layout, the other 99 % of the page. Every change is verified before it comes back. Built for developers and for AI agents.

Get a free keyQuick start5,000 pages a month free · no card
curl -sS https://api.niubai.vip/v1/edit -H "Authorization: Bearer sk_live_…" \
  -F file=@invoice.pdf \
  -F 'edits=[{"find": "$4,200", "replace": "$4,800"}]'
→ status: done · 1 change · font: document's own · collateral pixels: 0

No key yet? Leave the Authorization line out: 200 pages a day per IP to try, outputs carry a small SAMPLE mark.

How it works

Three steps, no SDK required. SDKs and an MCP server exist if you want them.

Get a key

Enter an email below. The free plan has 5,000 pages a month (500 a day) and needs no card.

Send the PDF and the edits

Upload the file or point at a URL, and list what to find and what to put there. Scope by page, region, anchor or occurrence.

Get the verified result

The edited PDF, plus per change: the font used, the pixel check, a before/after preview. A change that cannot be verified is rolled back, not returned.

Real output, not mock-ups

Each pair below was produced by the API itself over a real document. The request that made it is next to it.

Replace a figure in an agreement, font and layout untouched{"edits": [{"find": "$4,200", "replace": "$4,800"}]}
beforeBefore: Replace a figure in an agreement, font and layout untouched
afterAfter: Replace a figure in an agreement, font and layout untouched
Redact a card number, with the bytes actually gone{"edits": [{"op": "redact", "find": "4111 1111 1111 1111"}]}
beforeBefore: Redact a card number, with the bytes actually gone
afterAfter: Redact a card number, with the bytes actually gone
A longer sentence reflows the paragraph instead of overflowing{"edits": [{"find": "…", "replace": "…", "fit": "reflow"}]}
beforeBefore: A longer sentence reflows the paragraph instead of overflowing
afterAfter: A longer sentence reflows the paragraph instead of overflowing

Ten examples with their requests →

Five operations

Exact, case-insensitive, word and regex matching; OCR for scanned pages; batch mode for one template and many records.

replace

Rewrite a phrase in the document's own font. Longer text is fitted, or reflows the paragraph.

delete

Remove a phrase and tidy the punctuation and spacing it leaves behind.

redact

Remove text for real: content stream, image pixels, metadata, outlines. Reports anywhere else the string still occurs.

insert

Add text at a point or after an anchor phrase, in the surrounding style.

form

Fill AcroForm fields by name, read the value back, optionally flatten.

For agents: an MCP server

Claude Code, Cursor, VS Code and Claude Desktop can edit PDFs through the same API with five tools. Local files are uploaded for you; every tool answers with what changed and a preview.

claude mcp add pdfedit -- npx -y @niubai/pdfedit-mcp

That is the whole set-up: no key needed to start (200 pages a day per IP, output watermarked); a free key lifts both. Web clients that cannot run a local server use the hosted endpoint https://pdfedit-mcp-remote.niubai-pdfedit-remote-worker.workers.dev/mcp with PDF URLs.

What to say to the agent, and what comes back: three worked examples. Set-up for your client: Claude · Cursor · VS Code.

Get a free key

SDKs: npm install @niubai/pdfedit · Python SDK from the repo · source and examples at https://github.com/zp130221/pdfedit-mcp.

Let your AI assistant write the integration. Paste the line below into ChatGPT, Claude, Cursor or any coding agent, say what you want changed in your PDF, and it writes working code. The file it reads is this whole API written for a model: endpoints, edit syntax, options, results and every error.
Read https://api.niubai.vip/llms-full.txt and use that API to replace text in a PDF for me.
Open the file

Pricing

You pay for the pages you edit, not the pages you send. One edit on one page of a 300-page contract costs one page; the other 299 are not billed. A page that needed OCR counts as five. Every plan is prepaid: nothing is billed beyond what you buy. Prices in USD, tax added at checkout where the buyer's country requires it. Also: a 20,000-page pack for $12, never expires, bought from your account page.

Free

$0

5,000 pages / month, 500 a day

No card. Flagged documents watermarked.

Get a free key

Try it

$4.90 once

2,000 pages, never expire · $0.0025 / page

Pay once, no subscription.

Growth

$29 / month

100,000 pages · $0.00029 / page

Watermark control on flagged documents.

Scale

$99 / month

500,000 pages · $0.0002 / page

Highest concurrency and rate limits.

Subscriptions renew monthly and can be cancelled any time from the customer portal link on the receipt; the plan stays until the end of the paid period. Payments are handled by Creem, the merchant of record. See the refund policy.

One edit, one page
Starter's 20,000 pages are about 20,000 edits, when each one changes a single page. Document size does not decide the bill; the pages an edit touched do.
Try before you pay
200 pages a day with no account at all (2,000 a month); 5,000 a month with a free key, no mark on ordinary documents. Nothing to cancel if you stop.
Creem is the merchant of record
Card details never reach this service. Invoices, VAT and the cancel link come from Creem; see the refund policy.
Your documents are not kept
Deleted within 24 hours, never used for training, never read by people (privacy).
No lock-in
Plain HTTP and an OpenAPI document; the SDKs, MCP server and skill are MIT on GitHub. Nothing to migrate off but a base URL.

Get a free key

One account per email. We'll email you a sign-in link; keys are made on your account page. Already have one? Quick start.

Questions

What counts as a page?

A page of the document that an applied edit touched. One edit on one page of a 300-page contract costs one page. Pages that needed OCR count as five.

Does it change anything I did not ask for?

It is built not to. Every change is rendered before and after and compared pixel by pixel outside its own area; if anything else on the page moved, the change is rolled back and the API says why. A request with one failing edit returns nothing rather than a document that is subtly wrong.

Which fonts does it use?

The document's own font when enough of it is embedded, a metric-compatible substitute when it is not, an approximation as a last resort. The response tells you which one you got for every change.

What about scans?

Pages without a text layer go through OCR; a replacement on such a page is drawn as pixels and verified by re-rendering. Redaction on a scanned word is refused, because the word is the image.

Where do my documents go?

They are stored only to serve the request and deleted automatically within 24 hours. Job records without document content are kept 30 days for support and billing. Nothing is used for anything else.

Is there a watermark?

Not on an ordinary document, on any plan. A document that looks like an invoice, a contract or a sealed paper is marked "Edited" by default; Growth and Scale accounts that accept the document-integrity terms may turn that off. A redaction is never watermarked.