# getAssetsByGroup_v2

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://solana-mainnet.g.alchemy.com/v2/{apiKey}

Returns all Solana NFTs and compressed NFTs belonging to a specific group identified by `groupKey` and `groupValue` (for example, all assets in a given collection).


Reference: https://www.alchemy.com/docs/reference/alchemy-das-apis-for-solana-v2/solana-das-api-v2-endpoints/get-assets-by-group-v-2

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| groupKey | string | Yes | The group classification type to search by (for example, `collection`, `community`, `creator`).  |
| groupValue | string | Yes | The collection address or group identifier to retrieve all matching NFTs for. |
| page | integer | No | The page of results to return (1-based). |
| limit | integer | No | The maximum number of assets to return per page. |
| sortBy | object | No | Sorting configuration for ordering the returned assets. |
| before | string | No | The cursor for paginating backwards through the assets. |
| after | string | No | The cursor for paginating forwards through the assets. |
| options | object | No | Display and formatting options for the response. |

## Result

**Asset page** (object): A paginated list of assets in the specified group.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "getAssetsByGroup_v2",
  "params": [
    "collection",
    "J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w",
    1,
    10,
    {
      "sortBy": "created"
    }
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "last_indexed_slot": 365750752,
    "total": 1,
    "limit": 10,
    "page": 1,
    "items": [
      {
        "interface": "ProgrammableNFT",
        "id": "JEGruwYE13mhX2wi2MGrPmeLiVyZtbBptmVy9vG3pXRC",
        "authorities": [
          {
            "address": "2RtGg6fsFiiF1EQzHqbd66AhW7R5bWeQGpTbv2UMkCdW",
            "scopes": [
              "full"
            ]
          }
        ],
        "compression": {
          "eligible": false,
          "compressed": false,
          "data_hash": "",
          "creator_hash": "",
          "asset_hash": "",
          "tree": "",
          "seq": 0,
          "leaf_id": 0
        },
        "grouping": [
          {
            "group_key": "collection",
            "group_value": "J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w"
          }
        ],
        "royalty": {
          "royalty_model": "creators",
          "target": null,
          "percent": 0.042,
          "basis_points": 420,
          "primary_sale_happened": true,
          "locked": false
        },
        "creators": [
          {
            "address": "5XvhfmRjwXkGp3jHGmaKpqeerNYjkuZZBYLVQYdeVcRv",
            "share": 0,
            "verified": true
          }
        ],
        "ownership": {
          "frozen": true,
          "delegated": false,
          "delegate": null,
          "ownership_model": "single",
          "owner": "3F21SJs4FMpsakrxmd8GjgfQZG6BN6MVsvXcm5Yc6Jcf"
        },
        "mutable": true,
        "burnt": false
      }
    ]
  },
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://solana-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getAssetsByGroup_v2",
  "params": [
    "collection",
    "J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w",
    1,
    10,
    {
      "sortBy": "created"
    },
    "string",
    "string",
    {
      "showUnverifiedCollections": false,
      "showCollectionMetadata": false,
      "showGrandTotal": false
    }
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'getAssetsByGroup_v2',
    params: [
      'collection',
      'J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w',
      1,
      10,
      {sortBy: 'created'},
      'string',
      'string',
      {
        showUnverifiedCollections: false,
        showCollectionMetadata: false,
        showGrandTotal: false
      }
    ]
  })
};

