Delete User
Delete User
POST
/api/portal/v1/admin/deleteUser
Description
Delete a user. A background job is enqueued to remove the user’s data and record from the chart instance; the deletion completes asynchronously. Track the job through the Jobs endpoints.
A user cannot be deleted if any of the following are true:
- The user is the caller (you cannot delete yourself).
- The user is an administrator.
- The user is the only user on their account.
Authentication
This endpoint requires a Bearer token in the Authorization header.
- Authorization:
Bearer <token>. A valid Portal API session token or API token belonging to an administrator.
Request Body
The request body should be JSON-encoded.
- id: The
idof the user to delete.
Response Schema
On success, the endpoint returns the identifiers of the deleted user and the cleanup job.
deletedUserId: Theidof the user that was deleted.jobId: Theidof the background job performing instance-side cleanup of the user’s data.
Error Responses
- 400 Bad Request: The request body is malformed, or the user cannot be deleted (self, administrator, or the only user on the account).
- 401 Unauthorized: The
Authorizationheader is missing or the token is not valid. - 403 Forbidden: The authenticated user is not an administrator.
- 404 Not Found: No user exists with the given
id.
Example Request
POST https://<your-host>:9909/api/portal/v1/admin/deleteUser
Authorization: Bearer <token>
Content-Type: application/json
{
"id": 7
}
Example Response
Status Code: 200 OK
Response Body:
{
"deletedUserId": 7,
"jobId": "5e37b9c1-a4c2-4b8e-9f3a-72d3f4a5b8e1"
}