# Create Partner SKU

### Description

This service creates a Partner SKU for the authenticated partner. This allows partners to map their own internal codes to a specific SKU within Thalamus using a SKU Reference Code (`skuCodeKey`).

***

### Request

#### Restrictions

* Authentication: Requires a successful partner login.
* Role Validation: The logged-in user must have the appropriate partner roles to perform this action.

#### Endpoint

```
POST https://<server-url>/api/v4/partner/skus
```

#### Parameters

| **Parameter**  | **Location**   | **Description**                                                                        |
| -------------- | -------------- | -------------------------------------------------------------------------------------- |
| `touchpoint`   | Query / Header | The identifier for the touchpoint. Use `Thalamus-Touchpoint` for the header.           |
| `token`        | Query / Header | The authentication token for the partner session. Use `Thalamus-Token` for the header. |
| `Content-Type` | Header         | Must be `application/json`.                                                            |

#### Request Body Fields

| **Field**         | **Type** | **Description**                                                              |
| ----------------- | -------- | ---------------------------------------------------------------------------- |
| `skuCodeKey`      | String   | Required. The Reference code.                                                |
| `skuCode`         | String   | Required. The Thalamus SKU code.                                             |
| `code`            | String   | Required. The internal code of the partner SKU.                              |
| `name`            | String   | Required. The display name of the partner SKU.                               |
| `equivalenceType` | Integer  | Mapping type: `1` (Equivalence), `2` (Unit), `3` (Package), `4` (Boxes).     |
| `equivalence`     | String   | A decimal value. Note: For types 2, 3, and 4, this value must be set to `1`. |

Example Body:

```
{  
   "skuCodeKey": "COD-BRA",
   "skuCode": "70010010BP",
   "code": "7797906000250",
   "name": "CORTE TRADICIONAL PACK 1X720G",
   "equivalenceType": 1,
   "equivalence": "12.5"
}
```

***

### Response

#### ✅ Successful Response: `201 Created`

The Partner SKU was successfully created and mapped.

JSON

```
{
	"message": "OK"
}
```

***

### ❌ Unsuccessful Response

#### `400 Bad Request`

The following errors may be returned in the `errors` object:

| **Error Code**                      | **Field**            | **Description**                                                  |
| ----------------------------------- | -------------------- | ---------------------------------------------------------------- |
| `InvalidRoleForLoggedParty`         | `partner`            | The logged-in user does not have the "Partner" role.             |
| `field.required`                    | `skuCodeKey`         | The SKU Reference Code is missing.                               |
| `partnerSku.invalidSkuCode`         | `skuCodeKey+skuCode` | The combination of reference code and SKU code is invalid.       |
| `partnerSku.duplicatedCode`         | `sku.code`           | This SKU code has already been assigned to the provided partner. |
| `partnerSku.invalidEquivalenceType` | `equivalenceType`    | The integer provided for the type is not valid.                  |
| `equivalenceNaN`                    | `equivalence`        | The equivalence value must be a valid number string.             |
| `partnerSku.equivalenceDefault`     | `error.saving`       | If type is not `1`, the equivalence value must be exactly `1.0`. |
| `InvalidJson`                       | N/A                  | The request body is not valid JSON.                              |
