Products
Products represent the items available for sale in your application. On this page, we'll dive into the different product endpoints you can use to manage products programmatically. We'll look at how to query, create, update, and delete products.
The product model
The product model includes detailed information about the product, including its variants, prices, and inventory details.
Properties
- Name
id- Type
- string
- Description
Unique identifier for the product.
- Name
name- Type
- string
- Description
The name of the product.
- Name
description- Type
- string
- Description
The description of the product.
- Name
imageUrl- Type
- string
- Description
URL of the product image.
- Name
price- Type
- number
- Description
The base price of the product.
- Name
discountPrice- Type
- number
- Description
The lowest price of the product.
- Name
currency- Type
- string
- Description
The currency code of the product price.
- Name
variants- Type
- array
- Description
List of product variants.
- Name
id- Type
- string
- Description
Unique identifier for the product variant.
- Name
name- Type
- string
- Description
The name of the variant.
- Name
inventoryQuantity- Type
- number
- Description
The inventory quantity of the variant.
- Name
inventoryTotal- Type
- number
- Description
The total inventory quantity of the variant in grams
- Name
price- Type
- number
- Description
The base price of the variant.
- Name
discountPrice- Type
- number
- Description
The discounted price of the variant.
- Name
discountPercentage- Type
- number
- Description
The discount percentage of the variant.
- Name
currencyCode- Type
- string
- Description
The currency code of the variant price.
- Name
priceListId- Type
- string
- Description
The price list identifier of the variant.
- Name
priceListName- Type
- string
- Description
The name of the price list.
- Name
weight- Type
- number
- Description
The weight of the variant.
- Name
prices- Type
- array
- Description
List of prices for the variant.
- Name
id- Type
- string
- Description
Unique identifier for the price.
- Name
price- Type
- number
- Description
The price amount.
- Name
priceList- Type
- object
- Description
The price list details.
- Name
id- Type
- string
- Description
Unique identifier for the price list.
- Name
name- Type
- string
- Description
The name of the price list.
- Name
currency- Type
- string
- Description
The currency code of the price.
- Name
createdAt- Type
- string
- Description
The timestamp when the price was created.
- Name
quantity- Type
- number
- Description
The quantity of the variant (grams in the fraction).
- Name
strain- Type
- object
- Description
The strain information of the product if it is flower
- Name
cannabinoids- Type
- object
- Description
The cannabinoids content of the strain.
- Name
thc- Type
- number
- Description
The THC content percentage of the strain.
- Name
cbg- Type
- number
- Description
The CBG content percentage of the strain.
- Name
cbd- Type
- number
- Description
The CBD content percentage of the strain.
- Name
terpenes- Type
- array
- Description
List of terpenes present in the strain.
- Name
flavors- Type
- array
- Description
List of flavors associated with the strain.
- Name
genetics- Type
- object
- Description
The genetics of the strain.
- Name
parents- Type
- array
- Description
List of parent strains.
- Name
children- Type
- array
- Description
List of child strains.
- Name
category- Type
- string
- Description
The category of the product.
- Name
isFlower- Type
- boolean
- Description
Whether the product is a flower.
- Name
inventoryQuantity- Type
- number
- Description
The total inventory quantity of the product.
Example product
{
"id": "l7cGNIBKZiNJ6wqF",
"name": "Product 1",
"description": "This is product 1",
"imageUrl": "https://assets.yourapp.com/products/product1.jpg",
"price": 100,
"discountPrice": 80,
"currency": "USD",
"variants": [
{
"id": "variantId",
"name": "Updated Variant",
"inventoryQuantity": 100,
"weight": 10,
"price": 100,
"discountPrice": 80,
"currencyCode": "USD",
"priceListId": "priceListId",
"priceListName": "Price List",
"prices": [
{
"id": "priceId",
"price": 100,
"priceList": {
"id": "priceListId",
"name": "Price List"
},
"currency": "USD",
"createdAt": "2023-05-13T12:00:00Z"
},
{
"id": "priceId",
"price": 80,
"priceList": {
"id": "priceListId",
"name": "Price List"
},
"currency": "USD",
"createdAt": "2023-05-14T12:00:00Z"
}
]
}
],
"strain": {
"cannabinoids": {
"thc": 18,
"cbg": 1,
"cbd": 0.1
},
"terpenes": ["Myrcene", "Pinene", "Caryophyllene"],
"flavors": ["Berry", "Sweet", "Earthy"],
"genetics": {
"parents": ["Blueberry", "Haze"],
"children": ["Dream Berry"]
}
},
"category": "Category 1",
"isFlower": true,
"inventoryQuantity": 50
}
List all products
This endpoint allows you to retrieve a paginated list of all your products. By default, a maximum of ten products are shown per page.
Optional attributes
- Name
category- Type
- string
- Description
Filter products by category.
- Name
limit- Type
- integer
- Description
Limit the number of products returned.
- Name
page- Type
- integer
- Description
Start offset of products returned.
- Name
sort- Type
- string
- Description
Sort the list of products by specified attribute.
- Name
direction- Type
- string
- Description
Sort direction, can be 'asc' or 'desc'.
- Name
search- Type
- string
- Description
Search products by name or description.
Request
curl -G https://api.yourapp.com/store/products \
-H "Authorization: Bearer {token}" \
-d limit=10
Response
[
{
"id": "l7cGNIBKZiNJ6wqF",
"name": "Product 1",
"description": "This is product 1",
"imageUrl": "https://assets.yourapp.com/products/product1.jpg",
"price": 100,
"discountPrice": 80,
"currency": "USD",
"variants": [
{
"id": "variant1",
"name": "Variant 1",
"inventoryQuantity": 50,
"price": 100,
"currencyCode": "USD",
// ...
}
],
"strain": null,
"category": "Category 1",
"isFlower": true,
"inventoryQuantity": 50
}
]
Retrieve a product
This endpoint allows you to retrieve a product by providing the product ID.
Request
curl https://api.yourapp.com/admin/products/:id \
-H "Authorization: Bearer {token}"
Response
{
"id": "l7cGNIBKZiNJ6wqF",
"name": "Product 1",
"description": "This is product 1",
"imageUrl": "https://assets.yourapp.com/products/product1.jpg",
"price": 100,
"discountPrice": 80,
"currency": "USD",
"variants": [
{
"id": "variant1",
"name": "Variant 1",
"inventoryQuantity": 50,
"price": 100,
"currencyCode": "USD"
}
],
"strain": null,
"category": "Category 1",
"isFlower": true,
"inventoryQuantity": 50
}
Create a product
This endpoint allows you to create a new product in your application.
Medusa Reference
Required attributes
- Name
name- Type
- string
- Description
The name of the product.
- Name
description- Type
- string
- Description
The description of the product.
- Name
imageUrl- Type
- string
- Description
URL of the product image.
- Name
category- Type
- string
- Description
The category of the product.
Optional attributes
- Name
strain- Type
- object
- Description
The strain information of the product.
Request
curl -X POST https://api.yourapp.com/admin/products \
-H "Authorization: Bearer {token}" \
-d '{
"name": "Product 1",
"description": "This is product 1",
"imageUrl": "https://assets.yourapp.com/products/product1.jpg",
"currency": "USD"
}'
Response
{
"id": "l7cGNIBKZiNJ6wqF",
"name": "Product 1",
"description": "This is product 1",
"imageUrl": "https://assets.yourapp.com/products/product1.jpg",
"currency": "USD",
"variants": [],
"strain": null,
"category": "Category 1",
"isFlower": true,
}
Update a product
This endpoint allows you to update an existing product in your application.
Medusa Reference
Optional attributes
- Name
name- Type
- string
- Description
The name of the product.
- Name
description- Type
- string
- Description
The description of the product.
- Name
imageUrl- Type
- string
- Description
URL of the product image.
- Name
category- Type
- string
- Description
The category of the product.
- Name
strain- Type
- object
- Description
The strain information of the product.
Request
curl -X PUT https://api.yourapp.com/admin/products/:id \
-H "Authorization: Bearer {token}" \
-d '{
"name": "Updated Product",
"description": "This is an updated product",
"imageUrl": "https://assets.yourapp.com/products/updatedproduct.jpg",
}'
Response
{
"id": "l7cGNIBKZiNJ6wqF",
"name": "Updated Product",
"description": "This is an updated product",
"imageUrl": "https://assets.yourapp.com/products/updatedproduct.jpg",
"currency": "USD",
"variants": [],
"strain": null,
"category": "Category 1",
"isFlower": true,
}
Create a product variant
This endpoint allows you to create a new product variant in your application.
Medusa Reference
Required attributes
- Name
name- Type
- string
- Description
The name of the variant.
- Name
inventoryQuantity- Type
- number
- Description
The inventory quantity of the variant.
- Name
currencyCode- Type
- string
- Description
The currency code of the variant price.
Optional attributes
- Name
weight- Type
- number
- Description
The weight of the variant.
Request
curl -X POST https://api.yourapp.com/admin/products/:productId/variants \
-H "Authorization: Bearer {token}" \
-d '{
"name": "New Variant",
"inventoryQuantity": 50,
"currencyCode": "USD"
}'
Response
{
"id": "variantId",
"name": "New Variant",
"inventoryQuantity": 50,
"currencyCode": "USD",
"weight": 10
}
Update a product variant
This endpoint allows you to update an existing product variant in your application.
Medusa Reference
Optional attributes
- Name
name- Type
- string
- Description
The name of the variant.
- Name
inventoryQuantity- Type
- number
- Description
The inventory quantity of the variant.
- Name
weight- Type
- number
- Description
The weight of the variant.
Request
curl -X PUT https://api.yourapp.com/admin/products/:productId/variants/:variantId \
-H "Authorization: Bearer {token}" \
-d '{
"name": "Updated Variant",
"inventoryQuantity": 100,
"weight": 10
}'
Response
{
"id": "variantId",
"name": "Updated Variant",
"inventoryQuantity": 100,
"weight": 10,
"price": 100,
"discountPrice": 80,
"currencyCode": "USD",
"priceListId": "priceListId",
"priceListName": "Price List",
"prices": [
{
"id": "priceId",
"price": 100,
"priceList": {
"id": "priceListId",
"name": "Price List"
},
"currency": "USD",
"createdAt": "2023-05-13T12:00:00Z"
},
{
"id": "priceId",
"price": 80,
"priceList": {
"id": "priceListId",
"name": "Price List"
},
"currency": "USD",
"createdAt": "2023-05-14T12:00:00Z"
}
]
}