# Create cart

POST `/cart`

This endpoint lets you to create a cart with a unique identifier for each of your users.&#x20;

The unique identifier for all cart requests is the user's Object Id. Here's a [generator and helper function](https://observablehq.com/@hugodf/mongodb-objectid-generator) you can use. You do not need to register a user beforehand. When you do a request to /cart, just pass in the new user's Object Id. You'll then use the same Object Id for subsequent requests to add more items to the cart, get a cart, and create an order.

If the product you're adding to the Request Body has a variant, then pass in the Variant Id. If the product doesn't have any variants, you pass in the Product Id as the Variant Id.&#x20;

**Headers**

| Header          | Type   | Description                                                                   |
| --------------- | ------ | ----------------------------------------------------------------------------- |
| `Authorization` | string | Bearer token.                                                                 |
| `customuserid`  | string | This is a unique Object Id identifier that you create for each of your users. |

**Request body**

```json
{
    "items": [
        {"variantId": 123, "product": 123, "quantity": 1}
    ]
}
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "status": "Cart Created",
}
```

{% endtab %}

{% tab title="400" %}

```json
{
 "status": "Server Error",
}
```

{% endtab %}
{% endtabs %}
