quick-addition-90714
04/15/2025, 5:37 PMbrief-egg-61061
04/15/2025, 5:37 PMbrief-egg-61061
04/15/2025, 5:38 PMPOST /admin/identities
Looking at the API documentation and examples, you need to provide information like schema_id
and traits
(such as email or username), but there's no option to specify a custom ID. The system will automatically assign an ID to the newly created identity, which you can see in the response. For example, when creating a user, you would provide something like: json { "schema_id": "<preset://email>", "traits": { "email": "<mailto:user@example.com|user@example.com>" } }
And the response would include the system-generated ID: json { "id":"auto-generated-uuid", "credentials":{ "password":{ "type":"password", "identifiers":[ "<mailto:user@example.com|user@example.com>" ], // ... }, // ... } }
If you need to associate your own identifier with Ory identities, you have a few options: 1. Store your custom ID in the identity's metadata fields (metadata_admin
or metadata_public
) 2. Use the Ory-generated ID in your application and maintain a mapping in your database 3. Store your custom ID as a trait in the identity schema [Invite users documentation](https://www.ory.sh/docs/kratos/manage-identities/invite-users) shows the typical flow for creating users through the admin API, and it always involves getting the auto-generated ID from the response.