Enable user settings
The enable user settings control whether a user’s ability to authenticate is activated or deactivated. This endpoint gives administrators the ability to turn on (or off) a user’s active status.
For information about users, see Users.
Enable users API operations
The enable/disable user endpoints support the following operations:
-
GET /environments/{environmentId}/users/{userId}/enabled
Read enabled user setting -
PUT /environments/{environmentId}/users/{userId}/enabled
Update enabled user setting
For hands-on experience with the users API endpoints, click the Run in Postman button below to download a Postman collection that you can import and open in your local Postman application.
Enable user data model
Property | Description |
---|---|
enabled |
A read-only boolean attribute that specifies whether the user is enabled. This attribute is set to ‘true’ by default when the user is created. |
id |
A string that specifies the user resource’s unique identifier. |
Response codes
Code | Message |
---|---|
200 | Successful operation. |
201 | Successfully created. |
204 | Successfully removed. No content. |
400 | The request could not be completed. |
401 | You do not have access to this resource. |
404 | The requested resource was not found. |
Endpoint examples
Get user enabled setting
When a new user resource is created, the value specified for the enabled
attribute determines the user’s ability to authenticate. If the enabled
attribute is omitted from the POST
request, the value is set to true
by default.
For existing users, you can use the GET /environments/{environmentId}/users/{userId}/enabled
operation to check whether the specified user is enabled or disabled.
curl -X "GET" "https://api.pingone.com/v1/environments/{environmentId}/users/{userId}/enabled" \
-H 'Authorization: Bearer jwtToken'
The response data for an enabled user looks like this:
{
"_links": {
"self": {
"href": "https://api.pingone.com/v1/environments/02d37832-476a-431b-8a60-d77cecd7005c/users/9a774ad6-b6b6-4179-af87-226cd68955f0/enabled"
},
"user": {
"href": "https://api.pingone.com/v1/environments/02d37832-476a-431b-8a60-d77cecd7005c/users/9a774ad6-b6b6-4179-af87-226cd68955f0"
}
},
"enabled": true
}
Update user enabled setting
You can modify the user’s enabled
attribute value by calling the PUT /environments/{environmentId}/users/{userId}/enabled
endpoint.
The following sample shows the PUT /environments/{environmentId}/users/{userId}/enabled
operation to disable the user resource’s ability to authenticate.
curl -X "PUT" "https://api.pingone.com/v1/environments/{environmentId}/users/{userId}/enabled" \
-H 'Content-type: application/json' \
-H 'Authorization: Bearer jwtToken' \
-d $'{
"enabled": "false"
}'
The response data with the updated setting looks like this:
{
"_links": {
"self": {
"href": "https://api.pingone.com/v1/environments/02d37832-476a-431b-8a60-d77cecd7005c/users/9a774ad6-b6b6-4179-af87-226cd68955f0/enabled"
},
"user": {
"href": "https://api.pingone.com/v1/environments/02d37832-476a-431b-8a60-d77cecd7005c/users/9a774ad6-b6b6-4179-af87-226cd68955f0"
}
},
"enabled": false
}