> ## Documentation Index
> Fetch the complete documentation index at: https://docs.salesive.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get cart

> Retrieve the current cart for the authenticated shopper.

## Request

```http theme={null}
GET /cart
Authorization: Bearer {{token}}
x-shop-id: {{shopId}}
```

## Headers

| Header          | Type   | Description                                              |
| --------------- | ------ | -------------------------------------------------------- |
| `Authorization` | string | Provide the customer token in the format `Bearer <jwt>`. |
| `x-shop-id`     | string | Identify the shop that owns the cart.                    |

## Successful response

```json theme={null}
{
    "status": 200,
    "success": true,
    "message": "Cart retrieved",
    "data": {
        "_id": "693606ada7a8f7dc8ae32d80",
        "items": [
            {
                "itemType": "food",
                "food": {
                    "_id": "68e5bb463a1fc56a8ac150c0",
                    "name": "Margherita Pizza",
                    "price": 8500,
                    "promoPrice": 7500,
                    "images": [
                        "https://cdn.salesive.com/foods/margherita.webp"
                    ]
                },
                "foodId": "68e5bb463a1fc56a8ac150c0",
                "name": "Margherita Pizza",
                "image": "https://cdn.salesive.com/foods/margherita.webp",
                "price": 7500,
                "quantity": 1,
                "selectedAddons": [
                    {
                        "addonId": "68e5bb463a1fc56a8ac150d1",
                        "name": "Extra Cheese",
                        "description": "A richer mozzarella finish baked on top.",
                        "price": 1500,
                        "quantity": 2
                    }
                ],
                "_id": "6937b6e9e455c711f1fc9064",
                "id": "6937b6e9e455c711f1fc9064"
            },
            {
                "itemType": "product",
                "product": null,
                "variant": null,
                "name": "Laptop Stand",
                "image": "https://cdn.salesive.com/products/laptop-stand.jpg",
                "price": 8500,
                "sku": null,
                "variantAttributes": {},
                "quantity": 1,
                "_id": "693c06a05b24f53cda948082",
                "selectedAddons": [],
                "id": "693c06a05b24f53cda948082"
            }
        ],
        "totalPrice": 19000,
        "createdAt": "2025-12-07T22:58:53.640Z",
        "updatedAt": "2025-12-12T14:38:55.782Z",
        "__v": 3,
        "id": "693606ada7a8f7dc8ae32d80"
    }
}
```

## Notes

* Food line items include `itemType: "food"`, `food`, `foodId`, and `selectedAddons`.
* Each selected add-on snapshots `name`, `description`, `price`, and `quantity` at the time it was added to cart.
* Use the cart item `_id` with `/cart/item/:itemId` when managing food lines or any item with a unique add-on combination.

## Error response

```json theme={null}
{
    "status": 401,
    "success": false,
    "message": "Unauthorized",
    "data": {}
}
```


## OpenAPI

````yaml GET /cart
openapi: 3.1.0
info:
  title: Salesive Store API
  description: >-
    REST interface for querying products, categories, and merchandising banners
    exposed by Salesive storefronts.
  version: 1.0.0
servers:
  - description: Production
    url: https://store.salesive.com/api/v1
security:
  - BearerAuth: []
    ShopIdHeader: []
paths:
  /cart:
    get:
      summary: Get cart
      description: Retrieve the current cart for the authenticated shopper.
      parameters:
        - $ref: '#/components/parameters/XShopIdHeader'
      responses:
        '200':
          description: Cart retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CartResponse'
        '401':
          description: Unauthorized.
components:
  parameters:
    XShopIdHeader:
      name: x-shop-id
      in: header
      description: >-
        Optional identifier that scopes responses to a specific storefront when
        the referer cannot be inferred.
      required: false
      schema:
        type: string
  schemas:
    CartResponse:
      type: object
      required:
        - status
        - success
        - message
        - data
      properties:
        status:
          type: integer
          description: HTTP status code returned by the API.
        success:
          type: boolean
          description: Indicates whether the request succeeded.
        message:
          type: string
          description: Human-readable response message.
        data:
          $ref: '#/components/schemas/Cart'
    Cart:
      type: object
      required:
        - _id
        - items
        - totalPrice
      properties:
        _id:
          type: string
          description: Cart identifier.
        user:
          type: string
          description: Identifier of the shopper who owns the cart.
        shop:
          type: string
          description: Identifier of the shop associated with the cart.
        items:
          type: array
          items:
            $ref: '#/components/schemas/CartItem'
        totalPrice:
          type: number
          description: Total price of all items in the cart.
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the cart was created.
        updatedAt:
          type: string
          format: date-time
          description: Timestamp when the cart was last updated.
    CartItem:
      type: object
      required:
        - itemType
        - name
        - image
        - price
        - quantity
      properties:
        _id:
          type: string
        itemType:
          type: string
          enum:
            - product
            - food
            - service
        product:
          type: object
          description: Product or variant metadata for the cart item.
          properties:
            _id:
              type: string
            id:
              type: string
            name:
              type: string
            images:
              type: array
              items:
                type: string
                format: uri
            price:
              type: number
            promoPrice:
              type: number
              nullable: true
            sku:
              type: string
            parentProductId:
              type: string
            variantAttributes:
              type: object
              additionalProperties:
                type: string
        food:
          type: object
          description: Food metadata for a food line item.
          properties:
            _id:
              type: string
            id:
              type: string
            name:
              type: string
            images:
              type: array
              items:
                type: string
                format: uri
            price:
              type: number
            promoPrice:
              type:
                - number
                - 'null'
        foodId:
          type: string
          description: Identifier of the food item when `itemType` is `food`.
        variant:
          type: string
          description: Identifier of the variant if the line item is variant-based.
        name:
          type: string
          description: Display name of the line item.
        image:
          type: string
          format: uri
          description: Primary image for the line item.
        price:
          type: number
          description: Unit price of the line item.
        sku:
          type: string
          description: SKU of the line item, if applicable.
        variantAttributes:
          type: object
          description: Attributes for the selected variant.
          additionalProperties:
            type: string
        quantity:
          type: integer
          minimum: 1
          description: Quantity of the line item in the cart.
        selectedAddons:
          type: array
          items:
            $ref: '#/components/schemas/SelectedAddon'
          description: Snapshot of selected add-ons for food items.
    SelectedAddon:
      type: object
      required:
        - addonId
        - name
        - price
        - quantity
      properties:
        addonId:
          type: string
        name:
          type: string
        description:
          type: string
        price:
          type: number
        quantity:
          type: integer
          minimum: 1
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT issued by the Salesive Store API for authenticated shoppers.
    ShopIdHeader:
      type: apiKey
      in: header
      name: x-shop-id
      description: >-
        Optional storefront identifier sent as a header to scope responses to a
        specific shop. Try It requests remember this value once provided.

````