Most PRMS API endpoints require a valid JSON Web Token (JWT). This page explains how to obtain a token, how to include it in requests, and how to handle authentication errors.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AllianceBioversityCIAT/onecgiar_pr/llms.txt
Use this file to discover all available pages before exploring further.
Which endpoints require authentication
JWT authentication is enforced on all requests to:/api/*— all main application endpoints/clarisa/*— CLARISA catalog proxy/toc/*— Theory of Change endpoints/type-one-report— PMU consolidated report
/api/ are not authenticated by PRMS itself — they are protected at the network perimeter (API Gateway / IP allowlist):
/api/bilateral/*— bilateral result summaries/api/platform-report/*— platform report payloads
The auth header
PRMS uses a custom request header namedauth to carry the JWT. This is not the standard Authorization header.
The token header is
auth, not Authorization. The PRMS middleware reads req.headers['auth'] directly. Sending the token as Authorization: Bearer <token> will not work — the middleware will reject the request with a 401.JWT token obtained from the /auth/* endpoints. Pass the raw token string — no
Bearer prefix.Example authenticated request
<your-jwt-token> with the token string returned by the /auth/* login flow. Do not add a Bearer prefix or wrap the value in quotes inside the header.
Obtaining a token
Tokens are issued by the/auth/* endpoints using your organisation’s Cognito or Active Directory credentials. The exact flow depends on your identity provider:
- Cognito / OIDC: call
/auth/login/providerwith the provider authorization code. - AD / custom credentials: call
/auth/login/customwith your credentials. - Code validation:
/auth/validate/codeis used as part of the multi-step AD flow.
auth header.
Token expiry and refresh
Tokens expire. On every successful authenticated request, PRMS issues a fresh token in theauth response header, implementing a rolling session. Your HTTP client should read the auth header from each response and use the new value for the next request.
When a token cannot be refreshed automatically and you send an expired one, the API returns:
shouldRefreshToken: true, call the appropriate /auth/* refresh endpoint to obtain a new token without requiring the user to re-enter credentials.
Handling 401 responses
Theresponse field in a 401 body tells you what action to take:
| Field | Value | Meaning | Action |
|---|---|---|---|
shouldRefreshToken | true | Token has expired but the session may be recoverable. | Call /auth/* to refresh the token. |
shouldRedirectToLogin | true | Token is invalid, malformed, missing, or Basic auth was sent. | Re-authenticate via the login flow. |
Role-based access control
Some endpoints are protected by role requirements in addition to JWT authentication. If your token is valid but your account does not hold the required role, the API returns403 Forbidden.
Roles are defined in two dimensions:
Role level (lower number = more privileged):
| Role | Level |
|---|---|
| Admin | 1 |
| Guest | 2 |
| Lead | 3 |
| Co-Lead | 4 |
| Coordinator | 5 |
| Member | 6 |
| Action Area Global Director | 7 |
| Action Area Coordinator | 8 |
Initiative— scoped to a specific initiative.Action_Area— scoped to an action area.Application— application-wide.
Using the Swagger UI
The interactive documentation athttp://localhost:3000/api (development) is configured to use the same auth header. When you open the Swagger UI:
- Click Authorize at the top right.
- Enter your JWT token in the
authfield (no prefix). - Click Authorize and close the dialog.
auth header automatically.