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

# Cart Create

> Create a cart with one or more items and get a checkout URL



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/henry-sdk/openapi.documented.yml post /cart
openapi: 3.1.0
info:
  title: Henry Labs API
  version: 1.5.0
  description: Playground for Henry Labs API endpoints
  contact:
    name: Henry Labs API Support
    email: support@henrylabs.ai
servers:
  - url: https://api.henrylabs.ai/v1
    description: Production server
security:
  - ApiKeyAuth: []
tags:
  - name: Product
    description: Product search, details, and data enrichment
  - name: Cart
    description: Universal user shopping cart management
  - name: Orders
    description: Order management post purchase
  - name: Merchants
    description: Merchant information and status
  - name: Card
    description: Card tokenization and management
paths:
  /cart:
    post:
      tags:
        - Cart
      summary: Cart Create
      description: Create a cart with one or more items and get a checkout URL
      operationId: cartCreate
      requestBody:
        content:
          application/json:
            example:
              items:
                - link: https://www.nike.com/u/custom-nike-ja-3-by-you-10002205
                  affiliateProductLink: >-
                    https://partner.example.com/click?url=https%3A%2F%2Fwww.nike.com%2Fu%2Fcustom-nike-ja-3-by-you-10002205
                  quantity: 2
                  selectedOptions:
                    - regular
                    - black
                    - 10-w
                  metadata:
                    creatorSource: Frank Herbert
              settings:
                options:
                  allowPartialPurchase: true
                  collectBuyerEmail: required
                  collectBuyerAddress: optional
                  collectBuyerPhone: 'off'
                serviceFeeFixed:
                  value: 1.99
                  currency: USD
                serviceFeePercent: 10
                events: []
            schema:
              $ref: '#/components/schemas/cartCreateInput'
      responses:
        '201':
          description: Cart created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/cartCreateResponse'
        '400':
          description: Bad request - Invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  status:
                    type: string
                  message:
                    type: string
                required:
                  - success
                  - status
                  - message
                additionalProperties: false
        '401':
          description: Unauthorized - Invalid API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  status:
                    type: string
                  message:
                    type: string
                required:
                  - success
                  - status
                  - message
                additionalProperties: false
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import HenrySDK from '@henrylabs/sdk';

            const client = new HenrySDK({
              apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted
            });

            const cart = await client.cart.create({
              items: [
                {
                  link: 'https://www.nike.com/u/custom-nike-ja-3-by-you-10002205',
                  affiliateProductLink:
                    'https://partner.example.com/click?url=https%3A%2F%2Fwww.nike.com%2Fu%2Fcustom-nike-ja-3-by-you-10002205',
                  quantity: 2,
                  selectedOptions: ['regular', 'black', '10-w'],
                  metadata: { creatorSource: 'Frank Herbert' },
                },
              ],
              settings: {
                options: {
                  allowPartialPurchase: true,
                  collectBuyerEmail: 'required',
                  collectBuyerAddress: 'optional',
                  collectBuyerPhone: 'off',
                },
                serviceFeeFixed: { value: 1.99, currency: 'USD' },
                serviceFeePercent: 10,
                events: [],
              },
            });

            console.log(cart.data);
