Skip to main content

Authentication

All endpoints except /auth/login require a Bearer token. REST clients and non-browser WebSocket clients normally send it in the Authorization header; browser WebSocket clients use the approved query-token form described below.


Login

To access the Cloud API, you first need an API token from your Cogniteam Cloud Platform organization. See the Creating a Token guide for how to generate one.

Endpoint

POST /auth/login

Request Body

{
"userToken": "your_api_token_here"
}

Response

{
"token": "bearer your_bearer_token_here"
}

Using the Token

Include the token in the Authorization header of every subsequent request:

{
"authorization": "bearer <token>"
}

Token Notes

The Bearer token may expire. Re-authenticate if you receive a 401 Unauthorized response.


Browser WebSocket Authentication

Browser WebSocket clients cannot set custom Authorization headers. Approved WebSocket routes use an access_token query parameter instead. Remove an optional leading bearer prefix before adding the token to the URL.

Cloud Fleet Custom KPI:

wss://api.cognimbus.com/apigateway/v2/fleets/{fleetId}/custom-kpis?access_token=<token>

Local robot stream:

ws://<agent-host>:19992/apigateway/v2/robots/{robotId}/streams/connect?access_token=<token>

Local Fleet Custom KPI:

ws://<agent-host>:19992/apigateway/v2/fleets/local-fleet/custom-kpis?access_token=<token>

Query-token authentication is accepted only on approved WebSocket upgrade routes.


Common Errors

401: token is missing or expired — re-authenticate.