Paperbase Docs

Quickstart

From npm install to your first PDF in five minutes.

Install the SDK

npm install paperbase

Get an API key

Sign up at paperbase.dev — 100 renders/month free, no credit card required.

Set your key as an environment variable:

PAPERBASE_API_KEY=pb_live_...

Generate your first PDF

generate.ts
import { Paperbase } from "paperbase";
 
const paperbase = new Paperbase({ apiKey: process.env.PAPERBASE_API_KEY! });
 
const result = await paperbase.pdf.generate({
  input: { type: "markdown", content: "# Q3 Report\n\nRevenue was up 34% QoQ." },
  template: "report",
  theme: {
    logo_url: "https://cdn.example.com/logo.svg",
    accent_color: "#ff4e8c",
  },
});
 
// result.url        → signed URL to the PDF (valid 7 days)
// result.page_count → number of pages
// result.warnings   → structured, fixable warnings
console.log(result.url);

What you get back

FieldTypeDescription
urlstringSigned URL to the rendered PDF
preview_urlstringSigned URL to a PNG preview of page 1
page_countnumberNumber of pages
warningsWarning[]Structured rendering warnings — see Warning catalog
job_idstringUnique job ID for later retrieval

Next steps

On this page