---
title: "Replace a user identity"
method: PUT
path: "/api/my-account/identities"
tags: ["My account"]
---

# Replace a user identity

`PUT /api/my-account/identities`

Replace (upsert) an identity (social identity) for the user. Creates the identity if absent, replaces it otherwise. Idempotent. Unlike POST, this allows replacing an existing identity for the same social target. When replacing with a different social user ID, previously stored third-party tokens for the old identity are cleared. A logto-verification-id header is required when the user has at least one security verification method: password, primary email, or primary phone. The header can be omitted only when the user has none of these methods. A verification record for the new social identity is always required.

## Request body

- object
  - `newIdentifierVerificationRecordId` string, required — The identifier verification record ID for the new social identity ownership verification.

## Response `204`

The identity was replaced successfully.

## Other responses

- `400` — The request body is invalid or the social identity field is not editable.
- `401` — Permission denied, identity verification is required or insufficient scope.
- `403` — Forbidden
- `422` — The new verification record is invalid or the identity is already in use.

---

[API](https://skmtc.net/logto/apis/logto-api-references.md) · [All operations](https://skmtc.net/logto/apis/logto-api-references/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/logto/logto-api-references/revisions/0287c6a59eba/schema)
