Create a client organization
Identity module
POST/organizations/clientsorganizations.createClient
Partner console (Section 4.6.1): creates a client organization under the caller's partner organization, on the given plan, with an Owner invite for the client, through `app.create_client_organization`. Requires `org.partner.manage` in the partner organization; partner staff gain no access to the client organization. The invite token is returned once. Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.
- Requires the capability org.partner.manage.
- OAuth scopes: org.
- Send an Idempotency-Key header. A replay with the same key returns the original response.
- Error statuses: 400, 401, 409, 422, 429. Errors are RFC 9457 problem details.
Request body: CreateClientOrganizationRequest
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Client organization name.Constraints: length 1 to 300 |
| slug | string | Yes | URL slug; reserved and taken slugs are refused.Constraints: pattern ^[a-z0-9](?:[a-z0-9-]{1,61}[a-z0-9])?$ |
| owner_email | string (email) | Yes | Email of the client's first Owner, who receives an invite. |
| plan_code | string | No | Plan code from `plans.yaml`; defaults to access.Constraints: pattern ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$ |
{
"name": "Harbor City Events",
"slug": "northwind-live",
"owner_email": "alex.rivera@northwindlive.example",
"plan_code": "access"
}Response 201: CreateClientOrganizationResult
| Field | Type | Required | Description |
|---|---|---|---|
| org_id | string (uuid) | Yes | Identifier of the client organization. |
| invite_id | string (uuid) | Yes | Identifier of the Owner invite. |
| invite_token | string | Yes | Invite token from the invitation email. Sent in the body, never in a URL.Constraints: length 1 to any |
{
"org_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
"invite_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
"invite_token": "xinv_3f9a1c0d7e2b4a6f8c1d0e9b7a5c3f1e"
}Code samples
curl -X POST "$XOS_BASE_URL/organizations/clients" \
-H "Authorization: Bearer $XOS_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"name":"Harbor City Events","slug":"northwind-live","owner_email":"alex.rivera@northwindlive.example","plan_code":"access"}'const { data } = await xos.organizations.createClient({
"name": "Harbor City Events",
"slug": "northwind-live",
"owner_email": "alex.rivera@northwindlive.example",
"plan_code": "access"
});response = xos.organizations.create_client({"name": "Harbor City Events", "slug": "northwind-live", "owner_email": "alex.rivera@northwindlive.example", "plan_code": "access"})xos organizations create-client --data '{"name":"Harbor City Events","slug":"northwind-live","owner_email":"alex.rivera@northwindlive.example","plan_code":"access"}'