Account & keys

Programmatic key management — list keys, create a new one, revoke, fetch your account profile.

Account & keys

The endpoints below let you manage your account from your own UI, instead of through the gpdf dashboard. They all take a Firebase ID token, not an API key — they're meant for the browser, not for backend services.

💡 Tip — Most teams don't need these

If you only render PDFs, you don't need these endpoints. The dashboard at /app/keys covers the same surface with a UI.

GET /v1/account

Returns the signed-in user's account profile.

GET /v1/account HTTP/1.1
Authorization: Bearer <firebase_id_token>
{
  "id":    "uid_xxx",
  "email": "user@example.com",
  "name":  "Taiki Noda",
  "plan":  "pro",
  "subscription": {
    "status": "active",
    "current_period_start": "2026-04-01T00:00:00Z",
    "current_period_end":   "2026-05-01T00:00:00Z"
  },
  "polar_customer_portal_url": "https://polar.sh/portal/...",
  "created_at": "2026-01-15T03:24:00Z"
}
HTTP code When
401 unauthorized Token missing or invalid.
404 not_found Auth was fine but no account record (you signed in without ever signing up).

PATCH /v1/account

Update the display name. That's the only mutable field for now.

{ "name": "T. Noda" }

GET /v1/account/keys

List your active and revoked API keys. Raw key material is never returned.

{
  "keys": [
    {
      "key_prefix":   "gpdf_a1b2c3d4",
      "label":        "production",
      "active":       true,
      "last_used_at": "2026-04-13T22:14:11Z",
      "created_at":   "2026-02-01T00:00:00Z"
    },
    {
      "key_prefix":   "gpdf_x9y8z7w6",
      "label":        "old-staging",
      "active":       false,
      "last_used_at": "2026-01-10T08:02:00Z",
      "created_at":   "2025-12-01T00:00:00Z"
    }
  ]
}

last_used_at is updated asynchronously and may lag a few minutes behind real traffic.

POST /v1/account/keys

Create a new API key. The raw key is shown in the response once and never again.

POST /v1/account/keys HTTP/1.1
Authorization: Bearer <firebase_id_token>
Content-Type: application/json
{ "label": "staging" }
{
  "key_prefix": "gpdf_x9y8z7w6",
  "raw_key":    "gpdf_x9y8z7w6abcdef0123456789abcdef01",
  "label":      "staging",
  "created_at": "2026-04-14T05:30:00Z"
}
HTTP code When
400 invalid_request Label longer than 64 bytes.
401 unauthorized Token missing or invalid.
500 internal_error Could not allocate a unique key (extremely rare; safe to retry).

DELETE /v1/account/keys/{prefix}

Revoke a key. The hashed value is kept (for audit), but the key returns 401 immediately on subsequent use. Revocation is permanent — there's no PATCH /v1/account/keys/{prefix} to un-revoke; create a new one instead.

⚠️ Heads-up — There is currently no server-side guard against revoking your last active key. If you delete every key, the dashboard is the only way to issue a new one. Create the replacement key before revoking the old one.

DELETE /v1/account/keys/gpdf_a1b2c3d4 HTTP/1.1
Authorization: Bearer <firebase_id_token>
HTTP/1.1 204 No Content
HTTP code When
400 invalid_request Prefix missing from the URL.
401 unauthorized Token missing or invalid.
404 not_found Prefix doesn't exist on this account.

Something unclear or missing on this page?