<@U04UQ68083H> how can I create a new identity wit...
# ory-copilot
c
@chilly-king-10285 how can I create a new identity with organization "xyz" using http curl requests?
b
A message from kapa.ai
To create a new identity with an organization using HTTP curl requests in Ory, you'll need to follow a two-step process. First, you'll create the organization, and then you'll create the identity associated with that organization. Here's how you can do it: 1. Create the organization:
Copy code
bash curl -X POST --location "<https://api.console.ory.sh/projects/$PROJECT_ID/organizations>" \      -H "Authorization: Bearer $WORKSPACE_API_KEY" \      -H "Content-Type: application/json" \      -d '{            "label":  "xyz",            "domains": ["<http://example.com|example.com>"]          }'
This will return the organization ID. Let's assume it's
6bb1c7d1-3b3e-4995-9e09-35649dc45a2b
. 2. Create the identity with the organization ID:
Copy code
bash curl -X POST -H "Authorization: Bearer $WORKSPACE_API_KEY" \      -H 'Content-Type: application/json' \      -d '{          "schema_id": "<preset://email>",          "traits": {              "email": "<mailto:user@example.com|user@example.com>"          },          "credentials": {              "password": {                  "config": {                      "password": "securepassword"                  }              }          },          "organization_id": "6bb1c7d1-3b3e-4995-9e09-35649dc45a2b"      }' \      https://$<http://PROJECT_SLUG.projects.oryapis.com/admin/identities|PROJECT_SLUG.projects.oryapis.com/admin/identities>
Make sure to replace the following variables: - `$PROJECT_ID`: Your Ory project ID - `$WORKSPACE_API_KEY`: Your Ory workspace API key - `$PROJECT_SLUG`: Your Ory project slug This process will create a new identity associated with the "xyz" organization. Sources: [Create SSO connections for an organization](https://www.ory.sh/docs/kratos/organizations#create-sso-connections-for-an-organization) [Create an Identity](https://www.ory.sh/docs/kratos/manage-identities/create-users-identities)