Create Collection

🔒

Requires write_collection access scope. More access scope

The Create Collection API allows users to create a new collection in the store, including details like the title, description, associated products, SEO attributes, and merchandise sorting rules. This endpoint provides flexibility for managing collections and organizing products effectively.This API is especially useful for:

  1. Create a collection to group related products for better categorization.
  2. Apply specific sorting rules to arrange products in the collection.

Request Parameters

Public Request Parameters

📘

Public Request Parameters

Body Parameters

Parameter Type Required Example Description
title string Yes Summer Collection The name of the collection.
handle string No summer-collection A unique URL-friendly identifier for the collection.
description string No A collection of summer products. The description of the collection.
image object No Image Object
image.src string No http://cdn.shoplazza.com/image.jpg The source URL of the collection image.
image.width int32 No 300 The width of the collection image in pixels.
image.height int32 No 300 The height of the collection image in pixels.
image.alt string No Summer Collection Image Alt text for the collection image.
seo_title string No Summer Collection The SEO title for the collection.
seo_description string No Explore our summer collection. The SEO description for the collection.
seo_keywords string No summer, collection, products Comma-separated keywords for SEO.
sort_order string No sales-desc Merchandise sorting rules. Options include: manual (default), sales-desc, price-asc, price-desc, views-desc, vendor-asc, vendor-desc, created-desc, and more.
product_ids string No 123e4567-e89b-12d3-a456-426614174000 Comma-separated list of product IDs to include in the collection. Must be valid UUIDs.

Sort Order Options

  • manual: Default manual sorting.
  • sales-desc: By total sales volume, high to low.
  • published-desc: By product published time, newest first.
  • real-sales-desc: By product real sales, more to less.
  • inventory-quantity-asc: By inventory quantity, less to more.
  • inventory-quantity-desc: By inventory quantity, more to less.
  • views-desc: By product page views, more to less.
  • add-to-cart-count-desc: By add-to-cart count, more to less.
  • updated-desc: By product update time, newest first.
  • vendor-asc: By supplier name A-Z.
  • vendor-desc: By supplier name Z-A.
  • alpha-asc: By product title A-Z.
  • alpha-desc: By product title Z-A.
  • price-asc: By price, low to high.
  • price-desc: By price, high to low.
  • created-desc: By creation time, newest first.

Response Explanation

Public Response Parameters

📘

Public Response Parameters

Success Response

Field Type Example Description
id string a60fe556-43ad-4e07-9125-507ac1bf71f7 Unique identifier of the collection.
title string Test-Collection Name of the collection.
description string Desc Description of the collection.
handle string test-collection URL-friendly handle for the collection.
smart boolean false Indicates whether the collection is smart.
image object Image Object Object containing details of the collection image.
image.src string //cdn.shoplazza.com/loading.png Source URL of the collection image.
image.width integer 100 Width of the collection image in pixels.
image.height integer 100 Height of the collection image in pixels.
image.alt string "" Alt text for the collection image.
image.path string loading.png File path of the collection image.
seo_title string seo_title SEO title of the collection.
seo_description string Desc SEO description of the collection.
seo_keywords string test SEO keywords associated with the collection.
sort_order string title-asc Merchandise sorting rules. Options include: manual (default), sales-desc, price-asc, price-desc, views-desc, vendor-asc, vendor-desc, created-desc, and more. (see Sort Order Options).
created_at string 2024-04-16T10:31:12Z Timestamp when the collection was created.
updated_at string 2024-04-16T10:31:12Z Timestamp when the collection was last updated.

Error Response

Error responses in the API can be represented using two different fields: errors and error. Both fields provide details about issues encountered during request processing. Below is an explanation of the fields with their respective examples and descriptions.

FieldTypeExampleDescription
errorsArray[ "Title is taken."]A list of errors encountered during the request processing.
FieldTypeExampleDescription
errorArray "store is not active"Indicates an error encountered during the process.

Error Details

Status CodeMessagePossible ReasonExample Response
400Bad RequestInvalid input format or request structure (e.g., missing required fields or incorrect data types).Bad Request
UnauthorizedThe request is missing valid authentication credentials or the credentials provided are invalid.Unauthorized
422Invalid or empty product_id, or product_id is not foundMissing required product_id, or incorrect UUID types.{ "errors": [ "productIds has an invalid UUID"]}
Title is takentitle is already existed{ "errors": ["Title is taken."] }
Unprocessable EntityMissing required field input, or invalid field input{ "errors": ["Title is required."] }
404Record Not FoundThe collection could not be created due to missing or invalid data, or the specified products do not exist.{ "errors": ["Record is required."] }

API Structure Overview

Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!