Skip to content

Create Attribute Set

Request

Creates a new attribute set for the tenant from the supplied name and optional Product and Variant form layouts, returning the created attribute set and a Location header pointing to it.

The Product and Variant layouts behave differently when omitted: an omitted productLayout falls back to a standard default layout, whereas an omitted variantLayout is not created at all (no Variant layout is stored). A Variant layout can be added later with PATCH /v2/AttributeSets({id}).

Authentication

Requires a valid API key in the X-API-KEY header.

Request Body

FieldRequiredDescription
name✅ YesUnique name for the attribute set within the tenant.
productLayout❌ NoForm layout for Products. Defaults to the standard layout when omitted.
variantLayout❌ NoForm layout for Variants. When omitted, no Variant layout is created (it can be added later via PATCH).

Layout Structure

Each layout is a JSON document with a sections array. Each section has a title and a rows array. Each row has a fields array and an optional divider (dividerType, dividerTitle). Each field carries an attributeId and a size.

{
  "sections": [
    {
      "title": "General",
      "rows": [
        {
          "fields": [
            { "attributeId": "prod_title", "size": "half" },
            { "attributeId": "prod_ref",   "size": "half" }
          ]
        },
        {
          "dividerType": "normal",
          "dividerTitle": "Details",
          "fields": [
            { "attributeId": "prod_description", "size": "row" }
          ]
        }
      ]
    }
  ]
}

size — width of the field in the form grid. One of: quarter, half, threeQuarters, row.

dividerType — optional visual separator above the row. One of: normal, wide, lineBreak. dividerTitle is optional and only meaningful when dividerType is set. Both properties are omitted from rows that have no divider.

Layout Validation

A layout may contain any subset of the tenant's valid attributes — you do not need to include all of them. Attributes omitted from the layout simply do not appear in the form for this attribute set; they are not removed from the tenant.

If a layout is supplied it must satisfy all of the following rules; otherwise the request returns 400 Bad Request describing each failure:

  • The layout must be well-formed: the sections, rows and fields arrays must all be present (non-null). Omitting a sections, rows or fields array (or sending it as null) is rejected.
  • Every attributeId included must exist for the entity type (Products or Variants) in the tenant's storage definition.
  • No attributeId may appear more than once across the entire layout.
  • Each field size must be one of: quarter, half, threeQuarters, row.
  • The sum of field sizes within any single row must not exceed a full row.
  • Every row must contain at least one field.
  • Section title values must be unique (case-insensitive).
  • When a row sets dividerType it must be one of: normal, wide, lineBreak.

Required attributes

These attributes must always be present in their respective layout:

LayoutRequired attribute IDs
productLayouttyp_id, prod_ref, prod_title, cat_ref, prod_stat, prod_description, prod_image, prod_tags
variantLayoutfrmt_stat, prod_ref, frmt_ref, frmt_tags

Response

201 Created — The Location header points to the new resource: /v2/AttributeSets({id}). The response body contains the created attribute set (CreateAttributeSet2Response).

Error Responses

  • 400 Bad Request — Missing body, missing name, duplicate name, or layout validation failure.
  • 401 Unauthorized — Missing or invalid API key. Returned by the API gateway as { "message": "Unauthorized", "request_id": "d8aafa5b8f3e400b60bea0123dd33317" }.
  • 403 Forbidden — The API key does not have write permissions for this operation.
  • 500 Internal Server Error — Unexpected technical error.

Example

Request:

POST /v2/AttributeSets HTTP/1.1
X-API-KEY: your-api-key-here
Content-Type: application/json
            
{ "name": "Electronics" }

Response:

HTTP/1.1 201 Created
Location: /v2/AttributeSets(7)
Body

Attribute set creation payload.

namestring or null
productLayoutobject(FormLayoutDto)
Example:
{ "sections": [ { … }, { … } ] }
variantLayoutobject(FormLayoutDto)
Example:
{ "sections": [ { … }, { … } ] }
POST
/v2/AttributeSets
curl -i -X POST \
  https://api2.saleslayer.com/catalog/v2/AttributeSets \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "string",
    "productLayout": {
      "sections": [
        {
          "title": "General",
          "rows": [
            {
              "fields": [
                {
                  "attributeId": "code",
                  "size": "half"
                },
                {
                  "attributeId": "name",
                  "size": "half"
                }
              ]
            },
            {
              "fields": [
                {
                  "attributeId": "parent_ref",
                  "size": "row"
                }
              ],
              "dividerType": "normal",
              "dividerTitle": "Hierarchy"
            }
          ]
        },
        {
          "title": "Content",
          "rows": [
            {
              "fields": [
                {
                  "attributeId": "status",
                  "size": "quarter"
                },
                {
                  "attributeId": "description",
                  "size": "threeQuarters"
                }
              ]
            },
            {
              "fields": [
                {
                  "attributeId": "image",
                  "size": "half"
                },
                {
                  "attributeId": "tags",
                  "size": "half"
                }
              ]
            }
          ]
        }
      ]
    },
    "variantLayout": {
      "sections": [
        {
          "title": "General",
          "rows": [
            {
              "fields": [
                {
                  "attributeId": "code",
                  "size": "half"
                },
                {
                  "attributeId": "name",
                  "size": "half"
                }
              ]
            },
            {
              "fields": [
                {
                  "attributeId": "parent_ref",
                  "size": "row"
                }
              ],
              "dividerType": "normal",
              "dividerTitle": "Hierarchy"
            }
          ]
        },
        {
          "title": "Content",
          "rows": [
            {
              "fields": [
                {
                  "attributeId": "status",
                  "size": "quarter"
                },
                {
                  "attributeId": "description",
                  "size": "threeQuarters"
                }
              ]
            },
            {
              "fields": [
                {
                  "attributeId": "image",
                  "size": "half"
                },
                {
                  "attributeId": "tags",
                  "size": "half"
                }
              ]
            }
          ]
        }
      ]
    }
  }'

Responses

Created

Bodyapplication/json
@etagstring or null
@contextstring or null
valueany or null
Response
{ "@readLink": "string", "@editLink": "string", "@etag": "string", "@navigationLinks": [ { … } ], "@associationLinks": [ { … } ], "@context": "string", "value": null }