Create a client organization
Módulo Identity
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`.
- Requiere la capacidad org.partner.manage.
- Alcances de OAuth: org.
- Envía el encabezado Idempotency-Key. Una repetición con la misma clave devuelve la respuesta original.
- Estados de error: 400, 401, 409, 422, 429. Los errores son detalles de problema RFC 9457.
Cuerpo de la solicitud: CreateClientOrganizationRequest
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| name | string | Sí | Client organization name.Restricciones: length 1 to 300 |
| slug | string | Sí | URL slug; reserved and taken slugs are refused.Restricciones: pattern ^[a-z0-9](?:[a-z0-9-]{1,61}[a-z0-9])?$ |
| owner_email | string (email) | Sí | Email of the client's first Owner, who receives an invite. |
| plan_code | string | No | Plan code from `plans.yaml`; defaults to access.Restricciones: 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"
}Respuesta 201: CreateClientOrganizationResult
| Campo | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| org_id | string (uuid) | Sí | Identifier of the client organization. |
| invite_id | string (uuid) | Sí | Identifier of the Owner invite. |
| invite_token | string | Sí | Invite token from the invitation email. Sent in the body, never in a URL.Restricciones: length 1 to any |
{
"org_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
"invite_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
"invite_token": "xinv_3f9a1c0d7e2b4a6f8c1d0e9b7a5c3f1e"
}Ejemplos de código
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"}'