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.
Service credentials never imply unrestricted access. They remain machine credentials with explicit scope limits.
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 application create and content-update routes on the machine-consumable surface.- 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 (
service) - 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.
- 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.