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

Local only

Browser WebSocket clients cannot set custom Authorization headers. For Local API Gateway WebSocket routes, send the token as an access_token query parameter instead:

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

You may pass either the raw token or the value with the bearer prefix. Query-token authentication is accepted only on approved WebSocket upgrade routes.


Common Errors

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