# Delete user

Canonical page: https://docs.ovok.com/slim-apis/user/delete-user

| Method | Path |
| --- | --- |
| `DELETE` | `/v1/slim/user/:profileType/:profileId` |

[Authentication](/authentication) · [Access policies](/access-policies)

Removes a practitioner from a project: deletes their membership and practitioner profile, and their user account when this was their last membership. Use it to offboard a team member.

**Auth:** Bearer token for a practitioner, project admin or System Owner session. The caller's access policy must grant `Practitioner:delete` (project admins skip this check).
**Scope:** The practitioner's project must be the caller's project (from the token) or a direct child of it.

## Request [#request]

### Path parameters [#path-parameters]

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `profileType` | `"Practitioner"` | Yes | Profile type. Only `Practitioner` is accepted. |
| `profileId` | `string (uuid)` | Yes | Id of the practitioner to remove. |

## Behaviour [#behaviour]

- The removal appears in [change history](/slim-apis/audit/list-change-history) as an `Access` row with key `userRemoved`. See the [key catalogue](/slim-apis/audit/change-history-keys).

- `profileType` must be `Practitioner` and `profileId` a UUID.
- The account is found through the practitioner's membership. When no membership, user or project can be resolved for the id, the route answers 404.
- The membership, the practitioner and, when it has no other membership, the user are deleted together or not at all.
- The owner of the caller's own project cannot be deleted. The owner of a child project can.
- If another change to the same account is still running, the request fails with 409 and nothing is deleted. Retry.
- After the delete, an account-deletion email is sent to the user's email address, if they have one. A failed email does not fail the request.
- Returns `{ "success": true }`.


## Example [#example]

```bash
curl -X DELETE 'https://api.sandbox.ovok.com/v1/slim/user/Practitioner/3f1c2b7e-8d4a-4c1e-9b2f-6a7d5e4c3b21' \
  -H "Authorization: Bearer ${OVOK_TOKEN}"
```

## Successful response [#successful-response]

`200` — User deleted successfully.

```json
{
  "success": true
}
```

| Field | Type | Description |
| --- | --- | --- |
| `success` | `boolean` | Always `true`. A failed delete returns an error status instead. |

## Errors [#errors]

| Status | Meaning |
| --- | --- |
| [`400`](/errors/malformed-request) | The FHIR server refused the delete. |
| [`401`](/errors/unauthenticated) | The bearer token is missing or invalid. |
| [`403`](/errors/forbidden) | The session is not a practitioner, admin or System Owner session, its access policy lacks `Practitioner:delete`, the practitioner is outside the caller's project and its direct children, or the practitioner owns the caller's project. |
| [`404`](/errors/not-found) | No account matches the profile. |
| [`409`](/errors/conflict) | Another change to the same account is in progress. |
| [`422`](/errors/validation-failed) | `profileType` or `profileId` fails validation. |
| [`500`](/errors/internal-error) | The delete failed unexpectedly, or failed and could not be fully rolled back. |
| [`503`](/errors/service-unavailable) | Your access policy could not be read, or the service is temporarily over capacity. Retry shortly, and honour `Retry-After` when it is present. |
