curl --request DELETE \
--url https://www.asteragents.com/api/admin/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"userIds": [
"user_2ABC123DEF"
]
}
'{
"success": true,
"total": 2,
"successful": 2,
"failed": 0,
"results": [
{
"userId": "user_2ABC123DEF",
"success": true
},
{
"userId": "user_2XYZ789GHI",
"success": true
}
]
}{
"success": false,
"total": 3,
"successful": 2,
"failed": 1,
"results": [
{
"userId": "user_2ABC123DEF",
"success": true
},
{
"userId": "user_2XYZ789GHI",
"success": true
}
],
"errors": [
{
"userId": "user_2MNO456PQR",
"success": false,
"error": "Cannot remove yourself from the organization"
}
]
}{
"error": "User is not part of any organization"
}{
"error": "Unauthorized: User is not an admin in this organization"
}{
"error": "Internal Server Error"
}Admin API
Remove users from organization
Remove multiple users from the organization in a single request.
- You cannot remove yourself
- Removed users lose access to all organization resources
- This action cannot be undone
DELETE
/
admin
/
users
curl --request DELETE \
--url https://www.asteragents.com/api/admin/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"userIds": [
"user_2ABC123DEF"
]
}
'{
"success": true,
"total": 2,
"successful": 2,
"failed": 0,
"results": [
{
"userId": "user_2ABC123DEF",
"success": true
},
{
"userId": "user_2XYZ789GHI",
"success": true
}
]
}{
"success": false,
"total": 3,
"successful": 2,
"failed": 1,
"results": [
{
"userId": "user_2ABC123DEF",
"success": true
},
{
"userId": "user_2XYZ789GHI",
"success": true
}
],
"errors": [
{
"userId": "user_2MNO456PQR",
"success": false,
"error": "Cannot remove yourself from the organization"
}
]
}{
"error": "User is not part of any organization"
}{
"error": "Unauthorized: User is not an admin in this organization"
}{
"error": "Internal Server Error"
}Authorizations
JWT token from Clerk authentication.
Must be from a user with org:admin role.
Body
application/json
Array of Clerk user IDs to remove
Required array length:
1 - 50 elements