# collections - storefront - QUERY Version: 2024-10 ## Description List of the shop’s collections. ### Access Scopes ## Arguments * [after](/docs/api/storefront/2024-10/scalars/String): String - Returns the elements that come after the specified cursor. * [before](/docs/api/storefront/2024-10/scalars/String): String - Returns the elements that come before the specified cursor. * [first](/docs/api/storefront/2024-10/scalars/Int): Int - Returns up to the first `n` elements from the list. * [last](/docs/api/storefront/2024-10/scalars/Int): Int - Returns up to the last `n` elements from the list. * [query](/docs/api/storefront/2024-10/scalars/String): String - Apply one or multiple filters to the query. | name | description | acceptable_values | default_value | example_use | | ---- | ---- | ---- | ---- | ---- | | collection_type | | title | | updated_at | Refer to the detailed [search syntax](https://shopify.dev/api/usage/search-syntax) for more information about using filters. * [reverse](/docs/api/storefront/2024-10/scalars/Boolean): Boolean - Reverse the order of the underlying list. * [sortKey](/docs/api/storefront/2024-10/enums/CollectionSortKeys): CollectionSortKeys - Sort the underlying list by the given key. ## Returns * [edges](/docs/api/storefront/2024-10/objects/CollectionEdge): CollectionEdge! A list of edges. * [nodes](/docs/api/storefront/2024-10/objects/Collection): Collection! A list of the nodes contained in CollectionEdge. * [pageInfo](/docs/api/storefront/2024-10/objects/PageInfo): PageInfo! Information to aid in pagination. * [totalCount](/docs/api/storefront/2024-10/scalars/UnsignedInt64): UnsignedInt64! The total count of Collections. ## Examples ### Retrieve collections Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \\\n-d '{\n\"query\": \"query { collections(first: 2) { edges { node { id products(first: 5) { edges { node { id } } } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Storefront({\n domain: 'your-development-store.myshopify.com',\n storefrontAccessToken,\n});\nconst data = await client.query({\n data: `query {\n collections(first: 2) {\n edges {\n node {\n id\n products(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n }\n }\n }\n }`,\n});\n" Ruby example: null Remix example: "const { storefront } = await unauthenticated.storefront(\n 'your-development-store.myshopify.com'\n);\n\nconst response = await storefront.graphql(\n `#graphql\n query {\n collections(first: 2) {\n edges {\n node {\n id\n products(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n collections(first: 2) {\n edges {\n node {\n id\n products(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n }\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "collections": { "edges": [ { "node": { "id": "gid://shopify/Collection/547751128", "products": { "edges": [ { "node": { "id": "gid://shopify/Product/929898465" } }, { "node": { "id": "gid://shopify/Product/538825261" } } ] } } }, { "node": { "id": "gid://shopify/Collection/585546552", "products": { "edges": [] } } } ] } } }