📡API Reference
Products API
Complete API reference for managing products programmatically.
Authentication
All API requests require authentication via JWT token in the Authorization header.
Authorization Header
Authorization: Bearer <your_jwt_token>Get Token: Login at /auth/login to receive JWT token
Base URL
https://api.bitforge.in/api/v1Get All Products
Retrieve a paginated list of products. Supports filtering by category, price range, and search query.
GET
/productsQuery Parameters
| Parameter | Type | Description |
|---|---|---|
page | integer | Page number (default: 1) |
limit | integer | Items per page (default: 20, max: 100) |
category | string | Filter by category |
search | string | Search in title and description |
sortBy | string | Sort by: price, createdAt, sales |
Example Request
curl -X GET "https://api.bitforge.in/api/v1/products?page=1&limit=10&category=ebooks" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"Example Response
{
"success": true,
"data": {
"products": [
{
"_id": "507f1f77bcf86cd799439011",
"title": "Complete Web Development Guide",
"description": "Comprehensive guide to modern web development",
"price": 499,
"category": "ebooks",
"seller": {
"_id": "507f1f77bcf86cd799439012",
"name": "John Doe"
},
"imageUrl": "https://cdn.bitforge.in/products/image.jpg",
"rating": 4.8,
"totalSales": 245,
"status": "approved",
"createdAt": "2026-02-01T10:30:00.000Z"
}
],
"pagination": {
"currentPage": 1,
"totalPages": 5,
"totalItems": 47,
"itemsPerPage": 10
}
}
}Get Product by ID
Retrieve detailed information about a specific product.
GET
/products/:productIdExample Request
curl -X GET "https://api.bitforge.in/api/v1/products/507f1f77bcf86cd799439011" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"Example Response
{
"success": true,
"data": {
"_id": "507f1f77bcf86cd799439011",
"title": "Complete Web Development Guide",
"description": "Comprehensive guide covering HTML, CSS, JavaScript, React, Node.js, and more.",
"price": 499,
"category": "ebooks",
"seller": {
"_id": "507f1f77bcf86cd799439012",
"name": "John Doe",
"email": "john@example.com",
"avatar": "https://cdn.bitforge.in/avatars/john.jpg"
},
"imageUrl": "https://cdn.bitforge.in/products/image.jpg",
"fileUrl": "https://cdn.bitforge.in/products/file.pdf",
"fileSize": 15728640,
"rating": 4.8,
"totalSales": 245,
"reviews": 58,
"status": "approved",
"tags": ["web", "development", "javascript", "react"],
"createdAt": "2026-02-01T10:30:00.000Z",
"updatedAt": "2026-02-07T08:15:00.000Z"
}
}Create Product
Upload a new product. Requires seller role.
POST
/productsRequest Body
{
"title": "Complete Web Development Guide",
"description": "Comprehensive guide to modern web development",
"price": 499,
"category": "ebooks",
"tags": ["web", "development", "javascript"],
"image": "<base64_encoded_image_or_file>",
"file": "<base64_encoded_file>",
"fileType": "pdf"
}Example Request
curl -X POST "https://api.bitforge.in/api/v1/products" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Complete Web Development Guide",
"description": "Comprehensive guide to modern web development",
"price": 499,
"category": "ebooks"
}'Example Response
{
"success": true,
"message": "Product created successfully and sent for approval",
"data": {
"_id": "507f1f77bcf86cd799439011",
"title": "Complete Web Development Guide",
"status": "pending",
"createdAt": "2026-02-07T10:30:00.000Z"
}
}Update Product
Update an existing product. Requires seller role and ownership.
PUT
/products/:productIdExample Request
curl -X PUT "https://api.bitforge.in/api/v1/products/507f1f77bcf86cd799439011" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"price": 599,
"description": "Updated description with more details"
}'Note: Updates to approved products go through pending changes workflow and require admin approval.
Delete Product
Request product deletion. Requires admin approval.
DELETE
/products/:productIdExample Request
curl -X DELETE "https://api.bitforge.in/api/v1/products/507f1f77bcf86cd799439011" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"Example Response
{
"success": true,
"message": "Product deletion request sent for admin approval"
}Error Responses
The API returns standard HTTP status codes and error messages.
400Bad Request
{
"success": false,
"error": "Validation error",
"message": "Price must be between 50 and 100000"
}401Unauthorized
{
"success": false,
"error": "Authentication required",
"message": "Please provide a valid JWT token"
}404Not Found
{
"success": false,
"error": "Product not found",
"message": "No product found with ID: 507f1f77bcf86cd799439011"
}