Authentication
Every request to the OneFive API requires an API key passed in the Authorization header.
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:
| Prefix | Type | Usage |
|---|---|---|
sk_ | Secret | Full CRUD, server-side only |
pk_ | Publishable | Read-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:
{
"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:
| Scope | Controls |
|---|---|
catalog | Products, variants, images |
orders | Orders and fulfillment |
customers | Customer profiles |
inventory | Stock levels |
shipping | Shipping zones and rates |
promotions | Discounts and promotions |
tax | Tax configuration |
developer | Webhooks, deploy hooks, API keys |
settings | Store configuration |
cart | Cart 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:
{
"error": {
"code": "unauthorized",
"message": "Missing or invalid API key."
}
}Insufficient permissions
Status 403:
{
"error": {
"code": "forbidden",
"message": "Key does not have permission for this action."
}
}Rate limits
Requests are rate-limited per project using a sliding window.
| Plan | Requests per minute |
|---|---|
| Free | 60 |
| Pro | 600 |
Every response includes rate limit headers:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 42
X-RateLimit-Reset: 1692374520When the limit is exceeded, the API returns a 429 with a Retry-After header:
{
"error": {
"code": "rate_limited",
"message": "Too many requests."
}
}Monthly quota
Each plan includes a monthly request quota. When exceeded, the API returns a 429:
{
"error": {
"code": "quota_exceeded",
"message": "Monthly API quota exceeded."
}
}| Plan | Monthly quota |
|---|---|
| Free | 2,000 |
| Pro | 100,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.comSet 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.