Skip to content

Create an account membership role

Identity module

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.

  • Requires the capability me.account.write.
  • OAuth scopes: me.
  • 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: AccountMembershipRoleCreate

accountMembershipRoles.create: AccountMembershipRoleCreate
FieldTypeRequiredDescription
account_membership_idstring (uuid)YesIdentifier of the account membership.
account_roleAccountRoleYesRole inside an external account.Constraints: one of "Account Owner", "Account Admin", "Account Finance", "Account Member"
{
  "account_membership_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
  "account_role": "Account Finance"
}

Response 201: AccountMembershipRole

accountMembershipRoles.create: AccountMembershipRole
FieldTypeRequiredDescription
idstring (uuid)YesIdentifier of the account membership role.
created_atstring (date-time)YesWhen the row was created.
updated_atstring (date-time)YesWhen the row was last updated.
account_membership_idstring (uuid)YesIdentifier of the account membership.
account_roleAccountRoleYesRole inside an external account.Constraints: one of "Account Owner", "Account Admin", "Account Finance", "Account Member"
granted_bystring (uuid) | nullYesIdentifier 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"
}

Code samples

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"}'