Filtering

REST and WebSocket API endpoints that return multiple results may provide possibility to filter the data by certain properties. Not all properties can be used as filters. Please check the endpoint documentation to find out what properties are available for filtering.

Requests

To filter the results by a property, the corresponding property should be provided as a query param. Multiply filters can be used in one request to narrow down the data to what fits your dApp use-case. Some filters can accept multiple values separated by a comma.

Example

Filter NFT tokens by owner and contract package:

curl -X 'GET' \
  'https://api.testnet.cspr.cloud/nft-tokens?owner_hash=8c9675894eb753007c17058b4616dee224171365f0ac5e161152b1e5c95ce944&contract_package_hash=998af6825d77da15485baf4bb89aeef3f1dfb4a78841d149574b0be694ce4821' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
{
  "data": [
    {
      "contract_package_hash": "998af6825d77da15485baf4bb89aeef3f1dfb4a78841d149574b0be694ce4821",
      "is_burned": false,
      "offchain_metadata": null,
      "offchain_metadata_status": 0,
      "onchain_metadata": "eyJuYW1lIjogIlF1aWV0IHBsYWNlcyIsICJhc3NldCI6ICJodHRwczovL21hcml0aW1lLnNlYWxzdG9yYWdlLmlvL21ha2UvOTk4YWY2ODI1ZDc3ZGExNS9iMzQ0NzhkMzkyNjY0OGEyODkzZWNlM2NiNzJiMGIwMSIsICJkZXNjcmlwdGlvbiI6ICJhIGxvZnQgIn0=",
      "owner_hash": "8c9675894eb753007c17058b4616dee224171365f0ac5e161152b1e5c95ce944",
      "owner_type": 0,
      "timestamp": "2022-12-06T18:41:41Z",
      "token_id": "13",
      "token_standard_id": 1,
      "tracking_id": 21455
    },
    {
      "contract_package_hash": "998af6825d77da15485baf4bb89aeef3f1dfb4a78841d149574b0be694ce4821",
      "is_burned": false,
      "offchain_metadata": null,
      "offchain_metadata_status": 0,
      "onchain_metadata": "eyJuYW1lIjogImxpYnJhcnkiLCAiYXNzZXQiOiAiaHR0cHM6Ly9tYXJpdGltZS5zZWFsc3RvcmFnZS5pby9tYWtlLzk5OGFmNjgyNWQ3N2RhMTUvNTQ0ZjI5ZDJiOTZmNDc1ZjhmYWMwMmJmMzY5ZWM2MGUiLCAiZGVzY3JpcHRpb24iOiAiYW5vdGhlciBjb29sIHF1aWV0IHBsYWNlIn0=",
      "owner_hash": "8c9675894eb753007c17058b4616dee224171365f0ac5e161152b1e5c95ce944",
      "owner_type": 0,
      "timestamp": "2022-12-06T18:44:45Z",
      "token_id": "14",
      "token_standard_id": 1,
      "tracking_id": 21456
    }
  ],
  "item_count": 2,
  "page_count": 1
}

Last updated