Documentation · API Reference

Shoprivet REST API Reference

Production base URL: https://api.shoprivet.io. Public storefront and cart endpoints are designed for browsers and apps; /v1 merchant routes require a server-side Authorization: Bearer shoprivet_live_... key.

Security boundary Merchant API keys grant write access to your stores, products, orders, discounts, and payment configurations. Use them only in server-side code (Node.js Route Handlers, backend jobs, CLI scripts) and never in browser JavaScript or NEXT_PUBLIC_ / VITE_ client variables. Outbound merchant order webhooks are not currently supported. Poll GET /v1/stores/:storeId/orders or trigger downstream syncs from your server-side checkout confirmation handler.

Public Storefront, Cart & Checkout Endpoints

Call these endpoints from browser code, static HTML sites, or server components using only your public store slug (for example, downtown-shop) and per-session cart/order tokens.

GET Get a public store

/public/stores/:slug · Auth: Public (no API key)

curl
curl "$API_BASE/public/stores/downtown-shop"
JavaScript
const store = await fetch(`${API_BASE}/public/stores/downtown-shop`).then((r) => r.json())
console.log(store)
GET List public products

/public/stores/:slug/products · Auth: Public (no API key)

curl
curl "$API_BASE/public/stores/downtown-shop/products?category=accessories&page=1&limit=24"
JavaScript
const products = await fetch(`${API_BASE}/public/stores/downtown-shop/products?category=accessories&page=1&limit=24`).then((r) => r.json())
console.log(products)
GET List payment methods

/public/stores/:slug/payment-methods · Auth: Public (no API key)

curl
curl "$API_BASE/public/stores/downtown-shop/payment-methods"
JavaScript
const methods = await fetch(`${API_BASE}/public/stores/downtown-shop/payment-methods`).then((r) => r.json())
console.log(methods)
POST Create a guest cart and check out

/public/stores/:slug/carts · Auth: Public cart creation; returns store-scoped Bearer credential

curl
CART=$(curl -s -X POST "$API_BASE/public/stores/downtown-shop/carts")
CART_TOKEN=$(echo "$CART" | jq -r '.credential')

curl -X POST "$API_BASE/public/stores/downtown-shop/carts/current/items" \
  -H "Authorization: Bearer $CART_TOKEN" -H "Content-Type: application/json" \
  -d '{"productId":"PRODUCT_ID","variantId":"VARIANT_ID","options":{"Size":"M"},"quantity":1}'

curl -X POST "$API_BASE/public/stores/downtown-shop/carts/current/checkout" \
  -H "Authorization: Bearer $CART_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Ada Lovelace","email":"[email protected]","provider":"cash_on_delivery","idempotencyKey":"checkout-retry-key-0001"}'
JavaScript
const created = await fetch(`${API_BASE}/public/stores/downtown-shop/carts`, { method: 'POST', credentials: 'omit' }).then((r) => r.json())
const cartCredential = created.credential
const cartHeaders = { Authorization: `Bearer ${cartCredential}`, 'Content-Type': 'application/json' }
const checkoutKey = crypto.randomUUID() // Keep this key for retries of this same attempt.

await fetch(`${API_BASE}/public/stores/downtown-shop/carts/current/items`, {
  method: 'POST',
  headers: cartHeaders,
  credentials: 'omit',
  body: JSON.stringify({ productId: 'PRODUCT_ID', variantId: 'VARIANT_ID', options: { Size: 'M' }, quantity: 1 }),
})

const checkout = await fetch(`${API_BASE}/public/stores/downtown-shop/carts/current/checkout`, {
  method: 'POST',
  headers: cartHeaders,
  credentials: 'omit',
  body: JSON.stringify({
    name: 'Ada Lovelace',
    email: '[email protected]',
    provider: 'cash_on_delivery',
    idempotencyKey: checkoutKey,
  }),
}).then((r) => r.json())
if (checkout.authorizationUrl) window.location.assign(checkout.authorizationUrl)
console.log(checkout)
GET Retrieve the current guest cart

/public/stores/:slug/carts/current · Auth: Guest Cart Bearer token

curl
curl "$API_BASE/public/stores/downtown-shop/carts/current" \
  -H "Authorization: Bearer $CART_TOKEN"
JavaScript
const cart = await fetch(`${API_BASE}/public/stores/downtown-shop/carts/current`, {
  headers: { Authorization: `Bearer ${cartCredential}` },
  credentials: 'omit',
}).then((response) => response.json())
console.log(cart.items, cart.total, cart.canCheckout)
PATCH Update or remove a cart item

/public/stores/:slug/carts/current/items/:itemId · Auth: Guest Cart Bearer token

