Products
Ce contenu n’est pas encore disponible dans votre langue.
Overview
Section titled “Overview”The Products resource provides fake product data with names, prices, descriptions, categories, brands, and stock information.
Endpoints
Section titled “Endpoints”| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/products | List all products |
| GET | /v1/products/:id | Get a specific product |
| GET | /v1/products/:id/reviews | Get product's reviews |
Product Object
Section titled “Product Object”{ "id": 1, "name": "Ergonomic Rubber Keyboard", "slug": "ergonomic-rubber-keyboard", "description": "Carbonite neutralizes our open-source, virtual RAM drive.", "price": 299.99, "currency": "USD", "discountPercentage": 10, "stock": 50, "sku": "KEYB-001", "brandId": 1, "categoryId": 1, "rating": 4.5, "thumbnail": "https://example.com/images/keyboard.jpg", "images": [ "https://example.com/images/keyboard.jpg", "https://example.com/images/keyboard-2.jpg" ], "status": "active", "category": "smartphones", "createdAt": "2026-01-15T10:30:00.000Z", "updatedAt": "2026-01-15T10:30:00.000Z"}| Field | Type | Description |
|---|---|---|
id |
number |
Unique identifier |
name |
string |
Product name |
slug |
string |
URL-friendly unique slug |
description |
string |
Product description |
price |
number |
Product price |
currency |
string |
Currency code (e.g. USD) |
discountPercentage |
number |
Discount percentage (0–100) |
stock |
number |
Available stock count |
sku |
string |
Stock keeping unit |
brandId |
number |
ID of the brand |
categoryId |
number |
ID of the category |
rating |
number |
Average rating (0–5) |
thumbnail |
string |
Thumbnail image URL |
images |
string[] |
Array of image URLs |
status |
string |
Status (active, draft, archived) |
category |
string |
Legacy category string |
createdAt |
string |
ISO 8601 timestamp |
updatedAt |
string |
ISO 8601 timestamp |
List Products
Section titled “List Products”curl https://api.phantomjson.app/v1/productsQuery Parameters
Section titled “Query Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
page |
number |
1 |
Page number |
limit |
number |
20 |
Items per page (max: 100) |
sort |
string |
— | Sort field and direction |
q |
string |
— | Search query |
fields |
string |
— | Fields to return |
name |
string |
— | Filter by name |
category |
string |
— | Filter by category string |
categoryId |
number |
— | Filter by category ID |
brandId |
number |
— | Filter by brand ID |
status |
string |
— | Filter by status |
Response
Section titled “Response”{ "data": [ { "id": 1, "name": "Ergonomic Rubber Keyboard", "slug": "ergonomic-rubber-keyboard", "price": 299.99, "currency": "USD", "category": "smartphones" } ], "meta": { "total": 100, "page": 1, "limit": 20, "totalPages": 5 }}Get Product by ID
Section titled “Get Product by ID”curl https://api.phantomjson.app/v1/products/1Response
Section titled “Response”{ "data": { "id": 1, "name": "Ergonomic Rubber Keyboard", "slug": "ergonomic-rubber-keyboard", "description": "Carbonite neutralizes our open-source, virtual RAM drive.", "price": 299.99, "currency": "USD", "discountPercentage": 10, "stock": 50, "sku": "KEYB-001", "brandId": 1, "categoryId": 1, "rating": 4.5, "status": "active" }}Get Product’s Reviews
Section titled “Get Product’s Reviews”curl https://api.phantomjson.app/v1/products/1/reviewsResponse
Section titled “Response”{ "data": [ { "id": 1, "productId": 1, "userId": 1, "rating": 5, "title": "Great product!", "comment": "Really love this keyboard." } ], "meta": { "total": 3, "page": 1, "limit": 20, "totalPages": 1 }}Examples
Section titled “Examples”Search Products
Section titled “Search Products”curl "https://api.phantomjson.app/v1/products?q=keyboard"Filter by Category
Section titled “Filter by Category”curl "https://api.phantomjson.app/v1/products?category=smartphones"Filter by Brand
Section titled “Filter by Brand”curl "https://api.phantomjson.app/v1/products?brandId=1"Filter by Price Range
Section titled “Filter by Price Range”curl "https://api.phantomjson.app/v1/products?price[gte]=50&price[lte]=200"Sort by Price
Section titled “Sort by Price”# Cheapest firstcurl "https://api.phantomjson.app/v1/products?sort=price:asc"
# Most expensive firstcurl "https://api.phantomjson.app/v1/products?sort=price:desc"Field Selection
Section titled “Field Selection”curl "https://api.phantomjson.app/v1/products?fields=id,name,price,category"Combined Query
Section titled “Combined Query”# Cheap smartphones sorted by pricecurl "https://api.phantomjson.app/v1/products?category=smartphones&price[lte]=500&sort=price:asc&fields=id,name,price"Categories
Section titled “Categories”Available product categories:
smartphoneslaptopstabletsaccessoriescamerasaudio
Relations
Section titled “Relations”- Brand — Each product may belong to a brand (
brandId) - Category — Each product may belong to a category (
categoryId) - Reviews — Each product has many reviews (access via
/v1/products/:id/reviews)
