---
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/objects/collection'
  md: 'https://developer.shopline.com/docs/storefront-api/products/objects/collection.md'
---
# Collection

Fetch a specific Collection by one of its unique attributes.

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

## Type Signature

`Collection`

## Fields

* `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.

## Schema Definition

```graphql
type Collection { 
	banner: Image
	createdAt: Date!
	descriptionHtml: String
	handle: String
	id: ID!
	image: Image
	metafield(identifier,HasMetafieldsIdentifierInput!): Metafield
	metafields(identifiers,[HasMetafieldsIdentifierInput!]!): [Metafield]
	onlineStoreUrl: String
	products(filters,[ProductFilterInput],first,Int,last,Int,before,String,after,String,reverse,Boolean,query,String,sortKey,ProductCollectionSortKeys): ProductConnection
	productsCount: Int
	sortOrder: String
	templatePath: String
	title: String
	updatedAt: Date 
}
```

## Field from

* [CollectionEdge](https://developer.shopline.com/docs/storefront-api/products/objects/collection-edge.md).node

  The item at the end of CollectionEdge.

* [Query](https://developer.shopline.com/docs/storefront-api/products/queries/collection.md).collection

  通过其独特属性之一获取特定分类

* [Query](https://developer.shopline.com/docs/storefront-api/products/queries/proxy-node-collection.md).proxyNodeCollection

  当前接口即将下线，新增接入将无法直接使用。如需申请使用权限，请通过工单系统联系平台。

* [CollectionConnection](https://developer.shopline.com/docs/storefront-api/products/objects/collection-connection.md).nodes

   A list of the nodes contained in CollectionEdge.

## 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).

