Saltar al contenido

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

organizations.createClient: CreateClientOrganizationRequest
CampoTipoObligatorioDescripción
namestringSíClient organization name.Restricciones: length 1 to 300
slugstringSíURL slug; reserved and taken slugs are refused.Restricciones: pattern ^[a-z0-9](?:[a-z0-9-]{1,61}[a-z0-9])?$
owner_emailstring (email)SíEmail of the client's first Owner, who receives an invite.
plan_codestringNoPlan 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

organizations.createClient: CreateClientOrganizationResult
CampoTipoObligatorioDescripción
org_idstring (uuid)SíIdentifier of the client organization.
invite_idstring (uuid)SíIdentifier of the Owner invite.
invite_tokenstringSí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"}'