Saltar al contenido

Create an account membership role

Módulo Identity

POST/account-membership-rolesaccountMembershipRoles.create

An account role held through an account membership. Creates an account membership role. Requires `Idempotency-Key`; a replay returns the original response. The organization is derived from the credential or the parent row, never from the body.

  • Requiere la capacidad me.account.write.
  • Alcances de OAuth: me.
  • 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: AccountMembershipRoleCreate

accountMembershipRoles.create: AccountMembershipRoleCreate
CampoTipoObligatorioDescripción
account_membership_idstring (uuid)SíIdentifier of the account membership.
account_roleAccountRoleSíRole inside an external account.Restricciones: one of "Account Owner", "Account Admin", "Account Finance", "Account Member"
{
  "account_membership_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
  "account_role": "Account Finance"
}

Respuesta 201: AccountMembershipRole

accountMembershipRoles.create: AccountMembershipRole
CampoTipoObligatorioDescripción
idstring (uuid)SíIdentifier of the account membership role.
created_atstring (date-time)SíWhen the row was created.
updated_atstring (date-time)SíWhen the row was last updated.
account_membership_idstring (uuid)SíIdentifier of the account membership.
account_roleAccountRoleSíRole inside an external account.Restricciones: one of "Account Owner", "Account Admin", "Account Finance", "Account Member"
granted_bystring (uuid) | nullSíIdentifier of the person who granted the role; null for the creator's own Account Owner role.
{
  "id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
  "created_at": "2026-10-08T14:30:00Z",
  "updated_at": "2026-10-08T14:30:00Z",
  "account_membership_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
  "account_role": "Account Finance",
  "granted_by": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f"
}

Ejemplos de código

curl -X POST "$XOS_BASE_URL/account-membership-roles" \
  -H "Authorization: Bearer $XOS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"account_membership_id":"0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f","account_role":"Account Finance"}'
const { data } = await xos.accountMembershipRoles.create({
    "account_membership_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
    "account_role": "Account Finance"
  });
response = xos.account_membership_roles.create({"account_membership_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f", "account_role": "Account Finance"})
xos account-membership-roles create --data '{"account_membership_id":"0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f","account_role":"Account Finance"}'