List All Categories
Authentication
This endpoint does not require authentication. It is publicly accessible.
Query Parameters
Search categories by name
Response
Unique category identifier
URL-friendly category identifier (auto-generated from name)
Request Example
curl -X GET "https://api.example.com/api/v1/categories/" \
-H "Accept: application/json"
Response Example
[
{
"id": 1,
"name": "Electronics",
"slug": "electronics"
},
{
"id": 2,
"name": "Clothing",
"slug": "clothing"
},
{
"id": 3,
"name": "Home & Garden",
"slug": "home-garden"
}
]
Get Category Details
Retrieve a specific category along with all its associated products.
GET /api/v1/categories/{slug}/
Authentication
This endpoint does not require authentication. It is publicly accessible.
Path Parameters
The URL-friendly slug identifier of the category
Response
Unique category identifier
URL-friendly category identifier
Array of all products in this category
Unique product identifier
Product base price or lowest variant price
Product media (images/videos)
Active offers for the product
Request Example
curl -X GET "https://api.example.com/api/v1/categories/electronics/" \
-H "Accept: application/json"
Response Example
{
"id": 1,
"name": "Electronics",
"slug": "electronics",
"product_set": [
{
"id": 1,
"name": "Premium Wireless Headphones",
"category": "Electronics",
"description": "High-quality wireless headphones with noise cancellation",
"store": "https://api.example.com/api/v1/stores/tech-store/",
"base_price": "149.99",
"shipping_fee": "5.99",
"rating": 4.5,
"is_standalone": false,
"total_stock_level": 250,
"total_sold": 1050,
"is_available": true,
"is_active": true,
"created": "2024-01-15T10:30:00Z",
"updated": "2024-03-01T14:22:00Z",
"media": [
{
"id": 1,
"file": "https://cdn.example.com/products/2024/01/headphones.jpg",
"is_primary": true,
"file_size": 2.45,
"file_type": "image"
}
],
"product_offers": []
},
{
"id": 2,
"name": "4K Smart TV",
"category": "Electronics",
"description": "55-inch 4K Ultra HD Smart LED TV",
"store": "https://api.example.com/api/v1/stores/tech-store/",
"base_price": "599.99",
"shipping_fee": "29.99",
"rating": 4.7,
"is_standalone": true,
"total_stock_level": 45,
"total_sold": 230,
"is_available": true,
"is_active": true,
"created": "2024-01-20T09:15:00Z",
"updated": "2024-02-28T11:30:00Z",
"media": [
{
"id": 5,
"file": "https://cdn.example.com/products/2024/01/tv-main.jpg",
"is_primary": true,
"file_size": 3.12,
"file_type": "image"
}
],
"product_offers": [
{
"id": 15,
"name": "Electronics Clearance - 20% Off",
"discount_type": "percentage",
"discount_value": "20.00"
}
]
}
]
}
Error Responses
Category with the specified slug does not exist{
"detail": "Not found."
}
List Products by Category
Get a paginated list of products filtered by category slug.
GET /api/v1/products/categories/{slug}/
Authentication
This endpoint does not require authentication. It is publicly accessible.
Path Parameters
The URL-friendly slug identifier of the category
Query Parameters
Search products within this category
Filter by availability status
Number of products per page
Request Example
curl -X GET "https://api.example.com/api/v1/products/categories/electronics/" \
-H "Accept: application/json"
Response Example
{
"count": 45,
"next": "https://api.example.com/api/v1/products/categories/electronics/?limit=10&offset=10",
"previous": null,
"results": [
{
"id": 1,
"name": "Premium Wireless Headphones",
"category": "Electronics",
"base_price": "149.99",
"rating": 4.5,
"is_available": true,
"media": [...],
"product_offers": [...]
}
]
}
Notes
- Categories are ordered alphabetically by name
- Category slugs are automatically generated from the category name when created
- Slugs are URL-safe and lowercase (e.g., “Home & Garden” becomes “home-garden”)
- Products within categories are ordered by
total_sold (descending) and then by rating (descending)
- The category lookup by slug is case-sensitive