Skip to main content

Products

List All Products

curl -X GET "${VITE_BASE_URL}/product" \
  -H "Authorization: Bearer <token>"
Retrieves a list of all products. Authentication Required: Yes

Response

data
array
Array of product objects
id
number
Product unique identifier
name
string
Product name
description
string
Product description
price
number
Product price
category_id
number
Associated category ID
images
array
Array of product images
colors
array
Available colors for the product
sizes
array
Available sizes for the product
{
  "data": [
    {
      "id": 1,
      "name": "T-Shirt Premium",
      "description": "High quality cotton t-shirt",
      "price": 299.99,
      "category_id": 1,
      "images": [
        {
          "id": 1,
          "url": "https://example.com/image.jpg",
          "is_primary": true
        }
      ],
      "colors": ["Red", "Blue", "Green"],
      "sizes": ["S", "M", "L", "XL"]
    }
  ]
}

Get Product by ID

curl -X GET "${VITE_BASE_URL}/product/1" \
  -H "Authorization: Bearer <token>"
Retrieves a single product by its ID. Authentication Required: Yes

Path Parameters

id
number
required
Product ID

Response

id
number
Product unique identifier
name
string
Product name
description
string
Product description
price
number
Product price
category
object
Category details
images
array
Product images

Create Product

curl -X POST "${VITE_BASE_URL}/product" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: multipart/form-data" \
  -F "name=New Product" \
  -F "description=Product description" \
  -F "price=499.99" \
  -F "category_id=1" \
  -F "images[]=@/path/to/image1.jpg" \
  -F "images[]=@/path/to/image2.jpg"
Creates a new product with images. Authentication Required: Yes
Content-Type: multipart/form-data

Request Body

name
string
required
Product name
description
string
Product description
price
number
required
Product price
category_id
number
required
Category ID
images
file[]
Array of image files
colors
array
Array of color IDs
sizes
array
Array of size IDs

Response

id
number
Created product ID
message
string
Success message

Update Product

curl -X PUT "${VITE_BASE_URL}/product/1" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: multipart/form-data" \
  -F "name=Updated Product" \
  -F "price=599.99"
Updates an existing product. Authentication Required: Yes
Content-Type: multipart/form-data

Path Parameters

id
number
required
Product ID to update

Request Body

Same fields as Create Product (all optional for updates)

Delete Product

curl -X DELETE "${VITE_BASE_URL}/product/1" \
  -H "Authorization: Bearer <token>"
Deletes a product. Authentication Required: Yes

Path Parameters

id
number
required
Product ID to delete

Product Images

Set Primary Image

curl -X PUT "${VITE_BASE_URL}/product_image/5/primary" \
  -H "Authorization: Bearer <token>"
Sets an image as the primary image for a product. Authentication Required: Yes

Path Parameters

id
number
required
Image ID

Delete Product Image

curl -X DELETE "${VITE_BASE_URL}/product_image/5" \
  -H "Authorization: Bearer <token>"
Deletes a product image. Authentication Required: Yes

Path Parameters

id
number
required
Image ID to delete

Categories

List All Categories

curl -X GET "${VITE_BASE_URL}/product_category" \
  -H "Authorization: Bearer <token>"
Retrieves all product categories. Authentication Required: Yes

Get Category by ID

curl -X GET "${VITE_BASE_URL}/product_category/1" \
  -H "Authorization: Bearer <token>"
Authentication Required: Yes

Path Parameters

id
number
required
Category ID

Create Category

curl -X POST "${VITE_BASE_URL}/product_category" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "New Category",
    "description": "Category description"
  }'
Creates a new product category. Authentication Required: Yes

Request Body

name
string
required
Category name
description
string
Category description

Update Category

curl -X PUT "${VITE_BASE_URL}/product_category/1" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"name": "Updated Category"}'
Authentication Required: Yes

Path Parameters

id
number
required
Category ID

Delete Category

curl -X DELETE "${VITE_BASE_URL}/product_category/1" \
  -H "Authorization: Bearer <token>"
Authentication Required: Yes

Path Parameters

id
number
required
Category ID

Colors

List All Colors

curl -X GET "${VITE_BASE_URL}/product_color" \
  -H "Authorization: Bearer <token>"
Authentication Required: Yes

Get Color by ID

curl -X GET "${VITE_BASE_URL}/product_color/1" \
  -H "Authorization: Bearer <token>"
Authentication Required: Yes

Create Color

curl -X POST "${VITE_BASE_URL}/product_color" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"name": "Navy Blue", "hex": "#001f3f"}'
Authentication Required: Yes

Request Body

name
string
required
Color name
hex
string
Hex color code (e.g., #FF0000)

Update Color

curl -X PUT "${VITE_BASE_URL}/product_color/1" \
  -H "Authorization: Bearer <token>"
Authentication Required: Yes

Delete Color

curl -X DELETE "${VITE_BASE_URL}/product_color/1" \
  -H "Authorization: Bearer <token>"
Authentication Required: Yes

Sizes

List All Sizes

curl -X GET "${VITE_BASE_URL}/product_size" \
  -H "Authorization: Bearer <token>"
Authentication Required: Yes

Get Size by ID

curl -X GET "${VITE_BASE_URL}/product_size/1" \
  -H "Authorization: Bearer <token>"
Authentication Required: Yes

Create Size

curl -X POST "${VITE_BASE_URL}/product_size" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"name": "XXL", "code": "XXL"}'
Authentication Required: Yes

Request Body

name
string
required
Size name
code
string
Size code (e.g., S, M, L, XL)

Update Size

curl -X PUT "${VITE_BASE_URL}/product_size/1" \
  -H "Authorization: Bearer <token>"
Authentication Required: Yes

Delete Size

curl -X DELETE "${VITE_BASE_URL}/product_size/1" \
  -H "Authorization: Bearer <token>"
Authentication Required: Yes

Build docs developers (and LLMs) love