Skip to main content

Delete identities

Ory Identities doesn't expose account deletion as a self-service flow, to prevent users from accidentally and irrecoverably destroying their account and to avoid an attack surface for deleting accounts on a user's behalf.

Instead, deleting an identity is an administrative operation. Call the DELETE /admin/identities/{id} endpoint with the identity's ID. Deletion is permanent and can't be undone.

curl --request DELETE -sL \
--header "Authorization: Bearer {ORY_API_KEY}" \
https://playground.projects.oryapis.com/admin/identities/{id}
info

The Admin API is protected by your project API key, so all calls must be made from your server. Never expose the API key or call the Admin API from a browser or mobile client. See Authorization with API Keys.

Let users delete their own account

To offer a "Delete my account" option in your UI, build it in your own backend:

  1. Expose a button in your application's UI, for example on the settings page.
  2. On click, have your server-side application call DELETE /admin/identities/{id} with the logged-in identity's ID, which you get from the user's session via toSession or /sessions/whoami.
  3. Require a fresh privileged session so the user re-authenticates before deletion.
  4. Add an explicit confirmation step with CSRF protection, so a deletion can't be triggered accidentally or by a forged request.

Account deletion and GDPR

Deleting the Ory identity alone rarely satisfies a GDPR "right to erasure" request. User data usually also lives in your own databases, CRM, analytics, email provider, logs, and backups, and all of it must be cleaned up. GDPR was among the first such regulations, but the same applies to a number of similar data protection laws in other countries.

Track and orchestrate deletion requests in your own system, treating the Ory identity as one of several data stores. Your endpoint can then:

To keep a record of the user instead of deleting it, strip the credentials and PII but keep a skeleton record: use PUT /admin/identities/{id} to update the traits and DELETE /admin/identities/{id}/credentials/{type} to remove credentials.