> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orbitflare.com/llms.txt
> Use this file to discover all available pages before exploring further.

# getAssetsByGroup

> List every NFT and compressed NFT in a Solana collection with DAS getAssetsByGroup on OrbitFlare.

## Overview

`getAssetsByGroup` lists the assets in a group. In practice the group is a collection: pass `groupKey: "collection"` and the collection address as `groupValue`. Only verified collection members are returned unless you set `showUnverifiedCollections`.

## Parameters

<ResponseField name="groupKey" type="string" required>
  The group type. Use `collection`.
</ResponseField>

<ResponseField name="groupValue" type="string" required>
  The collection address (base-58).
</ResponseField>

<ResponseField name="page" type="number">
  Page number, starting at 1. See [Pagination](/das-api/pagination).
</ResponseField>

<ResponseField name="limit" type="number">
  Results per page. Maximum and default 1,000.
</ResponseField>

<ResponseField name="cursor" type="string">
  Cursor from a previous response.
</ResponseField>

<ResponseField name="before" type="string">
  Return assets with IDs before this one.
</ResponseField>

<ResponseField name="after" type="string">
  Return assets with IDs after this one.
</ResponseField>

<ResponseField name="sortBy" type="object">
  `{ "sortBy": "id" | "created" | "updated" | "recent_action" | "none", "sortDirection": "asc" | "desc" }`
</ResponseField>

<ResponseField name="options" type="object">
  [Display options](/das-api/display-options): `showFungible`, `showUnverifiedCollections`, `showCollectionMetadata`, `showInscription`. Also accepted as `displayOptions`.
</ResponseField>

## Response

A list with `last_indexed_slot`, `total`, `limit`, `page` or `cursor`, and `items` ([asset objects](/das-api/asset-object)).

## Code Examples

### Request

```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY -X POST -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getAssetsByGroup",
  "params": {
    "groupKey": "collection",
    "groupValue": "J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w",
    "page": 1,
    "limit": 1
  }
}'
```

### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
{
  "jsonrpc": "2.0",
  "result": {
    "last_indexed_slot": 457714577,
    "total": 1,
    "limit": 1,
    "page": 1,
    "items": [
      {
        "interface": "ProgrammableNFT",
        "id": "JEGruwYE13mhX2wi2MGrPmeLiVyZtbBptmVy9vG3pXRC",
        "content": {
          "json_uri": "https://madlads.s3.us-west-2.amazonaws.com/json/6867.json",
          "metadata": { "name": "Mad Lads #6867", "symbol": "MAD" }
        },
        "grouping": [
          { "group_key": "collection", "group_value": "J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w" }
        ],
        "ownership": {
          "frozen": true,
          "delegated": true,
          "delegate": "FARqKAafAbgT25QcgiX5d1g6xpadgG7xymu5N6gSmp4x",
          "ownership_model": "single",
          "owner": "CxBhuJwhVgNMc7yjnRx3XFAsTnnbYDc2bhAGSaLBjNqZ"
        }
      }
    ]
  },
  "id": 1
}
```

The asset object is shortened. See [Asset object](/das-api/asset-object) for a full example.

### TypeScript

Collect the holders of a collection:

```typescript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
const RPC_URL = 'https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY';

async function getCollectionHolders(collection: string) {
  const holders = new Map<string, number>();
  let cursor: string | undefined;

  while (true) {
    const response = await fetch(RPC_URL, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getAssetsByGroup',
        params: { groupKey: 'collection', groupValue: collection, limit: 1000, cursor },
      }),
    });
    const { result, error } = await response.json();
    if (error) throw new Error(error.message);

    for (const asset of result.items) {
      const owner = asset.ownership.owner;
      holders.set(owner, (holders.get(owner) ?? 0) + 1);
    }
    if (result.items.length < 1000) break;
    cursor = result.cursor;
  }

  return holders;
}
```

## Common Errors

| Code | Message | Solution |
| - | - | - |
| -32602 | missing field `groupValue` | Send both `groupKey` and `groupValue` |
| -32602 | Pagination Error. Limit should not be greater than 1000. | Use a `limit` of 1,000 or less |
| -32602 | Pagination Sorting Error | Cursors and ranges need `sortBy: "id"`; use `page` with other sorts |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.