---
title: "Ask your analytics (AI)"
description: "Answers a question about your own analytics with Claude Haiku 5.5, which picks from a fixed set of queries that Markdrop runs on the documents you own…"
canonical_url: https://docs.markdrop.in/api/analytics/ask-your-analytics-ai
last_updated: 2026-11-04
site: "Markdrop Docs"
index: https://docs.markdrop.in/llms.txt
---

# Ask your analytics (AI)

`POST https://api.markdrop.in/api/v1/me/analytics/ai/ask`

Answers a question about your own analytics with Claude Haiku 5.5, which picks from a fixed set of queries that Markdrop runs on the documents you own (totals, top links, a link's numbers, referrers, channels, devices, countries, views by day, period comparisons, file versions). Streams server-sent events: `status` (what it's checking), `delta` (answer text; `reset: true` clears what was shown), then `done` with `answer` and `links` (only analytics pages the queries returned); or `limit`, or `error`. The same question the same day is answered from the copy kept (`cached: true`) unless `fresh` is `true`. Counts towards your AI limits.

- **Authentication:** API token required: `Authorization: Bearer mdk_…`.
- **Rate limit:** 20 per minute per IP address.
- **MCP tool:** `ask_analytics` ([tools](https://docs.markdrop.in/ai/tools))
- **Guide:** [Insights and Ask](https://docs.markdrop.in/analytics/overview#insights-and-ask)

## Request body

`application/json`, required.

- `question` (string, required): 1–500 characters.
- `range` (string): One of `7d`, `30d`, `90d`, `all`. One of `7d`, `30d`, `90d`, `all`.
- `fresh` (boolean): Default `false`.

## Responses

- `200`: OK.
- `401`: No token, or the token is revoked or mistyped.
- `422`: The request didn't validate. `detail` lists each problem, with where it is (`loc`) and why (`msg`).
- `429`: Too many requests from your IP address. Wait the seconds in `Retry-After`.

## Examples

**curl**

```bash
curl -X POST https://api.markdrop.in/api/v1/me/analytics/ai/ask \
  -H "Authorization: Bearer $MARKDROP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"question":"Which link did best this month?","range":"30d"}'
```

**JavaScript**

```javascript
const res = await fetch("https://api.markdrop.in/api/v1/me/analytics/ai/ask", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MARKDROP_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "question": "Which link did best this month?",
    "range": "30d"
  }),
});
const data = await res.text();
```

**Python**

```python
import os

import requests

r = requests.post(
    "https://api.markdrop.in/api/v1/me/analytics/ai/ask",
    headers={"Authorization": f"Bearer {os.environ['MARKDROP_TOKEN']}"},
    json={
        "question": "Which link did best this month?",
        "range": "30d",
    },
)
r.raise_for_status()
print(r.text)
```
