Queries
collections
List the store's published collections and optionally search or sort the result.
Last updated:
collections returns every published collection visible in the resolved
store. Each item includes its public metadata and the number of associated
published products.
Signature
collections(
search: String
sort: NavigationSearchSort
): [CollectionItem!]!Arguments
| Argument | Type | Default | Rule |
|---|---|---|---|
search | String | null | Searches name, slug, description, and type. It is trimmed before searching; an empty value is treated as null. Maximum input length: 200 characters. |
sort | NavigationSearchSort | null | When omitted, results are sorted by name ascending. |
NavigationSearchSort
The sort argument accepts these exact values:
| Value | Effective collection order |
|---|---|
DEFAULT | Name ascending. |
NAME_ASC | Name ascending. |
NAME_DESC | Name descending. |
ORDER_ASC | Name ascending at present. |
ORDER_DESC | Name ascending at present. |
NEWEST | Creation descending, then name ascending. |
UPDATED_DESC | Last update descending, then name ascending. |
ORDER_ASC and ORDER_DESC belong to the shared navigation enum, but
collections do not currently have a manual order field in their public index.
CollectionItem fields
| Field | Type | Description |
|---|---|---|
id | String! | Opaque public collection identifier. |
slug | String! | Public slug used in the collection URL. |
name | String! | Public name. |
description | String | Public description, or null when empty. |
imageUrl | String | Public image URL, or null when absent. |
type | String! | Collection type stored by the catalog. |
productCount | Int! | Number of associated published products in the current store. |
Query
query Collections($search: String, $sort: NavigationSearchSort) {
collections(search: $search, sort: $sort) {
id
slug
name
description
imageUrl
type
productCount
}
}Variables
{
"search": "summer",
"sort": "NAME_ASC"
}Enums are sent as strings inside the JSON variables object.
cURL
curl --request POST "https://storefront.ecomiq.pe/graphql" \
--header "Content-Type: application/json" \
--header "x-Store-Domain: my-store" \
--data-binary '{
"query": "query Collections($search: String, $sort: NavigationSearchSort) { collections(search: $search, sort: $sort) { id slug name description imageUrl type productCount } }",
"variables": {
"search": "summer",
"sort": "NAME_ASC"
}
}'Response
{
"data": {
"collections": [
{
"id": "collection-1",
"slug": "summer",
"name": "Summer",
"description": null,
"imageUrl": null,
"type": "Manual",
"productCount": 2
}
]
}
}A store with no matching collections returns "collections": [].
Errors
| Code | When it occurs |
|---|---|
BAD_USER_INPUT | search exceeds 200 characters. |
STORE_CONTEXT_REQUIRED | x-Store-Domain does not resolve a store. |
{
"errors": [
{
"message": "Search must not exceed 200 characters.",
"path": ["collections"],
"extensions": {
"code": "BAD_USER_INPUT"
}
}
],
"data": null
}Read GraphQL errors for the complete envelope handling rules.
REST equivalent
GET /v1/collections
exposes the same list and accepts the REST filters documented in its reference.