Authentication
How to authenticate with the Paperbase API using API keys.
API keys
Every request to the Paperbase API must include an API key in the Authorization header as a Bearer token:
Keys are issued per-workspace. You get your first key automatically when you sign up at paperbase.dev.
Key types
Paperbase issues two kinds of keys:
| Prefix | Type | Use |
|---|---|---|
pb_live_ | Live key | Production traffic — counts against your monthly quota |
pb_test_ | Test key | Development and CI — renders work identically, does not count against quota. Expires after 24 hours |
Get a test key without signing up:
Response:
Setting the key
Environment variable (recommended)
Direct instantiation
Raw fetch
Monthly quota
| Tier | Renders/month |
|---|---|
| Free | 100 |
| Starter | 500 |
| Builder | 2,500 |
| Pro | 10,000 |
| Scale | Unlimited |
When the quota is exhausted, the API returns 429 PB_MONTHLY_QUOTA_EXCEEDED. The workspace owner must upgrade at paperbase.dev/billing — the limit resets on the first of each month.
401 errors
A 401 means authentication failed before rendering was attempted. The response body always includes a machine-readable agent_message:
Common causes:
| Symptom | Fix |
|---|---|
No Authorization header | Add Authorization: Bearer pb_live_… |
Wrong prefix (Bearer missing) | Ensure the value is Bearer <key>, not just <key> |
Key starts with pk_ or similar | Use only pb_live_ or pb_test_ keys |
| Test key expired | Call POST /v1/keys/test to get a fresh one |
| Key not found in DB | Regenerate from the dashboard |
Creating additional keys
The key field is returned once only — store it in a secret manager (e.g. Vercel Environment Variables, AWS Secrets Manager) immediately.
Related
- Errors & warnings — full error code reference
- API reference — complete request/response schema