Commerce API

API endpoints

Complete REST endpoint reference for the Commerce API v1.

All endpoints are prefixed with /v1. The interactive OpenAPI reference at Commerce API provides request/response schemas, try-it-out, and code samples.

Health & identity

MethodPathScopeDescription
GET/v1/healthPublicHealth check
GET/v1/meStorefrontCurrent caller: organizationId, scopes and via
GET/v1/openapi.jsonPublicOpenAPI 3.1 specification

Catalog (storefront)

MethodPathDescription
GET/v1/productsList products (search, sort, pagination)
GET/v1/products/{id}Get product by ID
GET/v1/products/by-slug/{slug}Get product by URL slug
GET/v1/categoriesList categories
GET/v1/storeStore info (name, currency, locales)
GET/v1/countriesCountry list for address forms

Query parameters for /v1/products:

ParamTypeDescription
querystringSearch term
categoryIdstringFilter by category
sortFieldstringField to sort by
sortDirectionasc or descSort direction
pagenumberPage number (default 1)
perPagenumberItems per page, up to 100 (default 20)

Cart (storefront)

MethodPathDescription
POST/v1/cartsCreate a new cart
GET/v1/carts/{id}Get cart with items and totals
POST/v1/carts/{id}/itemsAdd item to cart
PATCH/v1/carts/{id}/items/{itemId}Update item quantity
DELETE/v1/carts/{id}/items/{itemId}Remove item from cart
POST/v1/carts/{id}/couponApply coupon code. See the note below
DELETE/v1/carts/{id}/couponRemove applied coupon
GET/v1/carts/{id}/shipping-methodsList available shipping methods
PATCH/v1/carts/{id}/shipping-methodSet shipping method
GET/v1/carts/{id}/payment-methodsList available payment methods
PUT/v1/carts/{id}/shipping-addressSet shipping address
PUT/v1/carts/{id}/billing-addressSet billing address
POST/v1/carts/{id}/place-orderConvert cart to order

The coupon endpoints exist, but no merchant can create coupons yet, so there's nothing for a code to match.

Orders (storefront)

MethodPathDescription
GET/v1/ordersList the signed-in customer's orders. An API key alone is refused
GET/v1/orders/{id}Get order. Staff and the customer who placed it see all of it; anyone else, the public view

Admin — Products

MethodPathDescription
GET/v1/admin/productsList all products
POST/v1/admin/productsCreate product
GET/v1/admin/products/{id}Get product
PATCH/v1/admin/products/{id}Update product
DELETE/v1/admin/products/{id}Delete product

Admin — Categories

MethodPathDescription
POST/v1/admin/categoriesCreate category
PATCH/v1/admin/categories/{id}Update category
DELETE/v1/admin/categories/{id}Delete category

Admin — Orders

MethodPathDescription
GET/v1/admin/ordersList all orders
GET/v1/admin/orders/{id}Get order detail
GET/v1/admin/orders/{id}/historyGet order history
POST/v1/admin/orders/{id}/cancelCancel order. Doesn't refund. On a paid order the shopper is told to contact the store. Use refund instead.
POST/v1/admin/orders/{id}/fulfillMark order as fulfilled
POST/v1/admin/orders/{id}/refundRefund order in full

Admin — Customers

MethodPathDescription
GET/v1/admin/customersList customers
GET/v1/admin/customers/{id}Get customer detail

Admin — Store & inventory

MethodPathDescription
GET/v1/admin/storeGet store settings
PATCH/v1/admin/storeUpdate store settings
POST/v1/admin/inventoryUpdate inventory: productId, optional variantId, quantity, and optional adjustment (set, increment or decrement)
GET/v1/admin/dashboardDashboard statistics

Webhooks

MethodPathAuthDescription
POST/v1/webhooks/payments/{provider}x-checkout-secretProcess payment webhook
GET/v1/webhooks/payments/{provider}—Provider verification challenge

Query param: org={orgId} for tenant-scoped webhook verification.

Response format

Success

A single resource comes back as itself. A list comes back like this:

json
{
  "items": [],
  "total": 42,
  "page": 1,
  "perPage": 20,
  "hasMore": true
}

Error

json
{
  "code": "NOT_FOUND",
  "message": "Product not found"
}

The HTTP status carries the status. A failed validation returns 422 with code: "VALIDATION" and an errors list, with a path and message for each field.

Using the API client

ts
import { createCommerceApiClient } from '@prood/api-client'

const api = createCommerceApiClient({
  baseUrl: 'http://localhost:3005/v1',
  headers: { 'x-api-key': 'pkAbC123...' },
})

const { data } = await api.GET('/products', {
  params: { query: { query: 'shirt', perPage: 10 } },
})

See @prood/api-client for full client documentation.