Disable user
Request description
Endpoint: /users/:id/disable
Method: PATCH
The following parameter must be passed through the URL:
id: specifies the unique user identifier. Get it from Users list
No request body is required.
Header
{
"Content-Type": "application/json",
"Authorization": "Bearer <accessToken>"
}
Note: the <accessToken> is obtained as a result of the authentication. This endpoint only accepts the access token of a platform user with the Organization Owner or Organization Admin role.
Behaviour
- A disabled user cannot sign in to the platform. The user and their data are kept, and they can be enabled again with Enable user.
- The user must belong only to your organization. A user who also belongs to other organizations cannot be disabled through this API.
- An Organization Admin cannot disable an Organization Owner. Only an Organization Owner can.
- You cannot disable yourself.
- The request is idempotent: disabling a user who is already disabled returns
200. - The administrators of your organization receive a notification.
Responses
Correct response
Successful request
Describe the characteristics of a satisfactory response
200
Response structure:
{
// empty response
}
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
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.
Bad request
Describe the characteristics of a bad request
400
Response body
type DisableUserResponseType = {
errorType: DISABLE_USER_ERROR_TYPE;
errorMessage?: string;
message?: string;
details?: object[]; // Present on validation errors
};
enum DISABLE_USER_ERROR_TYPE {
INVALID_REQUEST_FORMAT = "invalidRequestFormat",
UNAUTHORIZED_RESOURCE = "unauthorizedResource",
ERROR_LOCKING_USER = "ERROR_LOCKING_USER",
}
errorType | errorMessage | Meaning |
|---|---|---|
invalidRequestFormat | Invalid user id | the id in the URL is not a valid user identifier |
unauthorizedResource | Unauthorized resource | the user does not belong to your organization |
ERROR_LOCKING_USER | — | the user could not be disabled. The reason is in message |
Forbidden request
Describe the characteristics of a forbidden request
403
Response body
{
"errorType": "notAllowedResource",
"errorMessage": "Unauthorized",
"message": "Unauthorized"
}
{
"errorType": "notAllowedResource",
"errorMessage": "User does not have permission to enable or disable themselves",
"message": "User does not have permission to enable or disable themselves"
}
{
"errorType": "notAllowedResource",
"errorMessage": "The user belongs to other organizations and cannot be enabled or disabled",
"message": "The user belongs to other organizations and cannot be enabled or disabled"
}
Server error
Describe the characteristics of an unexpected error
500
Response body
{
"message": "Error locking user"
}
Description: the user could not be disabled, or the change could not be confirmed. The user may still be able to sign in. You can retry the request: it is idempotent.