AUTH
Use the Auth API to:
- Log in to the project
- Retrieve an authentication token
- Validate an authentication token
- Refresh an authentication token
- Log out of the project
HTTP Headers
The HTTP headers used to access all RTLS APIs are listed below. Use the Auth API to set the headers for X-User-Email and X-User-Token.
| Header Name | Example Value | Description |
|---|---|---|
| X-User-Email | admin@example.com | Email address of the user performing HTTP requests to the API. |
| X-User-Token | Drv3yU7PdyqUMtr89erZ | Token allowing the user access to the API. |
| X-User-Project | OfOgUA4kTs2HrmYYlFw6Jg | Project identifier. Value of the project.uid field. |
Set header X-USER-EMAIL
Send a request to log in. Using the email address returned in the response, set:
X-USER-EMAIL = data.email
Set header X-USER-TOKEN
Send a request to log in. Using the authentication token returned in the response, set:
X-USER-TOKEN = data.token
Set header X-USER-PROJECT
Send a request to get projects using GET api/projects/ described in the Projects API. You must send
this request with headers X-USER-EMAIL and X-USER-TOKEN already set. Using the project UID returned in the response,
set:
X-USER-PROJECT = projects[i].uid
Auth Endpoints
| Functionality | Method | Endpoint |
|---|---|---|
| log in | POST | api/auth/log_in |
| validate | POST | api/auth/validate_token |
| refresh token | POST | api/auth/refresh_token |
| log out | POST | api/auth/log_out |
Endpoints
Log in
POST api/auth/log_in
Retrieves authentication token for user.
Your login credentials are created in the SiteWise web portal.
Request Fields
| Field | Required/Optional | Type | Description |
|---|---|---|---|
| required | string | Your email credential used to log in. | |
| password | required | string | Your password used to log in. |
Response Fields
| Field | Description |
|---|---|
| success | Returns whether the login attempt was successful:
|
| The email used to log in. | |
| token | An authentication token to identify the current user. |
| company | A JSON object with information about the company associated with the user. |
| company.id | The identifier of the company in the server. |
| company.name | The company name. |
| company.user_params | User-defined company parameters. |
| company.uid | The unique identifier of the company. |
| company.role_uid | Reserved field. |
| company.scope | Reserved field. |
| company.role | Reserved object. |
| isSuperAdmin (Deprecated) |
Returns whether the current user is a super administrator user:
|
| isSystemUser (Deprecated) |
Returns whether the current user is project user (without administrator privileges):
|
| isCompanyAdmin (Deprecated) |
Returns whether the current user is a company administrator user:
|
| sign_in_count | Returns the number of successful logins. |
| role | Return user role
|
Example Request
{
"email": "user@example.com",
"password": "Drv3yU7PdyqUMtr89erZ"
}
Example Response
{
"success": true,
"data": {
"email": "user@company.com",
"token": "Vwp7i3o1234Z4MqycAo_",
"company": {
"id": 283,
"name": "RPP Boston",
"taggings_count": 0,
"user_params": {
"color": "#ff5b5b",
"website": "",
"phone": "12345678900",
"tag_allocation": false,
"address": ""
},
"uid": "Kr5G4eydvoRz4YZWCStzsQ",
"scope": "Y",
"role_uid": "XJv7AtqCJfFHtDPJzyUF5d",
"role": {
"id": 3,
"name": "Subcontractor",
"uid": "XJv7AtqCJfFHtDPJzyUF5d",
"display_name": "Company"
}
},
"isSuperAdmin": false,
"isSystemUser": false,
"isCompanyAdmin": true,
"sign_in_count": 386
}
}
Errors
| Error Status | Error Type | Error Body | Description |
|---|---|---|---|
| 401 | Unauthorized | {"success":false,"error":"Unable to log in. Check your email address and your password."} | The wrong email or password was submitted, or the token or user was not found. |
| 422 | Unprocessable entity | {"message":"Credentials are invalid"} | The wrong email or password was submitted, or the token or user was not found. |
| 401 | Unauthorized | {"message":"Unable to log in. Check your email address and your password."} | The wrong email or password was submitted. |
| 423 | Locked | {"message": "The user is disabled "} | The user was disabled. |
SSO Login
GET /api/v2/auth/sso/log_in
Returns the AWS Cognito Hosted UI login URL with all necessary parameters (e.g. redirect URI, client ID, state, etc). Note: This endpoint is conditionally available and depends on SSO being configured on the server.
Response Fields
| Field | Description |
|---|---|
| loginUrl | A fully constructed AWS Cognito Hosted UI URL the frontend should redirect to. Contains query params:
|
| redirectUris | A list of valid redirect URIs configured in AWS Cognito. |
Example response
{
"loginUrl": "https://your-domain.auth.region.amazoncognito.com/oauth2/authorize?client_id=abc123&redirect_uri=https%3A%2F%2Fraymond.rpplabs.com%2Fauth%2Fcallback&response_type=code&scope=openid+profile+email&state=a1b2c3d4e5f6g7",
"redirectUris": [
"https://site-wise-portal-dev.rpplabs.com/app/v2025.1.749",
"https://raymond.rpplabs.com",
"http://localhost:8001",
"http://localhost:8002",
"http://localhost:8003",
"http://localhost:8004"
]
}
SSO Callback
POST /api/v2/auth/sso/callback
Exchanges the authorization code for Cognito tokens using client secret, verifies the ID token, updates or creates a user in the database, and returns the tokens to the frontend. Note: This endpoint is conditionally available and depends on SSO being configured on the server.
Request Fields
| Field | Required/Optional | Type | Description |
|---|---|---|---|
| code | required | string | Authorization code received from Cognito redirect. |
| redirect_uri | required | string | Redirect URI for the client application. The value must match the one registered in AWS Cognito. |
Response Fields
| Field | Description |
|---|---|
| The email used to log in. | |
| access_token | OAuth2 access token (JWT). |
| refresh_token | OAuth2 refresh token for renewing access. |
| company | A JSON object with information about the company associated with the user. |
| company.id | The identifier of the company in the server. |
| company.name | The company name. |
| company.user_params | User-defined company parameters. |
| company.uid | The unique identifier of the company. |
| role | Return user role:
|
Example request
{
"code": "abc123",
"redirect_uri": "http://localhost:8090"
}
Example response
{
"access_token": "eyJraWQiOiJLT...",
"refresh_token": "def456",
"email": "user@company.com",
"role": "system_admin"
"company": {
"id": 283,
"uid": "Kr5G4eydvoRz4YZWCStzsQ",
"name": "RPP Boston",
"user_params": {
"color": "#ff5b5b",
"website": "",
"phone": "12345678900",
"address": ""
}
}
}
Errors
| Error Status | Error Type | Description |
|---|---|---|
| 422 | Unprocessable entity | The request is missing or contains an invalid code or redirect_uri. |
| 401 | Unauthorized | Token exchange failed due to invalid authorization code. |
| 500 | Internal Server Error | Unexpected server error during URL generation. |
Validate
POST /api/auth/validate_token
Validate an existing authentication token. Returns a JSON object with status of 200.
You must log in first to retrieve a token. Use the headers to send a request to validate your token.
Request Fields
| Field | Required/Optional | Type | Description |
|---|---|---|---|
| required | string | The email to log out. | |
| token | required | string | The token to log out. |
| onBehalfToken | optional | string | The additional token for user that enter to lower scope (company admin in project scope). |
Request Example
{
"email": "redpoint_positioning_impersonate@g6g66uJfQBOnY9pm-_H66g",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHBpcm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dHVzIjoiQUNUSVZFIn0sImlhdCI6MTU5MjIyMjczMX0.o5QCFNvwh2kRIJS76fwpOVwnBwp3tyxLXl86Z7TJo4k"
}
{
"email": "regular_user@gmail.com",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHBpcmVzSW4iOjEyMDAsInVzZXIiOnsiZW1haWwiOiJyZWRwb2ludF9wb3NpdGlvbmluZ19pbXBlcnNvbmF0ZUBnNmc2NnVKZlFCT25ZOXBtLV9INjZnIiwidWlkIjoiMUFyUDdBWktUYW1ZczY2YjFjTmVfQSIsImF1dGhlbnRpY2F0aW9uX3Rva2VuIjoiZXlKaGJHY2lPaUpJVXpJMU5pSXNJblI1Y0NJNklrcFhWQ0o5LmV5SmxlSEJwY21WelNXNGlPakV3TXpZNE1EQXdMQ0pwWkNJNklteFNNa1ZtZG1wVFZFNVhUa3Q0WW5CYVgwNVZWVkVpTENKcFlYUWlPakUxT0Rrek5qWTBORGg5Ll9kdU11MVEzM3JRVGxHNnBCSHBZcHBxVU9KdXM5MlQzekJnbnB1Ui1nRTgiLCJhZG1pbiI6MSwiY29tcGFueV91aWQiOiJnNmc2NnVKZlFCT25ZOXBtLV9INjZnIiwic3RhdHVzIjoiQUNUSVZFIn0sImlhdCI6MTU5MjIyMjczM30.117hpAhQGi8-qbBX4AxTULeaoH5XpSToyZI3qLJIMkw"
}
Response Fields
| Field | Description |
|---|---|
| success | Indicates if the token was successfully validated:
|
| data | A JSON object with information about the login. |
| data.email | The email used to log in. |
| data.token | An authentication token to identify the current user. |
Example Response
{
"success": true,
"data": {
"email": "admin@example.com",
"token": "Drv3yU7PdyqUMtr89erZ"
}
}
Errors
| Error Status | Error Type | Error Body | Description |
|---|---|---|---|
| 401 | Unauthorized | {"success":false,"error":"Unable to authenticate"} | Invalid token. |
| 423 | Locked | {"message": "The user is disabled "} | The user was disabled. |
Refresh token
POST /api/auth/refresh_token
Expire an existing token and obtain a new one. On success, a JSON object is returned with the status 200.
Request Fields
| Field | Description |
|---|---|
| The email used to log in. | |
| token | An authentication token to identify the current user. To get a token, see log in. |
Response Fields
| Field | Description |
|---|---|
| success | Indicates if the token was successfully refreshed:
|
| data | A JSON object with information about the login. |
| data.email | The email used to log in. |
| data.token | A new authentication token to identify the current user. |
Example Request
{
"email": "user@example.com",
"token": "pp76TniNb39o6G0mYjQP"
}
Example Response
{
"success": true,
"data": {
"email": "user@example.com",
"token": "Drv3yU7PdyqUMtr89erZ"
}
}
A new, updated token is included in the response.
Errors
| Error Status | Error Type | Error Body | Description |
|---|---|---|---|
| 401 | Unauthorized | {"success":false,"error":"Token expired"} | The token was expired and the authentication failed. |
| 401 | Unauthorized | {"success":false,"error":"Token expired"} | An incorrect token was entered and authentication failed. |
Log out
POST api/auth/log_out
Log out of your account. A successful request returns a status of 200.
Request Fields
| Field | Required/Optional | Type | Description |
|---|---|---|---|
| required | string | The email to log out. | |
| token | required | string | The token to log out. |
Example Request
{
"email": "user@example.com",
"token": "Drv3yU7PdyqUMtr89erZ"
}
Example Response
{
"success": true,
"data": {
"email": "user@example.com"
}
}
Note: The log out request must include a valid X-User-Token and X-User-Email in the headers.
Errors
| Error Status | Error Type | Error Body | Description |
|---|---|---|---|
| 401 | Unauthorized | {"message":"Token expired"} | Invalid token was sent in headers. |
| 403 | Forbidden | {"success":false,"error":"Log out fails"} | Incorrect token entered. |
SSO Logout
GET /api/v2/auth/sso/log_out
Returns the AWS Cognito logout URL with all necessary parameters (e.g. redirect URI, client ID, etc). Note: This endpoint is conditionally available and depends on SSO being configured on the server.
Response Fields
| Field | Description |
|---|---|
| logoutUrl | A fully constructed AWS Cognito Hosted UI URL the frontend should redirect to. Contains query params:
|
| logoutUris | A list of valid logout URIs configured in AWS Cognito. |
Example response
{
"logoutUrl": "https://your-domain.auth.region.amazoncognito.com/logout?client_id=qa6vpei240jjqni80s24umjgt&logout_uri=http://localhost:8090",
"logoutUris": [
"https://site-wise-portal-dev.rpplabs.com/app/v2025.1.749",
"https://raymond.rpplabs.com",
"http://localhost:8001",
"http://localhost:8002",
"http://localhost:8003",
"http://localhost:8004"
]
}