# collections - admin-graphql - QUERY Version: 2024-10 ## Description Returns a list of collections. ### Access Scopes ## Arguments * [after](/docs/api/admin-graphql/2024-10/scalars/String): String - The elements that come after the specified [cursor](https://shopify.dev/api/usage/pagination-graphql). * [before](/docs/api/admin-graphql/2024-10/scalars/String): String - The elements that come before the specified [cursor](https://shopify.dev/api/usage/pagination-graphql). * [first](/docs/api/admin-graphql/2024-10/scalars/Int): Int - The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql). * [last](/docs/api/admin-graphql/2024-10/scalars/Int): Int - The last `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql). * [query](/docs/api/admin-graphql/2024-10/scalars/String): String - A filter made up of terms, connectives, modifiers, and comparators. | name | type | description | acceptable_values | default_value | example_use | | ---- | ---- | ---- | ---- | ---- | ---- | | default | string | Filter by a case-insensitive search of multiple fields in a document. | | | - `query=Bob Norman`
- `query=title:green hoodie` | | collection_type | string | | - `custom`
- `smart` | | handle | string | | id | id | Filter by `id` range. | | | - `id:1234`
- `id:>=1234`
- `id:<=1234` | | product_id | id | Filter by collections containing a product by its ID. | | product_publication_status | string | Filter by the publishable status of the resource on a channel, such as the online store. The value is a composite of the [channel `app` ID](https://shopify.dev/api/admin-graphql/latest/objects/Channel#app-price) (`Channel.app.id`) and one of the valid values. | - `approved`
- `rejected`
- `needs_action`
- `awaiting_review`
- `published`
- `demoted`
- `scheduled`
- `provisionally_published` | | - `publishable_status:189769876-approved` | | publishable_status | string | Filter by the publishable status of the resource on a channel, such as the online store. The value is a composite of either the [channel `app` ID](https://shopify.dev/api/admin-graphql/latest/objects/Channel#app-price) (`Channel.app.id`) or [channel `name`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Channel#field-name) and one of the valid values. | - `online_store_channel`
- `published`
- `unpublished`
- `visible`
- `unavailable`
- `hidden`
- `intended`
- `visible` | | - `publishable_status:published`
- `publishable_status:189769876:visible`
- `publishable_status:pos:hidden` | | published_at | time | Filter by the date and time when the collection was published to the Online Store. | | published_status | string | Filter by the published status of the resource on a channel, such as the online store. | - `unset`
- `pending`
- `approved`
- `not approved` | | - `published_status:approved` | | title | string | | updated_at | time | You can apply one or more filters to a query. Learn more about [Shopify API search syntax](https://shopify.dev/api/usage/search-syntax). * [reverse](/docs/api/admin-graphql/2024-10/scalars/Boolean): Boolean - Reverse the order of the underlying list. * [savedSearchId](/docs/api/admin-graphql/2024-10/scalars/ID): ID - The ID of a [saved search](https://shopify.dev/api/admin-graphql/latest/objects/savedsearch#field-id). The search’s query string is used as the query argument. * [sortKey](/docs/api/admin-graphql/2024-10/enums/CollectionSortKeys): CollectionSortKeys - Sort the underlying list using a key. If your query is slow or returns an error, then [try specifying a sort key that matches the field used in the search](https://shopify.dev/api/usage/pagination-graphql#search-performance-considerations). ## Returns * [edges](/docs/api/admin-graphql/2024-10/objects/CollectionEdge): CollectionEdge! The connection between the node and its parent. Each edge contains a minimum of the edge's cursor and the node. * [nodes](/docs/api/admin-graphql/2024-10/objects/Collection): Collection! A list of nodes that are contained in CollectionEdge. You can fetch data about an individual node, or you can follow the edges to fetch data about a collection of related nodes. At each node, you specify the fields that you want to retrieve. * [pageInfo](/docs/api/admin-graphql/2024-10/objects/PageInfo): PageInfo! An object that’s used to retrieve [cursor information](https://shopify.dev/api/usage/pagination-graphql) about the current page. ## Examples ### Retrieve collection listings that are published to your app Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query CustomCollectionList { collections(first: 50, query: \\\"collection_type:custom\\\") { nodes { id handle title updatedAt descriptionHtml publishedOnCurrentPublication sortOrder templateSuffix } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query CustomCollectionList {\n collections(first: 50, query: \"collection_type:custom\") {\n nodes {\n id\n handle\n title\n updatedAt\n descriptionHtml\n publishedOnCurrentPublication\n sortOrder\n templateSuffix\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query CustomCollectionList {\n collections(first: 50, query: \"collection_type:custom\") {\n nodes {\n id\n handle\n title\n updatedAt\n descriptionHtml\n publishedOnCurrentPublication\n sortOrder\n templateSuffix\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query CustomCollectionList {\n collections(first: 50, query: \"collection_type:custom\") {\n nodes {\n id\n handle\n title\n updatedAt\n descriptionHtml\n publishedOnCurrentPublication\n sortOrder\n templateSuffix\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query CustomCollectionList {\n collections(first: 50, query: \"collection_type:custom\") {\n nodes {\n id\n handle\n title\n updatedAt\n descriptionHtml\n publishedOnCurrentPublication\n sortOrder\n templateSuffix\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "collections": { "nodes": [ { "id": "gid://shopify/Collection/395646240", "handle": "ipods_two", "title": "IPods Two", "updatedAt": "2008-02-02T00:00:00Z", "descriptionHtml": "

The best selling ipod ever. Again

", "publishedOnCurrentPublication": true, "sortOrder": "MANUAL", "templateSuffix": null }, { "id": "gid://shopify/Collection/691652237", "handle": "non-ipods", "title": "Non Ipods", "updatedAt": "2013-02-02T00:00:00Z", "descriptionHtml": "

No ipods here

", "publishedOnCurrentPublication": true, "sortOrder": "MANUAL", "templateSuffix": null }, { "id": "gid://shopify/Collection/841564295", "handle": "ipods", "title": "IPods", "updatedAt": "2008-02-02T00:00:00Z", "descriptionHtml": "

The best selling ipod ever

", "publishedOnCurrentPublication": true, "sortOrder": "MANUAL", "templateSuffix": null } ] } } } ### Retrieve the first five collections Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { collections(first: 5) { edges { node { id title handle updatedAt sortOrder } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n collections(first: 5) {\n edges {\n node {\n id\n title\n handle\n updatedAt\n sortOrder\n }\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n collections(first: 5) {\n edges {\n node {\n id\n title\n handle\n updatedAt\n sortOrder\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n collections(first: 5) {\n edges {\n node {\n id\n title\n handle\n updatedAt\n sortOrder\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n collections(first: 5) {\n edges {\n node {\n id\n title\n handle\n updatedAt\n sortOrder\n }\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "collections": { "edges": [ { "node": { "id": "gid://shopify/Collection/79210309", "title": "Custom Other Items", "handle": "reorder_custom", "updatedAt": "2008-10-10T00:00:00Z", "sortOrder": "MANUAL" } }, { "node": { "id": "gid://shopify/Collection/94229130", "title": "All products more expensive than free", "handle": "everything", "updatedAt": "2006-02-02T00:00:00Z", "sortOrder": "MANUAL" } }, { "node": { "id": "gid://shopify/Collection/142458073", "title": "All snowboards", "handle": "snowboards", "updatedAt": "2006-02-02T00:00:00Z", "sortOrder": "MANUAL" } }, { "node": { "id": "gid://shopify/Collection/411960790", "title": "Bold snowboards", "handle": "bold", "updatedAt": "2006-02-02T00:00:00Z", "sortOrder": "MANUAL" } }, { "node": { "id": "gid://shopify/Collection/431528632", "title": "All arbor products tagged deepsnow", "handle": "all-arbor-products-tagged-deepsnow", "updatedAt": "2006-02-02T00:00:00Z", "sortOrder": "MANUAL" } } ] } } } ### Retrieve the five most recently updated smart collections Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { collections(first: 5, query: \\\"collection_type:smart\\\", sortKey: UPDATED_AT, reverse: true) { edges { node { id title handle updatedAt sortOrder } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n collections(first: 5, query: \"collection_type:smart\", sortKey: UPDATED_AT, reverse: true) {\n edges {\n node {\n id\n title\n handle\n updatedAt\n sortOrder\n }\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n collections(first: 5, query: \"collection_type:smart\", sortKey: UPDATED_AT, reverse: true) {\n edges {\n node {\n id\n title\n handle\n updatedAt\n sortOrder\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n collections(first: 5, query: \"collection_type:smart\", sortKey: UPDATED_AT, reverse: true) {\n edges {\n node {\n id\n title\n handle\n updatedAt\n sortOrder\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n collections(first: 5, query: \"collection_type:smart\", sortKey: UPDATED_AT, reverse: true) {\n edges {\n node {\n id\n title\n handle\n updatedAt\n sortOrder\n }\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "collections": { "edges": [ { "node": { "id": "gid://shopify/Collection/522532842", "title": "Frisbees", "handle": "reorder_smart_frisbees", "updatedAt": "2008-10-12T00:00:00Z", "sortOrder": "MANUAL" } }, { "node": { "id": "gid://shopify/Collection/1063001310", "title": "Smart Other items", "handle": "reorder_smart", "updatedAt": "2008-10-11T00:00:00Z", "sortOrder": "MANUAL" } }, { "node": { "id": "gid://shopify/Collection/1009501285", "title": "Dummy", "handle": "blank", "updatedAt": "2006-02-02T00:00:00Z", "sortOrder": "MANUAL" } }, { "node": { "id": "gid://shopify/Collection/925420914", "title": "All snowboards called Draft", "handle": "drafts", "updatedAt": "2006-02-02T00:00:00Z", "sortOrder": "MANUAL" } }, { "node": { "id": "gid://shopify/Collection/619119800", "title": "Cheap Stuff", "handle": "cheap", "updatedAt": "2006-02-02T00:00:00Z", "sortOrder": "MANUAL" } } ] } } } ### Retrieves a list of custom collections Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query CustomCollectionList { collections(first: 50, query: \\\"collection_type:custom\\\") { nodes { id handle title updatedAt descriptionHtml publishedOnCurrentPublication sortOrder templateSuffix } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query CustomCollectionList {\n collections(first: 50, query: \"collection_type:custom\") {\n nodes {\n id\n handle\n title\n updatedAt\n descriptionHtml\n publishedOnCurrentPublication\n sortOrder\n templateSuffix\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query CustomCollectionList {\n collections(first: 50, query: \"collection_type:custom\") {\n nodes {\n id\n handle\n title\n updatedAt\n descriptionHtml\n publishedOnCurrentPublication\n sortOrder\n templateSuffix\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query CustomCollectionList {\n collections(first: 50, query: \"collection_type:custom\") {\n nodes {\n id\n handle\n title\n updatedAt\n descriptionHtml\n publishedOnCurrentPublication\n sortOrder\n templateSuffix\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query CustomCollectionList {\n collections(first: 50, query: \"collection_type:custom\") {\n nodes {\n id\n handle\n title\n updatedAt\n descriptionHtml\n publishedOnCurrentPublication\n sortOrder\n templateSuffix\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "collections": { "nodes": [ { "id": "gid://shopify/Collection/395646240", "handle": "ipods_two", "title": "IPods Two", "updatedAt": "2008-02-02T00:00:00Z", "descriptionHtml": "

The best selling ipod ever. Again

", "publishedOnCurrentPublication": true, "sortOrder": "MANUAL", "templateSuffix": null }, { "id": "gid://shopify/Collection/691652237", "handle": "non-ipods", "title": "Non Ipods", "updatedAt": "2013-02-02T00:00:00Z", "descriptionHtml": "

No ipods here

", "publishedOnCurrentPublication": true, "sortOrder": "MANUAL", "templateSuffix": null }, { "id": "gid://shopify/Collection/841564295", "handle": "ipods", "title": "IPods", "updatedAt": "2008-02-02T00:00:00Z", "descriptionHtml": "

The best selling ipod ever

", "publishedOnCurrentPublication": true, "sortOrder": "MANUAL", "templateSuffix": null } ] } } }