FakeStoreAPI Documentation (v2.1.11)
Official Documentation: https://fakestoreapi.com/docs
A free fake REST API designed specifically for testing and prototyping e-commerce applications, supporting full CRUD operations across core resources.
Prepared by:
Md. Ebrahim Hossain
SQA Engineer at Achieve Test Prep (Newark, US)
Source API: fakestoreapi.com
Base URL
The primary endpoint is:
https://fakestoreapi.com
🛒 Product Operations
1. Get All Products
/products
Status Code: 200
Request Sample (JavaScript)
fetch('https://fakestoreapi.com/products')
.then(response => response.json())
.then(data => console.log(data));
Response (200 OK - Schema)
HTTP/1.1 200 Success [ { "id": 0, "title": "string", "price": 0.1, "description": "string", "category": "string", "image": "http://example.com" } ... array of product objects ... ]
2. Add a New Product
/products
Status Code: 201
Request Body Schema (JSON)
{
"id": 0,
"title": "string",
"price": 0.1,
"description": "string",
"category": "string",
"image": "http://example.com"
}
Response (201 Created)
HTTP/1.1 201 Product created successfully { "id": 0, "title": "string", "price": 0.1, ... full product object ... }
3. Get Single Product
/products/{id}
Status Code: 200
Request Sample (JavaScript)
fetch('https://fakestoreapi.com/products/1')
.then(response => response.json())
.then(data => console.log(data));
Response (200 OK)
HTTP/1.1 200 Success { "id": 0, "title": "string", "price": 0.1, ... full product object ... }
4. Update a Product
/products/{id}
Status Code: 200
Request Body (Update)
Requires the full product schema.
{
"id": 0,
"title": "Updated Title",
"price": 99.99,
...
}
Response (200 OK - Updated Product)
HTTP/1.1 200 Product updated successfully { "id": 0, "title": "Updated Title", ... }
5. Delete a Product
/products/{id}
Status Code: 200
Request Sample (JavaScript)
fetch('https://fakestoreapi.com/products/1', {
method: 'DELETE'})
.then(response => response.json())
.then(data => console.log(data));
Response (200 OK - Deleted Object)
The deleted product object is returned upon successful deletion.
HTTP/1.1 200 Product deleted successfully { "id": 1, "title": "Deleted Product Title", ... }
🛍️ Cart Operations
1. Get All Carts
/carts
Status Code: 200
Request Sample (JavaScript)
fetch('https://fakestoreapi.com/carts')
.then(response => response.json())
.then(data => console.log(data));
Response (200 OK - Schema)
HTTP/1.1 200 Success [ { "id": 0, "userId": 0, "products": [ { "productId": 0, "quantity": 0 } ] } ]
2. Add a New Cart
/carts
Status Code: 201
Request Body Schema (JSON)
{
"id": 0,
"userId": 0,
"products": [
{ "productId": 0, "quantity": 0 }
]
}
Response (201 Created)
HTTP/1.1 201 Cart created successfully { "id": 0, "userId": 0, ... full cart object ... }
3. Get Single Cart
/carts/{id}
Status Code: 200
Request Sample (JavaScript)
fetch('https://fakestoreapi.com/carts/1')
.then(response => response.json())
.then(data => console.log(data));
Response (200 OK)
HTTP/1.1 200 Success { "id": 0, "userId": 0, ... full cart object ... }
4. Update a Cart
/carts/{id}
Status Code: 200
Request Body (Update)
Requires the full cart schema.
{
"id": 1,
"userId": 1,
"products": [
{ "productId": 1, "quantity": 3 }
]
}
Response (200 OK - Updated Cart)
HTTP/1.1 200 Cart updated successfully { "id": 1, "userId": 1, ... }
5. Delete a Cart
/carts/{id}
Status Code: 200
Request Sample (JavaScript)
fetch('https://fakestoreapi.com/carts/1', {
method: 'DELETE'})
.then(response => response.json())
.then(data => console.log(data));
Response (200 OK - Deleted Object)
The deleted cart object is returned upon successful deletion.
HTTP/1.1 200 Cart deleted successfully { "id": 1, "userId": 1, ... }
👤 User Operations
1. Get All Users
/users
Status Code: 200
Request Sample (JavaScript)
fetch('https://fakestoreapi.com/users')
.then(response => response.json())
.then(data => console.log(data));
Response (200 OK - Schema)
HTTP/1.1 200 Success [ { "id": 0, "username": "string", "email": "string", "password": "string" } ]
2. Add a New User
/users
Status Code: 201
Request Body Schema (JSON)
{
"id": 0,
"username": "string",
"email": "string",
"password": "string"
}
Response (201 Created)
HTTP/1.1 201 User created successfully { "id": 0, "username": "string", ... full user object ... }
3. Get Single User
/users/{id}
Status Code: 200
Request Sample (JavaScript)
fetch('https://fakestoreapi.com/users/1')
.then(response => response.json())
.then(data => console.log(data));
Response (200 OK)
HTTP/1.1 200 Success { "id": 0, "username": "string", ... full user object ... }
4. Update a User
/users/{id}
Status Code: 200
Request Body (Update)
Requires the full user schema.
{
"id": 1,
"username": "new_username",
...
}
Response (200 OK - Updated User)
HTTP/1.1 200 User updated successfully { "id": 1, "username": "new_username", ... }
5. Delete a User
/users/{id}
Status Code: 200
Request Sample (JavaScript)
fetch('https://fakestoreapi.com/users/1', {
method: 'DELETE'})
.then(response => response.json())
.then(data => console.log(data));
Response (200 OK - Deleted Object)
The deleted user object is returned upon successful deletion.
HTTP/1.1 200 User deleted successfully { "id": 1, "username": "deleted_user", ... }
🔒 Authentication Operations
1. Login
/auth/login
Status Code: 200
Request Body Schema (JSON)
{
"username": "string",
"password": "string"
}
Response (200 OK - Token)
HTTP/1.1 200 Login successful { "token": "eyJhbGciOiJIUzI1NiI...[JWT]" }