brandfinedocs
REST API

Authentication

One site key per workspace, safe anywhere, plus an identity secret if your site has logged-in users.

Every /external/* request is authenticated with one HTTP header:

X-Api-Key: brandfine_pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxx

The key resolves to exactly one workspace. Brandfine works out which site's content to return from the key alone: no workspace ID or tenant slug in the URL.

Your two credentials

Site keyIdentity secret
Looks likebrandfine_pk_…64 hex characters
WhereAnywhere: server, build, browser, a PUBLIC_ / NEXT_PUBLIC_ env varYour server only, never a browser
DoesReads published content, does what visitors do (forms, bookings, chat, analytics)Signs a logged-in visitor so chat and bookings trust who they are
Need it?Every siteOnly sites with user accounts

The site key can't write content, change settings or read private data (traffic numbers, inbox, AI insights): those happen in Brandfine, through MCP, or through an app connected with Connect. So a leaked site key exposes nothing that isn't already public on your site.

Getting them

  1. Sign in to Brandfine at app.brandfine.co.
  2. Open your workspace → Access → API keys.
  3. Copy the Site key. If your site has logged-in users, also Reveal the Identity secret.

Convention for env vars: BRANDFINE_API_KEY for the site key, BRANDFINE_IDENTITY_SECRET for the identity secret.

Keys from before October 2026

Workspaces created earlier also have a workspace key (brandfine_… without _pk_), shown under Legacy workspace key. It keeps working with exactly the site key's reach on routes a server calls, so nothing you built breaks. Two differences:

  • Browser-only routes (the chat widget, the analytics tag) take the site key alone. Don't put a legacy key in a web page.
  • Until you Rotate the identity secret, it is derived from the legacy key, so keep that key private. Rotating cuts the link.

Switch your sites to the site key when convenient.

What the site key can do

  • GET /external/workspace: name, languages, display settings
  • GET /external/posts, /posts/:slug, /categories, /post-types, /navigations/:key: published content only
  • POST /external/submissions: contact forms
  • GET /external/analytics-config: the analytics tag's setup
  • GET /external/appointments/availability, POST …/requests, POST …/requests/lookup: bookings (a visitor's own bookings need a signed identity)
  • /external/live-chat/*: the chat widget

It cannot:

  • Write any data (content and settings change in Brandfine).
  • Read private data or other workspaces' data.
  • Reach internal /ws/<team>/* endpoints (those use session, MCP or service-key auth).

Rate limits

Content reads with the site key are metered per client IP: 3000 a minute by default. Past it you get 429 with Retry-After. A build that renders a large site from one machine stays well inside it.

Errors

CodeMeaning
401Missing, invalid or revoked key, or a key not allowed on that route.
404The resource exists for some workspace but not yours, OR doesn't exist at all. (Returned uniformly to avoid leaking workspace existence.)
429Rate limited. Back off for Retry-After seconds.
5xxBrandfine server issue. The SDK serves stale cache on these; you should too.

On this page