Delete User By UserId
The endpoint Delete User By userId is used to delete an existing Leapwork or Active Directory user from the Leapwork application, using the userId. After the successful deletion, the completed operation is returned in the response. The userId used as the input can be obtained from the Get All Users endpoint with the UserType as “Leapwork” or “ActiveDirectory”.
Please note that when using this endpoint, the user will be removed from his/her respective teams and deleted from the Leapwork system.
Request URL
http://{controllerMachine}:{controllerPort}/api/v4/user/{userId}
Input parameters
Field |
Type |
Description |
Comment |
accessKey |
string |
An access key is required to restrict unauthorized access to the API. |
The Access Key should include user scope to access user related APIs. |
userId |
string |
Unique identifier for the user |
This can be obtained from the Get All Users endpoint with the UserType as “Leapwork” or "ActiveDirectory" |
Examples
Curl
curl -X DELETE --header 'Accept: application/json' --header 'accessKey: UsctfG8Mg1LVa29L' 'http://localhost:9001/api/v4/user/3940e00a-164c-4693-be0b-14ff4746c4a'
PowerShell
$headers = @{}
$headers.Add("accessKey","UsctfG8Mg1LVa29L")
Invoke-WebRequest -Uri "http://localhost:9001/api/v4/user/3940e00a-164c-4693-be0b-14ff4746c4a" -ContentType "application/json" -Headers $headers -Method DELETE
Response
If a user is deleted successfully, it will return a 'true' value.
{
"$id": "1",
"OperationCompleted": true
}
Response Object
Field |
Type |
Description |
Values |
$id |
string |
ID of internal object |
|
OperationCompleted |
bool |
Returns ‘true’ if the user is deleted successfully |
true | false |
Response Code
- 200 (OK)
- 400 (Bad Request)
- 401 (Unauthorized - eg: “Incorrect Accesskey”)
- 403 (Forbidden – eg: “AccessKey does not have the relevant scope permission”, "It is forbidden to delete the last one administrator")
- 404 (Not Found – eg: “User not found”)
- 409 (Conflict – eg: “At least one team should contain an administrator”)
- 500 (Internal Server Error)