Skip to content

Authentication ​

Every request to the OneFive API requires an API key passed in the Authorization header.

bash
curl https://api.hydrajs.dev/v1/products \
  -H "Authorization: Bearer sk_your_api_key"

API keys ​

When you create a project, you receive two keys:

PrefixTypeUsage
sk_SecretFull CRUD, server-side only
pk_PublishableRead-only, client-safe

Keys are shown once at creation time. Store them somewhere secure. They cannot be retrieved later.

Secret vs publishable ​

Secret keys (sk_*) have full access to every endpoint. Use them in server-side code only. Never expose them in a browser, mobile app, or client-side bundle.

Publishable keys (pk_*) are safe to use in client-side code. They can read products, images, and store settings. They cannot create, update, or delete resources. Attempting a write operation with a publishable key returns a 403:

json
{
  "error": {
    "code": "forbidden",
    "message": "Key does not have permission for this action."
  }
}

Scoped permissions ​

API keys support granular permissions per resource area. When creating a key, you can restrict access to specific scopes:

ScopeControls
catalogProducts, variants, images
ordersOrders and fulfillment
customersCustomer profiles
inventoryStock levels
shippingShipping zones and rates
promotionsDiscounts and promotions
taxTax configuration
developerWebhooks, deploy hooks, API keys
settingsStore configuration
cartCart and checkout

Each scope can be set to none, read, or write. Omitting permissions gives the key unrestricted access.

See API Keys for the full endpoint reference.

Error responses ​

Missing or invalid key ​

Status 401:

json
{
  "error": {
    "code": "unauthorized",
    "message": "Missing or invalid API key."
  }
}

Insufficient permissions ​

Status 403:

json
{
  "error": {
    "code": "forbidden",
    "message": "Key does not have permission for this action."
  }
}

Rate limits ​

Requests are rate-limited per project using a sliding window.

PlanRequests per minute
Free60
Pro600

Every response includes rate limit headers:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 42
X-RateLimit-Reset: 1692374520

When the limit is exceeded, the API returns a 429 with a Retry-After header:

json
{
  "error": {
    "code": "rate_limited",
    "message": "Too many requests."
  }
}

Monthly quota ​

Each plan includes a monthly request quota. When exceeded, the API returns a 429:

json
{
  "error": {
    "code": "quota_exceeded",
    "message": "Monthly API quota exceeded."
  }
}
PlanMonthly quota
Free2,000
Pro100,000

CORS ​

CORS headers are applied only to requests made with publishable keys. To allow browser requests from your storefront, add your domain(s) to Allowed Origins in your store settings or via the Store API. Only exact-match origins are accepted:

https://mystore.com
https://staging.mystore.com

Set a single * entry to allow requests from any origin.

Best practices ​

  • Never commit keys to version control. Use environment variables.
  • Use publishable keys on the client. Secret keys belong on the server.
  • Rotate keys regularly. Use the roll endpoint to rotate a key without downtime.
  • Scope permissions. Give each key only the access it needs.