Docs

One endpoint. Send a source (HTML, a URL, or a template + JSON) and get a PDF back. Auth is a Bearer API key; keys are stored hashed.

Authentication

Pass your key as Authorization: Bearer <key>. Create a key in the dashboard. Include an idempotencyKey to make retries safe — a repeat returns the stored result instead of re-rendering (or re-billing).

POST /api/v1/pdf

cURL
curl https://docweave.dev/api/v1/pdf \
  -H "Authorization: Bearer dw_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "source": { "type": "html", "html": "<h1>Hello, PDF</h1>" },
    "options": { "format": "A4" }
  }'
Node.js
const res = await fetch("https://docweave.dev/api/v1/pdf", {
  method: "POST",
  headers: {
    Authorization: "Bearer dw_live_your_key",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    source: {
      type: "template",
      template: "<h1>Invoice {{ number }}</h1><p>Total: {{ total }}</p>",
      data: { number: "INV-042", total: "$1,280.00" },
    },
    idempotencyKey: "inv-042", // safe to retry — never double-generates
  }),
});
const { result } = await res.json();
// result.bytesBase64 -> write to a .pdf file
Python
import requests, base64

r = requests.post(
    "https://docweave.dev/api/v1/pdf",
    headers={"Authorization": "Bearer dw_live_your_key"},
    json={"source": {"type": "url", "url": "https://example.com"}},
)
result = r.json()["result"]
if result["ok"]:
    with open("out.pdf", "wb") as f:
        f.write(base64.b64decode(result["bytesBase64"]))

Using an AI agent?

Skip HTTP entirely — add the Docweave MCP server and your agent gets a generate_pdf tool.