Medusa Carts API

A cart is a virtual shopping bag that customers can use to add items they want to purchase. A cart is then used to checkout and place an order. These API routes allow customers to create and manage their cart, and place an order.

Operations 15

POST /store/carts Create Cart #
GET /store/carts/{id} Get a Cart #
POST /store/carts/{id} Update a Cart #
POST /store/carts/{id}/complete Complete Cart #
POST /store/carts/{id}/customer Change Cart's Customer to Logged-in Customer #
POST /store/carts/{id}/gift-cards Add Gift Card to Cart #
DELETE /store/carts/{id}/gift-cards Remove Gift Card from Cart #
POST /store/carts/{id}/line-items Add Line Item to Cart #
POST /store/carts/{id}/line-items/{line_id} Update a Line Item in a Cart #
DELETE /store/carts/{id}/line-items/{line_id} Remove Line Item from Cart #
POST /store/carts/{id}/promotions Add Promotions to Cart #
DELETE /store/carts/{id}/promotions Remove Promotions from Cart #
POST /store/carts/{id}/shipping-methods Add Shipping Method to Cart #
POST /store/carts/{id}/store-credits Add Store Credit to Cart #
POST /store/carts/{id}/taxes Calculate Cart Taxes #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/medusa-carts-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

medusa-carts-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  version: 2.19.0
  title: Medusa Storefront Carts API
  license:
    name: MIT
    url: https://github.com/medusajs/medusa/blob/master/LICENSE
  description: 'A cart is a virtual shopping bag that customers can use to add items they want to purchase.


    A cart is then used to checkout and place an order.


    These API routes allow customers to create and manage their cart, and place an order.

    '
servers:
- url: http://localhost:9000
- url: https://api.medusajs.com
tags:
- name: Carts
  description: 'A cart is a virtual shopping bag that customers can use to add items they want to purchase.


    A cart is then used to checkout and place an order.


    These API routes allow customers to create and manage their cart, and place an order.

    '
  externalDocs:
    description: How to implement cart functionality in a storefront.
    url: https://docs.medusajs.com/resources/storefront-development/cart
  x-associatedSchema:
    $ref: '#/components/schemas/StoreCart'
