Your account

Schedule account deletion

Schedule the deletion of the signed-in user's own account with DELETE /v1/auth/delete, and how signing in again cancels it.

MethodPath
DELETE/v1/auth/delete

Authentication · Account routes · Email templates

Schedules the deletion of the caller's own account. The account is not deleted right away. It stays until the scheduled date, and signing in again before then cancels the deletion.

This is an account-level route. It has no /v1/auth/tenant/ variant. Use the access token that a tenant sign-in returns.

Auth: Bearer token of the user who deletes their own account, a patient or a practitioner. Scope: The caller's own User, in the project of the token.

Request

Body

Both fields are optional. Send {} to accept the defaults.

NameTypeRequiredDescription
daysintegerNoDays from now until the account is due. From 0 to 90. Default 30.
wipebooleanNoWhether the user's medical data should be deleted too. Default false. It is recorded on the request, but it does not change what is deleted yet.

Behaviour

  • Ovok signs the user out of all sessions, including the one you call with, and then records the deletion date on the User. Calling the route again resets the date.
  • The account is removed by a daily clean-up once its date has passed. The clean-up deletes the project membership, the profile (Patient or Practitioner) and the User.
  • days set to 0 makes the account due immediately. It is still removed by the next daily clean-up, not during the request.
  • The clean-up does not delete medical data yet, so wipe has no effect on what is deleted.
  • A successful sign-in through the tenant login/token routes, for patients or practitioners, removes the scheduled deletion.
  • Ovok sends a confirmation email: PATIENT_ACCOUNT_DELETION for a patient and ACCOUNT_DELETION otherwise. It goes out only when the template is mapped. A failed email does not fail the request.
  • The response holds scheduled, the due date, and the updated User without its password hash.

Example

curl -X DELETE 'https://api.sandbox.ovok.com/v1/auth/delete' \
  -H "Authorization: Bearer ${OVOK_TOKEN}" \
  -H 'Content-Type: application/json' \
  -d '{
    "days": 30,
    "wipe": false
  }'

Successful response

200 — The deletion is scheduled. The user is trimmed here.

{
  "scheduled": "2026-11-08T09:15:00.000Z",
  "user": {
    "resourceType": "User",
    "id": "9a4e6c10-3b7d-4f28-8c15-2d0e7b9a6f43",
    "meta": { "lastUpdated": "2026-10-09T09:15:00.000Z" },
    "firstName": "Alex",
    "lastName": "Example",
    "email": "alex@example.com"
  }
}
FieldTypeDescription
scheduledstringWhen the account is due for deletion. ISO 8601.
userobjectThe updated User, without its password hash.
user.resourceType"User"Always User.
user.idstring (uuid)User id.
user.meta.lastUpdatedstringWhen the User was last changed. ISO 8601.
user.firstNamestringFirst name.
user.lastNamestringLast name.
user.emailstringSign-in email address.
user.identifierobject[]Identifiers on the User, including the markers that record the scheduled deletion. Use scheduled instead of reading them.

Other fields of the User can be present.

Errors

StatusMeaning
400The session has no user, project or email address to act on.
401The bearer token is missing, invalid, expired or revoked.
422days is not an integer from 0 to 90, or wipe is not a boolean.
429Too many requests.

Last updated on

On this page