few-oyster-74399
07/10/2024, 8:09 AMchilly-king-10285
07/10/2024, 8:09 AMchilly-king-10285
07/10/2024, 8:09 AMupdateIdentity API
. You can do this with the following command: bash export IDENTITY_ID=$IDENTITY_ID ory get identity "$IDENTITY_ID" --project "$PROJECT_ID" --format json-pretty > identity-"$IDENTITY_ID".json
2. Update the saved JSON to match the new identity schema. For example: bash -"schema_id" : "$OLD_SCHEMA_ID", +"schema_id" : "$NEW_SCHEMA_ID", "traits": { -"foo": "foobar" +"bar": barfoo }
3. Update the identity using PUT: bash curl -d "@identity-$IDENTITY_ID.json" -X PUT https://$<http://ORY_SLUG.projects.oryapis.com/admin/identities/$IDENTITY_ID|ORY_SLUG.projects.oryapis.com/admin/identities/$IDENTITY_ID> \ -H "Authorization: Bearer $ORY_API_KEY" \ -H'Content-Type: application/json'
The updateIdentity API
overwrites the existing identity with the one provided in the request body. Omit any fields that should not be changed, including the credentials
field. This should return the modified identity as the response. If you have more identities to be patched to the new schema, repeat the above process for each of them. For more details, you can refer to the [Ory documentation](https://www.ory.sh/docs/identities/model/manage-identity-schema#update-identities-to-use-a-new-schema).