paths:
  /store/carts:
    post:
      operationId: PostCarts
      summary: Create Cart
      description: Create a cart.
      x-authenticated: false
      parameters:
      - name: x-publishable-api-key
        in: header
        description: Publishable API Key created in the Medusa Admin.
        required: true
        schema:
          type: string
          externalDocs:
            url: https://docs.medusajs.com/api/store#publishable-api-key
      - name: x-medusa-locale
        in: header
        description: The locale in BCP 47 format to retrieve localized content.
        required: false
        schema:
          type: string
          example: en-US
          externalDocs:
            url: https://docs.medusajs.com/resources/commerce-modules/translation/storefront
            description: Learn more in the Serve Translations in Storefront guide.
      - name: fields
        in: query
        description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. without prefix it will replace the entire default fields.
        required: false
        schema:
          type: string
          title: fields
          description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. without prefix it will replace the entire default fields.
          externalDocs:
            url: '#select-fields-and-relations'
      - name: locale
        in: query
        description: The locale in BCP 47 format to retrieve localized content.
        required: false
        schema:
          type: string
          example: en-US
          externalDocs:
            url: https://docs.medusajs.com/resources/commerce-modules/translation/storefront
            description: Learn more in the Serve Translations in Storefront guide.
      requestBody:
        content:
          application/json:
            schema:
              allOf:
              - $ref: '#/components/schemas/StoreCreateCart'
              - type: object
                description: The cart's details.
                properties:
                  additional_data:
                    type: object
                    description: Pass additional custom data to the API route. This data is passed to the underlying workflow under the `additional_data` parameter.
              description: The cart's details.
      x-codeSamples:
      - lang: JavaScript
        label: JS SDK
        source: "import Medusa from \"@medusajs/js-sdk\"\n\nlet MEDUSA_BACKEND_URL = \"http://localhost:9000\"\n\nif (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {\n  MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL\n}\n\nexport const sdk = new Medusa({\n  baseUrl: MEDUSA_BACKEND_URL,\n  debug: process.env.NODE_ENV === \"development\",\n  publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,\n})\n\nsdk.store.cart.create({\n  region_id: \"reg_123\"\n})\n.then(({ cart }) => {\n  console.log(cart)\n})"
      - lang: Shell
        label: cURL
        source: "curl -X POST '{backend_url}/store/carts' \\\n-H 'Content-Type: application/json' \\\n-H 'x-publishable-api-key: {your_publishable_api_key}' \\\n--data-raw '{\n  \"region_id\": \"reg_123\"\n}'"
      tags:
      - Carts
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StoreCartResponse'
        '400':
          $ref: '#/components/responses/400_error'
        '401':
          $ref: '#/components/responses/unauthorized'
        '404':
          $ref: '#/components/responses/not_found_error'
        '409':
          $ref: '#/components/responses/invalid_state_error'
        '422':
          $ref: '#/components/responses/invalid_request_error'
        '500':
          $ref: '#/components/responses/500_error'
      x-workflow: createCartWorkflow
      x-events:
      - name: cart.created
        payload: "```ts\n{\n  id, // The ID of the cart\n}\n```"
        description: Emitted when a cart is created.
        deprecated: false
  /store/carts/{id}:
    get:
      operationId: GetCartsId
      summary: Get a Cart
      description: Retrieve a cart by its ID. You can expand the cart's relations or select the fields that should be returned.
      x-authenticated: false
      parameters:
      - name: id
        in: path
        description: The cart's ID.
        required: true
        schema:
          type: string
      - name: x-publishable-api-key
        in: header
        description: Publishable API Key created in the Medusa Admin.
        required: true
        schema:
          type: string
          externalDocs:
            url: https://docs.medusajs.com/api/store#publishable-api-key
      - name: x-medusa-locale
        in: header
        description: The locale in BCP 47 format to retrieve localized content.
        required: false
        schema:
          type: string
          example: en-US
          externalDocs:
            url: https://docs.medusajs.com/resources/commerce-modules/translation/storefront
            description: Learn more in the Serve Translations in Storefront guide.
      - name: fields
        in: query
        description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. without prefix it will replace the entire default fields.
        required: false
        schema:
          type: string
          title: fields
          description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. without prefix it will replace the entire default fields.
          externalDocs:
            url: '#select-fields-and-relations'
      - name: locale
        in: query
        description: The locale in BCP 47 format to retrieve localized content.
        required: false
        schema:
          type: string
          example: en-US
          externalDocs:
            url: https://docs.medusajs.com/resources/commerce-modules/translation/storefront
            description: Learn more in the Serve Translations in Storefront guide.
      x-codeSamples:
      - lang: JavaScript
        label: JS SDK
        source: "import Medusa from \"@medusajs/js-sdk\"\n\nlet MEDUSA_BACKEND_URL = \"http://localhost:9000\"\n\nif (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {\n  MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL\n}\n\nexport const sdk = new Medusa({\n  baseUrl: MEDUSA_BACKEND_URL,\n  debug: process.env.NODE_ENV === \"development\",\n  publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,\n})\n\nsdk.store.cart.retrieve(\"cart_123\")\n.then(({ cart }) => {\n  console.log(cart)\n})"
      - lang: Shell
        label: cURL
        source: 'curl ''{backend_url}/store/carts/{id}'' \

          -H ''x-publishable-api-key: {your_publishable_api_key}'''
      tags:
      - Carts
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StoreCartResponse'
        '400':
          $ref: '#/components/responses/400_error'
        '401':
          $ref: '#/components/responses/unauthorized'
        '404':
          $ref: '#/components/responses/not_found_error'
        '409':
          $ref: '#/components/responses/invalid_state_error'
        '422':
          $ref: '#/components/responses/invalid_request_error'
        '500':
          $ref: '#/components/responses/500_error'
    post:
      operationId: PostCartsId
      summary: Update a Cart
      description: Update a cart's details. This unsets the payment methods chosen before, and the customer would have to choose them again. Also, if the customer has chosen a shipping method whose option isn't valid for the cart's shipping address anymore, the shipping method will be unset. For example, if the shipping option is valid only in the US geo zone, and the shipping address's country code is `DE`, the shipping method will be unset.
      x-authenticated: false
      parameters:
      - name: id
        in: path
        description: The cart's ID.
        required: true
        schema:
          type: string
      - name: x-publishable-api-key
        in: header
        description: Publishable API Key created in the Medusa Admin.
        required: true
        schema:
          type: string
          externalDocs:
            url: https://docs.medusajs.com/api/store#publishable-api-key
      - name: x-medusa-locale
        in: header
        description: The locale in BCP 47 format to retrieve localized content.
        required: false
        schema:
          type: string
          example: en-US
          externalDocs:
            url: https://docs.medusajs.com/resources/commerce-modules/translation/storefront
            description: Learn more in the Serve Translations in Storefront guide.
      - name: fields
        in: query
        description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. without prefix it will replace the entire default fields.
        required: false
        schema:
          type: string
          title: fields
          description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. without prefix it will replace the entire default fields.
          externalDocs:
            url: '#select-fields-and-relations'
      - name: locale
        in: query
        description: The locale in BCP 47 format to retrieve localized content.
        required: false
        schema:
          type: string
          example: en-US
          externalDocs:
            url: https://docs.medusajs.com/resources/commerce-modules/translation/storefront
            description: Learn more in the Serve Translations in Storefront guide.
      requestBody:
        content:
          application/json:
            schema:
              allOf:
              - $ref: '#/components/schemas/UpdateCartData'
              - type: object
                description: The properties to update in the cart item.
                properties:
                  additional_data:
                    type: object
                    description: Pass additional custom data to the API route. This data is passed to the underlying workflow under the `additional_data` parameter.
              description: The properties to update in the cart item.
      x-codeSamples:
      - lang: JavaScript
        label: JS SDK
        source: "import Medusa from \"@medusajs/js-sdk\"\n\nlet MEDUSA_BACKEND_URL = \"http://localhost:9000\"\n\nif (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {\n  MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL\n}\n\nexport const sdk = new Medusa({\n  baseUrl: MEDUSA_BACKEND_URL,\n  debug: process.env.NODE_ENV === \"development\",\n  publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,\n})\n\nsdk.store.cart.update(\"cart_123\", {\n  region_id: \"reg_123\"\n})\n.then(({ cart }) => {\n  console.log(cart)\n})"
      - lang: Shell
        label: cURL
        source: 'curl -X POST ''{backend_url}/store/carts/{id}'' \

          -H ''x-publishable-api-key: {your_publishable_api_key}'''
      tags:
      - Carts
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                description: The updated cart's details.
                required:
                - cart
                properties:
                  cart:
                    $ref: '#/components/schemas/StoreCart'
        '400':
          $ref: '#/components/responses/400_error'
        '401':
          $ref: '#/components/responses/unauthorized'
        '404':
          $ref: '#/components/responses/not_found_error'
        '409':
          $ref: '#/components/responses/invalid_state_error'
        '422':
          $ref: '#/components/responses/invalid_request_error'
        '500':
          $ref: '#/components/responses/500_error'
      x-workflow: updateCartWorkflow
      x-events:
      - name: cart.updated
        payload: "```ts\n{\n  id, // The ID of the cart\n}\n```"
        description: Emitted when a cart's details are updated.
        deprecated: false
      - name: cart.region_updated
        payload: "```ts\n{\n  id, // The ID of the cart\n}\n```"
        description: 'Emitted when the cart''s region is updated. This

          event is emitted alongside the `cart.updated` event.'
        deprecated: false
  /store/carts/{id}/complete:
    post:
      operationId: PostCartsIdComplete
      summary: Complete Cart
      description: Complete a cart and place an order.
      x-authenticated: false
      externalDocs:
        url: https://docs.medusajs.com/resources/storefront-development/checkout/complete-cart
        description: 'Storefront guide: How to implement cart completion during checkout.'
      parameters:
      - name: id
        in: path
        description: The cart's ID.
        required: true
        schema:
          type: string
      - name: x-publishable-api-key
        in: header
        description: Publishable API Key created in the Medusa Admin.
        required: true
        schema:
          type: string
          externalDocs:
            url: https://docs.medusajs.com/api/store#publishable-api-key
      - name: x-medusa-locale
        in: header
        description: The locale in BCP 47 format to retrieve localized content.
        required: false
        schema:
          type: string
          example: en-US
          externalDocs:
            url: https://docs.medusajs.com/resources/commerce-modules/translation/storefront
            description: Learn more in the Serve Translations in Storefront guide.
      - name: fields
        in: query
        description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. without prefix it will replace the entire default fields.
        required: false
        schema:
          type: string
          title: fields
          description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. without prefix it will replace the entire default fields.
          externalDocs:
            url: '#select-fields-and-relations'
      - name: locale
        in: query
        description: The locale in BCP 47 format to retrieve localized content.
        required: false
        schema:
          type: string
          example: en-US
          externalDocs:
            url: https://docs.medusajs.com/resources/commerce-modules/translation/storefront
            description: Learn more in the Serve Translations in Storefront guide.
      x-codeSamples:
      - lang: JavaScript
        label: JS SDK
        source: "import Medusa from \"@medusajs/js-sdk\"\n\nlet MEDUSA_BACKEND_URL = \"http://localhost:9000\"\n\nif (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {\n  MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL\n}\n\nexport const sdk = new Medusa({\n  baseUrl: MEDUSA_BACKEND_URL,\n  debug: process.env.NODE_ENV === \"development\",\n  publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,\n})\n\nsdk.store.cart.complete(\"cart_123\")\n.then((data) => {\n  if(data.type === \"cart\") {\n    // an error occurred\n    console.log(data.error, data.cart)\n  } else {\n    // order placed successfully\n    console.log(data.order)\n  }\n})"
      - lang: Shell
        label: cURL
        source: 'curl -X POST ''{backend_url}/store/carts/{id}/complete'' \

          -H ''x-publishable-api-key: {your_publishable_api_key}'''
      tags:
      - Carts
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                oneOf:
                - type: object
                  description: The created order's details.
                  required:
                  - type
                  - order
                  properties:
                    type:
                      type: string
                      title: type
                      description: The type of the returned object. In this case, the order is returned because the cart was completed successfully.
                      default: order
                    order:
                      $ref: '#/components/schemas/StoreOrder'
                - type: object
                  description: The details of why the cart completion failed.
                  required:
                  - type
                  - cart
                  - error
                  properties:
                    type:
                      type: string
                      title: type
                      description: The type of the returned object. In this case, the cart is returned because an error has occurred.
                      default: cart
                    cart:
                      $ref: '#/components/schemas/StoreCart'
                    error:
                      type: object
                      description: The error's details.
                      required:
                      - message
                      - name
                      - type
                      properties:
                        message:
                          type: string
                          title: message
                          description: The error's message.
                        name:
                          type: string
                          title: name
                          description: The error's name.
                        type:
                          type: string
                          title: type
                          description: 'The error''s type. Can be a [MedusaError type](https://docs.medusajs.com/learn/fundamentals/api-routes/errors#medusaerror-types) or `payment_authorization_error` or `payment_requires_more_error` for payment-related errors.

                            '
        '400':
          $ref: '#/components/responses/400_error'
        '401':
          $ref: '#/components/responses/unauthorized'
        '404':
          $ref: '#/components/responses/not_found_error'
        '409':
          $ref: '#/components/responses/invalid_state_error'
        '422':
          $ref: '#/components/responses/invalid_request_error'
        '500':
          $ref: '#/components/responses/500_error'
      x-workflow: completeCartWorkflow
      x-events:
      - name: order.placed
        payload: "```ts\n{\n  id, // The ID of the order\n}\n```"
        description: 'Emitted when an order is placed, or when a draft order is converted to an

          order.'
        deprecated: false
      - name: reservation-item.created
        payload: "```ts\n{\n  id, // The ID of the reservation\n  order_id, // (optional) The ID of the order, if the reservation was created by an order flow\n}\n```"
        description: Emitted when reservations are created.
        deprecated: false
        since: 2.18.0
  /store/carts/{id}/customer:
    post:
      operationId: PostCartsIdCustomer
      summary: Change Cart's Customer to Logged-in Customer
      x-sidebar-summary: Change Customer
      description: Change the cart's customer to the currently logged-in customer. This is useful when you create the cart for a guest customer, then they log in with their account.
      externalDocs:
        url: https://docs.medusajs.com/resources/storefront-development/cart/update#set-carts-customer
        description: 'Storefront guide: How to set the cart''s customer.'
      x-authenticated: true
      parameters:
      - name: id
        in: path
        description: The cart's ID.
        required: true
        schema:
          type: string
      - name: x-publishable-api-key
        in: header
        description: Publishable API Key created in the Medusa Admin.
        required: true
        schema:
          type: string
          externalDocs:
            url: https://docs.medusajs.com/api/store#publishable-api-key
      - name: x-medusa-locale
        in: header
        description: The locale in BCP 47 format to retrieve localized content.
        required: false
        schema:
          type: string
          example: en-US
          externalDocs:
            url: https://docs.medusajs.com/resources/commerce-modules/translation/storefront
            description: Learn more in the Serve Translations in Storefront guide.
      - name: fields
        in: query
        description: 'Comma-separated fields that should be included in the returned data.

          if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields.

          without prefix it will replace the entire default fields.'
        required: false
        schema:
          type: string
          title: fields
          description: Comma-separated fields that should be included in the returned data. If a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. Without prefix it will replace the entire default fields.
          externalDocs:
            url: '#select-fields-and-relations'
      - name: locale
        in: query
        description: The locale in BCP 47 format to retrieve localized content.
        required: false
        schema:
          type: string
          example: en-US
          externalDocs:
            url: https://docs.medusajs.com/resources/commerce-modules/translation/storefront
            description: Learn more in the Serve Translations in Storefront guide.
      security:
      - cookie_auth: []
      - jwt_token: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              description: Optional additional data to pass to the underlying workflow.
              properties:
                additional_data:
                  type: object
                  description: Pass additional custom data to the API route. This data is passed to the underlying workflow under the `additional_data` parameter.
      x-codeSamples:
      - lang: JavaScript
        label: JS SDK
        source: "import Medusa from \"@medusajs/js-sdk\"\n\nlet MEDUSA_BACKEND_URL = \"http://localhost:9000\"\n\nif (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {\n  MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL\n}\n\nexport const sdk = new Medusa({\n  baseUrl: MEDUSA_BACKEND_URL,\n  debug: process.env.NODE_ENV === \"development\",\n  publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,\n})\n\n// TODO must be authenticated as the customer to set the cart's customer\nsdk.store.cart.transferCart(\"cart_123\")\n.then(({ cart }) => {\n  console.log(cart)\n})"
      - lang: Shell
        label: cURL
        source: 'curl -X POST ''{backend_url}/store/carts/{id}/customer'' \

          -H ''Authorization: Bearer {jwt_token}'' \

          -H ''x-publishable-api-key: {your_publishable_api_key}'''
      tags:
      - Carts
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StoreCartResponse'
        '400':
          $ref: '#/components/responses/400_error'
        '401':
          $ref: '#/components/responses/unauthorized'
        '404':
          $ref: '#/components/responses/not_found_error'
        '409':
          $ref: '#/components/responses/invalid_state_error'
        '422':
          $ref: '#/components/responses/invalid_request_error'
        '500':
          $ref: '#/components/responses/500_error'
      x-workflow: transferCartCustomerWorkflow
      x-events:
      - name: cart.customer_transferred
        payload: "```ts\n{\n  id, // The ID of the cart\n  customer_id, // The ID of the customer\n}\n```"
        description: Emitted when the customer in the cart is transferred.
        deprecated: false
        since: 2.8.0
  /store/carts/{id}/gift-cards:
    post:
      operationId: PostCartsIdGiftCards
      summary: Add Gift Card to Cart
      x-sidebar-summary: Add Gift Card
      description: Add a Gift Card to a cart
      x-authenticated: false
      x-ignoreCleanup: true
      parameters:
      - name: id
        in: path
        description: The cart's ID.
        required: true
        schema:
          type: string
      - name: x-publishable-api-key
        in: header
        description: Publishable API Key created in the Medusa Admin.
        required: true
        schema:
          type: string
          externalDocs:
            url: https://docs.medusajs.com/api/store#publishable-api-key
      - name: x-medusa-locale
        in: header
        description: The locale in BCP 47 format to retrieve localized content.
        required: false
        schema:
          type: string
          example: en-US
          externalDocs:
            url: https://docs.medusajs.com/resources/commerce-modules/translation/storefront
            description: Learn more in the Serve Translations in Storefront guide.
      - name: locale
        in: query
        description: The locale in BCP 47 format to retrieve localized content.
        required: false
        schema:
          type: string
          example: en-US
          externalDocs:
            url: https://docs.medusajs.com/resources/commerce-modules/translation/storefront
            description: Learn more in the Serve Translations in Storefront guide.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StoreAddGiftCardToCart'
      x-codeSamples:
      - lang: Shell
        label: cURL
        source: "curl -X POST '{backend_url}/store/carts/{id}/gift-cards' \\\n-H 'x-publishable-api-key: {your_publishable_api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{\n  \"code\": \"{value}\"\n}'"
      tags:
      - Carts
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StoreCartResponse'
        '400':
          $ref: '#/components/responses/400_error'
        '401':
          $ref: '#/components/responses/unauthorized'
        '404':
          $ref: '#/components/responses/not_found_error'
        '409':
          $ref: '#/components/responses/invalid_state_error'
        '422':
          $ref: '#/components/responses/invalid_request_error'
        '500':
          $ref: '#/components/responses/500_error'
      x-badges:
      - text: Plugin
        description: 'This API route is only available through the [Loyalty Plugin](https://docs.medusajs.com/resources/commerce-modules/loyalty).

          '
    delete:
      operationId: DeleteCartsIdGiftCards
      summary: Remove Gift Card from Cart
      x-sidebar-summary: Remove Gift Card
      description: Remove a Gift Card from a cart.
      x-authenticated: false
      x-ignoreCleanup: true
      parameters:
      - name: id
        in: path
        description: The cart's ID.
        required: true
        schema:
          type: string
      - name: x-publishable-api-key
        in: header
        description: Publishable API Key created in the Medusa Admin.
        required: true
        schema:
          type: string
          externalDocs:
            url: https://docs.medusajs.com/api/store#publishable-api-key
      - name: x-medusa-locale
        in: header
        description: The locale in BCP 47 format to retrieve localized content.
        required: false
        schema:
          type: string
          example: en-US
          externalDocs:
            url: https://docs.medusajs.com/resources/commerce-modules/translation/storefront
            description: Learn more in the Serve Translations in Storefront guide.
      - name: locale
        in: query
        description: The locale in BCP 47 format to retrieve localized content.
        required: false
        schema:
          type: string
          example: en-US
          externalDocs:
            url: https://docs.medusajs.com/resources/commerce-modules/translation/storefront
            description: Learn more in the Serve Translations in Storefront guide.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StoreRemoveGiftCardFromCart'
      x-codeSamples:
      - lang: Shell
        label: cURL
        source: "curl -X DELETE '{backend_url}/store/carts/{id}/gift-cards' \\\n-H 'x-publishable-api-key: {your_publishable_api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{\n  \"code\": \"{value}\"\n}'"
      tags:
      - Carts
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StoreCartResponse'
        '400':
          $ref: '#/components/responses/400_error'
        '401':
          $ref: '#/components/responses/unauthorized'
        '404':
          $ref: '#/components/responses/not_found_error'
        '409':
          $ref: '#/components/responses/invalid_state_error'
        '422':
          $ref: '#/components/responses/invalid_request_error'
        '500':
          $ref: '#/components/responses/500_error'
      x-badges:
      - text: Plugin
        description: 'This API route is only available through the [Loyalty Plugin](https://docs.medusajs.com/resources/commerce-modules/loyalty).

          '
  /store/carts/{id}/line-items:
    post:
      operationId: PostCartsIdLineItems
      summary: Add Line Item to Cart
      x-sidebar-summary: Add Line Item
      description: Add a product variant as a line item in the cart.
      externalDocs:
        url: https://docs.medusajs.com/resources/storefront-development/cart/manage-items#add-product-variant-to-cart
        description: 'Storefront guide: How to add a product variant to the cart.'
      x-authenticated: false
      parameters:
      - name: id
        in: path
        description: The cart's ID.
        required: true
        schema:
          type: string
      - name: x-publishable-api-key
        in: header
        description: Publishable API Key created in the Medusa Admin.
        required: true
        schema:
          type: string
          externalDocs:
            url: https://docs.medusajs.com/api/store#publishable-api-key
      - name: x-medusa-locale
        in: header
        description: The locale in BCP 47 format to retrieve localized content.
        required: false
        schema:
          type: string
          example: en-US
          externalDocs:
            url: https://docs.medusajs.com/resources/commerce-modules/translation/storefront
            description: Learn more in the Serve Translation

# --- truncated at 32 KB (241 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/medusa/refs/heads/main/openapi/medusa-carts-api-openapi.yml