Enable user


Request description

Endpoint: /users/:id/enable
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.

{
  "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

  • The user can sign in to the platform again.
  • Use it to enable a user disabled with Disable user, or a user who was blocked after too many failed login attempts: the failed attempts counter is reset.
  • The user must belong only to your organization. A user who also belongs to other organizations cannot be enabled through this API.
  • An Organization Admin cannot enable an Organization Owner. Only an Organization Owner can.
  • The request is idempotent: enabling a user who is already enabled returns 200.
  • The administrators of your organization receive a notification.
Enabling applies to the whole platform, not only to your organization. That is why it is only allowed on users who belong exclusively to your organization.

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 EnableUserResponseType = {
  errorType: ENABLE_USER_ERROR_TYPE;
  errorMessage?: string;
  message?: string;
  details?: object[];  // Present on validation errors
};

enum ENABLE_USER_ERROR_TYPE {
  INVALID_REQUEST_FORMAT = "invalidRequestFormat",
  UNAUTHORIZED_RESOURCE = "unauthorizedResource",
  ERROR_UNLOCKING_USER = "ERROR_UNLOCKING_USER",
}
Description:
errorTypeerrorMessageMeaning
invalidRequestFormatInvalid user idthe id in the URL is not a valid user identifier
unauthorizedResourceUnauthorized resourcethe user does not belong to your organization
ERROR_UNLOCKING_USER—the user could not be enabled. The reason is in message


Forbidden request

Describe the characteristics of a forbidden request

403

Response body

{
  "errorType": "notAllowedResource",
  "errorMessage": "Unauthorized",
  "message": "Unauthorized"
}
Description: an Organization Admin tried to enable an Organization Owner.Response body
{
  "errorType": "notAllowedResource",
  "errorMessage": "User does not have permission to enable or disable themselves",
  "message": "User does not have permission to enable or disable themselves"
}
Description: the user identified by the access token tried to enable itself.Response body
{
  "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"
}
Description: the user also belongs to other organizations.Users without the Owner or Admin role receive the common 403 response.


Server error

Describe the characteristics of an unexpected error

500

Response body

{
  "message": "Error unlocking user"
}

Description: the user could not be enabled, or the change could not be confirmed. The user may still be unable to sign in. You can retry the request: it is idempotent.