Skip to main content

Endpoint

GET /api/v1/products/

Authentication

This endpoint does not require authentication. It is publicly accessible.

Query Parameters

Search products by name, category name, label, or store brand name
category
integer
Filter products by category ID
is_available
boolean
Filter by product availability status
  • true - Only show available products
  • false - Only show unavailable products
store
integer
Filter products by store ID
limit
integer
default:"10"
Number of products to return per page
offset
integer
default:"0"
Number of products to skip for pagination

Response

count
integer
Total number of products matching the query
next
string
URL for the next page of results (null if no more pages)
previous
string
URL for the previous page of results (null if first page)
results
array
Array of product objects

Request Examples

curl -X GET "https://api.example.com/api/v1/products/" \
  -H "Accept: application/json"

Response Example

200 OK
{
  "count": 156,
  "next": "https://api.example.com/api/v1/products/?limit=10&offset=10",
  "previous": null,
  "results": [
    {
      "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-main.jpg",
          "is_primary": true,
          "file_size": 2.45,
          "file_type": "image"
        },
        {
          "id": 2,
          "file": "https://cdn.example.com/products/2024/01/headphones-demo.mp4",
          "is_primary": false,
          "file_size": 8.12,
          "file_type": "video"
        }
      ],
      "product_offers": [
        {
          "id": 10,
          "name": "Spring Sale - 15% Off Electronics",
          "discount_type": "percentage",
          "discount_value": "15.00"
        }
      ]
    }
  ]
}

Error Responses

400
Bad Request
Invalid query parameters
{
  "error": "Invalid value for is_available parameter"
}

Notes

  • Products are ordered by total_sold (descending) and then by rating (descending)
  • The base_price field returns the product’s base price, or the lowest variant price if the product has variants
  • The search functionality searches across product name, category name, label, and store brand name
  • Only active products are included in the results by default
  • Media files have a 10MB size limit
  • Supported image formats: JPEG, PNG, WebP
  • Supported video formats: MP4, WebM

Build docs developers (and LLMs) love