curl
curl -X PATCH "$API_BASE/public/stores/downtown-shop/carts/current/items/$CART_ITEM_ID" \
  -H "Authorization: Bearer $CART_TOKEN" -H "Content-Type: application/json" \
  -d '{"quantity":2}'
# Remove one: DELETE /public/stores/downtown-shop/carts/current/items/$CART_ITEM_ID
# Clear cart: DELETE /public/stores/downtown-shop/carts/current/items
# Revoke cart: DELETE /public/stores/downtown-shop/carts/current
JavaScript
const updated = await fetch(`${API_BASE}/public/stores/downtown-shop/carts/current/items/CART_ITEM_ID`, {
  method: 'PATCH',
  headers: { Authorization: `Bearer ${cartCredential}`, 'Content-Type': 'application/json' },
  credentials: 'omit',
  body: JSON.stringify({ quantity: 2 }),
}).then((response) => response.json())
POST Import a legacy browser cart once

/public/stores/:slug/carts/current/legacy-import · Auth: Guest Cart Bearer token

curl
curl -X POST "$API_BASE/public/stores/downtown-shop/carts/current/legacy-import" \
  -H "Authorization: Bearer $CART_TOKEN" -H "Content-Type: application/json" \
  -d '{"items":[{"productId":"PRODUCT_ID","variantId":"VARIANT_ID","options":{"Size":"M"},"quantity":1}]}'
JavaScript
const result = await fetch(`${API_BASE}/public/stores/downtown-shop/carts/current/legacy-import`, {
  method: 'POST',
  headers: { Authorization: `Bearer ${cartCredential}`, 'Content-Type': 'application/json' },
  credentials: 'omit',
  body: JSON.stringify({ items: [{ productId: 'PRODUCT_ID', variantId: 'VARIANT_ID', options: { Size: 'M' }, quantity: 1 }] }),
}).then((response) => response.json())
console.log(result.imported, result.cart)
POST Checkout

/public/stores/:slug/checkout · Auth: Public (returns orderAccessToken)

curl
curl -X POST "$API_BASE/public/stores/downtown-shop/checkout" \
  -H "Content-Type: application/json" \
  -d '{"name":"Ada Lovelace","email":"[email protected]","provider":"cash_on_delivery","idempotencyKey":"checkout-retry-key-0001","items":[{"productId":"PRODUCT_ID","quantity":1}]}'
JavaScript
const checkout = await fetch(`${API_BASE}/public/stores/downtown-shop/checkout`, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    name: 'Ada Lovelace',
    email: '[email protected]',
    provider: 'cash_on_delivery',
    idempotencyKey: crypto.randomUUID(),
    items: [{ productId: 'PRODUCT_ID', quantity: 1 }],
  }),
}).then((r) => r.json())
console.log(checkout)
GET Look up an order with the checkout orderAccessToken

/public/stores/:slug/orders/:orderNumber · Auth: Scoped orderAccessToken Bearer header

curl
curl "$API_BASE/public/stores/downtown-shop/orders/SRV-20260919-0001" \
  -H "Authorization: Bearer $ORDER_ACCESS_TOKEN"
JavaScript
const order = await fetch(`${API_BASE}/public/stores/downtown-shop/orders/SRV-20260919-0001`, {
  headers: { Authorization: `Bearer ${orderAccessToken}` },
}).then((r) => r.json())
console.log(order)
GET Download a paid file

/public/downloads/:token · Auth: Unique order download token

curl
curl -LO "$API_BASE/public/downloads/TOKEN"
JavaScript
window.location.href = `${API_BASE}/public/downloads/TOKEN`
POST Confirm a payment

/public/stores/:slug/orders/:orderNumber/confirm · Auth: Scoped orderAccessToken Bearer header

curl
curl -X POST "$API_BASE/public/stores/downtown-shop/orders/SRV-20260919-0001/confirm" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ORDER_ACCESS_TOKEN" \
  -d '{"reference":"cs_test_..."}'
