Skip to content
Reponse.ai LogoDocs
DocsAPISDKsGuides

Search Documentation

Search for an article...

Getting Started

  • Overview
  • Architecture
  • Installation
  • Authentication
  • First Request

Products & Collections

  • Products — List
  • Products — Get
  • Products — Metafields
  • Collections — List
  • Collections — Get
  • Collections — Products

Cart & Checkout

  • Cart — Create
  • Cart — Get
  • Cart — Add Item
  • Cart — Update Item
  • Cart — Remove Item
  • Cart — Apply Promotion
  • Checkout — Stripe
  • Checkout — Payment Intent
  • Checkout — ACP

Orders & Fulfillment

  • Orders — Create
  • Orders — Get
  • Orders — Confirm
  • Orders — Cancel
  • Orders — Fulfill
  • Orders — Refund

Commerce

  • Inventory — Get
  • Inventory — Update
  • Shipping — Rates
  • Discounts — List
  • Discounts — Create
  • Discounts — Validate
  • Subscriptions — Manage

Loyalty & Gift Cards

  • Loyalty — Balance
  • Loyalty — Redeem
  • Loyalty — Referral
  • Gift Cards — List
  • Gift Cards — Redeem

Tickets & Support

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

Platform

  • Product Feed — JSON
  • Product Feed — CSV
  • Theme — Get
  • Approvals — Execute
  • Approvals — Reject
  • Geocode

SDKs

  • SDK Overview
  • TypeScript SDK
  • React Hooks

Guides

  • Chat Widget
  • Shopify Sync
  • Storefront Starter
  • Loyalty Program
  • Discounts & Promotions
  • Subscriptions
  • Klaviyo Integration
  • Custom Domains
  • Agentic Commerce (ACP)
  • A2A Protocol
  • 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
DocsSDKsTypeScript SDK

TypeScript SDK

The official TypeScript SDK.

1 min read/Last updated Aug 19, 2026
On this page

Overview

`@reponseai/sdk` is the official typed client for the Reponse Commerce API. It provides namespaced operations — `catalog`, `cart`, `orders`, `loyalty`, `tickets`, `subscriptions`, and `discounts` — with full TypeScript inference for request parameters and response shapes.

Installation

bash
pnpm add @reponseai/sdk
# or
npm install @reponseai/sdk

Client creation

typescript
import { Reponse } from '@reponseai/sdk';

const reponse = new Reponse({
  apiKey: process.env.REPONSE_API_KEY!,
  // Optional overrides
  baseUrl: 'https://api.reponse.ai',   // default
  timeout: 10_000,                       // ms, default 30 000
  retries: 2,                            // auto-retry on 5xx, default 0
});
OptionTypeDefaultDescription
apiKeystring—Required. API key from Dashboard → Settings → API Keys
baseUrlstringhttps://api.reponse.aiAPI base URL
timeoutnumber30000Request timeout in milliseconds
retriesnumber0Number of automatic retries on 5xx responses

API namespaces

Catalog

typescript
// List products (paginated)
const { data, meta } = await reponse.catalog.listProducts({
  query: { limit: 10, cursor: 'abc123' },
});

// Get a single product
const { data: product } = await reponse.catalog.getProduct({
  path: { id: 'prod_xxx' },
});

// List collections
const { data: collections } = await reponse.catalog.listCollections();

Cart

typescript
// Create a cart
const { data: cart } = await reponse.cart.create({
  body: { currency: 'EUR' },
});

// Get a cart
const { data: cart } = await reponse.cart.get({
  path: { id: cartId },
});

// Add item
await reponse.cart.addItem({
  path: { id: cartId },
  body: { variantId: 'var_xxx', quantity: 2 },
});

// Apply promo code
await reponse.cart.applyPromo({
  path: { id: cartId },
  body: { code: 'SAVE10' },
});

Orders

typescript
// List orders for a customer
const { data: orders } = await reponse.orders.list({
  query: { email: 'buyer@example.com', limit: 5 },
});

// Get order by ID
const { data: order } = await reponse.orders.get({
  path: { id: 'ord_xxx' },
});

Loyalty

typescript
// Get balance
const { data: balance } = await reponse.loyalty.getBalance({
  path: { contactId: 'ctc_xxx' },
});

// Redeem points
await reponse.loyalty.redeem({
  path: { contactId: 'ctc_xxx' },
  body: { points: 500, reason: 'checkout' },
});

Tickets

typescript
// Create a support ticket
const { data: ticket } = await reponse.tickets.create({
  body: { subject: 'Missing item', email: 'buyer@example.com' },
});

Subscriptions

typescript
// List subscriptions
const { data: subs } = await reponse.subscriptions.list({
  query: { status: 'active' },
});

// Delay next shipment
await reponse.subscriptions.manage({
  path: { id: 'sub_xxx' },
  body: { action: 'delay', days: 7 },
});

Pagination

List endpoints return a `meta` object with cursor-based pagination:

typescript
const { data, meta } = await reponse.catalog.listProducts({
  query: { limit: 20 },
});

console.log(meta.nextCursor);  // pass as `cursor` to fetch the next page
console.log(meta.hasMore);     // boolean

Error handling

All SDK methods throw a `ReponseApiError` on non-2xx responses:

typescript
import { ReponseApiError } from '@reponseai/sdk';

try {
  await reponse.cart.get({ path: { id: 'invalid' } });
} catch (err) {
  if (err instanceof ReponseApiError) {
    console.error(err.status);   // 404
    console.error(err.code);     // "CART_NOT_FOUND"
    console.error(err.message);  // "Cart not found"
  }
}
PropertyTypeDescription
statusnumberHTTP status code
codestringMachine-readable error code
messagestringHuman-readable description
requestIdstringUnique request ID for support

Common error codes

CodeStatusDescription
UNAUTHORIZED401Missing or invalid API key
FORBIDDEN403Key lacks required scope
NOT_FOUND404Resource does not exist
VALIDATION_ERROR422Invalid request parameters
RATE_LIMITED429Too many requests — retry after header
INTERNAL_ERROR500Server error — retry or contact support

Troubleshooting

SymptomCauseFix
UNAUTHORIZED on every callWrong or missing API keyVerify REPONSE_API_KEY env variable
Types not matching responseOutdated SDK versionRun pnpm update @reponseai/sdk
Timeout errorsSlow network or large payloadIncrease timeout option
RATE_LIMITED errorsExceeding 100 req/s defaultAdd backoff logic or request a limit increase
PreviousSDK Overview
NextReact Hooks