# Find Account Groups by Merchant ID

Returns every account group within the authenticated organization that carries the given `merchant_id`. Use this endpoint to locate WHITELABEL group records using the identifier that already exists on your side, without having to store or look up WHITELABEL-generated group IDs.

<Note>
**Multiple matches and empty results**

A `merchant_id` is not guaranteed to be unique — more than one group can share the same value. All matching groups are returned. When no group carries the requested `merchant_id`, the response contains an empty `data` array rather than an error. Deleted groups are never included.
</Note>

**GET** `/organizations/account-groups`

Base URL: `https://api-sandbox.whitelabel.com/v1`

Returns all account groups that match the given `merchant_id`. Because a merchant ID is not guaranteed to be unique, every matching group is returned. When no group carries that merchant ID the response contains an empty `data` array — it is not an error. Only groups belonging to the authenticated organization are ever returned; deleted groups are excluded.

## Authorization

- PUBLIC-API-KEY (apiKey in header)
- PRIVATE-SECRET-KEY (apiKey in header)

## Query parameters

- `merchant_id` (string, required)
  The merchant-side identifier to look up. Must be an exact match.

## Responses

### 200

OK — zero or more matching account groups.

- `data` (object[])
  List of account groups that carry the requested merchant_id. Empty when no match is found.
  - `id` (string<uuid>)
    WHITELABEL-generated unique identifier of the account group.
  - `name` (string)
    Display name of the account group.
  - `merchant_id` (string)
    Merchant-side identifier stored on this group.
  - `parent_code` (string,null<uuid>)
    The `id` of the group this group is nested under. `null` for a root (top-level) group.
  - `created_at` (string<date-time>)
    ISO 8601 timestamp of when the group was created.
  - `updated_at` (string<date-time>)
    ISO 8601 timestamp of the last update.
- `pagination` (object)
  - `page` (integer)
  - `page_size` (integer)
  - `total_items` (integer)
  - `total_pages` (integer)
  - `has_next` (boolean)
  - `has_previous` (boolean)

Example:

```json
{
  "data": [
    {
      "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"
    }
  ],
  "pagination": {
    "page": 0,
    "page_size": 0,
    "total_items": 0,
    "total_pages": 0,
    "has_next": true,
    "has_previous": true
  }
}
```

### 400

Bad Request — `merchant_id` query parameter is missing or blank.

### 401

Unauthorized — invalid or missing API credentials.