Docs
Open Okidoki

API basics

Keys, answers with a sentence, errors and limits.

Everything a person can do in Okidoki, an agent or a script can do through the API. It is a plain JSON API at https://okidoki.sh/api/v1, and every answer comes with one sentence that can be repeated as it is.

#Your first call

Make a key under Settings → Connections → Your AI agent (see API keys), then:

Terminal
curl -H "Authorization: Bearer oks_..." "https://okidoki.sh/api/v1/sites/mysite.com/summary?period=7d"
JSON
{
  "message": "312 visitors came in the last 7 days, 18% more than the 7 days before.",
  "data": { "...": "the numbers" }
}

GET https://okidoki.sh/api/v1 without a key lists every endpoint, report, period and filter. The whole API is also described as OpenAPI 3.1 at https://okidoki.sh/api/v1/openapi.json: load it in Postman, Insomnia or Scalar, or generate a client from it.

#Signing in

Send a key in the Authorization header:

Text
Authorization: Bearer oks_...
WhoTokenCan do
Agents and scriptsAPI key, oks_...What the key allows: one site or the whole account, read-only or read and change
People in the dashboardSession, after signing in on okidoki.shEverything in their account
Anyone with a share linkThe share token, in the addressRead the shared site's reports

#Answers

Every successful answer is JSON with two fields:

FieldWhat it is
messageOne plain sentence, written to be repeated to a person as it is
dataThe numbers and details, for programs

Agents should repeat message rather than describe data in their own words. That way what they say always comes from Okidoki.

#Errors

Errors have a status code, a stable code for programs and a message that says what to do, in words that can be passed on:

JSON
{
  "error": {
    "code": "site_not_found",
    "message": "There is no site \"mysite.co\" in this account. List your sites with GET /api/v1/sites.",
    "status": 404,
    "request_id": "req_6f1c0a9e2b7d4c3a8e5f1b2c",
    "docs": "https://docs.okidoki.sh/api#errors"
  }
}

Programs should branch on code, never on the message, which may be reworded. Every answer, also a good one, has an X-Request-Id header: quote it when you write to us about a call.

StatusMeaningCommon codes
400Something in the request is wrongbad_domain, bad_period, bad_filter, bad_goal, bad_json, bad_cursor, bad_idempotency_key
401No key, or the key does not workunauthorized
402Needs Plus, or the plan has no roomplus_required, site_limit, history_limit
403The key may not do this, or the domain is blockedread_only_key, site_key, owner_only, blocked
404No such site, goal, link or endpointsite_not_found, webhook_not_found, not_found
405The endpoint exists, but not with this method. The Allow header lists the ones it takesmethod_not_allowed
409It already exists, a limit is reached, or the same Idempotency-Key is still runningsite_exists, goal_exists, goal_limit, account_exists, idempotency_in_progress
413The body is too largetoo_large
422The Idempotency-Key was used for another requestidempotency_key_reused
429Too many calls; wait Retry-After secondsrate_limited, agent_read_limit, busy
500Something went wrong on our sideinternal

#Rate limits

Two limits, both with headers so a script can pace itself:

LimitHow muchHeaders
Burst, per key120 calls a minuteRateLimit-Limit, RateLimit-Remaining, RateLimit-Reset (seconds), RateLimit-Policy
Report reads (questions from AI tools), per account20 a month on Free, 2,000 on Plus, back on the 1st (UTC)Okidoki-Monthly-Reads-Limit, Okidoki-Monthly-Reads-Remaining

Over a limit the answer is 429 with a Retry-After header in seconds. Wait that long and try again; do not retry at once in a loop. Plus has no daily limit, and the dashboard has none at all.

#Retries and Idempotency-Key

Calls that change something (POST, PATCH, DELETE) take an Idempotency-Key header: any unique string up to 255 characters, like a UUID. If the connection drops and you send the same call again with the same key within 24 hours, Okidoki does not do it twice: you get the first answer again, with Idempotent-Replayed: true.

Terminal
curl -X POST https://okidoki.sh/api/v1/sites/mysite.com/goals \
  -H "Authorization: Bearer oks_..." -H "Content-Type: application/json" \
  -H "Idempotency-Key: 7d0c5d4e-2b1a-4c1e-9f7a-3e8b6a2c9d10" \
  -d '{"name":"Signed up","page":"/thanks"}'
  • Use a new key for each new thing you want done. The same key with another body is 422 idempotency_key_reused.
  • Answers with a status of 500 or more are not kept, so a retry after one runs again.
  • Secrets are never kept. Replaying POST /keys or POST /webhooks gives the same id, with the secret written as [shown only in the first answer].
  • Retry GET calls and 5xx answers freely, with a growing wait (1, 2, 4 seconds…). Do not retry other 4xx answers without changing the request.

#Pages

Lists that can grow long are paged with a cursor: events and the webhook delivery log. Ask for up to limit items (1 to 100), and pass next_cursor from the answer as cursor to get the next page. has_more is false and next_cursor is null on the last page.

JSON
{ "message": "...", "data": { "events": ["..."], "next_cursor": "evt_1042", "has_more": true } }

Reports are not paged: they return the top limit rows (up to 100), sorted by what matters most.

#Versions

The version is in the address: /api/v1, and in the Okidoki-Api-Version header of every answer. Version 1 only grows. We add endpoints, fields, report columns, event types and error codes, but never remove or rename them, and never change what a field means. Write your code to ignore fields and event types it does not know.

If something ever has to change in a way that breaks code, it comes as /api/v2, and /api/v1 keeps working for at least 12 months after we tell every account with a key by email. Endpoints on their way out answer with Deprecation and Sunset headers before then. Webhook events carry api_version too.

#Sites in addresses

Wherever an address has :site, use the site's domain, like mysite.com, or its id. Domains are cleaned up the same way as when you add a site, so www.mysite.com works too.

#Periods and filters

Reports, summaries, insights and exports take the same query parameters:

ParameterValues
periodtoday, 24h, yesterday, 7d, 30d, 90d, month, last_month, year, all, custom. Defaults to 7d
from, toDates like 2026-11-01, for period=custom
compareprevious (the default) or year, the same dates last year
limitRows per list, 1 to 100. Defaults to 10
Filterspage, source, channel, campaign, utm_source, utm_medium, country, region, device, browser, os

See Periods and comparisons and Filters.

#Requests

  • Send bodies as JSON with Content-Type: application/json, up to 64 KB.
  • The API allows calls from any origin (CORS), so it works from a browser too. Never put a key that can change things in public code.
  • Answers are never cached: Cache-Control: no-store.
  • Times are ISO 8601 in UTC, like 2026-11-10T08:00:00.000Z. Days in reports are the site's own days, in its time zone.
  • Ids are opaque strings. Store them as they are.
  • The API runs in the EU, in Stockholm.

#Plus features

Exports with a key, alerts, revenue, campaign costs, benchmarks and history older than 12 months need Plus. On Free, all your data downloads as CSV in the web app: see Export your data. When a key's account does not have it, the answer is 402 with a message saying so. See Plans and pricing.

#Next