Base URLhttps://ottla.ai/api/v1

Getting started

Authentication

You need to send your key in the Authorization header. The scopes on your key determine which endpoints you can call.

Updated 7 min read

On this page

Every call to the Ottla API, apart from GET /health, carries an API key. You create keys in Storefront → API keys. The full key is shown once, when you create it: Ottla keeps only a hash, and afterwards the console shows just its first characters and last 4. Every key starts with osk_live_, because there are no test keys.

You do not need to create a key for your Magento store. When you Connect to Ottla, we create the keys that your store uses. Our module keeps these up to date for you. Learn more in our Magento module guide.

An API key in the Ottla console showing its identifier, scopes and allowed origins Example data

Send the key

Put the key in the Authorization header as a Bearer token. This works from browsers and servers alike.

curl https://ottla.ai/api/v1/recommendations \
  -H "Authorization: Bearer YOUR_BROWSER_KEY" \
  -H "Origin: https://shop.example" \
  -H "Content-Type: application/json" \
  -d '{"sku": "TENT-2P", "limit": 4}'

Server code can send the key in X-API-Key instead, if your HTTP client makes that easier:

X-API-Key from a server
curl https://ottla.ai/api/v1/ingest/acks \
  -H "X-API-Key: YOUR_SERVER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ack_ids": ["01JC3V7Q4M8T2X9K5R6N0B1D2E"]}'

Scopes

Each key has scopes that determine what it can do. The console sets these for you when you pick what the key is for. There are only 4 scopes.

A key locked to one shop
What each scope allows
Scope Endpoints Usual key
ask:read /ask, /compare, /search, /product-search, /autocomplete, /search/events, /recommendations, /product-alerts, /suggested-questions, /product-questions, /conversation, /conversations, /conversations/delete, /attribution/ingest Storefront widget
feedback:write /feedback, /feedback/{id}, /track, /escalation, /escalation/message, /escalation/messages, /escalation/rate, /escalation/contact Storefront widget
ingest:write Every /ingest/* endpoint, including /ingest/acks, and /privacy/shopper-erasure Server import
channels:read AI channels, which let AI shopping agents read your public catalogue (Pro and Enterprise). See AI channels. AI channel

GET /health needs no key at all.

Keys and websites

Most keys are limited to one website when you create them. A Storefront widget key always is, and so is an AI channel key. Requests made with a website-bound key do not need website_id, so leave it out: the key decides, and the ingestion endpoints refuse a key that names a different website. A Server import key may instead cover every website in the workspace, and then each request names its website with website_id.

Customer group prices can only be sent via our Magento connector

Direct API calls are answered with guest prices and guest visibility. Fields such as customer_group or customer_group_id in a request body are ignored, so a page cannot ask for trade prices by sending them. Only the Magento module can tell Ottla who a signed-in shopper is, which is how trade and retail customers each see their own prices on a Magento store.

Authentication errors

Ottla checks the key first, then its IP addresses, then the scope, then the workspace, then the origin, and answers with the first problem it finds. Every error body has a stable error code and a readable message.

Errors from key checks
Status Error Meaning What to do
401 unauthenticated No key was sent. Send Authorization: Bearer with your key.
401 invalid_api_key The key is unknown, revoked or expired. Check you copied all of it. If it was revoked or has expired, create a new key.
403 forbidden_scope The key lacks the scope this endpoint needs. The message names it. Use a key made for this job, such as a Server import key for /ingest/*.
403 ip_not_allowed The key only works from other IP addresses. Call from a listed address, or update Allowed IP addresses on the key.
403 tenant_suspended The workspace is not currently active. Ask the workspace owner to contact us.
403 origin_not_configured, origin_required, origin_invalid, origin_not_allowed The request failed the allowed origins check. See origin errors.

See all error codes, including billing and rate limit errors, on our errors page.

Expiry, rotation and revoking

You can add an Expiry date to a key, or leave it blank for no expiry. To revoke a key, open it and click Revoke key. This immediately stops the key from working, so make sure you have deployed its replacement first.

You can Re-authorise your Magento store from the module’s Connection settings. This generates new keys without interrupting your store. The old keys continue to work for a few minutes, so nothing in flight fails. You can see when in the console with Stops working at.

FAQ

Frequently asked questions

Can I see a key again after creating it?

No. It is shown once, and Ottla keeps only a hash. If you lose it, create a new key, deploy it and revoke the old one.

Can I use X-API-Key from JavaScript in the browser?

No, browsers block it. Use Authorization: Bearer in the browser; X-API-Key is for server code.

Which key reports orders from my server?

A key with ask:read that only your server holds: a Storefront widget key marked Used by a store connector or another server, with your servers’ IP addresses. /attribution/ingest refuses the key in your web pages (server_key_required), and it does not check Origin, so your server calls it directly.

What happens to my Magento store’s keys when I re-authorise?

New keys are issued and the module starts using them. The old ones stop working a few minutes later.

Why do I get 403 forbidden_scope?

The key doesn’t have the scope the endpoint needs. The error message tells you which scope is missing. You cannot sync products with a Storefront widget key, for example. You need a Server import key.

Next

Try Ottla

Give every shopper a good answer.

Start your free trial on your own store, or book a demo and we’ll show you Ottla on a store like yours.

14 days free. No card needed.