<@U04UQ68083H> with ory kratos registration, how d...
# ory-copilot
s
@chilly-king-10285 with ory kratos registration, how do I specify which schema to use when registering a new user?
b
A message from kapa.ai
When registering a new user with Ory Kratos, the identity schema used is determined by the project's configuration. By default, new identities are created using the schema specified as the project's default schema (
default_schema_id
). If you want to use a different schema for a specific user during registration, you must use the Admin API to create the identity and explicitly set the
schema_id
in your request payload. This is not possible through the public self-service registration flow, which always uses the default schema configured for the project. Example using the Admin API:
Copy code
bash curl --request POST \   --header "Authorization: Bearer {ORY_API_KEY}" \   --header "Content-Type: application/json" \   --data '{     "schema_id": "your-custom-schema-id",     "traits": {       "email": "<mailto:user@example.com|user@example.com>"     }   }' https://{project-slug}.<http://projects.oryapis.com/admin/identities|projects.oryapis.com/admin/identities>
Replace
"your-custom-schema-id"
with the ID of the schema you want to use for this identity. The
schema_id
must match one of the schemas configured in your project settings. If you do not specify a
schema_id
, the default schema will be used for the new identity [Manage identity schemas](https://www.ory.sh/docs/identities/model/manage-identity-schema/) [Invite users](https://www.ory.sh/docs/kratos/manage-identities/invite-users/). Summary: - The self-service registration flow always uses the default schema. - To specify a different schema per user, use the Admin API and set
schema_id
in your request. If you need to change the default schema for all new registrations, update your project's configuration to set a new
default_schema_id
 [Manage identity schemas](https://www.ory.sh/docs/identities/model/manage-identity-schema/).