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

# Get cart

> Retrieves the current state of a cart, revalidating applied discounts when necessary.



## OpenAPI

````yaml https://api.craveup.com/swagger.json get /locations/{locationId}/carts/{cartId}
openapi: 3.0.0
info:
  title: Crave API v2.0
  version: 2.0.0
  description: >

    ## 🔑 Generate an API Key

    Every request to the Storefront API must include an API key.


    1. Sign in to the [Crave Business Manager](https://partners.craveup.com).

    2. Open **Settings → Developer → API Keys**.

    3. Click **Generate Key**, give it a descriptive name (for example,
    `storefront-sdk-staging`), and confirm.

    4. Copy the key immediately—once you leave the page it cannot be viewed
    again.


    Add the key to each request header:


    ```http

    GET /merchant/crave-collective

    Host: api.craveup.com

    X-API-Key: <your-api-key>

    ```


    ### Best practices

    - Store keys in environment variables or a secrets manager; never commit
    them to source control.

    - Use separate keys for staging and production so they can be rotated
    independently.

    - If a key is exposed, revoke it from the dashboard and generate a fresh one
    right away.
  contact:
    name: Crave Support
    email: support@craveup.com
servers:
  - url: https://api.craveup.com/api/v1
    description: Production Storefront API
  - url: https://dev-api-43233223.craveup.com/api/v1
    description: Staging Storefront API
security:
  - ApiKeyAuth: []
tags:
  - name: Merchants
    description: Retrieve merchant metadata and enabled storefront locations.
  - name: Locations
    description: Access individual location information and configuration.
  - name: Ordering Sessions
    description: Create or resume ordering sessions and carts for a location.
  - name: Menus
    description: Fetch menu bundles, categories, and popular products for a location.
  - name: Products
    description: Request detailed storefront product data including modifiers.
  - name: Carts
    description: Manage cart state, totals, and cross-sell recommendations.
  - name: Customers
    description: Handle storefront customer authentication, profiles, and sessions.
paths:
  /locations/{locationId}/carts/{cartId}:
    get:
      tags:
        - Carts
      summary: Get cart
      description: >-
        Retrieves the current state of a cart, revalidating applied discounts
        when necessary.
      parameters:
        - name: locationId
          in: path
          required: true
          schema:
            type: string
          example: loc_456def
        - name: cartId
          in: path
          required: true
          schema:
            type: string
          example: cart_123
      responses:
        '200':
          description: Cart retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StorefrontCart'
              examples:
                default:
                  summary: Active pickup cart
                  value:
                    id: cart_123
                    locationId: loc_456def
                    status: OPEN
                    lockedAt: null
                    discountCode: null
                    currency: usd
                    fulfilmentMethod: pickup
                    statementDescriptor: CRAVE*Downtown Pizza Co
                    pickupType: ASAP
                    orderDate: '2024-11-12'
                    orderTime: '18:30'
                    totalQuantity: 2
                    subTotal: '3600'
                    subTotalFormatted: $36.00
                    discountTotal: '0.00'
                    discountTotalFormatted: $0.00
                    waiterTipTotal: '0.00'
                    waiterTipTotalFormatted: $0.00
                    taxTotal: '280'
                    taxTotalFormatted: $2.80
                    taxAndFeeTotal: '320'
                    taxAndFeeTotalFormatted: $3.20
                    serviceFeeTotal: '120'
                    serviceFeeTotalFormatted: $1.20
                    paymentProcessingFeeTotal: '40'
                    paymentProcessingFeeTotalFormatted: $0.40
                    applicationFeeTotal: '0.00'
                    applicationFeeTotalFormatted: $0.00
                    netSalesTotal: '3600'
                    netSalesTotalFormatted: $36.00
                    fulfillmentMethodFeeTotal: '0.00'
                    fulfillmentMethodFeeTotalFormatted: $0.00
                    orderTotalWithServiceFee: '4040'
                    orderTotalWithServiceFeeFormatted: $40.40
                    orderTotalWithServiceFeeAmount: 4040
                    orderTotal: '4040'
                    orderTotalFormatted: $40.40
                    enterpriseFeeTotal: '0.00'
                    enterpriseFeeTotalFormatted: $0.00
                    subTotalWithoutDiscount: '3600'
                    subTotalWithoutDiscountFormatted: $36.00
                    restaurantDisplayName: Downtown Pizza Co
                    fees:
                      enterpriseFeeRate: '0.0000'
                      enterpriseFeeFix: '0.00'
                      serviceFeeRate: '0.0250'
                      serviceFeeFix: '0.00'
                      taxRate: '0.0775'
                      tipRate: '0.0000'
                      fulfillmentMethodFeeFix: '0.00'
                      fulfillmentMethodFeeRate: '0.0000'
                      paymentProcessingFeeRate: '0.0290'
                      paymentProcessingFeeFix: '0.30'
                    items:
                      - id: item_123
                        productId: prod_margherita
                        name: Margherita Pizza
                        description: Classic tomato, basil, mozzarella.
                        imageUrl: https://cdn.craveup.com/products/margherita.png
                        price: '1800'
                        priceFormatted: $18.00
                        quantity: 2
                        total: '3600'
                        totalFormatted: $36.00
                        discount: '0.00'
                        discountFormatted: $0.00
                        selections: []
                    deliveryInfo: null
                    tableServiceInfo: null
                    roomServiceInfo: null
                    metadata:
                      channel: qr
                    checkoutUrl: https://checkout.craveup.com/c/cart_123
                    fulfillmentIdentifier: null
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/GenericError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    StorefrontCart:
      type: object
      properties:
        id:
          type: string
          example: cart_123
        locationId:
          type: string
          example: loc_456def
        status:
          type: string
          example: OPEN
        lockedAt:
          type: string
          nullable: true
          format: date-time
          example: null
          description: >-
            Timestamp when the cart was locked for checkout. Null while the cart
            is editable.
        discountCode:
          type: string
          nullable: true
          example: SAVE10
        currency:
          type: string
          example: usd
        fulfilmentMethod:
          type: string
          example: pickup
          description: >-
            Current fulfillment method for the cart. Note: the API responds with
            the UK spelling `fulfilmentMethod`; when updating a cart send
            `fulfillmentMethod` in the request body.
        statementDescriptor:
          type: string
          nullable: true
          example: CRAVE*Downtown Pizza Co
          description: Descriptor that appears on the shopper’s card statement.
        pickupType:
          type: string
          example: ASAP
        orderDate:
          type: string
          example: '2024-11-12'
        orderTime:
          type: string
          example: '18:30'
        totalQuantity:
          type: integer
          example: 3
        subTotal:
          type: string
          example: '3600'
        subTotalFormatted:
          type: string
          example: $36.00
        discountTotal:
          type: string
          example: '0.00'
        discountTotalFormatted:
          type: string
          example: $0.00
        waiterTipTotal:
          type: string
          example: '540'
        waiterTipTotalFormatted:
          type: string
          example: $5.40
        taxTotal:
          type: string
          example: '280'
        taxTotalFormatted:
          type: string
          example: $2.80
        taxAndFeeTotal:
          type: string
          example: '320'
        taxAndFeeTotalFormatted:
          type: string
          example: $3.20
        serviceFeeTotal:
          type: string
          example: '120'
        serviceFeeTotalFormatted:
          type: string
          example: $1.20
        paymentProcessingFeeTotal:
          type: string
          example: '40'
        paymentProcessingFeeTotalFormatted:
          type: string
          example: $0.40
        applicationFeeTotal:
          type: string
          example: '0.00'
        applicationFeeTotalFormatted:
          type: string
          example: $0.00
        netSalesTotal:
          type: string
          example: '3600'
        netSalesTotalFormatted:
          type: string
          example: $36.00
        fulfillmentMethodFeeTotal:
          type: string
          example: '0.00'
        fulfillmentMethodFeeTotalFormatted:
          type: string
          example: $0.00
        orderTotalWithServiceFee:
          type: string
          example: '4460'
        orderTotalWithServiceFeeFormatted:
          type: string
          example: $44.60
        orderTotalWithServiceFeeAmount:
          type: number
          example: 4460
          description: Order total with fees converted into the smallest currency unit.
        orderTotal:
          type: string
          example: '4040'
        orderTotalFormatted:
          type: string
          example: $40.40
        enterpriseFeeTotal:
          type: string
          example: '0.00'
        enterpriseFeeTotalFormatted:
          type: string
          example: $0.00
        subTotalWithoutDiscount:
          type: string
          example: '3600'
        subTotalWithoutDiscountFormatted:
          type: string
          example: $36.00
        restaurantDisplayName:
          type: string
          example: Downtown Pizza Co
        deliveryInfo:
          type: object
          nullable: true
          properties:
            addressString:
              type: string
              example: 123 Market Street, San Francisco, CA 94105
            addressData:
              type: object
              additionalProperties: true
        tableServiceInfo:
          type: object
          nullable: true
          properties:
            tableNumber:
              type: string
              example: A5
        roomServiceInfo:
          type: object
          nullable: true
          properties:
            lastName:
              type: string
              example: Smith
            roomNumber:
              type: string
              example: '1203'
        fees:
          type: object
          properties:
            enterpriseFeeRate:
              type: string
              example: '0.0000'
            enterpriseFeeFix:
              type: string
              example: '0.00'
            serviceFeeRate:
              type: string
              example: '0.0250'
            serviceFeeFix:
              type: string
              example: '0.00'
            taxRate:
              type: string
              example: '0.0775'
            tipRate:
              type: string
              example: '0.0000'
            fulfillmentMethodFeeFix:
              type: string
              example: '0.00'
            fulfillmentMethodFeeRate:
              type: string
              example: '0.0000'
            paymentProcessingFeeRate:
              type: string
              example: '0.0290'
            paymentProcessingFeeFix:
              type: string
              example: '0.30'
        metadata:
          type: object
          nullable: true
          additionalProperties: true
        checkoutUrl:
          type: string
          nullable: true
        fulfillmentIdentifier:
          type: string
          nullable: true
          example: null
      additionalProperties: true
  responses:
    Unauthorized:
      description: Unauthorized - API key is missing or invalid.
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              message:
                type: string
                example: Unauthorized access
              code:
                type: string
                example: UNAUTHORIZED
    NotFound:
      description: Not Found - The requested resource was not found.
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              message:
                type: string
                example: Requested resource not found
              code:
                type: string
                example: NOT_FOUND
    GenericError:
      description: Generic Error - An unexpected error occurred.
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              message:
                type: string
                example: An unexpected error occurred
              code:
                type: string
                example: GENERIC_ERROR
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API Key required to authenticate requests

````