Using Buildspace API credentials
API credentials are machine credentials issued from the internal admin surface. Use them for system-to-system access to buildspace-api, not for end-user browser sessions.
Send the secret with X-Buildspace-Api-TokenAuthorization: Bearer <secret>, but the dedicated machine-token header is clearer and avoids confusion with user JWTs.
Use service for backend jobs, sync processes, automation, and integrations that act as infrastructure for your organization.
Use agent for autonomous or semi-autonomous workers where you want the credential to clearly represent an agent actor.
Neither principal implies unrestricted access. Both are machine principals and remain scope-limited.
A credential can only access routes that allow its principal and whose required scopes are present on the credential.
applications:readallows read access to machine-consumable application routes such asGET /api/v1/application/tokensandGET /api/v1/application/<uuid>/agents(application id in the path; same access pattern as other application-scoped reads).applications:writeon aservicecredential allows the same write routes as anagentwith that scope (for example application create and content updates), without agent binding;agentcredentials still require agent binding where the API enforces it.- Admin credential management routes are internal-only and are not part of the public machine-consumer surface.
- User-only routes still require a normal Supabase session token.
- The raw secret is shown once when the credential is created.
- Store it immediately in your secret manager.
- If it is lost or leaked, revoke the credential and create a new one.
curl -H "X-Buildspace-Api-Token: <credential_secret>" \
"{origin}/api/v1/application/tokens?limit=1"After creation, use the Buildspace Admin Test credentials flow to verify:
- the observed principal (
servicevsagent) - the scopes attached to the credential
- declared route coverage
- observed smoke-test results against buildspace-api
- Use service credentials primarily from backend jobs, syncs, and other server-to-server infrastructure.
- Use agent credentials primarily from external or internal workers that run outside the browser.
- Direct browser use of
X-Buildspace-Api-Tokenis allowed only from origins included inCORS_ALLOWED_ORIGINS. Even when allowed, prefer backend-mediated use for long-lived machine credentials instead of embedding them in frontend code.