Select account


Request description

Endpoint: /users/select-account

Method: POST

{
  "Content-Type": "application/json",
  "Authorization": "Bearer <accessToken>"
}

Payload example

{
  "selectedAccount": "mock-organization-id" // Organization ID of the account to select
}

Payload structure

interface ISelectAccountPayload {
  selectedAccount: string; // Organization ID of the account to select
}

Important note: selectedAccount must be the organizationId of one of the accounts returned by the User Login endpoint. Do not send the account id (organizationId~userId).

The selection is stored for the user: the next logins return this account with isSelected: "true", and every Management API request made with the user's access token is executed against the selected organization.

Responses

Correct response

Successful operation

Describe a successful operation when selecting an account

200

Response body example:

{
  "message": "Data saved successfully"
}
interface ISelectedAccountResponse {
  message: string;
}

The response is 200 even when selectedAccount is not the organizationId of one of your accounts. In that case the current selection is not changed. To confirm which account is selected, check isSelected in the User login response.

Wrong responses

Unauthorized request

Describes the response when the access token is not valid

401

Response body

{
  "message": "Unauthorized"
}
type SelectAccountErrorResponse = {
  message: string;
};


Forbidden request

Describes the response when the access token is rejected by the API authorizer

403

Response body

type SelectAccountErrorResponse = {
  message: string;
};


Bad request

Describe an invalid request

400

Response body example

{
  "errorType": "invalidRequestFormat",
  "errorMessage": "Invalid JSON body",
  "message": "Invalid JSON body"
}
Response structure
type SelectAccountErrorResponse = {
  message: string;
  errorType?: string;
  errorMessage?: string;
};
Description: the body is not valid JSON. The current selection is kept.