# SKUs

SKUs describe specific product variations that are being sold. A unique `code` identifies each SKU, which can be either the [EAN](https://en.wikipedia.org/wiki/International_Article_Number) code, the [UPC](https://en.wikipedia.org/wiki/Universal_Product_Code), or any other code format.

{% hint style="warning" %}
The SKU `name`, `description`, and `image_url` are best suited for internal usage (Commerce Layer is not a CMS).
{% endhint %}

By marking an SKU with the `do_not_ship` and `do_not_track` combinable flags, is possible to manage different scenarios, such as intangible products which generate no shipments, or products with a virtually infinite stock.

When creating an SKU you need to specify its [shipping category](/core-api-reference/shipping_categories.md), unless the SKU is marked as `do_not_ship`, in which case the relationship with the shipping category is optional.

### Inventory information

{% hint style="info" %}
For performance reasons the `inventory` attribute is returned when retrieving a single SKU only.
{% endhint %}

The related aggregated information about the SKU's inventory considers the [active markets](/core-api-reference/markets.md#disabling-markets) in scope only.

| Field                   | Type      | Description                                                                                                                                                                                                                                           |
| ----------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| inventory.**available** | `boolean` | The SKU availability, based on the [stock items](/core-api-reference/stock_items.md) associated with the stock location in scope — `true` if the sum of all the stock item quantities is greater than zero or if the SKU is marked as `do_not_track`. |
| inventory.**quantity**  | `integer` | The sum of the SKU's stock item quantities in the stock locations in scope (net of the related reserved stock quantities).                                                                                                                            |
| inventory.**levels**    | `array`   | Aggregated information by stock location, including stock item quantity and available [delivery lead times](/core-api-reference/delivery_lead_times.md) (ordered by shipping method cost, ascending).                                                 |

#### Checking real-time stock availability

You can fetch via API a list of SKUs and [include](/core/including-associations.md#using-relationship-paths) the `stock_items.reserved_stock` relationships, but in order to get the real-time stock availability you need to perform some additional computation on your side, based on the response payload:

1. Cycle the `included` payload for each SKU to get the sums of `stock_items` and `reserved_stocks` quantities.
2. Subtract the latter from the former to get the *cross-stock* availability for each SKU (you can also do distinct subtractions to get the *per-stock* SKU availability).

<details>

<summary>Data model</summary>

Check the related [ER diagram](/data-model/products/skus.md) and explore the flowchart that illustrates how the SKU resource relates to the other API entities.

</details>


---

# 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.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.
