CommerceForAI

API reference

The SDK wraps every endpoint. You can also call the API directly.

Authentication

curl https://api.commerceforai.com/v1/orders \
  -H "Authorization: Bearer $COMMERCEFORAI_API_KEY"

Conventions

  • Idempotency. Send Idempotency-Key on POSTs. A repeat with the same key replays the first response. Reusing a key with a different body returns idempotency_error.
  • Pagination. ?limit= (max 100) and ?starting_after=<id>. Lists return { object: "list", data, has_more }.
  • Errors. { error: { type, message, param? } } with types invalid_request, authentication_error, not_found, conflict, out_of_stock, stripe_error, idempotency_error, rate_limited.
  • Request ids. Every response has an x-request-id header. Include it when you contact support.

Store

MethodPathPurpose
GET/v1/storeStore settings, connected providers, feed URLs
PATCH/v1/storeName, tax, default success/cancel URLs
PUT/v1/store/shippingConnect EasyPost or Shippo
PUT / DELETE/v1/store/fulfillmentConnect / disconnect Printful or Printify
PUT / DELETE/v1/store/emailsCustomer emails via Resend
PUT/v1/store/storefrontProduct URL template, feeds, agent access

Catalog

MethodPathPurpose
POST/v1/productsCreate a product with variants
GET/v1/productsList; filter with active and metadata[key]=value
GET / PATCH / DELETE/v1/products/:idGet, update, archive
POST/v1/products/:id/variantsAdd a variant
PATCH/v1/variants/:idPrice, SKU, weight, print-on-demand mapping
GET/v1/inventoryTracked stock, lowest first
POST/v1/variants/:id/inventoryAdjust (+/−) or set stock

Checkout & orders

MethodPathPurpose
POST/v1/checkoutsReserve stock and create a Stripe Checkout
GET/v1/checkouts/:idCheckout status and resulting order
GET/v1/ordersList; filter by status
GET / PATCH/v1/orders/:idBy id or number; notes and metadata
POST/v1/orders/:id/fulfillMark shipped with tracking
POST/v1/orders/:id/refundRefund through Stripe, optional restock
POST/v1/orders/:id/submit-fulfillmentSend to print-on-demand now

Shipping & returns

MethodPathPurpose
POST/v1/orders/:id/shipping-ratesLive rates, cheapest first
POST / GET/v1/orders/:id/labelsBuy a label / list labels
POST/v1/orders/:id/returnsOpen a return
GET/v1/returnsList returns
POST/v1/returns/:id/approve | reject | receiveReturn lifecycle

Events

MethodPathPurpose
GET/v1/eventsOrdered event log (cursor: after)
POST / GET / DELETE/v1/webhook-endpointsManage webhook endpoints
GET/v1/emailsCustomer email log