Skip to main content

Endpoint

GET /api/v1/products/{id}/

Authentication

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

Path Parameters

id
integer
required
The unique identifier of the product

Response

id
integer
Unique product identifier
name
string
Product name
category
string
Category name the product belongs to
description
string
Detailed product description
store
string
Hyperlink to the store details
base_price
string
Base price of the product (decimal format)
shipping_fee
string
Shipping fee for the product (can be null)
rating
float
Average customer rating calculated from all reviews (null if no reviews)
is_standalone
boolean
Whether the product has variants or is a standalone item
total_stock_level
integer
Total available stock quantity across all variants
total_sold
integer
Total number of units sold across all variants
is_available
boolean
Current availability status (true if stock_level > 0)
is_active
boolean
Whether the product is active in the system
created
string
ISO 8601 timestamp of product creation
updated
string
ISO 8601 timestamp of last update
media
array
Array of product media objects (images/videos)
product_offers
array
Array of active offers applicable to this product
variants
array
Array of product variants with different attributes and pricing
reviews
array
Array of customer reviews for this product

Request Example

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

Response Example

200 OK
{
  "id": 1,
  "name": "Premium Wireless Headphones",
  "category": "Electronics",
  "description": "High-quality wireless headphones with active noise cancellation, 30-hour battery life, and premium sound quality. Perfect for music lovers and professionals.",
  "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"
    }
  ],
  "product_offers": [
    {
      "id": 10,
      "name": "Spring Sale - 15% Off Electronics",
      "discount_type": "percentage",
      "discount_value": "15.00"
    }
  ],
  "variants": [
    {
      "id": 1,
      "sku": "WH-1000-BLK",
      "is_default": true,
      "price_adjustment": "0.00",
      "stock_level": 100,
      "quantity_sold": 450,
      "is_active": true,
      "created": "2024-01-15T10:30:00Z",
      "updated": "2024-03-01T14:22:00Z",
      "attributes": [
        {
          "attribute": "Color",
          "value": "Black"
        }
      ]
    },
    {
      "id": 2,
      "sku": "WH-1000-WHT",
      "is_default": false,
      "price_adjustment": "10.00",
      "stock_level": 75,
      "quantity_sold": 320,
      "is_active": true,
      "created": "2024-01-15T10:30:00Z",
      "updated": "2024-03-01T14:22:00Z",
      "attributes": [
        {
          "attribute": "Color",
          "value": "White"
        }
      ]
    }
  ],
  "reviews": [
    {
      "id": 15,
      "user": "john_doe",
      "review_text": "Excellent sound quality and comfortable for long listening sessions. The noise cancellation is impressive!",
      "rating": 5,
      "sentiment": "POSITIVE",
      "sentiment_score": 0.92,
      "is_active": true,
      "created": "2024-02-20T15:45:00Z",
      "updated": "2024-02-20T15:45:00Z",
      "reviewimage_set": [
        {
          "id": 1,
          "image": "https://cdn.example.com/reviews/headphones-review-1.jpg",
          "is_primary": true
        }
      ]
    }
  ]
}

Error Responses

404
Not Found
Product with the specified ID does not exist
{
  "detail": "Not found."
}

Notes

  • Only active products are returned (products where is_active=True)
  • The rating is automatically calculated from all product reviews
  • Stock levels and availability are automatically updated when variants change
  • The price_adjustment on variants is added to the base_price to get the actual variant price
  • Standalone products (is_standalone=True) can only have one default variant
  • Review sentiment analysis may be automatically performed on review submission

Build docs developers (and LLMs) love