REST API
Authentication
Workspace-scoped X-Api-Key header. One key per workspace.
Every /external/* request is authenticated with a single HTTP
header:
X-Api-Key: bk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxThe key resolves to exactly one workspace. Brandfine identifies which tenant's content to return from the key alone — no workspace ID or tenant slug in the URL.
Getting a key
- Sign in to the CMS at
cms.brandfine.co. - Open your workspace → Settings → API keys.
- Click Reveal on the existing key, or Rotate to mint a new one. (Rotation revokes the old key immediately.)
Storing the key safely
- Server-side only. Never ship the key to a browser. The SDK refuses to construct a client without one because all requests pass through SSR / server functions, not the client.
- One key per environment. Use separate workspaces for staging vs. production rather than reusing the same key.
- Environment variable. Convention:
BRANDFINE_API_KEY.
What the key can do
Workspace API keys are read-only over the external surface. They can:
GET /external/workspaceGET /external/posts/*GET /external/categoriesGET /external/navigations/:key
They cannot:
- Write any data (creates/edits/deletes happen via the CMS UI).
- Read other workspaces' data.
- Hit internal
/ws/<team>/*endpoints (those use session auth, not API keys).
Errors
| Code | Meaning |
|---|---|
401 | Missing / invalid / revoked API key. |
404 | The resource exists for some workspace but not yours, OR doesn't exist at all. (Returned uniformly to avoid leaking workspace existence.) |
429 | Rate limited. Back off and retry. |
5xx | Brandfine server issue. The SDK serves stale cache on these; you should too. |