Manage Collections
The Collections API allows you to manage collection metadata for your Marqo account. Collections are product groupings (like "shirts", "electronics", or "sale items") that you can browse using the Browse Collections feature.
Note: You don't need to use the Create Collections API unless you want to add additional metadata to Marqo or call your collection something different in your merchandising/store metadata alongside your collection. Otherwise, Marqo will automatically define the collection name based on the collectionName
field from your product data (or another field name configured when the index is created).
This API lets you add custom metadata to your collections, such as display names, alternative IDs, or any other information you want to use in your merchandising interface.
Prerequisites
- A Marqo Cloud account
- Your Marqo API key (find your API key guide)
Collections API Endpoints
List Collections
Retrieve all collections and their metadata for your account.
curl https://ecom.marqo-ep.ai/api/v1/collections \
-H "Authorization: Bearer {api_key}"
Note: Replace {api_key}
with your API key.
Create Collection
Add a new collection with custom metadata.
curl -X POST https://ecom.marqo-ep.ai/api/v1/collections \
-H "Authorization: Bearer {api_key}" \
-H "Content-Type: application/json" \
-d '{
"id": "summer-sale",
"displayName": "Summer Sale Collection",
"metadata": {
"category": "seasonal",
"discount": "30%",
"startDate": "2024-06-01",
"endDate": "2024-08-31"
}
}'
Parameters:
- id
: Unique identifier for the collection
- displayName
: Human-readable name for display in your UI
- metadata
: Optional key-value pairs for additional collection information
Get Collection
Retrieve metadata for a specific collection.
curl https://ecom.marqo-ep.ai/api/v1/collections/summer-sale \
-H "Authorization: Bearer {api_key}"
Note: Replace summer-sale
with your collection ID.
Delete Collection
Remove a collection and its metadata.
curl -X DELETE https://ecom.marqo-ep.ai/api/v1/collections/summer-sale \
-H "Authorization: Bearer {api_key}"
Note: Replace summer-sale
with your collection ID.