Pottr/Docs
Topic:API Keys & Connect Tokens
Authentication
.md

API Keys & Connect Tokens

Understanding the Public Key vs Secret Key security model and endpoint permission gates.

Key Types & Prefixes

Key TypePrefixEnvironmentPermitted Scope
Public Keypk_live_...Frontend Web, Mobile, Jamstack

• App bootstrapping (POST /auth/bootstrap)
• User authentication (Signup, Login, Refresh, Password Reset)
• Public collection reads
• User-owned collection writes (paired with User JWT)

Secret Keysk_live_...Backend Servers, CI/CD Pipelines

• Full administrative access across all endpoints
• Blueprint provisioning (POST /blueprint)
• Schema discovery (GET /schema)
• Webhooks management (/webhooks)
• Bypasses row-level user ownership restrictions

Security Rule: Never Expose Secret Keys

Never embed your sk_live_... secret key in frontend JavaScript bundles, mobile app binaries, or public Git repositories. Secret keys have administrative privileges to manage webhooks, blueprints, and view un-scoped data.

How Keys Are Sent

Send keys in the Authorization: Bearer header. Secret keys are accepted in the header only, never in a query string, so they cannot leak into logs or browser history. Public keys may appear in a query string only on live event streams, where browsers cannot set headers.

Requests made from the WordPress admin by a logged-in administrator (with the WordPress REST nonce) are treated as trusted, so the admin screens work without a key.

Secret-Only Routes

A public key receives 403 insufficient_key_scope on these routes:

  • POST /blueprint (provision from a server or pipeline)
  • /webhooks (create, list, update, delete, test, regenerate secret)
  • GET /schema (schema discovery)
  • Auth usage and limits routes

Use POST /auth/bootstrap with a public key when a frontend needs to declare collections at boot; it is additive and rejects secret keys by design.

Key Regeneration

If a secret key is compromised, navigate to Pottr › API Keys in WordPress Admin and click Regenerate. Regenerating a key immediately invalidates the previous key across all active API requests, so update your environment variables and redeploy straight away. The API Keys screen also shows a ready-made .env snippet.