Skip to content
Reponse.ai LogoDocs
DocsAPISDKsGuides

Search Documentation

Search for an article...

Getting Started

  • Overview
  • Architecture
  • Installation
  • Authentication
  • First Request

Loyalty & Gift Cards

  • Loyalty — Balance
  • Loyalty — Redeem
  • Loyalty — Referral

Tickets & Support

  • Tickets — List
  • Tickets — Create
  • Tickets — Reply

SDKs

  • SDK Overview
  • TypeScript SDK
  • React Hooks

Guides

  • Chat Widget
  • Shopify Sync
  • Reponse in Shopify Admin
  • Loyalty Program
  • Klaviyo Integration
  • Custom Domains
  • AI Engines
  • MCP Server

Webhooks

  • Webhooks Overview
  • Events Reference
  • Shopify Webhooks
  • Stripe Webhooks
  • Reviews (Stamped / Trustpilot)
  • Logistics
  • Email Inbound

Resources

  • Environment Variables
  • Rate Limits
  • Changelog
DocsCart & CheckoutCart — Apply Promotion

Cart — Apply Promotion

Apply a promotion or discount code to a cart.

1 min read/Last updated Sep 9, 2026
On this page

Overview

Validates a code and applies the matching adjustment to the cart. The endpoint reads the new `promotions` table first, then falls back to the legacy `discount_codes` table for Shopify-migrated codes. The cart must be `open`.

Authentication

This endpoint requires a Bearer token. Include your workspace API key in the `Authorization` header.

Authorization: Bearer <your_api_key>

Request

**POST** `/v1/carts/:id/promotions`

Path parameters

NameTypeRequiredDescription
idstring (uuid)✅The cart ID.

Body parameters

NameTypeRequiredDescription
codestring✅Promotion code (case-insensitive).

Response

json
{ "applied": true, "code": "SUMMER20", "savings": 12.00, "total": 47.98 }

SDK example

typescript
await reponse.cart.applyPromotion({ path: { id: cartId }, body: { code: "SUMMER20" } });

Errors

StatusMeaning
400code is required, cart not open, or promotion not active/expired.
404Cart not found.