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.
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.
/public/stores/:slug · Auth: Public (no API key)
curl "$API_BASE/public/stores/downtown-shop"
const store = await fetch(`${API_BASE}/public/stores/downtown-shop`).then((r) => r.json())
console.log(store)
/public/stores/:slug/products · Auth: Public (no API key)
curl "$API_BASE/public/stores/downtown-shop/products?category=accessories&page=1&limit=24"
const products = await fetch(`${API_BASE}/public/stores/downtown-shop/products?category=accessories&page=1&limit=24`).then((r) => r.json())
console.log(products)
/public/stores/:slug/payment-methods · Auth: Public (no API key)
curl "$API_BASE/public/stores/downtown-shop/payment-methods"
const methods = await fetch(`${API_BASE}/public/stores/downtown-shop/payment-methods`).then((r) => r.json())
console.log(methods)
/public/stores/:slug/carts · Auth: Public cart creation; returns store-scoped Bearer credential
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"}'
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)
/public/stores/:slug/carts/current · Auth: Guest Cart Bearer token
curl "$API_BASE/public/stores/downtown-shop/carts/current" \
-H "Authorization: Bearer $CART_TOKEN"
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)
/public/stores/:slug/carts/current/items/:itemId · Auth: Guest Cart Bearer token
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
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())
/public/stores/:slug/carts/current/legacy-import · Auth: Guest Cart Bearer token
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}]}'
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)
/public/stores/:slug/checkout · Auth: Public (returns orderAccessToken)
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}]}'
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)
/public/stores/:slug/orders/:orderNumber · Auth: Scoped orderAccessToken Bearer header
curl "$API_BASE/public/stores/downtown-shop/orders/SRV-20260919-0001" \
-H "Authorization: Bearer $ORDER_ACCESS_TOKEN"
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)
/public/downloads/:token · Auth: Unique order download token
curl -LO "$API_BASE/public/downloads/TOKEN"
window.location.href = `${API_BASE}/public/downloads/TOKEN`
/public/stores/:slug/orders/:orderNumber/confirm · Auth: Scoped orderAccessToken Bearer header
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_..."}'
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.
/v1/stores
curl "$API_BASE/v1/stores?page=1&limit=20" \
-H "Authorization: Bearer $API_KEY"
const stores = await request('GET', '/v1/stores?page=1&limit=20')
console.log(stores)
/v1/stores
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"}'
const store = await request('POST', '/v1/stores', {
name: 'Downtown Shop',
type: 'physical',
currency: 'usd',
})
console.log(store)
/v1/stores/:id
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"}'
const store = await request('PATCH', '/v1/stores/STORE_ID', {
name: 'Downtown Shop',
status: 'active',
})
console.log(store)
/v1/stores/:storeId/products
curl "$API_BASE/v1/stores/STORE_ID/products?page=1&limit=20" \
-H "Authorization: Bearer $API_KEY"
const products = await request('GET', '/v1/stores/STORE_ID/products?page=1&limit=20')
console.log(products)
/v1/stores/:storeId/products/:id
curl "$API_BASE/v1/stores/STORE_ID/products/PRODUCT_ID" \
-H "Authorization: Bearer $API_KEY"
const product = await request('GET', '/v1/stores/STORE_ID/products/PRODUCT_ID')
console.log(product)
/v1/stores/:storeId/products
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"}'
const product = await request('POST', '/v1/stores/STORE_ID/products', {
name: 'Open Tee',
price: 20,
type: 'physical',
status: 'active',
})
console.log(product)
/v1/stores/:storeId/products/:id
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"}'
const product = await request('PATCH', '/v1/stores/STORE_ID/products/PRODUCT_ID', {
price: 24,
status: 'active',
})
console.log(product)
/v1/stores/:storeId/products/:id
curl -X DELETE "$API_BASE/v1/stores/STORE_ID/products/PRODUCT_ID" \
-H "Authorization: Bearer $API_KEY"
await request('DELETE', '/v1/stores/STORE_ID/products/PRODUCT_ID')
/v1/stores/:storeId/orders
curl "$API_BASE/v1/stores/STORE_ID/orders?page=1&limit=20" \
-H "Authorization: Bearer $API_KEY"
const orders = await request('GET', '/v1/stores/STORE_ID/orders?page=1&limit=20')
console.log(orders)
/v1/stores/:storeId/orders
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}]}'
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)
/v1/stores/:storeId/orders/:id/status
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"}'
const order = await request('PATCH', '/v1/stores/STORE_ID/orders/ORDER_ID/status', {
status: 'processing',
})
console.log(order)
/v1/stores/:storeId/orders/:id
curl -X DELETE "$API_BASE/v1/stores/STORE_ID/orders/ORDER_ID" \
-H "Authorization: Bearer $API_KEY"
await request('DELETE', '/v1/stores/STORE_ID/orders/ORDER_ID')
/v1/stores/:storeId/categories
curl "$API_BASE/v1/stores/STORE_ID/categories?page=1&limit=20" \
-H "Authorization: Bearer $API_KEY"
const categories = await request('GET', '/v1/stores/STORE_ID/categories?page=1&limit=20')
console.log(categories)
/v1/stores/:storeId/categories
curl -X POST "$API_BASE/v1/stores/STORE_ID/categories" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Accessories"}'
const category = await request('POST', '/v1/stores/STORE_ID/categories', {
name: 'Accessories',
})
console.log(category)
/v1/stores/:storeId/categories/:id
curl -X DELETE "$API_BASE/v1/stores/STORE_ID/categories/CATEGORY_ID" \
-H "Authorization: Bearer $API_KEY"
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. |
