Skip to content

Create Product

Create a new base product. Products are containers for product variants.

Endpoint

POST /v1/products/store/

Authentication

Required (Store role)

Request Body

{
  "category_id": 3,
  "brand_id": 2,
  "currency_id": 1
}

Parameters

Field Type Required Description
category_id integer Yes Category ID
brand_id integer No Brand ID (nullable)
currency_id integer Yes Currency ID

Response

Success (200 OK)

{
  "id": 1,
  "store_id": 5,
  "store": {
    "id": 5,
    "email": "store@example.com",
    "name": "My Store",
    "description": "Store description",
    "logo_url": "https://...",
    "business_address": "123 Main St",
    "preferred_language": "AZERBAIJANI",
    "contact_phone": "+994501234567",
    "percent": 10.5,
    "created": "2025-01-15T10:30:00Z"
  },
  "category_id": 3,
  "category": {
    "id": 3,
    "name": "Electronics",
    "image": "https://...",
    "parent_id": null
  },
  "brand_id": 2,
  "brand": {
    "id": 2,
    "name": "Brand Name",
    "image": "https://...",
    "created": "2025-01-15T10:30:00Z"
  },
  "currency_id": 1,
  "currency": {
    "id": 1,
    "name": "AZN",
    "value": 1.0
  },
  "created": "2025-01-15T10:30:00Z"
}

Error Responses

Category Not Found (404)

{
  "error": "Category not found"
}

Brand Not Found (404)

{
  "error": "Brand not found"
}

Currency Not Found (404)

{
  "error": "Currency not found"
}

Example Request

curl -X POST "https://api.luxmart.site/v1/products/store/" \
  -H "Authorization: Token your_access_token" \
  -H "Content-Type: application/json" \
  -d '{
    "category_id": 3,
    "brand_id": 2,
    "currency_id": 1
  }'

Notes

  • Product is automatically associated with the authenticated store
  • Category and currency are required
  • Brand is optional
  • After creating a product, you can create product variants using Create Variant