Skip to main content
All requests to the Scale API are authenticated using API keys. Scale uses a dual-key security model to protect your store’s resources while allowing browser-side client requests.

Key Types

When you go to your store’s developer dashboard, you can generate two types of API keys depending on where they will be used:
Key TypePrefixTarget EnvironmentPrivileges
Public / Publishablepk_live_ or pk_test_Browsers, mobile apps, SPA clientsRead-only access to storefront catalogs, write-only access to checkouts.
Secretsk_live_ or sk_test_Backend servers, scripts, cron jobsComplete read-write access to all storefront and shop management endpoints.
Never expose your Secret Key (sk_) in client-side code (like browsers or mobile apps). Anyone who extracts it can modify your catalog, download order history, and access customer details.

Validation Errors (400 Bad Request)

When your requests fail input validation checks (e.g., missing required fields, invalid UUID formats, or database integrity checks like a non-existent shop), the API returns a 400 Bad Request status code. The response body contains an array of validationErrors matching the fields verified by the internal Zod validation schemas.

Response Body (400 Bad Request)

{
  "message": "FORM_VALIDATION_ERROR",
  "code": 400,
  "validationErrors": [
    {
      "path": ["shopId"],
      "message": "Shop not found"
    },
    {
      "path": ["env"],
      "message": "Invalid enum value. Expected 'live' | 'test', received 'development'"
    }
  ]
}

How to Authenticate

To authenticate your API requests, pass your API key in either of the following headers: This is the cleanest way to pass the API key, especially for custom frontends.
X-Shop-API-Key: pk_live_abc123...

2. Using Authorization Header

Standard Bearer token format is also supported:
Authorization: Bearer pk_live_abc123...

Sample Request

Here is an example of fetching products using a Publishable Key in a request across different programming languages:
curl -X GET "https://api.getscale.ng/api/v1/storefront/shop/YOUR_SHOP_ID/products" \
  -H "X-Shop-API-Key: pk_live_abc123..."