[POST] Categories

Modified on Wed, 11 Mar at 12:17 PM

Create Category


This operation allows you to create a new category in the catalog.


It follows REST architecture principles and complies with the OData v4.01 standard.


[POST] Categories Endpoint


https://api2.saleslayer.com/rest/Catalog/Categories


Making a request


  • Use the HTTP method: POST.
  • Include the API key in the request headers for authentication.
  • The body must be sent in JSON format.
  • You must include attributes using their identifiers (not database names).
  • The cat_ref field is mandatory.


Request body example:


{
  "cat_ref": "CAT001",
  "cat_title": "Men's Footwear",
  "cat_stat": "D",
  "cat_description": "Category for men's footwear products",
  "cat_image": "cat_men.png",
  "cat_parent_id": 2
}


You can include multilingual and media attributes if they have been previously defined in your account configuration.


Response


201 Created


If the category was successfully created.


Example of response headers:


content-length: 0
date: Tue, 27 May 2025 23:06:09 GMT
location: https://api2.saleslayer.com/rest/Catalog/Categories(3)


Please note that the response returns the cat_id, which is useful for future reference.


400 Bad Request


There was an error in the submitted data (invalid format, missing or incorrect fields).


Response Body Example


"Attribute cat_ref is mandatory"


Or


"Missing file name(s):Cat_men2.png."


Limitations


  • Only one category can be created per request.
  • Bulk category creation is not supported.
  • Only one cat_parent_id can be assigned.
  • Images and files must already exist in the media library.


Multi-language fields support


You can include multilingual values for attributes that are configured to support multiple languages.


Making a request


  • Use HTTP method: POST.
  • Include your API key in the request headers.
  • Specify preferred language using the Accept-Language header.
  • The body must be sent in JSON format.
  • The field cat_ref is mandatory.
  • Multilingual fields must be sent as JSON objects with each supported language as a key.


Multilingual body example:


{
  "cat_ref": "CAT002",
  "cat_title": {
    "es": "Zapatillas",
    "en": "Sneakers"
  },
  "cat_stat": "V",
  "cat_description": {
    "es": "Calzado deportivo y urbano",
    "en": "Urban and sport footwear"
  },
  "cat_image": "sneakers_banner.jpg"
}


Make sure the attribute supports multiple languages and that the languages are enabled in your account.


Multilingual field conditions


You can send multilingual values for fields only if:


  • The field is defined as multilingual in the attribute set.
  • The languages used are supported by your account.


Common errors:


  • Unsupported language → 400 - Invalid language code
  • Non-multilingual field → 400 - Attribute does not support multi-language

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article