--- displayed_sidebar: jsClientSidebar slug: /references/js-client/CollectionsResource --- import ParameterTypes from "@site/src/components/ParameterTypes" # CollectionsResource This class is used to send requests to [Store Product Collection API Routes](https://docs.medusajs.com/api/store#product-collections). All its method are available in the JS Client under the `medusa.collections` property. A product collection is used to organize products for different purposes such as marketing or discount purposes. For example, you can create a Summer Collection. Using the methods in this class, you can list or retrieve a collection's details and products. ## Methods ### list Retrieve a list of product collections. The product collections can be filtered by fields such as `handle` or `created_at` passed in the `query` parameter. The product collections can also be paginated. #### Example To list product collections: ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.collections.list().then(({ collections, limit, offset, count }) => { console.log(collections.length) }) ``` By default, only the first `10` records are retrieved. You can control pagination by specifying the `limit` and `offset` properties: ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.collections .list({ limit, offset, }) .then(({ collections, limit, offset, count }) => { console.log(collections.length) }) ``` #### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> #### Returns `", "description": "An optional key-value map with additional details", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "products", "type": "[Product](../internal/classes/internal.Product.mdx)[]", "description": "The details of the products that belong to this product collection.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "title", "type": "`string`", "description": "The title that the Product Collection is identified by.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "updated_at", "type": "`Date`", "description": "The date with timezone at which the resource was updated.", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ] } ] } ] } ]} /> ___ ### retrieve Retrieve a product collection's details. #### Example ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) medusa.collections.retrieve(collectionId).then(({ collection }) => { console.log(collection.id) }) ``` #### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> #### Returns `", "description": "An optional key-value map with additional details", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "products", "type": "[Product](../internal/classes/internal.Product.mdx)[]", "description": "The details of the products that belong to this product collection.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "title", "type": "`string`", "description": "The title that the Product Collection is identified by.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "updated_at", "type": "`Date`", "description": "The date with timezone at which the resource was updated.", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ] } ] } ] } ]} />