Create Category
Create a new product category.
Endpoint
Authentication
Required (Store role)
Request Body
Content-Type: multipart/form-data
Form Fields
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | No | Deprecated fallback (API will derive from name_en) |
name_az |
string | No | Category name in Azerbaijani |
name_en |
string | Yes | Category name in English (used as default fallback) |
name_es |
string | No | Category name in Spanish |
name_de |
string | No | Category name in German |
parent_id |
integer | No | Parent category ID (for subcategories) |
image |
file | No | Category image |
Response
Success (200 OK)
{
"id": 1,
"name": "Elektronika",
"name_az": "Elektronika",
"name_en": "Electronics",
"name_es": "Electrónica",
"name_de": "Elektronik",
"image": "https://...",
"parent_id": null
}
Error Responses
Parent Category Not Found (404)
Validation Error (400)
Example Request
curl -X POST "https://api.luxmart.site/v1/products/category/" \
-H "Authorization: Token your_access_token" \
-F "name_az=Elektronika" \
-F "name_en=Electronics" \
-F "name_es=Electrónica" \
-F "name_de=Elektronik" \
-F "parent_id=" \
-F "image=@/path/to/image.jpg"
Notes
- Category image is uploaded to S3
- If
parent_idis 0 or not provided, category is a top-level category - Categories can be nested to any depth
- Translation Support: Provide
name_en(required) plus optionalname_az,name_es,name_de. The API stores English as the fallbacknamefield automatically. - The
namefield is kept for backward compatibility; you do not need to send it. The API writesname_enintoname.