---
title: "collection"
description: "Fetch a specific Collection by one of its unique attributes."
doc_type: graphql
doc_category: storefront
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/storefront-api/products/queries/collection'
  md: 'https://developer.shopline.com/docs/storefront-api/products/queries/collection.md'
---
# collection

Fetch a specific Collection by one of its unique attributes.

- **API Version:** v20270301
- **API Type:** Storefront
- **API Protocol:** GraphQL
- **Operation Type:** Query

## Type Signature

`Collection`

## Arguments

* `id`

  [ID](https://developer.shopline.com/docs/storefront-api/common/scalars/id.md)

  The ID of the `Collection`.

* `handle`

  [String](https://developer.shopline.com/docs/storefront-api/common/scalars/string.md)

  The handle of the `Collection`.
  

## Returns

* `banner`

  [Image](https://developer.shopline.com/docs/storefront-api/common-objects/objects/image.md)

  Banner associated with the collection.
  

* `createdAt`

  [Date!](https://developer.shopline.com/docs/storefront-api/common/scalars/date.md)

  The date and time when the collection was created.

* `descriptionHtml`

  [String](https://developer.shopline.com/docs/storefront-api/common/scalars/string.md)

  The description of the collection, complete with HTML formatting.

* `handle`

  [String](https://developer.shopline.com/docs/storefront-api/common/scalars/string.md)

  Automatically generate a unique string based on the title, limited to 255 characters.

* `id`

  [ID!](https://developer.shopline.com/docs/storefront-api/common/scalars/id.md)

  Unique global collection ID

* `image`

  [Image](https://developer.shopline.com/docs/storefront-api/common-objects/objects/image.md)

  Image associated with the collection.

* `metafield`

  [Metafield](https://developer.shopline.com/docs/storefront-api/common-objects/objects/metafield.md)

  Metafield associated with the collection

* `metafields`

  [[Metafield]](https://developer.shopline.com/docs/storefront-api/common-objects/objects/metafield.md)

  Metafields associated with the collection

* `onlineStoreUrl`

  [String](https://developer.shopline.com/docs/storefront-api/common/scalars/string.md)

  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`

  [ProductConnection](https://developer.shopline.com/docs/storefront-api/products/objects/product-connection.md)

  List of products in the collection.

* `~~productsCount~~`

  [Int](https://developer.shopline.com/docs/storefront-api/common/scalars/int.md)

  The number of products associated with the collection. [Deprecated]

* `~~sortOrder~~`

  [String](https://developer.shopline.com/docs/storefront-api/common/scalars/string.md)

  Sort by collection [Deprecated]

* `templatePath`

  [String](https://developer.shopline.com/docs/storefront-api/common/scalars/string.md)

  The path to the theme template.

* `title`

  [String](https://developer.shopline.com/docs/storefront-api/common/scalars/string.md)

  The collection’s name. Limit of 255 characters.

* `updatedAt`

  [Date](https://developer.shopline.com/docs/storefront-api/common/scalars/date.md)

  The date and time when the collection was last modified.

## Code Example

```graphql
 {
	collection(id, handle ) 
		 {
			# Collection fields
		}
}
```

## Error Handling

For detailed information about common codes, see [Status and error codes](https://developer.shopline.com/docs/apps/api-instructions-for-use/storefront-api/overview.md#status-and-error-codes).