JavaScript
const order = await fetch(`${API_BASE}/public/stores/downtown-shop/orders/SRV-20260919-0001/confirm`, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${orderAccessToken}` },
  body: JSON.stringify({ reference: 'cs_test_...' }),
}).then((r) => r.json())
console.log(order)

Additional Public Storefront Routes

Method Path Group Purpose
GET /public/stores/:slug/products-by-id/:id Storefront Catalog Look up a single public product by ID.
GET /public/stores/:slug/products/:productSlug Storefront Catalog Look up a single public product by URL slug.
GET /public/stores/:slug/categories Storefront Catalog List categories and product counts for a public store.
POST /public/stores/:slug/carts/current/discount Guest Cart & Checkout Apply a discount code to the current guest cart.
DELETE /public/stores/:slug/carts/current/discount Guest Cart & Checkout Remove any applied discount code from the current guest cart.
POST /public/stores/:slug/orders/:orderNumber/cancel Orders & Digital Delivery Cancel a pending order using the scoped orderAccessToken.
POST /public/stores/:slug/enquire Orders & Digital Delivery Submit a customer enquiry or order request without online checkout.
POST /public/stores/:slug/payments/:provider/webhook Webhooks Incoming signed webhook receiver for stripe, paystack, flutterwave, razorpay, and paypal.
GET /widget.js Embed Runtime Serves the Shadow DOM catalog, cart, and checkout widget script.

Authenticated Merchant Management API (/v1)

Execute all /v1 endpoints from a trusted backend using Authorization: Bearer $SHOPRIVET_API_KEY. Rate limits: Free 60 req/min, Premium 300 req/min, Business 1,000 req/min.

GET List stores

/v1/stores

curl
curl "$API_BASE/v1/stores?page=1&limit=20" \
  -H "Authorization: Bearer $API_KEY"
JavaScript
const stores = await request('GET', '/v1/stores?page=1&limit=20')
console.log(stores)
POST Create a store

/v1/stores

curl
curl -X POST "$API_BASE/v1/stores" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Downtown Shop","type":"physical","currency":"usd"}'
JavaScript
const store = await request('POST', '/v1/stores', {
  name: 'Downtown Shop',
  type: 'physical',
  currency: 'usd',
})
console.log(store)
PATCH Update a store

/v1/stores/:id

curl
curl -X PATCH "$API_BASE/v1/stores/STORE_ID" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Downtown Shop","status":"active"}'
JavaScript
const store = await request('PATCH', '/v1/stores/STORE_ID', {
  name: 'Downtown Shop',
  status: 'active',
})
console.log(store)
GET List products

/v1/stores/:storeId/products

curl
curl "$API_BASE/v1/stores/STORE_ID/products?page=1&limit=20" \
  -H "Authorization: Bearer $API_KEY"
JavaScript
const products = await request('GET', '/v1/stores/STORE_ID/products?page=1&limit=20')
console.log(products)
GET Get one product

/v1/stores/:storeId/products/:id

curl
curl "$API_BASE/v1/stores/STORE_ID/products/PRODUCT_ID" \
  -H "Authorization: Bearer $API_KEY"
JavaScript
const product = await request('GET', '/v1/stores/STORE_ID/products/PRODUCT_ID')
console.log(product)
POST Create a product

/v1/stores/:storeId/products

curl
curl -X POST "$API_BASE/v1/stores/STORE_ID/products" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Open Tee","price":20,"type":"physical","status":"active"}'
JavaScript
const product = await request('POST', '/v1/stores/STORE_ID/products', {
  name: 'Open Tee',
  price: 20,
  type: 'physical',
  status: 'active',
})
console.log(product)
PATCH Update a product

/v1/stores/:storeId/products/:id

curl
curl -X PATCH "$API_BASE/v1/stores/STORE_ID/products/PRODUCT_ID" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"price":24,"status":"active"}'
JavaScript
const product = await request('PATCH', '/v1/stores/STORE_ID/products/PRODUCT_ID', {
  price: 24,
  status: 'active',
})
console.log(product)
DELETE Delete a product

/v1/stores/:storeId/products/:id

curl
curl -X DELETE "$API_BASE/v1/stores/STORE_ID/products/PRODUCT_ID" \
  -H "Authorization: Bearer $API_KEY"
JavaScript
await request('DELETE', '/v1/stores/STORE_ID/products/PRODUCT_ID')
GET List orders

/v1/stores/:storeId/orders

curl
curl "$API_BASE/v1/stores/STORE_ID/orders?page=1&limit=20" \
  -H "Authorization: Bearer $API_KEY"
JavaScript
const orders = await request('GET', '/v1/stores/STORE_ID/orders?page=1&limit=20')
console.log(orders)
POST Create an order

/v1/stores/:storeId/orders

curl
curl -X POST "$API_BASE/v1/stores/STORE_ID/orders" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"customerName":"Ada Lovelace","customerEmail":"[email protected]","items":[{"productId":"PRODUCT_ID","quantity":1}]}'
JavaScript
const order = await request('POST', '/v1/stores/STORE_ID/orders', {
  customerName: 'Ada Lovelace',
  customerEmail: '[email protected]',
  items: [{ productId: 'PRODUCT_ID', quantity: 1 }],
})
console.log(order)
PATCH Update an order status

/v1/stores/:storeId/orders/:id/status

curl
curl -X PATCH "$API_BASE/v1/stores/STORE_ID/orders/ORDER_ID/status" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"status":"processing"}'
JavaScript
const order = await request('PATCH', '/v1/stores/STORE_ID/orders/ORDER_ID/status', {
  status: 'processing',
})
console.log(order)
DELETE Delete an order

/v1/stores/:storeId/orders/:id

curl
curl -X DELETE "$API_BASE/v1/stores/STORE_ID/orders/ORDER_ID" \
  -H "Authorization: Bearer $API_KEY"
JavaScript
await request('DELETE', '/v1/stores/STORE_ID/orders/ORDER_ID')
GET List categories

/v1/stores/:storeId/categories

curl
curl "$API_BASE/v1/stores/STORE_ID/categories?page=1&limit=20" \
  -H "Authorization: Bearer $API_KEY"
JavaScript
const categories = await request('GET', '/v1/stores/STORE_ID/categories?page=1&limit=20')
console.log(categories)
POST Create a category

/v1/stores/:storeId/categories

curl
curl -X POST "$API_BASE/v1/stores/STORE_ID/categories" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Accessories"}'
JavaScript
const category = await request('POST', '/v1/stores/STORE_ID/categories', {
  name: 'Accessories',
})
console.log(category)
DELETE Delete a category

/v1/stores/:storeId/categories/:id

curl
curl -X DELETE "$API_BASE/v1/stores/STORE_ID/categories/CATEGORY_ID" \
  -H "Authorization: Bearer $API_KEY"
JavaScript
await request('DELETE', '/v1/stores/STORE_ID/categories/CATEGORY_ID')

Additional Merchant /v1 Routes

Full request/response JSON schemas for every endpoint below are available in OpenAPI 3.0.3 JSON.

Method Path Purpose
GET /v1/stores/:id Retrieve a single store by ID.
DELETE /v1/stores/:id Delete a store.
GET /v1/stores/:id/catalog-widgets List embeddable catalog widget configurations for a store.
POST /v1/stores/:id/catalog-widgets Create a catalog widget configuration.
PATCH /v1/stores/:id/catalog-widgets/:widgetId Update catalog widget layout, columns, or filtering.
DELETE /v1/stores/:id/catalog-widgets/:widgetId Delete a catalog widget configuration.
GET /v1/stores/:storeId/custom-domains List configured custom domains (Premium and Business).
POST /v1/stores/:storeId/custom-domains Attach a hostname to a store.
POST /v1/stores/:storeId/custom-domains/:id/refresh Refresh DNS verification state.
DELETE /v1/stores/:storeId/custom-domains/:id Remove a custom domain.
PATCH /v1/stores/:storeId/products/:id/status Publish, draft, or archive a product.
POST /v1/stores/:storeId/products/:id/duplicate Duplicate a product.
POST /v1/stores/:storeId/products/reorder Reorder products by array of productIds.
GET /v1/stores/:storeId/products/feature-access Check variant and plan entitlement status for a store.
POST /v1/stores/:storeId/products/upload-image Upload product image multipart form-data (JPEG, PNG, WebP, or GIF).
POST /v1/stores/:storeId/products/upload-file Upload downloadable digital product asset (up to 50 MB within storage quota).
POST /v1/stores/:storeId/products/:id/files Attach an uploaded file to a digital product.
DELETE /v1/stores/:storeId/products/:id/files/:fileId Detach a file from a digital product.
POST /v1/stores/:storeId/products/ai/description Generate a product description within monthly or lifetime plan allowance.
PATCH /v1/stores/:storeId/categories/:id Update a category name or imageUrl.
GET /v1/stores/:storeId/orders/stats Retrieve order counts and revenue summary for a store.
GET /v1/stores/:storeId/orders/:id Retrieve a single order with items and payment attempts.
PATCH /v1/stores/:storeId/orders/:id/payment Manually update paymentStatus and optional paymentRef.
PATCH /v1/stores/:storeId/orders/:id/payments/:attemptId/review Record a merchant payment review note.
GET /v1/stores/:storeId/payments List configured payment gateway integrations (credentials masked).
POST /v1/stores/:storeId/payments Connect Stripe, Paystack, Flutterwave, Razorpay, PayPal, or Cash on delivery.
PATCH /v1/stores/:storeId/payments/:id Enable, disable, switch test/live mode, or rotate credentials.
DELETE /v1/stores/:storeId/payments/:id Remove a payment gateway integration.
GET /v1/stores/:storeId/discounts List discount codes and automatic promotions.
POST /v1/stores/:storeId/discounts Create a discount code or automatic promotion.
PUT /v1/stores/:storeId/discounts/:id Update a discount configuration (uses PUT).
DELETE /v1/stores/:storeId/discounts/:id Archive a discount.
GET /v1/stores/:storeId/discounts/entitlements Check discount plan capabilities.
GET /v1/stores/:storeId/discounts/analytics Fetch discount usage metrics (from/to ISO datetimes).
GET /v1/stores/:storeId/analytics/overview Retrieve revenue, orders, and product analytics within plan retention window.