An access token is required to call this API. Refer to Authorization for more information about how to obtain the token.
Query a list of the store's collections.
Arguments
after ● String
Returns elements following the specified cursor. The first argument must also be specified when using this argument.
before ● String
Returns elements preceding the specified cursor. The last argument must also be specified when using this argument.
first ● Int
Returns the first n elements in the list.
last ● Int
Returns the last n elements in the list.
reverse ● Boolean
Whether to reverse the order of the list.
● true: reverse
● false: do not reverse
Default value: false
sortkey ● CollectionSortKeys
Sorts the list by a specific sorting dimension.
More
query ● String
Applies one or multiple filters to the query.
CAUTION
  1. If keywords are used in the value, they must be escaped first.
  2. A maximum of 5 filters are supported per query.
Filter fieldDescription
collection_typeFilters by collection type. Valid values are manual (manual collection) and smart (smart collection). If no type is specified, all types of collections are returned.
titleFilters by collection title. Only one title can be specified in the title field.
updated_atFilters by collection update time. Format: ISO 8601. Filtering by time range is supported.

Search syntax reference

title:'T-shirt' AND updated_at:>'2020-10-21T23:39:20Z'
ids ● [ID]
Specifies the collection IDs to query, with multiple IDs separated by commas.
Return
edges ● [CollectionEdge!]non-null
A list of edges.
More
nodes ● [Collection]
A list of the nodes contained in CollectionEdge.
More
pageInfo ● PageInfo!non-null
Information to aid in pagination.
More
totalCount ● Int
the number of collections in the published scope
Status and error codes
For detailed information about common codes, see Status and error codes.
Example
Query collections based on the specified titles
query collections @inContext(saleChannel: "web",country:CN,language:EN){
collections(first: 2, query: "title:\"collection\" OR title:\"Custom\"" ) {
edges {
node {
id
title
products(first: 2) {
edges {
node {
id
title
}
}
}
}
}
}
}
Response
{
"data": {
"collections": {
"edges": [
{
"node": {
"id": "gid://shopline/Collection/12261186277836500577262340",
"products": {
"edges": []
},
"title": "Third Custom Collection"
}
},
{
"node": {
"id": "gid://shopline/Collection/12273187462690727542132340",
"products": {
"edges": [
{
"node": {
"id": "gid://shopline/Product/16073187380346473690812340",
"title": "A product title"
}
}
]
},
"title": "Third Custom Collection"
}
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 31,
"throttleStatus": {
"currentlyAvailable": 4969,
"maximumAvailable": 5000,
"restoreRate": 5000
},
"actualQueryCost": 31
}
}
}
Was this article helpful to you?