Filter Search Results by Type


October 13, 2022


← Back

We have added a new optional parameter to the /search endpoint to filter results to show only assets, only collections or both.

Valid arguments for type are asset, collection, and all.

Check out a few examples below, or view the full documentation.

Demo: Search for both assets and collections

If type is omitted, the default search is for both assets and collections.

$ curl <https://api.center.dev/v1/ethereum-mainnet/search\\?query\\=meebits>

{ "results": [ { "id": "ethereum-mainnet/0x7Bd29408f11D2bFC23c34f18275bBf23bB716Bc7", "name": "Meebits", "previewImageUrl": "<https://cdn.center.app/1/0x7Bd29408f11D2bFC23c34f18275bBf23bB716Bc7/5872/3e5d37cf78628851ba679bb9bca9170142e543b3130f74db5d89e076237fbcac.jpeg>", "relevance": 138.40265, "url": "<https://center.app/collections/0x7Bd29408f11D2bFC23c34f18275bBf23bB716Bc7>" }, ... ] }

$ curl <https://api.center.dev/v1/ethereum-mainnet/search\\?query\\=meebits\\&type\\=all>

{ "results": [ { "id": "ethereum-mainnet/0x7Bd29408f11D2bFC23c34f18275bBf23bB716Bc7", "name": "Meebits", "previewImageUrl": "<https://cdn.center.app/1/0x7Bd29408f11D2bFC23c34f18275bBf23bB716Bc7/5872/3e5d37cf78628851ba679bb9bca9170142e543b3130f74db5d89e076237fbcac.jpeg>", "relevance": 138.40265, "url": "<https://center.app/collections/0x7Bd29408f11D2bFC23c34f18275bBf23bB716Bc7>" }, ... ] }

Demo: Search for collections only

$ curl <https://api.center.dev/v1/polygon-mainnet/search\\?query\\=planetix\\&type\\=collection>
{
  "results": [
    {
      "id": "polygon-mainnet/0xB2435253C71FcA27bE41206EB2793E44e1Df6b6D",
      "name": "PlanetIX",
      "previewImageUrl": "<https://cdn.center.app/137/0xB2435253C71FcA27bE41206EB2793E44e1Df6b6D/3153537/774cbdf6ee2885a3e89b9f7064e6910a07d387c3db2a225344acbb2a82429cad.png>",
      "relevance": 11.72467,
      "url": "<https://center.app/polygon-mainnet/collections/0xB2435253C71FcA27bE41206EB2793E44e1Df6b6D>"
    },
    ...
  ]
}

Demo: Search for assets only

$ curl <https://api.center.dev/v1/ethereum-mainnet/search\\?query\\=meebits\\&type\\=asset>
{
  "results": [
    {
      "id": "ethereum-mainnet/0x7Bd29408f11D2bFC23c34f18275bBf23bB716Bc7/0",
      "name": "Meebits",
      "previewImageUrl": "",
      "relevance": 10.40766,
      "url": "<https://center.app/collections/0x7Bd29408f11D2bFC23c34f18275bBf23bB716Bc7/0>"
    },
    ...
  ]
}

Other requests or ideas? Please submit a feature request or reach out to our support team.