Skip to content

HTTP API overview

The PDF As You Go HTTP API — base URL, no-auth model, one endpoint per operation, and x402 payment.

The HTTP API is for non-MCP integrations: scripts, backends, and any x402-aware HTTP client. It has identical capabilities and identical pricing to the MCP server — one flat $0.05 per operation.

https://api.pdfasyougo.com/v1

There is one endpoint per operation, for example POST /v1/merge and POST /v1/watermark/text. The full list is in Operations & pricing.

There is no Authorization header and no API key. Authentication and payment are the same thing: each request is paid inline over x402, and a settled payment is the authorization. See The 402 flow for exactly how a request is paid.

  • Method: POST
  • Content type: application/json for URL/base64 inputs, or multipart/form-data for direct uploads.
  • Body: the operation’s parameters, including its file input(s).
Terminal window
curl -X POST https://api.pdfasyougo.com/v1/pages/rotate \
-H "Content-Type: application/json" \
-H "X-PAYMENT: <base64-encoded-payment-payload>" \
-d '{"file":"https://example.com/scan.pdf","pages":"1-3","degrees":90}'

A successful operation returns 200 OK with a JSON body containing a short-lived download URL and light metadata, plus an X-PAYMENT-RESPONSE header confirming settlement:

{
"output": {
"url": "https://files.pdfasyougo.com/o/3f9a…?token=…",
"expires_at": "2026-06-29T12:00:00Z",
"pages": 12,
"bytes": 98304
},
"operation": "pages.rotate",
"cost": "0.05 USDC"
}

See Conventions for the common request/response details (file inputs, page-range syntax, idempotency) and Errors for failure handling.

You can implement the 402 → sign → retry loop yourself, but it’s far easier to use an x402 client — for example x402-fetch in JavaScript/TypeScript, or an httpx integration in Python. The HTTP quickstart shows both.

  • The 402 flow — every field and header in the payment exchange.
  • Conventions — shared request/response rules.
  • Errors — status codes and error bodies.
  • Operations — every endpoint with parameters and examples.