---
title: collection - Storefront API
description: >
  Retrieves a single
  [`Collection`](/docs/api/storefront/2025-07/objects/Collection) by its ID or
  handle. Use the
  [`products`](/docs/api/storefront/2025-07/objects/Collection#field-Collection.fields.products)
  field to access items in the collection.
api_version: 2025-07
api_name: storefront
type: query
api_type: graphql
source_url:
  html: 'https://shopify.dev/docs/api/storefront/2025-07/queries/collection'
  md: 'https://shopify.dev/docs/api/storefront/2025-07/queries/collection.md'
---

# collection

query

Retrieves a single [`Collection`](https://shopify.dev/docs/api/storefront/2025-07/objects/Collection) by its ID or handle. Use the [`products`](https://shopify.dev/docs/api/storefront/2025-07/objects/Collection#field-Collection.fields.products) field to access items in the collection.

## Arguments

* handle

  [String](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

  The handle of the `Collection`.

* id

  [ID](https://shopify.dev/docs/api/storefront/2025-07/scalars/ID)

  The ID of the `Collection`.

***

## Possible returns

* Collection

  [Collection](https://shopify.dev/docs/api/storefront/2025-07/objects/Collection)

  A group of products [organized by a merchant](https://help.shopify.com/manual/products/collections) to make their store easier to browse. Collections can help customers discover related products by category, season, promotion, or other criteria.

  Query a collection's products with [filtering options](https://shopify.dev/docs/storefronts/headless/building-with-the-storefront-api/products-collections/filter-products) like availability, price range, vendor, and tags. Each collection includes [`SEO`](https://shopify.dev/docs/api/storefront/2025-07/objects/SEO) information, an optional [`Image`](https://shopify.dev/docs/api/storefront/2025-07/objects/Image), and supports custom data through [`metafields`](https://shopify.dev/docs/api/storefront/2025-07/objects/Metafield).

  * description

    [String!](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

    non-null

    Stripped description of the collection, single line with HTML tags removed.

    * truncate​At

      [Int](https://shopify.dev/docs/api/storefront/2025-07/scalars/Int)

      ### Arguments

      Truncates a string after the given length.

    ***

  * description​Html

    [HTML!](https://shopify.dev/docs/api/storefront/2025-07/scalars/HTML)

    non-null

    The description of the collection, complete with HTML formatting.

  * handle

    [String!](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

    non-null

    A human-friendly unique string for the collection automatically generated from its title. Limit of 255 characters.

  * id

    [ID!](https://shopify.dev/docs/api/storefront/2025-07/scalars/ID)

    non-null

    A globally-unique ID.

  * image

    [Image](https://shopify.dev/docs/api/storefront/2025-07/objects/Image)

    Image associated with the collection.

  * metafield

    [Metafield](https://shopify.dev/docs/api/storefront/2025-07/objects/Metafield)

    Token access required

    A [custom field](https://shopify.dev/docs/apps/build/custom-data), including its `namespace` and `key`, that's associated with a Shopify resource for the purposes of adding and storing additional information.

    * namespace

      [String](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

      ### Arguments

      The container the metafield belongs to. If omitted, the app-reserved namespace will be used.

    * key

      [String!](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

      required

      The identifier for the metafield.

    ***

  * metafields

    [\[Metafield\]!](https://shopify.dev/docs/api/storefront/2025-07/objects/Metafield)

    non-null Token access required

    A list of [custom fields](https://shopify.dev/docs/apps/build/custom-data) that a merchant associates with a Shopify resource.

    * identifiers

      [\[Has​Metafields​Identifier!\]!](https://shopify.dev/docs/api/storefront/2025-07/input-objects/HasMetafieldsIdentifier)

      required

      ### Arguments

      The list of metafields to retrieve by namespace and key.

      The input must not contain more than `250` values.

    ***

  * online​Store​Url

    [URL](https://shopify.dev/docs/api/storefront/2025-07/scalars/URL)

    The URL used for viewing the resource on the shop's Online Store. Returns `null` if the resource is currently not published to the Online Store sales channel.

  * products

    [Product​Connection!](https://shopify.dev/docs/api/storefront/2025-07/connections/ProductConnection)

    non-null

    List of products in the collection.

    * first

      [Int](https://shopify.dev/docs/api/storefront/2025-07/scalars/Int)

      ### Arguments

      Returns up to the first `n` elements from the list.

    * after

      [String](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

      Returns the elements that come after the specified cursor.

    * last

      [Int](https://shopify.dev/docs/api/storefront/2025-07/scalars/Int)

      Returns up to the last `n` elements from the list.

    * before

      [String](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

      Returns the elements that come before the specified cursor.

    * reverse

      [Boolean](https://shopify.dev/docs/api/storefront/2025-07/scalars/Boolean)

      Default:false

      Reverse the order of the underlying list.

    * sort​Key

      [Product​Collection​Sort​Keys](https://shopify.dev/docs/api/storefront/2025-07/enums/ProductCollectionSortKeys)

      Default:COLLECTION\_DEFAULT

      Sort the underlying list by the given key.

    * filters

      [\[Product​Filter!\]](https://shopify.dev/docs/api/storefront/2025-07/input-objects/ProductFilter)

      Returns a subset of products matching all product filters.

      The input must not contain more than `250` values.

    ***

  * seo

    [SEO!](https://shopify.dev/docs/api/storefront/2025-07/objects/SEO)

    non-null

    The collection's SEO information.

  * title

    [String!](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

    non-null

    The collection’s name. Limit of 255 characters.

  * tracking​Parameters

    [String](https://shopify.dev/docs/api/storefront/2025-07/scalars/String)

    URL parameters to be added to a page URL to track the origin of on-site search traffic for [analytics reporting](https://help.shopify.com/manual/reports-and-analytics/shopify-reports/report-types/default-reports/behaviour-reports). Returns a result when accessed through the [search](https://shopify.dev/docs/api/storefront/2025-07/queries/search) or [predictiveSearch](https://shopify.dev/docs/api/storefront/2025-07/queries/predictiveSearch) queries, otherwise returns null.

  * updated​At

    [Date​Time!](https://shopify.dev/docs/api/storefront/2025-07/scalars/DateTime)

    non-null

    The date and time when the collection was last modified.

***

## Examples

* ### collection reference
