Skip to main content
GET
/
api
/
product
/
:slug
Get Product Details
curl --request GET \
  --url https://api.example.com/api/product/:slug \
  --header 'x-api-key: <x-api-key>'
{
  "statusCode": 123,
  "message": "<string>",
  "data": {
    "id": 123,
    "name": "<string>",
    "slug": "<string>",
    "description": "<string>",
    "variant": [
      {}
    ],
    "price": 123,
    "stock": 123,
    "category_id": 123,
    "category_name": "<string>",
    "category_slug": "<string>",
    "img_urls": [
      {}
    ],
    "created_at": "<string>",
    "total_reviews": 123,
    "reviews": [
      {
        "id": 123,
        "product_id": 123,
        "user_id": 123,
        "user_name": "<string>",
        "rating": 123,
        "comment": "<string>",
        "created_at": "<string>"
      }
    ]
  }
}

Authentication

This endpoint requires an API key to be passed in the header.
x-api-key
string
required
Your API key for authentication

Path Parameters

slug
string
required
The URL-friendly product identifier (e.g., “classic-cotton-shirt”)

Response

statusCode
integer
HTTP status code (200 for success, 404 if product not found)
message
string
Response message
data
object
Detailed product information

Example Request

curl --request GET \
  --url 'https://api.example.com/api/product/classic-cotton-shirt' \
  --header 'x-api-key: your_api_key_here'

Example Response

{
  "statusCode": 200,
  "message": "Product details fetched successfully",
  "data": {
    "id": 1,
    "name": "Classic Cotton Shirt",
    "slug": "classic-cotton-shirt",
    "description": "A comfortable cotton shirt perfect for everyday wear. Made from 100% organic cotton with breathable fabric and modern fit.",
    "variant": ["S", "M", "L", "XL"],
    "price": 29.99,
    "stock": 150,
    "category_id": 1,
    "category_name": "Men's Clothing",
    "category_slug": "mens-clothing",
    "img_urls": [
      "uploads/products/shirt-1.jpg",
      "uploads/products/shirt-2.jpg",
      "uploads/products/shirt-3.jpg"
    ],
    "created_at": "2026-01-15T10:30:00.000Z",
    "total_reviews": 2,
    "reviews": [
      {
        "id": 5,
        "product_id": 1,
        "user_id": 12,
        "user_name": "John Doe",
        "rating": 5,
        "comment": "Great quality shirt! Very comfortable and fits perfectly.",
        "created_at": "2026-02-01T14:20:00.000Z"
      },
      {
        "id": 3,
        "product_id": 1,
        "user_id": 8,
        "user_name": "Jane Smith",
        "rating": 4,
        "comment": "Good value for money. The fabric is nice and soft.",
        "created_at": "2026-01-28T09:15:00.000Z"
      }
    ]
  }
}

Error Response

If the product is not found:
{
  "statusCode": 404,
  "message": "Product not found"
}

Build docs developers (and LLMs) love