# Sales Layer Catalog REST API (2.0.0)

The Sales Layer Catalog REST API provides programmatic access to the catalog data managed in Sales Layer.

Use this reference to retrieve, filter, create, update, or delete products, variants, categories, attribute sets, custom entities, metadata, and changelog records. These endpoints support synchronization, enrichment, publishing, reporting, and other integration workflows across ecommerce platforms, ERPs, marketplaces, DAM systems, supplier systems, and internal tools.

Start with metadata endpoints when your integration needs to discover available fields and relationships, use pagination and filtering for large reads, and rely on changelogs for incremental synchronization whenever possible.

## Attribute Sets

### Operations

#### get

`/AttributeSets`

#### get

`/AttributeSets({attributeSetIdentifier})`

#### get

`/AttributeSets({attributeSetIdentifier})/Products`

#### get

`/AttributeSets/$metadata`

## Attribute Sets v2

### Operations

#### get

`/v2/AttributeSets`

#### post

`/v2/AttributeSets`

#### get

`/v2/AttributeSets({id})`

#### patch

`/v2/AttributeSets({id})`

#### delete

`/v2/AttributeSets({id})`

### Get Attribute Sets

Returns all attribute sets defined for the tenant, each including its name, identifier, and form layout configuration for Products and Variants (`ProductLayout`, `VariantLayout`).

**Response**

**200 OK** — `GetAttributeSetsResponse` containing the list of attribute sets.

**Error Responses**
- **401 Unauthorized** — Missing or invalid tenant identifier.
- **500 Internal Server Error** — Unexpected technical error.

### Example

**Request:**
```http
GET /v2/AttributeSets HTTP/1.1
X-API-KEY: your-api-key-here
```
**Response:**
```http
HTTP/1.1 200 OK
Content-Type: application/json
```

## Create Attribute Set

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.

### Authentication

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

### Request Body
| Field         | Required | Description |
|---------------|----------|-------------|
| `name`       | ✅ Yes   | Unique name for the attribute set within the tenant. |
| `productLayout` | ❌ No | Form layout for Products. Defaults to the standard layout when omitted. |
| `variantLayout` | ❌ No | Form layout for Variants. When omitted, no Variant layout is created (it can be added later via `PATCH`). |

### 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 tenant identifier.
- **500 Internal Server Error** — Unexpected technical error.

### Example

**Request:**
```http
POST /v2/AttributeSets HTTP/1.1
X-API-KEY: your-api-key-here
Content-Type: application/json

{ "name": "Electronics" }
```
**Response:**
```http
HTTP/1.1 201 Created
Location: /v2/AttributeSets(7)
```

## Update Attribute Set

Partially updates an existing attribute set identified by `id`. Accepted values:
- **`default`** (case-insensitive) — updates the tenant's default attribute set.
- **Positive integer** — updates the attribute set with that numeric ID.

### Authentication

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

### Request Body
All fields are optional. Omitted (null) fields are left unchanged.

### Response

**200 OK** — The updated attribute set (`UpdateAttributeSet2Response`).

**Error Responses**
- **400 Bad Request** — Invalid `id`, missing body, or layout validation failure.
- **401 Unauthorized** — Missing or invalid tenant identifier.
- **404 Not Found** — No attribute set with the given identifier exists for this tenant.
- **500 Internal Server Error** — Unexpected technical error.

### Example

**Request:**
```http
PATCH /v2/AttributeSets({id}) HTTP/1.1
X-API-KEY: your-api-key-here
Content-Type: application/json

{ "name": "Electronics v2" }
```
**Response:**
```http
HTTP/1.1 200 OK
Content-Type: application/json
```

## Delete Attribute Set

Deletes the attribute set identified by `id` (a positive integer). The tenant's default attribute set cannot be deleted.

### Response
- **200 OK** — Attribute set deleted; the response body summarizes the operation.
- **204 No Content** — Nothing to delete (idempotent success).

**Error Responses**
- **400 Bad Request** — `id` is not a positive integer or the request is otherwise invalid.
- **401 Unauthorized** — Missing or invalid tenant identifier.
- **404 Not Found** — No attribute set with the given identifier exists for this tenant.
- **500 Internal Server Error** — Unexpected technical error.

### Example

**Request:**
```http
DELETE /v2/AttributeSets(7)?deleteAssociatedProductsAndVariants=false HTTP/1.1
X-API-KEY: your-api-key-here
```
**Response:**
```http
HTTP/1.1 200 OK
Content-Type: application/json
```
