Authentication and scopes

Create API keys, choose what each key may do, send it with every request and stay inside the rate limit.

Every request to /v1 needs an API key. Keys belong to one business, never expire on their own and can be revoked at any time.

Create a key

  1. Open Settings → Developer in the Portal. Only the owner can manage keys.
  2. Choose Create key, type a name that tells you where it is used, and pick the access for each resource.
  3. Copy the key now. Bakasir stores only a hash, so it cannot be shown again. If you lose it, revoke it and create a new one.

A business can hold up to 20 active keys. Use one key per integration so you can revoke one without breaking the others.

Send the key

Send the key as a bearer token:

curl https://api.bakasir.com/v1/me \
  -H "Authorization: Bearer bak_your_key_here"

The header X-API-Key: bak_your_key_here works too. Always call the API from your server. Never put a key in a web page or a mobile app.

Scopes

Each key has a level per resource: no access, read or write. Write includes read.

ResourceLevelsUsed by
productsread, write/v1/products
categoriesread, write/v1/categories
stockread, write/v1/stock, /v1/stores
customersread, write/v1/customers
salesread/v1/sales
ordersread/v1/orders

A request outside the key's access fails with 403 and the code insufficient_scope.

Rate limit

Each key may make 120 requests per minute by default. Bakasir can raise the limit for your business. Every response carries these headers:

HeaderMeaning
X-RateLimit-LimitRequests allowed per minute
X-RateLimit-RemainingRequests left in the current minute
X-RateLimit-ResetUnix time when the counter resets

When you pass the limit you get 429 with the code rate_limited and a Retry-After header in seconds. Wait that long, then continue.

Revoke a key

Choose Revoke next to the key in Settings → Developer and hold the button. The key stops working immediately and requests with it return 401 with the code revoked_api_key. Revoking stays available even if the plugin lapses.

When a key is refused

StatusCodeReason
401invalid_api_keyThe key is missing, malformed or unknown
401revoked_api_keyThe key was revoked
403plugin_inactiveThe Public API plugin is not active for the business
403tenant_inactiveThe business account is suspended
403insufficient_scopeThe key has no access to this resource or method
429rate_limitedToo many requests
How is this guide?

Last updated on