hey <@U04UQ68083H>, we managed to run Ory in a doc...
# ory-copilot
t
hey @chilly-king-10285, we managed to run Ory in a docker compose suit and so we have a healty container set of
hydra
,
keto
,
kratos
,
maildlurper
,
oathkeeper
,
postgres
of couse, and
redis
, all are good and healthy. I created a custom users admin api and ui projects to interact with it as well and I need to know how to start creating users on kratos first.
b
A message from kapa.ai
Great to hear your Ory stack is up and running! To create users (identities) in Ory Kratos, you typically interact with the Admin API. Here’s how you can do it: ### 1. Create a New Identity via Admin API You can create a user by sending a POST request to the
/admin/identities
endpoint. Here’s a sample
curl
command:
Copy code
bash curl --request POST -sL \   --header "Content-Type: application/json" \   --data '{     "schema_id": "default",     "traits": {       "email": "<mailto:user@example.com|user@example.com>"     }   }' <http://127.0.0.1:4434/admin/identities>
- Replace
"default"
with your schema ID if you use a custom schema. - Adjust the
traits
object to match your identity schema (e.g., add
name
, etc.). This will create a new identity in Kratos. The response will include the identity’s ID and other details. Note that this only creates the identity; it does not set a password or credentials yet [Create identities](https://www.ory.sh/docs/kratos/manage-identities/create-users-identities). ### 2. Set Credentials (Password) To allow the user to set their password, you can either: - Use the self-service registration flow (recommended for end-users). - Or, for invited users, trigger an account recovery flow so they can set their password via a secure link [Invite users](https://www.ory.sh/docs/kratos/manage-identities/invite-users). #### Example: Invite User Flow 1. Create the identity (as above). 2. Trigger account recovery to generate a recovery link:
Copy code
bash curl --request POST -sL \   --header "Content-Type: application/json" \   --data '{     "identity_id": "<IDENTITY_ID>",     "expires_in": "12h"   }' <http://127.0.0.1:4434/admin/recovery/link>
- Replace
<IDENTITY_ID>
with the ID from the previous step. 3. Send the recovery link to the user, so they can set their password and activate their account. --- Summary: - Use the Admin API to create identities. - Use the self-service registration or recovery flow to set credentials. Let me know if you need code samples for a specific language or more details on the registration flow!