Skip to content

Create Category

Create a new product category.

Endpoint

POST /v1/products/category/

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)

{
  "error": "Parent Category Not Found"
}

Validation Error (400)

{
  "message": "Param not send!"
}

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_id is 0 or not provided, category is a top-level category
  • Categories can be nested to any depth
  • Translation Support: Provide name_en (required) plus optional name_az, name_es, name_de. The API stores English as the fallback name field automatically.
  • The name field is kept for backward compatibility; you do not need to send it. The API writes name_en into name.