Documentation · Security & Auth

Authentication, Scoped Credentials, and Rate Limits

Shoprivet separates public storefront operations from privileged merchant management endpoints so your browser frontend never exposes private store credentials.

Never expose merchant API keys in browser code Merchant API keys (shoprivet_live_...) grant read and write access to your stores, products, orders, discounts, and payment configurations. Never ship them in client-side bundles or expose them via NEXT_PUBLIC_ or VITE_ environment variables.

Three credential types in Shoprivet

Public Storefront catalog routes (GET /public/stores/:slug, /products, /categories, /payment-methods) require no credentials and are safe to call directly from browsers, static sites, or edge loaders.

Customer cart and order operations use short-lived scoped bearer tokens created during checkout flows so buyers can manage only their own cart or inspect their own order.

Merchant management routes (/v1/stores/...) require a secret API key generated in Dashboard -> Developers and passed as Authorization: Bearer shoprivet_live_... exclusively from your backend server, serverless function, or CLI.

Credential / ModePrefix or SourceWhere AllowedPermitted Scope
Unauthenticated Public Routes None Browser & Server Read active store, products, categories, enabled payment methods; submit enquiries
Guest Cart Credential POST /public/stores/:slug/carts Browser & Server Read/add/update/clear guest cart items, apply discount code, initiate cart checkout
Order Access Token Checkout response or /recover Browser & Server Read customer order, verify/confirm payment, cancel unpaid order, view digital download links
Merchant API Key shoprivet_live_... (Dashboard) Server-side only Full store, product, variant, inventory, category, order, discount, payment, domain, and analytics CRUD

Creating and rotating merchant API keys

Sign in to Shoprivet and open Dashboard -> Developers (/app/dashboard/developers). Each account can hold up to 5 active API keys. When creating a key, copy the full secret immediately because Shoprivet only stores a hashed representation and displays a redacted prefix afterward.

Store your key in a server-only environment variable such as SHOPRIVET_API_KEY. On Next.js, never prefix this variable with NEXT_PUBLIC_. On Vite, never prefix it with VITE_.

API rate limits and response headers

Merchant API keys are rate-limited per account subscription plan using a sliding 60-second window. Every authenticated /v1 response includes standard rate-limit headers so your backend can throttle or back off safely.

  • X-RateLimit-Limit: Total requests allowed per minute window for your plan.
  • X-RateLimit-Remaining: Remaining requests available in the current window.
  • X-RateLimit-Reset: Unix timestamp (seconds) when the window resets.
  • Retry-After: Sent with HTTP 429 Too Many Requests indicating seconds to wait.
PlanAPI LimitPublic Cart LimitPublic Checkout / Confirm Limit
Free ($0/mo) 60 requests / minute 60 requests / minute 10 requests / hour per IP
Premium ($15/mo) 300 requests / minute 60 requests / minute 10 requests / hour per IP
Business ($39/mo) 1,000 requests / minute 60 requests / minute 10 requests / hour per IP

Pagination and standard error payloads

Collection endpoints accept page (default 1) and limit (default 20 on /v1 management endpoints, 24 on public products; max 100 across all paginated routes) query parameters and return total, page, and totalPages.

Schema validation failures return HTTP 400 with field-level errors generated by Zod validation pipes. Missing or expired tokens return HTTP 401, plan limits or permission denials return HTTP 403, and rate-limit breaches return HTTP 429.

json · HTTP 400 validation error format
{
  "success": false,
  "message": "Validation failed",
  "errors": [
    {
      "field": "price",
      "message": "Too small: expected number to be >=0"
    }
  ]
}

Webhooks and payment verification

Shoprivet exposes incoming payment webhook receivers at POST /public/stores/:slug/payments/:provider/webhook so Stripe, Paystack, Flutterwave, Razorpay, and PayPal notify Shoprivet of settled payments and refunds.

Outbound merchant order webhooks (pushing events from Shoprivet to arbitrary custom merchant URLs) are not currently supported. To verify payment state in a custom storefront, redirect the customer back to your return page, call POST /public/stores/:slug/orders/:orderNumber/confirm with orderAccessToken, or poll GET /v1/stores/:storeId/orders from your backend.