[POST] Variants

Create Variants

This operation allows you to create a new product variant in the catalog.
It follows REST architecture principles and complies with the OData v4.01 standard.

[POST] Variants Endpoint

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

Making a request

    • Use HTTP method: POST.
    • Include your API key in the request headers for authentication.
    • The body must be sent in JSON format.
    • Use valid attribute identifiers (not database field names).
    • The frmt_ref field is mandatory.

Request body example:

{
    "frmt_ref": "VAR001",
    "prod_id": "004",
    "frmt_stat": "D",
    "frmt_tags":"IA",
    "frmt_link":"https://es.wikipedia.org/wiki/Tipo_variante"
}

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

Response

🟢 201 Created

If the variant 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/Variants(4)

📝 Please note that the response returns the frmt_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

"Product 32 not found."

or

"Invalid attribute name: Prod_id"

🔴 401 Unauthorized

Missing or invalid API key.

🔴 403 Forbidden

User does not have permission to create variants.

🔴 404 Not Found

Referenced product (prod_id) does not exist or has been deleted.

🔴 412 Precondition Failed

System is not in a valid state to perform the operation.

🔴 500 Internal Server Error

Unexpected code execution failure or unidentified RPC error.

Limitations

  • Only one variant per request is allowed.
  • Bulk creation of variants is not yet supported.
  • The prod_id must point to a valid product (status ≠ X).
  • All submitted fields must exist
  • Images/files must already exist in the system (no direct upload support).

Multi-language fields support

If your account has multilingual fields configured, you can include values in multiple languages per attribute.

Making a request

  • Use HTTP method: POST.
  • Include your API key in the request headers.
  • The body must be sent in JSON format.
  • The frmt_ref field is mandatory.
  • Multilingual fields must be sent as JSON objects with each supported language as a key.

Multilingual body example:

{  "frmt_ref": "VAR002",  
   "prod_id": 27,  
   "frmt_stat": "V",  
   "frmt_title": {    
     "es": "Talla M",    
     "en": "Size M"  
   }
   
}

📝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 must be defined as multilingual.
  • The language must be supported by your account.

Common errors:

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