Delete user


Request description

Endpoint: /users/:id/delete
Method: DELETE

The following parameter must be passed through the URL:

  • id: specifies the unique user identifier
{
  "Content-Type": "application/json",
  "Authorization": "Bearer <accessToken>"
}

Note: the <accessToken> is obtained as a result of the authentication. The authentication flow you have to follow depends on the access mode, see Access modes.

Access modes

This endpoint accepts two kinds of access token. The meaning of :id depends on which one you use:

Access tokenDeletes a user from:id is
Platform userYour platform organizationThe unique user identifier
Dictation serviceYour organization's corporate dictation serverThe user login

No request body is required in either case.

How to get the dictation service token: the dictation path does not use the token returned by User login. Its access token is generated exactly the same way as the AI Services access tokens: with your APP Id and API Key encoded in base64 (appId:apiKey) and sent as Basic <token> to the /api/v1/token endpoint. See AI Services — Credentials for the full procedure and code examples.

Responses

Correct response

Successful request

Describe the characteristics of a satisfactory response

200

Response structure:

{
  "message": "Data deleted successfully"
}
Description: the response is the same in both access modes.

Wrong responses

Unauthorized request

Describe the characteristics of an unauthorized request

401

Response body

{
  "message": "Unauthorized"
}

Description: this error occurs when endpoint authorizers fail to validate the token sent in the request header.


Not found — platform user

Describe the characteristics of a not found request

404

Response body

{
  "errorType": "InvalidParameters",
  "errorMessage": "User not found",
  "message": "User not found",
  "details": [
    /* validation detail */
  ]
}

Description: there is no user with the identifier sent in the URL. Deleting a user that has already been deleted returns this same response.


Bad request — platform user

Describe the characteristics of a bad request

400

Response body

type DeleteUserResponseType = {
  errorType: DELETE_USER_ERROR_TYPE;
  errorMessage: string;
  message?: string;    // Present on validation errors
  details?: object[];  // Present on validation errors
};

enum DELETE_USER_ERROR_TYPE {
  INVALID_REQUEST_FORMAT = "invalidRequestFormat",
  UNAUTHORIZED_RESOURCE = "unauthorizedResource",
  NOT_ALLOWED_RESOURCE = "notAllowedResource",
}
Description:
errorTypeerrorMessageMeaning
invalidRequestFormatInvalid user idthe id in the URL is not a valid user identifier
unauthorizedResourceUnauthorized resourcethe user does not belong to your organization
notAllowedResourcenoOrganizationOwnerErrorthe user is the last Owner of the organization


Forbidden — platform user

Describe the characteristics of a forbidden request

403

Response body

{
  "errorType": "notAllowedResource",
  "errorMessage": "Unauthorized",
  "message": "Unauthorized"
}
Description: an Organization Admin tried to delete an Organization Owner.Response body
{
  "errorMessage": "User does not have permission to remove themselves"
}
Description: the user identified by the access token tried to delete itself. This response does not include errorType.


Forbidden — dictation user

Describe the characteristics of a forbidden request

403

Response body

{
  "message": "Forbidden"
}
Description: your credentials are not allowed to manage dictation users.Response body
{
  "message": "Dictation server rejected the operation"
}
Description: the dictation server refused the request.


Not found — dictation user

Describe the characteristics of a not found request

404

Response body

{
  "message": "There is no user with that login in the dictation server"
}
Description: the login sent in the URL does not exist. Deleting a user that is already gone returns this same response.Response body
{
  "message": "Tenant not found"
}
Description: there is no dictation server for your organization in this environment.


Server error — platform user

Describe the characteristics of an unexpected error

500

Response body

{
  "errorMessage": "Error removing user"
}
Description: an unexpected error occurred while deleting the user. If the organizations of the user could not be checked, nothing is deleted. Check whether the user still exists before retrying.


Dictation server unavailable

Describe the characteristics of an unreachable dictation server

502

Response body

{
  "message": "Dictation server unavailable"
}

Description: the dictation server could not complete the request.


Dictation server timeout

Describe the characteristics of a dictation server that does not answer in time

504

Response body

{
  "message": "Dictation server did not respond in time"
}

Description: the dictation server did not answer within the allowed time. Check whether the user still exists before retrying.