# Create a SKU

To [create](https://docs.commercelayer.io/core/creating-resources) a new SKU, send a `POST` request to the `/api/skus` endpoint, passing the resource arguments in the request body.

## Request

**POST** <https://yourdomain.commercelayer.io/api/skus>

### Arguments

| Body Parameter                       | Type      | Required |
| ------------------------------------ | --------- | -------- |
| **type**                             | `string`  | Required |
| attributes.**code**                  | `string`  | Required |
| attributes.**name**                  | `string`  | Required |
| attributes.**description**           | `string`  | Optional |
| attributes.**image\_url**            | `string`  | Optional |
| attributes.**pieces\_per\_pack**     | `integer` | Optional |
| attributes.**weight**                | `float`   | Optional |
| attributes.**unit\_of\_weight**      | `string`  | Optional |
| attributes.**hs\_tariff\_number**    | `string`  | Optional |
| attributes.**do\_not\_ship**         | `boolean` | Optional |
| attributes.**do\_not\_track**        | `boolean` | Optional |
| attributes.**reference**             | `string`  | Optional |
| attributes.**reference\_origin**     | `string`  | Optional |
| attributes.**metadata**              | `object`  | Optional |
| relationships.**shipping\_category** | `object`  | Required |
| relationships.**tags**               | `array`   | Optional |

### Example

{% tabs %}
{% tab title="Request" %}
The following request creates a new SKU:

```shell
curl -g -X POST \
  'https://yourdomain.commercelayer.io/api/skus' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "skus",
    "attributes": {
      "code": "TSHIRTMM000000FFFFFFXLXX",
      "name": "Men's Black T-shirt with White Logo (XL)"
    },
    "relationships": {
      "shipping_category": {
        "data": {
          "type": "shipping_categories",
          "id": "ABCRtyUpBa"
        }
      }
    }
  }
}'
```

{% endtab %}

{% tab title="Response" %}
On success, the API responds with a `201 Created` status code, returning the created resource object:

```json
{
  "data": {
    "id": "XAyRWNUzyN",
    "type": "skus",
    "links": {
      "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN"
    },
    "attributes": {
      "code": "TSHIRTMM000000FFFFFFXLXX",
      "name": "Men's Black T-shirt with White Logo (XL)",
      "description": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
      "image_url": "https://img.yourdomain.com/skus/xYZkjABcde.png",
      "pieces_per_pack": 6,
      "weight": 300.0,
      "unit_of_weight": "gr",
      "hs_tariff_number": "4901.91.0020",
      "do_not_ship": false,
      "do_not_track": false,
      "inventory": {
        "available": true,
        "quantity": 10,
        "levels": [
          {
            "quantity": 4,
            "delivery_lead_times": [
              {
                "shipping_method": {
                  "name": "Standard Shipping",
                  "reference": null,
                  "price_amount_cents": 700,
                  "free_over_amount_cents": 9900,
                  "formatted_price_amount": "€7,00",
                  "formatted_free_over_amount": "€99,00"
                },
                "min": {
                  "hours": 72,
                  "days": 3
                },
                "max": {
                  "hours": 120,
                  "days": 5
                }
              },
              {
                "shipping_method": {
                  "name": "Express Delivery",
                  "reference": null,
                  "price_amount_cents": 1200,
                  "free_over_amount_cents": null,
                  "formatted_price_amount": "€12,00",
                  "formatted_free_over_amount": null
                },
                "min": {
                  "hours": 48,
                  "days": 2
                },
                "max": {
                  "hours": 72,
                  "days": 3
                }
              }
            ]
          },
          {
            "quantity": 6,
            "delivery_lead_times": [
              {
                "shipping_method": {
                  "name": "Standard Shipping",
                  "reference": null,
                  "price_amount_cents": 700,
                  "free_over_amount_cents": 9900,
                  "formatted_price_amount": "€7,00",
                  "formatted_free_over_amount": "€99,00"
                },
                "min": {
                  "hours": 96,
                  "days": 4
                },
                "max": {
                  "hours": 144,
                  "days": 6
                }
              },
              {
                "shipping_method": {
                  "name": "Express Delivery",
                  "reference": null,
                  "price_amount_cents": 1200,
                  "free_over_amount_cents": null,
                  "formatted_price_amount": "€12,00",
                  "formatted_free_over_amount": null
                },
                "min": {
                  "hours": 72,
                  "days": 3
                },
                "max": {
                  "hours": 96,
                  "days": 4
                }
              }
            ]
          }
        ]
      },
      "created_at": "2018-01-01T12:00:00.000Z",
      "updated_at": "2018-01-01T12:00:00.000Z",
      "reference": "ANY-EXTERNAL-REFEFERNCE",
      "reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
      "jwt_custom_claim": {
      },
      "metadata": {
        "foo": "bar"
      }
    },
    "relationships": {
      "shipping_category": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/relationships/shipping_category",
          "related": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/shipping_category"
        }
      },
      "prices": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/relationships/prices",
          "related": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/prices"
        }
      },
      "stock_items": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/relationships/stock_items",
          "related": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/stock_items"
        }
      },
      "stock_reservations": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/relationships/stock_reservations",
          "related": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/stock_reservations"
        }
      },
      "delivery_lead_times": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/relationships/delivery_lead_times",
          "related": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/delivery_lead_times"
        }
      },
      "sku_options": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/relationships/sku_options",
          "related": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/sku_options"
        }
      },
      "sku_list_items": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/relationships/sku_list_items",
          "related": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/sku_list_items"
        }
      },
      "sku_lists": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/relationships/sku_lists",
          "related": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/sku_lists"
        }
      },
      "attachments": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/relationships/attachments",
          "related": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/attachments"
        }
      },
      "links": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/relationships/links",
          "related": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/links"
        }
      },
      "events": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/relationships/events",
          "related": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/events"
        }
      },
      "tags": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/relationships/tags",
          "related": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/tags"
        }
      },
      "jwt_customer": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/relationships/jwt_customer",
          "related": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/jwt_customer"
        }
      },
      "jwt_markets": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/relationships/jwt_markets",
          "related": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/jwt_markets"
        }
      },
      "jwt_stock_locations": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/relationships/jwt_stock_locations",
          "related": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/jwt_stock_locations"
        }
      },
      "event_stores": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/relationships/event_stores",
          "related": "https://yourdomain.commercelayer.io/api/skus/XAyRWNUzyN/event_stores"
        }
      }
    },
    "meta": {
      "mode": "test",
      "organization_id": "xRRkjDFafe",
      "trace_id": "69abaa3545913c78132e5578bd26208d44aa9043647d78698fd0021f3958cd74"
    }
  }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.commercelayer.io/core-api-reference/skus/create.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