fetch('https://solana-mainnet.g.alchemy.com/v2/docs-demo', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://solana-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getAssetsByGroup_v2",
    "params": [
        "collection",
        "J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w",
        1,
        10,
        { "sortBy": "created" },
        "string",
        "string",
        {
            "showUnverifiedCollections": False,
            "showCollectionMetadata": False,
            "showGrandTotal": False
        }
    ]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://solana-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"getAssetsByGroup_v2\",\n  \"params\": [\n    \"collection\",\n    \"J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w\",\n    1,\n    10,\n    {\n      \"sortBy\": \"created\"\n    },\n    \"string\",\n    \"string\",\n    {\n      \"showUnverifiedCollections\": false,\n      \"showCollectionMetadata\": false,\n      \"showGrandTotal\": false\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://solana-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"getAssetsByGroup_v2\",\n  \"params\": [\n    \"collection\",\n    \"J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w\",\n    1,\n    10,\n    {\n      \"sortBy\": \"created\"\n    },\n    \"string\",\n    \"string\",\n    {\n      \"showUnverifiedCollections\": false,\n      \"showCollectionMetadata\": false,\n      \"showGrandTotal\": false\n    }\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://solana-mainnet.g.alchemy.com/v2/docs-demo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"getAssetsByGroup_v2\",\n  \"params\": [\n    \"collection\",\n    \"J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w\",\n    1,\n    10,\n    {\n      \"sortBy\": \"created\"\n    },\n    \"string\",\n    \"string\",\n    {\n      \"showUnverifiedCollections\": false,\n      \"showCollectionMetadata\": false,\n      \"showGrandTotal\": false\n    }\n  ]\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## OpenRPC Method Specification

```yaml
name: getAssetsByGroup_v2
description: |
  Returns all Solana NFTs and compressed NFTs belonging to a specific group identified by `groupKey` and `groupValue` (for example, all assets in a given collection).
x-compute-units: 480
x-rate-limit-cus: 200
paramStructure: by-name
params:
  - name: groupKey
    required: true
    description: |
      The group classification type to search by (for example, `collection`, `community`, `creator`).
    schema:
      type: string
  - name: groupValue
    required: true
    description: The collection address or group identifier to retrieve all matching NFTs for.
    schema:
      type: string
  - name: page
    required: false
    description: The page of results to return (1-based).
    schema:
      type: integer
  - name: limit
    required: false
    description: The maximum number of assets to return per page.
    schema:
      type: integer
  - name: sortBy
    required: false
    description: Sorting configuration for ordering the returned assets.
    schema:
      title: Sort criteria
      type: object
      description: Sorting configuration for ordering the returned assets.
      properties:
        sortBy:
          type: string
          description: The criteria by which the retrieved assets will be sorted.
          enum:
            - created
            - recent_action
            - updated
            - none
        sortDirection:
          type: string
          description: The direction by which the retrieved assets will be sorted.
          enum:
            - asc
            - desc
  - name: before
    required: false
    description: The cursor for paginating backwards through the assets.
    schema:
      type: string
  - name: after
    required: false
    description: The cursor for paginating forwards through the assets.
    schema:
      type: string
  - name: options
    required: false
    description: Display and formatting options for the response.
    schema:
      title: Asset list options
      type: object
      description: |
        Optional display and formatting flags accepted by list-style DAS v2 methods (`getAssetsByAuthority`, `getAssetsByCreator`, `getAssetsByGroup`).
      properties:
        showUnverifiedCollections:
          type: boolean
          description: Displays grouping information for unverified collections instead of skipping them.
          default: false
        showCollectionMetadata:
          type: boolean
          description: Displays metadata for the collection.
          default: false
        showGrandTotal:
          type: boolean
          description: Shows the total number of assets that matched the query. This will make the request slower.
          default: false
examples:
  - name: getAssetsByGroup_v2 example
    params:
      - name: groupKey
        value: collection
      - name: groupValue
        value: J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w
      - name: page
        value: 1
      - name: limit
        value: 10
      - name: sortBy
        value:
          sortBy: created
    result:
      name: Asset page
      value:
        last_indexed_slot: 365750752
        total: 1
        limit: 10
        page: 1
        items:
          - interface: ProgrammableNFT
            id: JEGruwYE13mhX2wi2MGrPmeLiVyZtbBptmVy9vG3pXRC
            authorities:
              - address: 2RtGg6fsFiiF1EQzHqbd66AhW7R5bWeQGpTbv2UMkCdW
                scopes:
                  - full
            compression:
              eligible: false
              compressed: false
              data_hash: ''
              creator_hash: ''
              asset_hash: ''
              tree: ''
              seq: 0
              leaf_id: 0
            grouping:
              - group_key: collection
                group_value: J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w
            royalty:
              royalty_model: creators
              target: null
              percent: 0.042
              basis_points: 420
              primary_sale_happened: true
              locked: false
            creators:
              - address: 5XvhfmRjwXkGp3jHGmaKpqeerNYjkuZZBYLVQYdeVcRv
                share: 0
                verified: true
            ownership:
              frozen: true
              delegated: false
              delegate: null
              ownership_model: single
              owner: 3F21SJs4FMpsakrxmd8GjgfQZG6BN6MVsvXcm5Yc6Jcf
            mutable: true
            burnt: false
result:
  name: Asset page
  description: A paginated list of assets in the specified group.
  schema:
    title: Asset page
    type: object
    description: |
      A paginated page of assets. Returned by list-style methods: `getAssetsByAuthority`, `getAssetsByCreator`, `getAssetsByGroup`, `getAssetsByOwner`.
    properties:
      last_indexed_slot:
        type: integer
        description: All on-chain data up to and including this slot is guaranteed to have been indexed.
      total:
        type: integer
        description: The total number of assets found.
      limit:
        type: integer
        description: The maximum number of assets requested.
      page:
        type: integer
        description: The current page of results.
      items:
        type: array
        items:
          title: Asset
          type: object
          description: A DAS v2 digital asset entry.
          properties:
            last_indexed_slot:
              type: integer
              description: All on-chain data up to and including this slot is guaranteed to have been indexed.
            interface:
              title: Asset interface
              type: string
              description: |
                The interface type of the Solana digital asset, indicating its token standard and implementation. v2 adds MPL Core interfaces (`MplCoreAsset`, `MplCoreCollection`, `MplCoreGroup`) and `MplBubblegumV2` for the newer Bubblegum V2 compressed-NFT program.
              enum:
                - V1_NFT
                - V1_PRINT
                - LEGACY_NFT
                - V2_NFT
                - FungibleAsset
                - FungibleToken
                - Custom
                - Identity
                - Executable
                - ProgrammableNFT
                - MplCoreAsset
                - MplBubblegumV2
                - MplCoreCollection
                - MplCoreGroup
            is_agent:
              type: boolean
              description: |
                Whether this asset has an Agent Identity. Only true for MPL Core assets that use the AgentIdentity external plugin adapter. Defaults to false and is omitted from the response when false.
            agent_token:
              type: string
              description: Base58-encoded mint address of the agent token from the Agent Registry program. Omitted when the asset has no corresponding registry entry.
            asset_signer:
              type: string
              description: Base58-encoded PDA used for signing on behalf of the asset. Omitted when not applicable.
            id:
              type: string
              description: The unique identifier of the asset.
            content:
              title: Asset content
              type: object
              description: Content and off-chain metadata for the asset.
              properties:
                $schema:
                  type: string
                  description: The schema URL for the asset metadata.
                json_uri:
                  type: string
                  description: URI pointing to the JSON metadata, typically hosted on Arweave or other decentralized storage.
                files:
                  type: array
                  description: Files associated with the asset (images, videos, etc.).
                  items:
                    type: object
                    properties:
                      uri:
                        type: string
                      cdn_uri:
                        type: string
                      mime:
                        type: string
                metadata:
                  type: object
                  description: Complete metadata for the asset.
                  properties:
                    name:
                      type: string
                    symbol:
                      type: string
                    description:
                      type: string
                    token_standard:
                      type: string
                    attributes:
                      type: array
                      items:
                        type: object
                        properties:
                          trait_type:
                            type: string
                          value:
                            type: string
                links:
                  type: object
                  description: External links related to the asset.
            authorities:
              type: array
              items:
                title: Asset authority
                type: object
                description: An update-authority entry for the asset.
                properties:
                  address:
                    type: string
                    description: The authority's address.
                  scopes:
                    type: array
                    description: The scopes of authority.
                    items:
                      type: string
            compression:
              title: Asset compression
              type: object
              description: State-compression details for the asset.
              properties:
                eligible:
                  type: boolean
                  description: Whether the asset is eligible for compression.
                compressed:
                  type: boolean
                  description: Whether the asset is currently compressed using Solana's state compression.
                data_hash:
                  type: string
                  description: Hash of the asset data.
                creator_hash:
                  type: string
                  description: Hash of the creator data.
                asset_hash:
                  type: string
                  description: Hash of the entire asset.
                tree:
                  type: string
                  description: Merkle tree address.
                seq:
                  type: integer
                  description: Sequence number.
                leaf_id:
                  type: integer
                  description: Leaf identifier in the merkle tree.
            grouping:
              type: array
              items:
                title: Asset grouping
                type: object
                description: A grouping entry (for example, a collection membership).
                properties:
                  group_key:
                    type: string
                    description: The key identifying the group (e.g., `collection`).
                  group_value:
                    type: string
                    description: The value associated with the group.
            royalty:
              title: Asset royalty
              type: object
              description: Royalty configuration for marketplace sales.
              properties:
                royalty_model:
                  type: string
                  description: The model used for royalties.
                target:
                  oneOf:
                    - type: string
                    - type: 'null'
                  description: The target address for royalties (nullable).
                percent:
                  type: number
                  description: Royalty percentage.
                basis_points:
                  type: integer
                  description: Royalty basis points.
                primary_sale_happened:
                  type: boolean
                  description: Whether the primary sale has occurred.
                locked:
                  type: boolean
                  description: Whether the royalty is locked.
            creators:
              type: array
              items:
                title: Asset creator
                type: object
                description: A creator entry for the asset.
                properties:
                  address:
                    type: string
                    description: The creator's address.
                  share:
                    type: integer
                    description: The creator's share percentage.
                  verified:
                    type: boolean
                    description: Whether the creator is verified.
            ownership:
              title: Asset ownership
              type: object
              description: Current ownership details for the asset.
              required:
                - frozen
                - delegated
                - ownership_model
                - owner
              properties:
                frozen:
                  type: boolean
                  description: Whether the asset is frozen.
                delegated:
                  type: boolean
                  description: Whether the asset is delegated.
                delegate:
                  oneOf:
                    - type: string
                    - type: 'null'
                  description: The delegate's address if delegated (nullable).
                ownership_model:
                  type: string
                  description: The model of ownership.
                owner:
                  type: string
                  description: The owner's address.
            supply:
              oneOf:
                - title: Asset supply
                  type: object
                  description: Supply information for editioned assets.
                  properties:
                    print_max_supply:
                      type: integer
                      description: Maximum supply that can be printed.
                    print_current_supply:
                      type: integer
                      description: Current printed supply.
                    edition_nonce:
                      type: integer
                      description: Edition nonce.
                - type: 'null'
            mutable:
              type: boolean
              description: Whether the asset is mutable.
            burnt:
              type: boolean
              description: Whether the asset has been burnt.
            token_info:
              title: Token info
              type: object
              description: Token-specific information, including cached price data for the top 10k tokens by 24h volume.
              properties:
                supply:
                  type: integer
                  description: Total token supply.
                decimals:
                  type: integer
                  description: Number of decimals.
                token_program:
                  type: string
                  description: Token program ID.
                mint_authority:
                  type: string
                  description: Mint authority address.
                freeze_authority:
                  type: string
                  description: Freeze authority address.
                symbol:
                  type: string
                  description: The symbol of the token.
                price_info:
                  type: object
                  description: Cached price information for the token (up to 600 seconds old).
                  properties:
                    price_per_token:
                      type: number
                      description: The price per individual token.
                    currency:
                      type: string
                      description: The currency in which the token's price is denoted.
            plugins:
              title: MPL Core plugins
              type: object
              description: MPL Core plugin payload. May include a `groups` plugin (MIP-11) on assets and collections.
              additionalProperties: true
              properties:
                groups:
                  type: object
                  description: MIP-11 Groups plugin with membership metadata.
                  properties:
                    authority:
                      type: object
                      description: Plugin authority (for example, `UpdateAuthority`).
                      additionalProperties: true
                    data:
                      type: object
                      properties:
                        groups:
                          type: array
                          description: Group memberships for this asset or collection.
                          items:
                            type: object
                            properties:
                              group_address:
                                type: string
                                description: Base58 address of the MPL Core group account.
                              member_number:
                                type: integer
                                description: Member number within the group.
```
