[SOLVED] Search or filter Assets using GraphQL API


I’m using the following GraphQL query to get a list of Assets.

    queryAssets {

However, I don’t want all Assests, just specific ones. I am currently having two issues.

First, even though the Squidex UI exposes a Tags field, the GraphQL API does not (AssetDto).

Second, the GraphQL API for queryAssets shows a search parameter of type String. Assuming that it works the same as the OData $search, I tried the following but received the error “Error trying to resolve queryAssets.”

    queryAssets(search: "dashboard") {

In fact, I receive this error with any string I use for search, except for the empty string.

I’ve seen this and tried appending it to the GraphQL endpoint but it does not seem to have any effect.
$filter=startswith(slug, ‘dashboard’)

A couple of questions,

  1. Is it possible to search for Assets based on a tag value?
  2. Using GraphQL, how can I search (or filter) Assets based on a slug (or tag)?


The search Parameter is an OData filter.


Thanks, but would you mind sharing the format of the search parameter? I tried using the following OData filter variations without success:

queryAssets(search: "$filter = startswith(slug,'dashboard')") { ... }
queryAssets(search: "filter = startswith(slug,'dashboard')") { ... }
queryAssets(search: "startswith(slug,'dashboard')") { ... }

I have also tried the three variations above using “slug eq ‘dashboard-map-teachers.pdf’”. I always get the error “Error trying to resolve queryAssets.”



it was actually a bug. I pushed the fix to the master branch.

If you use Cloud: I will deploy it on Monday.


Thanks for the bug fix.

Could you please explain the search parameter format and how to use it? I still cannot get it to work using my examples above.


I just deployed it, was not able to do it before. The search parameter is gone and the new filter is an Odata filter.



Thanks for your help. I apologize for keeping this post alive but the filter seems to only work for some fields and not all fields in AssetsDto!

For example, this works queryAssets(filter:"contains(fileName, 'dashboard')") but this returns the usual error message queryAssets(filter:"contains(slug, 'dashboard')"). As you can see, I only changed the field name and I have “dashboard” in both fileName and slug.

In fact, slug is not the only String! field for which the filter produces error messages. Do you have any documentation or reference regarding which fields can be filtered?


You are right. I have to manually register fields to the query system and have forgotten to do it for slug and fileHash.

It is fixed and build is running.


I have deployed the update with all fields.


:clap:t4: Thank you!


Does it work now as expected?