← Back to All APIs

Products API

E-commerce product catalog with categories and filters

Base URL
https://fakeapi.in/api/products

API Endpoints

GET/api/products
Copy All

Get all products with pagination & sorting

Parameters

page(number)
Page number for pagination (default: 1)
limit(number)
Number of products per page (default: 10)
sortField(string)
Field to sort by (e.g. price, name, rating)
sortOrder(string)
Sorting order (asc or desc)
GET/api/products/10
Copy All

Get product details by ID

Parameters

id(number)
Unique ID of the product to fetch
GET/api/products?q=phone
Copy All

Search products by name containing 'phone'

Parameters

q(string)
Keyword to search products by name
GET/api/products?category=Books
Copy All

Filter products by category 'Books'

Parameters

category(string)
Category name to filter products
GET/api/products?sortField=price&sortOrder=desc
Copy All

Get products sorted by price descending

Parameters

sortField(string)
Field to sort by (e.g. price, rating, name)
sortOrder(string)
Sorting order (asc or desc)
GET/api/products?page=2&limit=5
Copy All

Paginate products (page 2, 5 per page)

Parameters

page(number)
Page number for pagination
limit(number)
Number of products per page
GET/api/products?isAvailable=true
Copy All

Filter products that are available

Parameters

isAvailable(boolean)
Show only available products (true/false)
GET/api/products?rating=5
Copy All

Filter products with rating equal to 5

Parameters

rating(number)
Filter products by rating value (1–5)
POST/api/products
Copy All

Create a new product

Parameters

name(string)
Product name
price(number)
Product price
category(string)
Product category
description(string)
Detailed product description
isAvailable(boolean)
Product availability status
rating(number)
Initial rating (optional)
image(string)
Product image URL or file path
PUT/api/products/1
Copy All

Update product (replace all fields)

Parameters

id(number)
Product ID to update
name(string)
Updated product name
price(number)
Updated product price
category(string)
Updated product category
description(string)
Updated product description
isAvailable(boolean)
Updated availability
rating(number)
Updated rating
image(string)
Updated image URL or file path
PATCH/api/products/1
Copy All

Partially update product (only specified fields will be updated)

Parameters

id(number)
Product ID to update
fields(object)
Fields to update (e.g. { price, name })
DELETE/api/products/1
Copy All

Delete product

Parameters

id(number)
Product ID to delete

Example Usage

Copy All

import axios from "axios";

const API_URL = process.env.NEXT_PUBLIC_API_URL;

// Get all posts
axios
  .get(`${API_URL}api/posts`)
  .then(res => console.log("All Posts:", res.data))
  .catch(err => console.error(err));

// Create a new post
axios
  .post(`${API_URL}api/posts`, {
    title: "My First Post",
    content: "This is a sample post created by Vishal.",
    author: "Vishal"
  })
  .then(res => console.log("Post Created:", res.data))
  .catch(err => console.error(err));

Example Response

Copy All
{
      "id": 1,
      "name": "Recycled Marble Shoes",
      "description": "The sleek and sugary Bike comes with fuchsia LED lighting for smart functionality",
      "price": 35147.09,
      "category": "Movies",
      "stock": 142,
      "rating": 4.9,
      "image": "https://loremflickr.com/3988/47/product?lock=6914485309837439",
      "isAvailable": false,
      "createdAt": "2025-04-21T03:20:41.636Z"
    }

Quick Actions

Test in Playground

API Status

StatusOperational
Rate Limit1000 requests/hour
Response FormatJSON
Products API - E-commerce Catalog Documentation | FakeAPI.in