Update Account Group

Updates the details of an existing account group: its name, its merchant ID, or the group it is nested under.

Only the fields present in the body are changed. parent_code has three states: omit it to leave the parent untouched, send null to detach the group and make it a root again, or send another group’s id to nest the group under it. Nesting is structural only — it does not grant or revoke any permission.

PATCH/organizations/account-groups/{account_group_id}

Updates an account group. Every field is optional and only the fields present in the body are changed.

parent_code nests the group under another group of the same organization. It has three states: absent leaves the current parent untouched; null detaches the group and promotes it back to a root, together with any sub-groups hanging off it; a group id nests the group under that group. Nesting is structural only — it grants and revokes nothing, so moving a group leaves every existing permission untouched.

Path Parameters

account_group_idstringrequired

Account group UUID.

Body application/json

namestring

Account group name (min=1, max=255).

merchant_idstring

Local identifier (min=1, max=255).

parent_codestring,null<uuid>

The id of the group to nest this group under. Omit it to leave the parent unchanged; send null to detach the group and make it a root again. The parent must belong to the same organization and must not be the group itself or one of its descendants.

Response

OK

idstring<uuid>
namestring
merchant_idstring
parent_codestring,null<uuid>

The id of the group this group is nested under. null for a root (top-level) group.

created_atstring<date-time>
updated_atstring<date-time>

Bad Request. The code field tells the reason:

  • PARENT_NOT_FOUND — no group with that parent_code in this organization.
  • INVALID_PARENT — the group was sent as its own parent.
  • PARENT_IS_DESCENDANT — the target parent sits inside this group’s own subtree, so the move would create a cycle.
  • MAX_NESTING_DEPTH — the move would push the tree past the maximum depth of 20 levels.
codestring

Machine-readable error code.

messagesstring[]

Human-readable details.

Not Found — no account group with that account_group_id in this organization.

Request
curl -X PATCH "https://api-sandbox.whitelabel.com/v1/organizations/account-groups/<account_group_id>" \
  -H "Content-Type: application/json" \
  -H "PUBLIC-API-KEY: <PUBLIC-API-KEY>" \
  -H "PRIVATE-SECRET-KEY: <PRIVATE-SECRET-KEY>" \
  -d '{
  "name": "string",
  "merchant_id": "string",
  "parent_code": null
}'
Response
{
  "id": "00000000-0000-0000-0000-000000000000",
  "name": "string",
  "merchant_id": "string",
  "parent_code": null,
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z"
}