components:
  schemas:
    cartCreateInput:
      type: object
      properties:
        items:
          minItems: 1
          type: array
          items:
            $ref: '#/components/schemas/cartItemInput'
          description: Items to include in the cart
        settings:
          $ref: '#/components/schemas/cartSettings'
        tags:
          description: Key-value tags to associate with the cart
          examples:
            - region: us-ny
            - user: hen-123
          type: object
          propertyNames:
            type: string
          additionalProperties:
            type: string
      required:
        - items
    cartCreateResponse:
      type: object
      properties:
        success:
          type: boolean
        status:
          type: string
        message:
          type: string
        data:
          $ref: '#/components/schemas/cartCreateResponseData'
      required:
        - success
        - status
        - message
        - data
      additionalProperties: false
    cartItemInput:
      type: object
      properties:
        link:
          type: string
          format: uri
          description: Direct product URL
          example: https://www.nike.com/u/custom-nike-ja-3-by-you-10002205
        affiliateProductLink:
          description: >-
            Optional affiliate or redirect URL used for fulfillment. If omitted,
            link is used.
          example: >-
            https://partner.example.com/click?url=https%3A%2F%2Fwww.nike.com%2Fu%2Fcustom-nike-ja-3-by-you-10002205
          type: string
          format: uri
        quantity:
          description: Quantity of this item
          example: 1
          default: 1
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        selectedOptions:
          description: >-
            An ordered array of option values to select for the product. Will be
            selected in the order listed.
          example:
            - regular
            - black
            - 10-w
          type: array
          items:
            type: string
        selectedShipping:
          description: Shipping option selected for this cart item
          example:
            value: standard
          type: object
          properties:
            id:
              description: Merchant-specific internal ID for the shipping option
              example: SHIP_EXPRESS
              type: string
            value:
              description: Common value of the shipping option
              example: express
              type: string
        coupons:
          description: List of coupon codes applied to this cart item
          example:
            - SUMMER26
            - SAVE10
          type: array
          items:
            type: string
        metadata:
          description: Misc metadata associated with this cart item
          example:
            creatorSource: Frank Herbert
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
      required:
        - link
    cartSettings:
      type: object
      properties:
        options:
          type: object
          properties:
            allowPartialPurchase:
              description: Whether the buyer can remove items from the cart during checkout
              type: boolean
            collectBuyerEmail:
              description: Controls email collection at checkout
              example: required
              type: string
              enum:
                - 'off'
                - required
                - optional
            collectBuyerAddress:
              description: Controls address collection at checkout
              example: optional
              type: string
              enum:
                - 'off'
                - required
                - optional
            collectBuyerPhone:
              description: Controls phone collection at checkout
              example: 'off'
              type: string
              enum:
                - 'off'
                - required
                - optional
        serviceFeeFixed:
          type: object
          properties:
            value:
              type: number
              minimum: 0
              description: Fixed service fee amount
              example: 1.99
            currency:
              default: USD
              description: ISO-4217 currency code
              example: USD
              type: string
              enum:
                - USD
                - EUR
                - AUD
                - SGD
                - TWD
                - GBP
                - CAD
                - MXN
                - NPR
                - INR
                - DKK
                - NOK
                - SEK
                - CHF
                - PLN
                - CZK
                - JPY
                - NZD
                - HKD
          required:
            - value
        serviceFeePercent:
          description: Service fee percentage (0–100)
          example: 10
          type: number
          minimum: 0
          maximum: 100
        events:
          $ref: '#/components/schemas/cartTriggerEvents'
    cartCreateResponseData:
      type: object
      properties:
        cartId:
          type: string
          description: ID for the created cart
        checkoutUrl:
          type: string
          format: uri
          description: URL for the buyer to make their purchase
        data:
          $ref: '#/components/schemas/cartCreateInputOutput'
        metadata:
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
      required:
        - cartId
        - checkoutUrl
        - data
      additionalProperties: false
    cartTriggerEvents:
      description: List of events to trigger during checkout
      type: array
      items:
        $ref: '#/components/schemas/TriggerEvent'
    cartCreateInputOutput:
      type: object
      properties:
        items:
          minItems: 1
          type: array
          items:
            $ref: '#/components/schemas/cartItemInputOutput'
          description: Items to include in the cart
        settings:
          $ref: '#/components/schemas/cartSettingsOutput'
        tags:
          description: Key-value tags to associate with the cart
          examples:
            - region: us-ny
            - user: hen-123
          type: object
          propertyNames:
            type: string
          additionalProperties:
            type: string
      required:
        - items
      additionalProperties: false
    TriggerEvent:
      type: object
      properties:
        type:
          type: string
          enum:
            - order
            - order.item
            - order.item.pending
            - order.item.processing
            - order.item.complete
            - order.item.failed
            - order.purchase
            - order.purchase.pending
            - order.purchase.processing
            - order.purchase.complete
            - order.purchase.cancelled
            - order.purchase.failed
            - order.purchase.full
            - order.purchase.full.pending
            - order.purchase.full.processing
            - order.purchase.full.complete
            - order.purchase.full.cancelled
            - order.purchase.full.failed
            - order.purchase.partial
            - order.purchase.partial.pending
            - order.purchase.partial.processing
            - order.purchase.partial.complete
            - order.purchase.partial.cancelled
            - order.purchase.partial.failed
            - order.update
            - order.update.3ds-required
            - order.update.adding-to-cart
            - order.update.filling-address-details
            - order.update.filling-card-details
            - order.update.submitting-order
            - order.update.changing-quantity
            - order.update.applying-coupon
            - order.update.selecting-shipping
            - order.update.selecting-options
            - order.update.product-search
            - points
            - points.give
            - points.remove
            - tier
            - tier.give
            - tier.remove
        conditional:
          $ref: '#/components/schemas/TriggerConditional'
        data:
          type: array
          items:
            $ref: '#/components/schemas/Trigger'
      required:
        - type
        - data
    cartItemInputOutput:
      type: object
      properties:
        link:
          type: string
          format: uri
          description: Direct product URL
          example: https://www.nike.com/u/custom-nike-ja-3-by-you-10002205
        affiliateProductLink:
          description: >-
            Optional affiliate or redirect URL used for fulfillment. If omitted,
            link is used.
          example: >-
            https://partner.example.com/click?url=https%3A%2F%2Fwww.nike.com%2Fu%2Fcustom-nike-ja-3-by-you-10002205
          type: string
          format: uri
        quantity:
          description: Quantity of this item
          example: 1
          default: 1
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        selectedOptions:
          description: >-
            An ordered array of option values to select for the product. Will be
            selected in the order listed.
          example:
            - regular
            - black
            - 10-w
          type: array
          items:
            type: string
        selectedShipping:
          description: Shipping option selected for this cart item
          example:
            value: standard
          type: object
          properties:
            id:
              description: Merchant-specific internal ID for the shipping option
              example: SHIP_EXPRESS
              type: string
            value:
              description: Common value of the shipping option
              example: express
              type: string
          additionalProperties: false
        coupons:
          description: List of coupon codes applied to this cart item
          example:
            - SUMMER26
            - SAVE10
          type: array
          items:
            type: string
        metadata:
          description: Misc metadata associated with this cart item
          example:
            creatorSource: Frank Herbert
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
      required:
        - link
      additionalProperties: false
    cartSettingsOutput:
      type: object
      properties:
        options:
          type: object
          properties:
            allowPartialPurchase:
              description: Whether the buyer can remove items from the cart during checkout
              type: boolean
            collectBuyerEmail:
              description: Controls email collection at checkout
              example: required
              type: string
              enum:
                - 'off'
                - required
                - optional
            collectBuyerAddress:
              description: Controls address collection at checkout
              example: optional
              type: string
              enum:
                - 'off'
                - required
                - optional
            collectBuyerPhone:
              description: Controls phone collection at checkout
              example: 'off'
              type: string
              enum:
                - 'off'
                - required
                - optional
          additionalProperties: false
        serviceFeeFixed:
          type: object
          properties:
            value:
              type: number
              minimum: 0
              description: Fixed service fee amount
              example: 1.99
            currency:
              default: USD
              description: ISO-4217 currency code
              example: USD
              type: string
              enum:
                - USD
                - EUR
                - AUD
                - SGD
                - TWD
                - GBP
                - CAD
                - MXN
                - NPR
                - INR
                - DKK
                - NOK
                - SEK
                - CHF
                - PLN
                - CZK
                - JPY
                - NZD
                - HKD
          required:
            - value
            - currency
          additionalProperties: false
        serviceFeePercent:
          description: Service fee percentage (0–100)
          example: 10
          type: number
          minimum: 0
          maximum: 100
        events:
          $ref: '#/components/schemas/cartTriggerEventsOutput'
      additionalProperties: false
    TriggerConditional:
      oneOf:
        - $ref: '#/components/schemas/TriggerConditionalTier'
        - $ref: '#/components/schemas/TriggerConditionalPoints'
      type: object
      discriminator:
        propertyName: type
        mapping:
          tier:
            $ref: '#/components/schemas/TriggerConditionalTier'
          points:
            $ref: '#/components/schemas/TriggerConditionalPoints'
    Trigger:
      oneOf:
        - $ref: '#/components/schemas/TriggerGivePointsFixed'
        - $ref: '#/components/schemas/TriggerGivePointsPerSpent'
        - $ref: '#/components/schemas/TriggerRemovePointsFixed'
        - $ref: '#/components/schemas/TriggerRemovePointsPerSpent'
        - $ref: '#/components/schemas/TriggerGiveTier'
        - $ref: '#/components/schemas/TriggerRemoveTier'
        - $ref: '#/components/schemas/TriggerSendWebhook'
        - $ref: '#/components/schemas/TriggerSendEmail'
      type: object
      discriminator:
        propertyName: type
        mapping:
          give_points_fixed:
            $ref: '#/components/schemas/TriggerGivePointsFixed'
          give_points_per_spent:
            $ref: '#/components/schemas/TriggerGivePointsPerSpent'
          remove_points_fixed:
            $ref: '#/components/schemas/TriggerRemovePointsFixed'
          remove_points_per_spent:
            $ref: '#/components/schemas/TriggerRemovePointsPerSpent'
          give_tier:
            $ref: '#/components/schemas/TriggerGiveTier'
          remove_tier:
            $ref: '#/components/schemas/TriggerRemoveTier'
          send_webhook:
            $ref: '#/components/schemas/TriggerSendWebhook'
          send_email:
            $ref: '#/components/schemas/TriggerSendEmail'
    cartTriggerEventsOutput:
      description: List of events to trigger during checkout
      type: array
      items:
        $ref: '#/components/schemas/TriggerEventOutput'
    TriggerConditionalTier:
      type: object
      properties:
        type:
          type: string
          const: tier
        operator:
          type: string
          enum:
            - equals
            - not_equals
        value:
          type: string
      required:
        - type
        - operator
        - value
    TriggerConditionalPoints:
      type: object
      properties:
        type:
          type: string
          const: points
        operator:
          type: string
          enum:
            - equals
            - not_equals
            - greater_than
            - less_than
            - greater_than_or_equal
            - less_than_or_equal
        value:
          type: number
      required:
        - type
        - operator
        - value
    TriggerGivePointsFixed:
      type: object
      properties:
        type:
          type: string
          const: give_points_fixed
        points:
          type: number
      required:
        - type
        - points
    TriggerGivePointsPerSpent:
      type: object
      properties:
        type:
          type: string
          const: give_points_per_spent
        points:
          type: number
        perAmount:
          type: object
          properties:
            value:
              type: number
            currency:
              type: string
              enum:
                - USD
                - EUR
                - AUD
                - SGD
                - TWD
                - GBP
                - CAD
                - MXN
                - NPR
                - INR
                - DKK
                - NOK
                - SEK
                - CHF
                - PLN
                - CZK
                - JPY
                - NZD
                - HKD
          required:
            - value
            - currency
      required:
        - type
        - points
        - perAmount
    TriggerRemovePointsFixed:
      type: object
      properties:
        type:
          type: string
          const: remove_points_fixed
        points:
          type: number
      required:
        - type
        - points
    TriggerRemovePointsPerSpent:
      type: object
      properties:
        type:
          type: string
          const: remove_points_per_spent
        points:
          type: number
        perAmount:
          type: object
          properties:
            value:
              type: number
            currency:
              type: string
              enum:
                - USD
                - EUR
                - AUD
                - SGD
                - TWD
                - GBP
                - CAD
                - MXN
                - NPR
                - INR
                - DKK
                - NOK
                - SEK
                - CHF
                - PLN
                - CZK
                - JPY
                - NZD
                - HKD
          required:
            - value
            - currency
      required:
        - type
        - points
        - perAmount
    TriggerGiveTier:
      type: object
      properties:
        type:
          type: string
          const: give_tier
        tierUUID:
          type: string
      required:
        - type
        - tierUUID
    TriggerRemoveTier:
      type: object
      properties:
        type:
          type: string
          const: remove_tier
      required:
        - type
    TriggerSendWebhook:
      type: object
      properties:
        type:
          type: string
          const: send_webhook
        webhookUUID:
          type: string
      required:
        - type
        - webhookUUID
    TriggerSendEmail:
      type: object
      properties:
        type:
          type: string
          const: send_email
      required:
        - type
    TriggerEventOutput:
      type: object
      properties:
        type:
          type: string
          enum:
            - order
            - order.item
            - order.item.pending
            - order.item.processing
            - order.item.complete
            - order.item.failed
            - order.purchase
            - order.purchase.pending
            - order.purchase.processing
            - order.purchase.complete
            - order.purchase.cancelled
            - order.purchase.failed
            - order.purchase.full
            - order.purchase.full.pending
            - order.purchase.full.processing
            - order.purchase.full.complete
            - order.purchase.full.cancelled
            - order.purchase.full.failed
            - order.purchase.partial
            - order.purchase.partial.pending
            - order.purchase.partial.processing
            - order.purchase.partial.complete
            - order.purchase.partial.cancelled
            - order.purchase.partial.failed
            - order.update
            - order.update.3ds-required
            - order.update.adding-to-cart
            - order.update.filling-address-details
            - order.update.filling-card-details
            - order.update.submitting-order
            - order.update.changing-quantity
            - order.update.applying-coupon
            - order.update.selecting-shipping
            - order.update.selecting-options
            - order.update.product-search
            - points
            - points.give
            - points.remove
            - tier
            - tier.give
            - tier.remove
        conditional:
          $ref: '#/components/schemas/TriggerConditionalOutput'
        data:
          type: array
          items:
            $ref: '#/components/schemas/TriggerOutput'
      required:
        - type
        - data
      additionalProperties: false
    TriggerConditionalOutput:
      oneOf:
        - $ref: '#/components/schemas/TriggerConditionalTierOutput'
        - $ref: '#/components/schemas/TriggerConditionalPointsOutput'
      type: object
      discriminator:
        propertyName: type
        mapping:
          tier:
            $ref: '#/components/schemas/TriggerConditionalTierOutput'
          points:
            $ref: '#/components/schemas/TriggerConditionalPointsOutput'
    TriggerOutput:
      oneOf:
        - $ref: '#/components/schemas/TriggerGivePointsFixedOutput'
        - $ref: '#/components/schemas/TriggerGivePointsPerSpentOutput'
        - $ref: '#/components/schemas/TriggerRemovePointsFixedOutput'
        - $ref: '#/components/schemas/TriggerRemovePointsPerSpentOutput'
        - $ref: '#/components/schemas/TriggerGiveTierOutput'
        - $ref: '#/components/schemas/TriggerRemoveTierOutput'
        - $ref: '#/components/schemas/TriggerSendWebhookOutput'
        - $ref: '#/components/schemas/TriggerSendEmailOutput'
      type: object
      discriminator:
        propertyName: type
        mapping:
          give_points_fixed:
            $ref: '#/components/schemas/TriggerGivePointsFixedOutput'
          give_points_per_spent:
            $ref: '#/components/schemas/TriggerGivePointsPerSpentOutput'
          remove_points_fixed:
            $ref: '#/components/schemas/TriggerRemovePointsFixedOutput'
          remove_points_per_spent:
            $ref: '#/components/schemas/TriggerRemovePointsPerSpentOutput'
          give_tier:
            $ref: '#/components/schemas/TriggerGiveTierOutput'
          remove_tier:
            $ref: '#/components/schemas/TriggerRemoveTierOutput'
          send_webhook:
            $ref: '#/components/schemas/TriggerSendWebhookOutput'
          send_email:
            $ref: '#/components/schemas/TriggerSendEmailOutput'
    TriggerConditionalTierOutput:
      type: object
      properties:
        type:
          type: string
          const: tier
        operator:
          type: string
          enum:
            - equals
            - not_equals
        value:
          type: string
      required:
        - type
        - operator
        - value
      additionalProperties: false
    TriggerConditionalPointsOutput:
      type: object
      properties:
        type:
          type: string
          const: points
        operator:
          type: string
          enum:
            - equals
            - not_equals
            - greater_than
            - less_than
            - greater_than_or_equal
            - less_than_or_equal
        value:
          type: number
      required:
        - type
        - operator
        - value
      additionalProperties: false
    TriggerGivePointsFixedOutput:
      type: object
      properties:
        type:
          type: string
          const: give_points_fixed
        points:
          type: number
      required:
        - type
        - points
      additionalProperties: false
    TriggerGivePointsPerSpentOutput:
      type: object
      properties:
        type:
          type: string
          const: give_points_per_spent
        points:
          type: number
        perAmount:
          type: object
          properties:
            value:
              type: number
            currency:
              type: string
              enum:
                - USD
                - EUR
                - AUD
                - SGD
                - TWD
                - GBP
                - CAD
                - MXN
                - NPR
                - INR
                - DKK
                - NOK
                - SEK
                - CHF
                - PLN
                - CZK
                - JPY
                - NZD
                - HKD
          required:
            - value
            - currency
          additionalProperties: false
      required:
        - type
        - points
        - perAmount
      additionalProperties: false
    TriggerRemovePointsFixedOutput:
      type: object
      properties:
        type:
          type: string
          const: remove_points_fixed
        points:
          type: number
      required:
        - type
        - points
      additionalProperties: false
    TriggerRemovePointsPerSpentOutput:
      type: object
      properties:
        type:
          type: string
          const: remove_points_per_spent
        points:
          type: number
        perAmount:
          type: object
          properties:
            value:
              type: number
            currency:
              type: string
              enum:
                - USD
                - EUR
                - AUD
                - SGD
                - TWD
                - GBP
                - CAD
                - MXN
                - NPR
                - INR
                - DKK
                - NOK
                - SEK
                - CHF
                - PLN
                - CZK
                - JPY
                - NZD
                - HKD
          required:
            - value
            - currency
          additionalProperties: false
      required:
        - type
        - points
        - perAmount
      additionalProperties: false
    TriggerGiveTierOutput:
      type: object
      properties:
        type:
          type: string
          const: give_tier
        tierUUID:
          type: string
      required:
        - type
        - tierUUID
      additionalProperties: false
    TriggerRemoveTierOutput:
      type: object
      properties:
        type:
          type: string
          const: remove_tier
      required:
        - type
      additionalProperties: false
    TriggerSendWebhookOutput:
      type: object
      properties:
        type:
          type: string
          const: send_webhook
        webhookUUID:
          type: string
      required:
        - type
        - webhookUUID
      additionalProperties: false
    TriggerSendEmailOutput:
      type: object
      properties:
        type:
          type: string
          const: send_email
      required:
        - type
      additionalProperties: false
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````