API Reference

SnapCard provides a simple REST API to capture screenshots, generate PDFs, and create dynamic OG social cards. All responses are binary (images/PDFs) or JSON.

Base URL
https://api.snapcard.dev

Authentication

Pass your API key in the Authorization header or as X-Api-Key.

# Bearer token (recommended)
curl -H "Authorization: Bearer sk_your_key" ...

# Header alternative
curl -H "X-Api-Key: sk_your_key" ...
POST/v1/auth/register

Create account and get first API key

Creates a new account for the given email address and returns an API key. If the account already exists, a new key is issued.

Request body (JSON)

emailstringrequiredYour email address

Response

{
  "userId": "clx...",
  "apiKey": "sk_...",
  "plan": "FREE",
  "message": "Account created — save your API key, it will not be shown again"
}
GET/v1/screenshotrequires auth

Capture a webpage screenshot

Renders a URL in a headless browser and returns it as a PNG or JPEG image.

Query parameters

urlstringrequiredFully-qualified URL to capture
format"png" | "jpeg"optionalImage format (default: png)
fullPagebooleanoptionalCapture full scrollable page (default: false)
widthnumberoptionalViewport width in px (default: 1280)
heightnumberoptionalViewport height in px (default: 720)
qualitynumberoptionalJPEG quality 0–100 (jpeg only)

Response

# Returns image/png or image/jpeg binary
# Response headers:
X-Usage: 42/1000

Example

curl "https://api.snapcard.dev/v1/screenshot?url=https://example.com&fullPage=true" \
  -H "Authorization: Bearer sk_your_key" \
  --output screenshot.png
GET/v1/pdfrequires auth

Convert a webpage to PDF

Renders a URL in a headless browser and returns a PDF document.

Query parameters

urlstringrequiredFully-qualified URL to convert
pageFormat"A4" | "Letter" | "Legal"optionalPage format (default: A4)

Response

# Returns application/pdf binary
# Response headers:
X-Usage: 5/1000

Example

curl "https://api.snapcard.dev/v1/pdf?url=https://example.com&pageFormat=Letter" \
  -H "Authorization: Bearer sk_your_key" \
  --output document.pdf
GET/v1/cardrequires auth

Generate a dynamic OG social card

Renders a branded social card image at 1200×630px, suitable for Open Graph / Twitter Card metadata.

Query parameters

templatestringoptionalCard template name (default: "default")
titlestringrequiredMain heading text (max 200 chars)
descriptionstringoptionalSubheading text (max 300 chars)
brandstringoptionalBrand label shown above title (max 100 chars)

Response

# Returns image/png (1200×630)
# Response headers:
Cache-Control: public, max-age=3600
X-Usage: 12/1000

Example

curl "https://api.snapcard.dev/v1/card?title=Hello+World&description=My+subtitle&brand=SnapCard" \
  -H "Authorization: Bearer sk_your_key" \
  --output card.png
GET/v1/usagerequires auth

Retrieve monthly usage

Returns the current month's request counts per endpoint along with your plan limits.

Response

{
  "usage": [
    { "endpoint": "screenshot", "month": "2026-03", "count": 42 },
    { "endpoint": "pdf", "month": "2026-03", "count": 5 },
    { "endpoint": "card", "month": "2026-03", "count": 12 }
  ],
  "plan": "STARTER",
  "limits": {
    "FREE": 100,
    "STARTER": 1000,
    "GROWTH": 10000,
    "SCALE": 100000
  }
}

Example

curl "https://api.snapcard.dev/v1/usage" \
  -H "Authorization: Bearer sk_your_key"
GET/v1/keysrequires auth

List active API keys

Returns all active (non-revoked) API keys for the authenticated user's account.

Response

{
  "keys": [
    {
      "id": "clx...",
      "name": "Default",
      "lastUsed": "2026-03-28T12:00:00.000Z",
      "createdAt": "2026-03-01T00:00:00.000Z"
    }
  ]
}
POST/v1/keysrequires auth

Create a new API key

Creates a new API key. Maximum 10 active keys per account. The full key is returned only once.

Request body (JSON)

namestringoptionalHuman-readable label (default: "My Key")

Response

{
  "id": "clx...",
  "name": "Production",
  "key": "sk_...",
  "createdAt": "2026-03-29T00:00:00.000Z",
  "message": "Save this key — it will not be shown again"
}
DELETE/v1/keys/:idrequires auth

Revoke an API key

Permanently revokes an API key by ID. Revoked keys are rejected immediately.

Path parameters

idstringrequiredAPI key ID from /v1/keys

Response

{ "message": "API key revoked" }

Error codes

All errors return JSON with error and code fields.

{ "error": "Monthly limit reached: 100/100 requests used", "code": "QUOTA_EXCEEDED" }
UNAUTHORIZED401Missing or invalid API key
QUOTA_EXCEEDED429Monthly plan limit reached
VALIDATION_ERROR400Invalid query or body parameters
NOT_FOUND404Requested resource does not exist
KEY_LIMIT_REACHED400Maximum of 10 active API keys
BILLING_UNAVAILABLE503Stripe billing not yet configured
INVALID_SIGNATURE400Stripe webhook signature mismatch