Authentication
Brainstormer uses JWT (JSON Web Token) bearer authentication for all API requests. Tokens are obtained via the login or register endpoints and must be included in every subsequent request.How It Works
- Authenticate via
POST /api/auth/loginorPOST /api/auth/registerto obtain an access token and refresh token. - Include the access token in the
Authorizationheader of every API request. - When the access token expires (24 hours), use the refresh token to obtain a new pair via
POST /api/auth/refresh.
Optional verified identity on public endpoints
Public distribution endpoints (e.g.GET /api/public/agents/:slug) can optionally accept a bearer token. When present, the gateway verifies the JWT signature and forwards verified user-id and organization-id headers to the bot service so that group-restricted agents can evaluate membership. When the token is absent, public endpoints behave exactly as before and serve only agents that do not require membership or group access.
All API requests require a valid JWT token in the
Authorization: Bearer <token> header. The API Gateway decodes the JWT and forwards auth context (user-id, organization-id, user-email, x-platform-role, x-org-role) as headers to downstream services.Token Format
The JWT payload contains:string
Unique user identifier (UUID).
string
User’s email address.
string
Platform-level role:
user or superadmin.array
List of organizations the user belongs to.
number
Token issued-at timestamp (Unix seconds).
number
Token expiration timestamp (Unix seconds).
Token Lifetimes
Header Format
Include the access token as a Bearer token in theAuthorization header:
The API Gateway also accepts the token from an
access_token cookie as a fallback, but the Authorization header is the primary method.
The Developer portal for managing API keys and authentication

