# API reference

> Every endpoint of the Okidoki API, with parameters and examples.

Every endpoint of the Okidoki API. All addresses start with `https://okidoki.sh/api/v1`. See [API basics](https://docs.okidoki.sh/api) for keys, answers, errors, rate limits, retries and pages. The same endpoints, with every parameter, are in the OpenAPI file at [`https://okidoki.sh/api/v1/openapi.json`](https://okidoki.sh/api/v1/openapi.json).

In the **Key** column: *read* works with any key, *change* needs a key that may read and change, and *account* needs a key for all sites that may read and change.

## Overview

| Method | Path | Key | What it does |
| --- | --- | --- | --- |
| `GET` | `/` | none | Lists endpoints, reports, periods and filters |
| `POST` | `/start` | none | Creates an account, a site and a key, for agents |
| `GET` | `/me` | read | The account, its plan and what the key may do |
| `PATCH` | `/me` | account | Turns the weekly email on or off |
| `GET` | `/me/weekly-email` | read | The email you would get on Monday |
| `GET` | `/sites` | read | Your sites |
| `POST` | `/sites` | account | Adds a site |
| `GET` | `/sites/:site` | read | One site, with install details |
| `PATCH` | `/sites/:site` | change | Sets the time zone |
| `DELETE` | `/sites/:site` | account | Deletes a site and its statistics |
| `GET` | `/sites/:site/verify` | read | Checks the install |
| `GET` | `/sites/:site/ad-blockers` | read | How to count visitors with ad blockers |
| `POST` | `/sites/:site/ad-blockers` | write | Uses an own subdomain, `{"host"}` |
| `DELETE` | `/sites/:site/ad-blockers` | write | Stops using the own subdomain |
| `GET` | `/sites/:site/summary` | read | One sentence and the totals |
| `GET` | `/sites/:site/insights` | read | Headline, unusual changes and question cards |
| `GET` | `/sites/:site/reports/:report` | read | One report |
| `GET` | `/sites/:site/export` | read, Plus | Reports as CSV |
| `GET` | `/campaign-places` | none | Where campaign links can be used |
| `GET` | `/sites/:site/campaign-link` | read | Makes a campaign link |
| `GET` | `/sites/:site/goals` | read | Goals |
| `GET` | `/sites/:site/goal-ideas` | read | Suggested goals |
| `POST` | `/sites/:site/goals` | change | Adds a goal |
| `DELETE` | `/sites/:site/goals/:goal` | change | Removes a goal |
| `GET` | `/sites/:site/funnels` | read | Saved funnels |
| `POST` | `/sites/:site/funnels` | change | Saves a funnel |
| `DELETE` | `/sites/:site/funnels/:funnel` | change | Removes a funnel |
| `GET` | `/sites/:site/share-links` | read | Share links |
| `POST` | `/sites/:site/share-links` | change | Makes a share link |
| `DELETE` | `/sites/:site/share-links/:link` | change | Turns a share link off |
| `GET` | `/shared/:token` | none | A shared site |
| `GET` | `/shared/:token/summary`, `/insights`, `/reports/:report` | none | Reports of a shared site |
| `GET` | `/keys` | account | API keys |
| `POST` | `/keys` | account | Makes an API key |
| `DELETE` | `/keys/:key` | account | Turns an API key off |
| `GET` | `/sites/:site/events` | read, Plus | What happened, newest first |
| `GET` | `/webhooks` | read, Plus | Webhooks |
| `POST` | `/webhooks` | change, Plus | Adds a webhook |
| `PATCH` | `/webhooks/:webhook` | change, Plus | Changes a webhook, or turns it on or off |
| `DELETE` | `/webhooks/:webhook` | change | Stops a webhook |
| `GET` | `/webhooks/:webhook/deliveries` | read, Plus | The delivery log |
| `GET` | `/sites/:site/alerts` | read | Alerts and the kinds there are |
| `POST` | `/sites/:site/alerts` | change, Plus | Turns an alert on, or changes it |
| `DELETE` | `/sites/:site/alerts/:alert` | change | Turns an alert off |
| `GET` | `/sites/:site/revenue` | read | Shop connections |
| `POST` | `/sites/:site/revenue` | change | Connects a shop or payment platform |
| `DELETE` | `/sites/:site/revenue/:provider` | change | Disconnects a shop |
| `GET` | `/sites/:site/benchmarks` | read, Plus | Your numbers next to sites like yours |
| `GET` | `/sites/:site/ask` | read | Suggested questions and questions left |
| `POST` | `/sites/:site/ask` | read | Asks a question |

## More endpoints

The tables on this page cover the endpoints most agents need. The API has more, one group per feature, and every one of them, with its parameters and answers, is in [`openapi.json`](https://okidoki.sh/api/v1/openapi.json):

| Feature | Endpoints | See |
| --- | --- | --- |
| Billing and the Plus trial | `/billing`, `/billing/checkout`, `/billing/trial`, `/billing/cancel`, `/billing/withdraw` | [Plans](https://docs.okidoki.sh/plans) |
| Give a month, get a month | `/me/friend` | [Plans](https://docs.okidoki.sh/plans#give-a-month-get-a-month) |
| Team | `/team`, `/team/:person` | [Sites and settings](https://docs.okidoki.sh/sites#team) |
| Partner program | `/partner` | [Partner program](https://docs.okidoki.sh/partners) |
| Marketing | `/sites/:site/marketing`, `/sites/:site/ad-accounts`, `/sites/:site/ad-costs`, `/sites/:site/ad-budgets`, `/sites/:site/ad-link-test` | [Marketing](https://docs.okidoki.sh/marketing) |
| What gave the result | `/sites/:site/attribution`, `/sites/:site/goals/:goal/journey` | [Funnels and paths](https://docs.okidoki.sh/funnels) |
| Goals | `/sites/:site/goal-targets`, `/sites/:site/event-labels`, `/sites/:site/funnel-ideas`, `/sites/:site/plan`, `/sites/:site/plan/kind` | [Goals](https://docs.okidoki.sh/goals) |
| A/B tests | `/sites/:site/experiments` | [A/B tests](https://docs.okidoki.sh/ab-tests) |
| Occasions and changes | `/sites/:site/occasions`, `/sites/:site/occasions/notes`, `/sites/:site/impact`, `/sites/:site/why` | [Occasions](https://docs.okidoki.sh/occasions) |
| Segments and views | `/sites/:site/segments`, `/sites/:site/views`, `/sites/:site/metrics`, `/sites/:site/compare`, `/sites/:site/patterns`, `/sites/:site/explore` | [Segments, views and more](https://docs.okidoki.sh/views) |
| Integrations | `/sites/:site/google`, `/sites/:site/bing`, `/sites/:site/imports`, `/sites/:site/crm`, `/sites/:site/email-apps` | [Integrations](https://docs.okidoki.sh/integrations) |
| Background agent and autopilot | `/sites/:site/findings`, `/sites/:site/agent`, `/sites/:site/autopilot`, `/sites/:site/autopilot/proposals/:proposal` | [Background agent](https://docs.okidoki.sh/background-agent) |
| Private pages and heat maps | `/sites/:site/private-pages`, `/sites/:site/heatmaps`, `/sites/:site/forecasts` | [Tracker](https://docs.okidoki.sh/tracker) |
| Agencies | `/clients`, `/clients/:client`, `/portfolio` | [Agencies and clients](https://docs.okidoki.sh/agency) |
| Change log | `/changes`, `/changes/:change/undo` | [Change log](https://docs.okidoki.sh/changes) |
| Install help | `/sites/:site/install-email` (signed in on okidoki.sh only) | [Install Okidoki](https://docs.okidoki.sh/install#someone-else-looks-after-your-site) |

## Start

### POST /start

Creates an account, adds a site and returns a key that can read and change, in one call. Made for agents setting Okidoki up for a person. No key needed.

| Field | Required | |
| --- | --- | --- |
| `email` | Yes | The person's email |
| `site` | No | The site address. Also accepted as `domain` or `url` |
| `timezone` | No | Like `Europe/Stockholm`. Defaults to UTC |

```bash
curl -X POST https://okidoki.sh/api/v1/start -H "Content-Type: application/json" \
  -d '{"email":"you@example.com","site":"mysite.com","timezone":"Europe/Stockholm"}'
```

The answer has `data.api_key` (keep it secret), `data.site` with install details, `data.claim_url` for the person, and `data.next_steps`. If the email already has an account, the answer is `409 account_exists`: ask the person to sign in and make a key instead. See [Set up with an agent](https://docs.okidoki.sh/agents).

## Account

### GET /me

The account's email, plan, number of sites and passkeys, whether the weekly email is on, and what the key may do in `data.access`.

### PATCH /me

```json
{ "weekly_email": false }
```

### GET /billing

The plan, and the questions to Okidoki AI: `monthly`, `left_this_month`, `extra`, `left` and `resets_at`.

### GET /me/passkeys

The passkeys on the account. Removing a passkey and closing the account can only be done signed in on okidoki.sh, in **Settings → Account**.

### GET /me/weekly-email

The email the account would get next Monday, with `subject`, `text` and `html`.

## Sites

### GET /sites

Every site the key can see. Each site has `id`, `domain`, `site_key`, `timezone`, `created_at` and `install`.

### POST /sites

```json
{ "domain": "mysite.com", "timezone": "Europe/Stockholm" }
```

Returns the site with `201`. The message holds the install sentence. Errors: `bad_domain`, `bad_timezone`, `site_limit` (the plan has no room), `site_exists`, `site_taken` (another account has it).

### GET /sites/:site

One site. Its `install` holds everything needed to install Okidoki:

| Field | What it is |
| --- | --- |
| `script_tag` | The tag for `<head>` |
| `react` | How to use the React component |
| `tag_manager` | The same tag as a few lines of script for Google Tag Manager's Custom HTML, which strips `data-*` from a plain tag |
| `agent_prompt` | The sentence for a site builder: the tag, an allowance in any Content Security Policy, a line in `AGENTS.md`, and a request to publish or deploy |
| `agent_prompt_policy` | The same sentence, which also adds a line about Okidoki to the site's privacy policy. Use it only when the person asks for the line |
| `privacy_policy` | The optional privacy policy sentence, as `text`, `markdown` and `html`, with a `note` on how to offer it |
| `one_click` | Builders where signing in there puts the tag on the site |
| `ad_blockers` | Where to read how to count visitors with ad blockers |

### PATCH /sites/:site

```json
{ "timezone": "America/New_York" }
```

### DELETE /sites/:site

Deletes the site and all its statistics. It cannot be undone.

## Check the install

### GET /sites/:site/verify

Says whether Okidoki counts visits, and if not, what to do.

| `data.status` | Meaning |
| --- | --- |
| `working` | A visit arrived in the last 24 hours |
| `quiet` | Visits arrived before, but none in the last 24 hours |
| `waiting` | No visit yet |

When it is not `working`, Okidoki opens the home page and says in the message whether the tag was found, and `data.page` has `reachable` and `tag_found`. See [Check that it works](https://docs.okidoki.sh/install/check).

## Ad blockers

### GET /sites/:site/ad-blockers

How to load Okidoki from the site's own address, so ad blockers let it through. `data.own_address` is the subdomain with `status` (`waiting` or `ready`), the DNS `records` to add and the new `script_tag`, or `null`. `data.suggested_host` is a good name for it. `data.proxy` has the `path`, the `script_tag`, an `agent_prompt` for a builder and `recipes` for Next.js, Vercel, Netlify, Cloudflare and Node. See [Count visitors with ad blockers](https://docs.okidoki.sh/ad-blockers).

### POST /sites/:site/ad-blockers

Body `{"host": "x7f3k.mysite.com"}`, or empty for the suggested name. Answers like the GET, with the record to add. `400 bad_host` for a name outside the site or one ad blockers block everywhere, like `stats.`. Okidoki never changes DNS: add the record yourself, then GET again until `status` is `ready`.

### DELETE /sites/:site/ad-blockers

Stops using the subdomain. Put the okidoki.sh tag back on the site first.

## Reports

All report endpoints take `period`, `from`, `to`, `compare`, `limit` and the filters. See [API basics](https://docs.okidoki.sh/api#periods-and-filters). On Free, a period reaching further back than 12 months is cut at the limit and the answer has `history_from` and `history_note`; a period entirely before it is `402 history_limit`.

An API key can ask 20 questions a month on Free and 2,000 on Plus. Reads of reports (summary, insights and reports together) within 3 minutes of the read that began a question are part of it. The count starts again on the 1st (UTC); after that the answer is `429 agent_read_limit`, unless a pack of extra questions has some left. The dashboard is never counted.

### GET /sites/:site/summary

One sentence about the period and the totals. Start here for *how is my site doing?*.

### GET /sites/:site/insights

What the top of the dashboard shows: `headline`, `unusual` (warnings and changes, up to four sentences), `warnings` (what broke, each with `key`, `severity`, `message` and often `path`, empty when nothing broke) and `cards`, each with a `question`, an `answer`, a `trend`, a `tip` and a few `numbers`.

### GET /sites/:site/reports/:report

`:report` is one of `overview`, `pages`, `sources`, `locations`, `technology`, `events`, `videos`, `goals`, `revenue`, `deals`, `health`, `realtime`, `search`, `bing`, `paths`, `funnels`, `customers`, `campaigns`, `reconcile`, `patterns`, `calendar`, `business`, `forecast`, `uptime`, `notfound`, `speed`, `sitesearch`, `heatmap`, `forms`, `budgets`, `impact`, `metrics`, `rhythm`.

| Report | Lists in `data` |
| --- | --- |
| `overview` | `totals`, `previous`, `change`, `timeseries` |
| `pages` | `pages`, `entry_pages`, `exit_pages`, `read_to_end`, `average_scroll_pct`, `reading`, `site_search` |
| `sources` | `channels`, `sources`, `campaigns`, `utm_sources`, `utm_mediums`, `ai_assistants`, `ai_crawlers` |
| `locations` | `countries`, `regions`, `languages` |
| `technology` | `devices`, `browsers`, `operating_systems`, `load_time` |
| `events` | `events`, each with `name`, `label`, `count`, `per_100_visitors` and `top_targets` |
| `goals` | `goals`, each with completions and the share of visitors, now and before |
| `health` | `warnings`, `not_found`, `errors`, `rage_clicks`, `load_time`. See [Warnings](https://docs.okidoki.sh/reports/health) |
| `paths` | With `page`: `views`, `next`, `previous`, `left_site`, `left_site_share`, `arrived_from_outside`. Without: `steps` (the most common page pairs) |
| `funnels` | `funnels`, each with `name`, `steps` (`views`, `from_previous`, `went_on`, `reached`) and `whole_way`. Add `steps=/pricing,/signup` to count any funnel without saving it |
| `revenue` | `totals` (`revenue`, `orders`, `average_order`, `revenue_per_visitor` and the period before), `currencies`, `channels`, `sources`, `campaigns`, `landing_pages`, `shops`. On Plus, channels, sources and landing pages also have `visitors` and `per_visitor`: the row's orders over the row's visitors on the same days, renewals left out, null under 10 orders or 100 visitors. `per_visitor` explains the rules. |
| `customers` | Plus. `totals`, `months`, `channels` and `subscriptions` for customers who buy again, and `value`: what customers actually paid in their first 90, 180 and 365 days (`days_90`, `days_180`, `days_365` with `customers`, `average` and `median`), in total and per first-order channel. Averages are null under 30 customers. Each channel's `estimate` is first orders per visitor over the last 90 days times its 180-day value. |

Every report also has `period` and `filters`. Rates like `bounce_rate` are between 0 and 1. Times are in milliseconds.

```bash
curl -H "Authorization: Bearer oks_..." \
  "https://okidoki.sh/api/v1/sites/mysite.com/reports/sources?period=last_month&limit=20"
```

### GET /sites/:site/export

Plus. `report` is `all` (the default) or one report. Returns a CSV file; add `format=json` to get `file` and `csv` inside JSON. See [Export](https://docs.okidoki.sh/export).

## Campaign links

### GET /campaign-places

The places a campaign link can be made for, with the `utm_source` and `utm_medium` each uses.

### GET /sites/:site/campaign-link

| Parameter | Required | |
| --- | --- | --- |
| `place` | Yes | One of the places, like `meta_ads` or `newsletter` |
| `campaign` | Yes | Like `spring sale`. Turned into `spring-sale` |
| `page` | No | A path, like `/pricing`. Defaults to `/` |
| `source` | For `other` | Where, like `partner-blog` |
| `content` | No | To tell ads apart, like `video` |

Returns `url` and the tags. Nothing is stored. See [Campaign links](https://docs.okidoki.sh/campaign-links).

## Goals

### GET /sites/:site/goals

The site's goals, each with `id`, `name`, `kind` (`page`, `event` or `engaged`), `match` and `target`.

### GET /sites/:site/goal-ideas

Up to six goals worth tracking, from what visitors did in the last 30 days, then the engagement goals (`engaged` with `read`, `time` or `pages`), each with how often it happened. All ready to add.

### POST /sites/:site/goals

Give `name` and one of `page`, `event` or `engaged`:

```json
{ "name": "Reached /thanks", "page": "/thanks" }
```

```json
{ "name": "Downloaded the guide", "event": "download", "target": "/guide.pdf" }
```

```json
{ "name": "Stayed over a minute", "engaged": "time", "seconds": 60 }
```

A page ending in `*` matches every page below it. `target` is optional: for an event its target, for `engaged` the page or section it must happen on, like `/blog/*`. `engaged` is `read` (scrolled to the end and stayed 15 seconds), `time` (on screen for `seconds`, 10 to 1800, 60 when left out) or `pages` (went on to another page, once per visit). A site can have 10 goals. Errors: `bad_goal`, `goal_exists`, `goal_limit`.

### DELETE /sites/:site/goals/:goal

Removes the goal. Get its id from the goals list.

## Funnels

Paths and funnels are counted as page pairs. Each page view knows only the page on your site right before it, so nobody is followed: a funnel counts how many went straight from one step to the next, and `whole_way` is an estimate made from those steps.

### GET /sites/:site/funnels

The site's saved funnels, each with `id`, `name` and `steps`.

### POST /sites/:site/funnels

Give 2 to 5 paths in order, as a list or comma separated. `name` is optional.

```json
{ "name": "Pricing to signup", "steps": ["/pricing", "/signup", "/welcome"] }
```

A path ending in `*` matches every page below it. A site can have 10 funnels. Errors: `bad_funnel`, `funnel_exists`, `funnel_limit`.

### DELETE /sites/:site/funnels/:funnel

Removes the funnel. Get its id from the funnels list.

## Share links

### GET /sites/:site/share-links

Active share links, each with `id`, `url` (the page) and `api` (the read-only API address).

### POST /sites/:site/share-links

Makes a new link and returns it with `201`.

### DELETE /sites/:site/share-links/:link

Turns the link off. It stops working at once.

### GET /shared/:token

No key needed. The shared site's domain, time zone and reports. Revenue is never shared. Then use `/shared/:token/summary`, `/shared/:token/insights` and `/shared/:token/reports/:report`, with the same parameters as the signed-in endpoints.

## Alerts

Plus, to turn on. See [Alerts](https://docs.okidoki.sh/alerts).

### GET /sites/:site/alerts

The alerts that are on, each with `id`, `kind`, `name`, `goal`, `days`, `email`, `chats` (the chat channels that also get it), `slack` and `last_fired_at`, and the `kinds` there are.

### POST /sites/:site/alerts

| Field | |
| --- | --- |
| `kind` | `spike`, `quiet` or `goal` |
| `goal` | For `goal`: the goal's id or name |
| `days` | For `goal`: 1 to 30. Defaults to 3 |
| `email` | `true` (the default) or `false` |
| `chat_url` | Optional incoming webhook address from Slack, Microsoft Teams or Discord. It becomes a [chat channel](#chat-channels) for this site that gets this alert. `slack_url` works too |

Sending the same kind again changes the alert that is on. An alert needs email or a chat channel, or both.

### DELETE /sites/:site/alerts/:alert

Turns the alert off.

## Events and webhooks

Plus. The full guide, with signature checks in Node.js and Python, is [Webhooks](https://docs.okidoki.sh/webhooks).

### GET /sites/:site/events

What happened on a site, newest first, kept 90 days: traffic jumps, a day without visitors, sales, goals reached or gone quiet, and the Monday check-in.

| Parameter | |
| --- | --- |
| `since` | Only after this time, like `2026-11-10T08:00:00Z`. Defaults to 7 days ago |
| `type` | Only this kind of event |
| `limit` | 1 to 100. Defaults to 20 |
| `cursor` | `next_cursor` from the page before |

```bash
curl -H "Authorization: Bearer oks_..." "https://okidoki.sh/api/v1/sites/mysite.com/events?since=2026-11-13T00:00:00Z"
```

An agent that checks in on a schedule keeps the time of its last check and passes it as `since`.

### POST /webhooks

Adds a webhook. Body: `url` (https), and optionally `events` (a list, or comma separated), `site` and `label`. The answer has the `secret`, shown once.

### PATCH /webhooks/:webhook

Changes `url`, `events` or `label`. `{"on": true}` turns a webhook that stopped after failures on again and sends at once; `{"on": false}` pauses it.

### GET /webhooks/:webhook/deliveries

Every attempt to send, newest first, for 30 days, with `limit` and `cursor`. `POST /webhooks/:webhook/deliveries/:delivery/retry` sends one again. `POST /webhooks/:webhook/rotate-secret` makes a new secret; the old one signs too for 24 hours.

## Chat channels

Plus. Alerts, sales and the Monday check-in as a message in Slack, Microsoft Teams or Discord. See [Alerts](https://docs.okidoki.sh/alerts#slack-teams-and-discord).

### GET /chat-channels

The channels, each with `id`, `kind` (`slack`, `teams` or `discord`), `address` (only its last characters), `site` (`all` or a domain), `events`, `label`, `on` and `last_sent_at`, and the `events` there are. The full address is never shown.

### POST /chat-channels

| Field | |
| --- | --- |
| `url` | The incoming webhook address from Slack, Teams or Discord |
| `events` | Optional, comma separated or a list: `traffic_spike`, `quiet_day`, `goal_quiet`, `sale`, `goal_reached`, `weekly_brief`, or `all`. Defaults to all but `goal_reached` |
| `site` | Optional. Only this site; leave out for all sites |
| `label` | Optional, like `#marketing` |

Okidoki sends a first message right away. If the chat does not take it, nothing is saved and the answer says why (`chat_failed`). The address is stored encrypted.

### PATCH /chat-channels/:channel

Change `events` or `label`.

### POST /chat-channels/:channel/test

Sends a test message and says whether it arrived (`data.ok`). A test that works turns a channel on again after it failed too many times in a row.

### DELETE /chat-channels/:channel

Stops sending to the channel.

## Revenue

Connecting works on every plan; Free reads the last 30 days in total and by channel. See [Revenue](https://docs.okidoki.sh/revenue).

### GET /sites/:site/revenue

The connected shops, each with `provider`, `webhook_url`, `ready`, `last_order_at` and the `steps` to finish.

### POST /sites/:site/revenue

Send `{"provider":"stripe"}`, or any other platform from [Revenue](https://docs.okidoki.sh/revenue), to start: the answer has the webhook address and the steps. Send it again with `secret`, the signing secret from the shop, to finish. Stripe secrets start with `whsec_`.

### DELETE /sites/:site/revenue/:provider

Disconnects the shop. Orders already received stay in the report.

## Benchmarks

### GET /sites/:site/benchmarks

Plus. Your last 30 days next to the median of sites of a similar size. Until 1,000 sites use Okidoki, `data.enabled` is `false`. See [Benchmarks](https://docs.okidoki.sh/benchmarks).

## API keys

### GET /keys

Active keys, with `label`, `preview`, `access`, `site`, `created_at` and `last_used_at`. Never the secret.

### POST /keys

| Field | |
| --- | --- |
| `site` | Optional. Limits the key to one site |
| `access` | `read` (the default) or `write` |
| `label` | Optional name, up to 80 characters |

The secret is in `data.secret`, only in this answer.

### DELETE /keys/:key

Turns the key off. It stops working at once. Use `current` as the key to turn off the key the request is made with, for example after an app has used a key from a sign-in once.

## Okidoki AI

### GET /sites/:site/ask

Suggested questions that fit the site (`suggestions`), how many questions are left (`questions`), and whether questions are switched on (`available`).

### POST /sites/:site/ask

```json
{
  "question": "Which campaign brought the most visitors last month?",
  "history": [{ "question": "How many came last week?", "answer": "312 visitors came..." }]
}
```

`history` is optional, for follow-up questions; the last 3 turns are used. The answer is in `message` and `data.answer`, with the reports it read and the questions left. A question that fails with `502 ask_failed` is not counted. See [Okidoki AI](https://docs.okidoki.sh/ask).

