Base URL
/api/. On a standalone install, use the API address of your install.
Authenticate
The API uses bearer access tokens. To get a token, sign in with the email and the password of a Stout account:accessToken. Send the token in the Authorization header of each request:
GET /api/orgs/me lists the organizations that you belong to, with the ID of each organization. The routes for one organization contain that ID, for example /api/orgs/<orgId>/members.
An account that signs in only through SSO has no Stout password, so it cannot use
POST /api/auth/login. For a script, use an account that has a password.Token lifetimes
- An access token expires after 15 minutes.
- The sign-in response also sets a refresh token in the
stout_refresh_tokencookie. The refresh token lasts 7 days. - To get a new access token, send
POST /api/auth/refreshwith that cookie. Stout returns a new access token, and it replaces the refresh token. - If a refresh token comes back more than 30 seconds after Stout replaced it, Stout ends that session.
- When you change or reset your password, Stout ends all of your other sessions.
Permissions
The API applies the same roles as the dashboard. A request to an organization that you do not belong to returns status 403. When a member sends a request that needs an owner or admin, the API returns status 403. See Roles and permissions. Boxes and CI systems do not use these tokens. Each box uses its own API key, which Stout creates when it installs on the box. A CI system sends its results with a CI key. See CI Metrics.Rate limits
Stout lets each caller send 300 requests per minute. For a request with a valid access token, the limit applies to the user. For a box, the limit applies to its API key. For any other request, the limit applies to the IP address. Some sign-in routes have lower limits:
A request over a limit returns status 429.
After 10 failed sign-ins for one email, Stout also locks that account until 15 minutes after the first failure. During the lock,
POST /api/auth/login returns status 429 with a Retry-After header.
Errors
An error response has a JSON body with anerror field that describes the problem:
fields list names each field that failed:
Health check
GET /healthz returns status 200 when the API is available. It needs no token: