
# Unlink an identity

`DELETE /fapi/v1/me/identities/{identity_id}` · called from the environment's sign-in host

Unlinks a social or enterprise identity from the authenticated user's account. The user's last login method cannot be removed. If the user's organization enforces SSO on this link, the identity can only be removed via the customer management API. After successful removal, a security notification is sent to all of the user's verified email addresses. Requires the authenticated user's `__Host-idp_session` cookie; if the cookie is missing, expired, or revoked, returns `401 unauthenticated`. A first-party app on another origin can instead send its front API access token (`Authorization: DPoP <token>` with a DPoP proof; see [Front API access token](/docs/api/fapi/front-api-token)).

The session must have been verified in the last 5 minutes. If the user has a second factor, the session must also have been opened with a second factor (`urn:idp:acr:mfa`).

## Request

Headers:

| Header | Required | Description |
| --- | --- | --- |
| `Idp-Client` | yes | SDK identifier. |
| `Origin` | yes | Must be exactly `https://<sign-in host>`. |

`identity_id`: the identity of the linked identity in `idn_…` format.

No body.

## Response

`204 No Content`.

## Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `unauthenticated` | No valid session cookie. |
| 401 | `step_up_required` | Session was not verified in the last 5 minutes or a second factor is required; re-verify with `max_age=300` (and if applicable, `acr_values`) in the `WWW-Authenticate` header. |
| 403 | `origin_not_allowed` | `Origin` is missing or wrong. |
| 404 | `not_found` | No such identity for this user. |
| 409 | `last_login_method` | This identity is the user's last login method. |
| 409 | `sso_enforced_by_organization` | The user's organization enforces SSO on this link. |

## Example

```bash
curl -X DELETE https://example.keenauth.app/fapi/v1/me/identities/idn_01j9zzzzzzzzzzzzzzzzzzzzzz \
  -H "Idp-Client: my-app/1.0.0 (node/22.0.0)" \
  -H "Origin: https://example.keenauth.app" \
  -b cookies.txt
```

## Personal data

This endpoint carries personal data: linked identities. [Personal data in the KeenAuth APIs](/docs/policies/personal-data) describes what is stored, how long it is kept and how it is deleted. Do not send special categories of personal data (health, biometric data, religion, political opinions, sexual orientation) in any field.
