# Search Intent

Source: https://docs.askaniela.com/guide/search-intent/

Search Intent tells you what people expect when they search for a phrase in a given market. You send a phrase and
a market and get the search intents with their shares of the top results, the content form that fits best, typical
length, page elements, reader questions and related searches. Higher levels add details about the top pages and a
comparison with your own page.

Common uses: planning content for a list of keywords, checking whether an existing page matches the phrase it
targets, and sorting large keyword lists by intent before writing briefs.

The same reports are available in the panel (**Query analysis** in the sidebar, product Search Intent). This guide covers the API.

## Endpoints

| Method and path | What it does | Scope |
|---|---|---|
| `POST /v1/intent` | Report for one phrase and market, `202` | `judge` |
| `POST /v1/intent/batch` | Up to 100 phrases in one request, `202` | `judge` |
| `POST /v1/intent/batch/csv` | The same from a CSV file (multipart) | `judge` |
| `GET /v1/intent/{id}` | Status and report; `?format=md` = instructions for an AI agent | `reports:read` |
| `GET /v1/intent` | History, filters `batch_id`, `q`, `limit` (up to 500) | `reports:read` |
| `GET /v1/intent/{id}/export.html`, `.pdf`, `.md`, `.csv` | Report export | `reports:read` |
| `GET /v1/intent/batches/{batch_id}/export.csv` | All phrases of a batch in one CSV | `reports:read` |
| `POST /v1/intent/batches/{batch_id}/cancel` | Cancel phrases of a batch that have not started, their held amount returns | `judge` |
| `POST /v1/intent/{id}/shares` | Read-only share link ([Share links](https://docs.askaniela.com/guide/sharing.md)) | user session or token, not API keys |

Base URL: `https://api.askaniela.com`. Authenticate with an API key in `Authorization: Bearer <key>`
([Authentication](https://docs.askaniela.com/guide/authentication.md)). New keys get `judge` and `reports:read`. You can create and test keys in
the [developer panel](https://docs.askaniela.com/guide/developer-portal.md).

## Market: country and language

A market is a country and a language, written `language-COUNTRY`: `en-US`, `pl-PL`, `de-DE`, `pt-BR-BR`. Instead
of `market` you can send `location_code` (e.g. `2616` = Poland) and `language_code` (e.g. `pl`). The response
always has `market`. An unknown country or language returns `422 validation_error`. Default: `en-US`, `desktop`.

## One phrase

```bash
curl https://api.askaniela.com/v1/intent?wait=30 \
  -H "Authorization: Bearer $ANIELA_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: running-shoes-us-v1" \
  -d '{"query": "best running shoes", "market": "en-US", "tier": "basic"}'
```

```python
import os, time, httpx

h = {"Authorization": f"Bearer {os.environ['ANIELA_KEY']}"}
r = httpx.post("https://api.askaniela.com/v1/intent", headers=h, timeout=90,
               json={"query": "kalkulator raty kredytu", "market": "pl-PL", "tier": "premium"})
rep = r.json()
while rep["status"] in ("queued", "running"):
    time.sleep(int(r.headers.get("Retry-After", 5)))
    r = httpx.get(f"https://api.askaniela.com/v1/intent/{rep['id']}", headers=h, timeout=30)
    rep = r.json()
print(rep["report"]["dominant_title"], rep["report"]["dominant_share"], rep["price_usd"])
```

`POST /v1/intent` returns `202` with `status: "queued"` and the report id (`itr_...`). A phrase usually takes from
several seconds to a few minutes. `?wait=N` keeps the request open up to N seconds (max 60). When the report is
ready within that time you get `200` with the result. Otherwise poll `GET /v1/intent/{id}` and follow the
`Retry-After` header (5 s, 60 s while `queue_state` is `delayed`).

Request fields:

| Field | Type | Notes |
|---|---|---|
| `query` | string | The phrase, up to 200 characters |
| `market` | string | `language-COUNTRY`, default `en-US`. Or `location_code` + `language_code` |
| `device` | string | `desktop` (default) or `mobile` |
| `tier` | string | `basic` (default), `premium` or `compare`, see below |
| `compare_url` | string | Your page, `http(s)`. Required with `compare` and allowed only there |
| `freshness` | string | `auto` (default) reuses recent search results, `fresh` always gets new ones |
| `max_age_days` | integer | Oldest results reused with `auto`, 0-7, default 3 |
| `report_lang` | string | `en` or `pl`, language of the report text and exports. Default: `Accept-Language`, else `en` |
| `project_id` | string | Project to bill and store the report in. Or the `X-Project-ID` header |
| `top_pages`, `include_domains`, `exclude_domains` | | `premium` and `compare`: how many top pages and from which domains, see [below](#top-pages-how-many-and-which-domains) |

## Levels

| `tier` | Name in the panel | What you get |
|---|---|---|
| `basic` | Ani's quick look | Intents and their shares, dominant intent, recommended form, typical length, page elements, reader questions, related searches, the result map |
| `premium` | Ani takes a closer look | `basic` plus details of the top pages: length, elements and what searchers expect to find (`report.closer`) |
| `compare` | Ani compares your page | `premium` plus your page from `compare_url` next to the top pages, with gaps and suggestions (`report.compare`). If your page cannot be read (it does not load or has no main text), the report has no comparison and the warning `compare_page_unreadable`, and it costs like `premium` (the comparison is not charged; search results and page fetches only when we actually paid for them) |

`compare` takes one phrase with one URL per request, not a batch. A level that is switched off returns
`422 tier_unavailable`. Older ids still work: `lite` = `basic`, `full` = `premium`.

## Top pages: how many and which domains

`premium` and `compare` (also in a batch) read pages from the top of the search results. Three optional fields
choose them:

| Field | Type | Notes |
|---|---|---|
| `top_pages` | integer | How many top pages we fetch and read, 3 to 10. Default: every organic result the search returned (up to 10). Pages cited by the AI Overview come on top (up to 12), the same pages as Gain & Gap |
| `include_domains` | array | Read only pages from these domains (subdomains included), up to 20 |
| `exclude_domains` | array | Skip pages from these domains (subdomains included), e.g. forums, marketplaces or competitors, up to 50 |

- A domain can be written as `example.com` or as an address; we take its host and drop `www.`.
- Pages are taken in the order of the results. A skipped domain makes room for the next result, but the search
  results have about 10 organic results, so a strict filter can leave fewer pages than `top_pages`. Then we read what
  is left and you pay for the pages taken, also when your filter leaves only 1 or 2 pages (the report says so).
- Your filter leaves no page: no page is read, the report has only the search intent part and the warning
  `pages_filtered_out`, and you pay only for the search results bought for this phrase ($0.0030 pay as you go; nothing
  when they were reused). The rest is refunded.
- At least 3 pages left, but fewer than 3 have text to read: the report is based on the search results only (see
  [What we do not read](#what-we-do-not-read)) and costs nothing, as without these fields. With 1 or 2 pages left
  every one of them has to have text.
- The intent shares (`report.intents`) still come from all search results: the fields change only which pages are
  read (`report.closer`, `report.compare`).
- `report.page_scope` says what the analysis covered: `requested`, `analyzed` (pages taken), `results`, `filtered`
  (results skipped by the domain filter) and both domain lists. Without these fields the report has no `page_scope`.
- Not with `tier: basic` (it reads no pages) and not together with your own `pages`: `422 invalid_request`.
- Pages cited by the AI Overview (outside the organic results, up to 12) are read too and marked
  `aio_source: true` in `report.closer.pages`. Length, element shares and expectation coverage count only the ranking
  pages; `aio_met` and `aio_assessed` in each expectation say how many AI Overview sources meet it. The domain filter
  applies to them, `top_pages` does not.
- Price: the analysis of the pages plus what we pay providers for this report. The analysis part of `premium` and
  `compare` is the table price below minus the fetch of 8 pages ($0.012); each page read more or fewer (ranking
  pages and AI Overview sources) adds or takes $0.0068 (Just Ask), never below the cost floor. Fetching a page is
  charged at our provider's cost plus 30% and only when we pay for it: a page reused from our cache costs nothing, a page you
  make us fetch again is charged, and with your own fetching or search results key (BYOK) that part costs nothing. We hold the price for the top pages (`top_pages` or 10) plus 12 sources at the
  highest fetch rate and charge for what was done: most searches return 8 to 10 organic results, and about 1 in 5
  has an AI Overview (5 to 12 sources).

## Many phrases

```bash
curl https://api.askaniela.com/v1/intent/batch \
  -H "Authorization: Bearer $ANIELA_KEY" -H "Content-Type: application/json" \
  -d '{"tier": "basic", "items": [{"query": "trail running shoes", "market": "en-US"},
                                  {"query": "buty do biegania w terenie", "market": "pl-PL"}]}'

curl https://api.askaniela.com/v1/intent/batch/csv \
  -H "Authorization: Bearer $ANIELA_KEY" \
  -F file=@phrases.csv -F market=en-US -F tier=basic
```

- Up to 100 phrases per request. Repeated phrases (same phrase, market and device) run and are charged once;
  `skipped` in the response counts them.
- The response has `batch_id`, one `items[]` entry per phrase (each its own report) and `price_usd` held for the batch.
- CSV: a `query` column with optional `market` and `device`, or two columns without a header (phrase, market).
  Up to 1 MB. The `market` form field is the default for rows without one.
- Track progress with `GET /v1/intent?batch_id=itb_...` and download everything with
  `GET /v1/intent/batches/{batch_id}/export.csv`.
- `POST /v1/intent/batches/{batch_id}/cancel` stops a batch: phrases that have not started become `cancelled`, are
  not run and not charged, and their held amount returns to your balance. Phrases already running finish and are
  charged as usual. The answer is `{"batch": {...}, "changed": true}` with the batch `status` (`cancelling` while
  running phrases finish, then `cancelled`) and counts `done`, `failed`, `cancelled`; a second call or a finished
  batch returns `changed: false`.

## Response

```json
{
  "id": "itr_...", "status": "done", "query": "best running shoes", "market": "en-US", "device": "desktop",
  "tier": "basic", "batch_id": null, "cache": "miss", "snapshot_at": "2026-11-09T08:12:40Z", "price_usd": 0.009,
  "report": {
    "dominant_intent_id": "i1", "dominant_title": "Compare and choose a running shoe", "dominant_share": 0.7,
    "recommended_form": "...", "length_words": {"p25": 1800, "p50": 2600, "p75": 3400},
    "intents": [{"intent_id": "i1", "title": "Compare and choose a running shoe", "answer_share": 0.7,
                 "searcher_goal": "...", "ranks": [1, 2, 3, 5, 6, 8, 9]}],
    "elements": [{"code": "tables", "share": 0.57}],
    "reader_questions": [{"question": "...", "coverage": 0.4, "source": "paa"}],
    "related_searches": ["..."], "summary": "...", "closer": null, "compare": null
  }
}
```

- Shares (`dominant_share`, `answer_share`, `share`, `coverage`) are fractions of the top results, from 0 to 1.
- `length_words` is in words of the main text. In `report.length_words` (pages of the dominant intent) every
  percentile is the word count of a real page (nearest rank). In `report.closer.length_words` (the top pages Ani
  read) percentiles are interpolated, so `p50` is the plain median: with an even number of pages it is the average
  of the two middle pages, rounded to a whole word. `report.closer.elements[].median` is the plain median too.
- `snapshot_at` is the date of the search results the report is based on. Results change, so compare dates
  with `GET /v1/intent?q=<phrase>` before you compare two reports.
- `cache` shows what was reused before the work started: `miss` (new results), `serp` (recent results reused),
  `profile` (the whole analysis reused).
- `status: "failed"` comes with `error` and costs nothing; `status: "cancelled"` (a batch phrase cancelled before it
  started) costs nothing either.

### Instructions for an AI agent

`GET /v1/intent/{id}?format=md` returns a ready Markdown file for an AI agent that edits your page, in the report
language (in the panel: "Instructions for an AI agent (.md)" and "Copy for an AI agent"). It contains the context of
the check, rules for safe work (backups, a draft instead of the live page, no publishing without a person's approval,
before/after, no invented facts, changing the form of the page is a person's decision, no text added only for length),
what the search results show, numbered steps (form of the page, expectations the page does not meet yet, suggestions,
missing elements, reader questions), verification with a new Search Intent report and a report template for a person.
It is built from the saved report, with no extra charge. Without a compared page (levels without `url`) the agent first
agrees with you which page the plan is for.

## Price per phrase

Prices for Just Ask (pay as you go). Packages and top-ups are cheaper, see [Pricing](https://docs.askaniela.com/guide/pricing.md).

| `tier` | Nothing reused (`cache: miss`) | Search results reused (`serp`) | Ready analysis reused (`profile`) |
|---|---|---|---|
| `basic` | $0.0098 | $0.0030 | $0 |
| `premium` | $0.0750 | $0.0682 | $0.0652 |
| `compare` | $0.0850 | $0.0782 | $0.0752 |

- Reused results are results of the same phrase, market and device fetched in the last `max_age_days` (default 3),
  by anyone. A ready analysis is the intent analysis of those results in the same report language.
  `freshness: "fresh"` always pays the first column.
- Reuse lowers only the basic part. `premium` and `compare` always add their surcharge ($0.0652 and $0.0752), because
  the top pages (and your page) are read for every report.
- `premium` and `compare` prices are for 8 pages. We read every organic result the search returned and the pages
  cited by the AI Overview, so the price follows the number of pages read and page fetches are charged at provider cost plus 30%, see
  [Top pages](#top-pages-how-many-and-which-domains).
- Every new `POST /v1/intent` is a new order and is charged by this table, also when the same phrase was ordered a
  minute ago. Reading an existing report with `GET /v1/intent/{id}` is free. A `POST` repeated within 24 hours with
  the same `Idempotency-Key` and the same body returns the first answer without a new charge.
- The price is held from your balance when the request starts and settled when it ends. A phrase that fails
  is refunded. The final amount is in `price_usd`.
- Example: 1000 phrases on `basic` cost $9.80 with new results and $3.00 when all of them were checked in the last
  3 days. It can be lower when ready analyses of those results exist too.

## Your own search results and pages

Already have the data? `POST /v1/intent` (one phrase, not batches) takes it instead of fetching, and you do not pay
for our fetch:

- `serp`: your search results for the phrase. `results` (3 to 20, usually the top 10 organic results) with
  `position` (1-100), `url` (http or https), `title` (up to 300 characters), `description` (up to 1000) and an
  optional `type` (default `organic`); optional `people_also_ask` and `related_searches` (up to 20 each),
  `ai_overview` (up to 4000 characters), `item_types` (SERP features, e.g. `video`, `images`) and `checked_at`
  (the date you collected the results). Positions and URLs must be unique. Price of the basic part: $0.0075
  instead of $0.0098 (no search results fee). The report has `serp_source: client` and `snapshot_at` = your
  `checked_at` (empty without it): we do not vouch for how fresh your results are.
- `pages` (`premium` and `compare` only): documents of the top pages, 3 to 10, each with `url` and either `html`
  (up to 2,000,000 characters) or `text` (up to 100,000). We read them the same way as fetched pages; a page's
  position comes from the search results when its URL is there. At least 3 pages need readable text. The page
  fetch part ($0.0120) is deducted: `premium` $0.0630, with your `serp` as well $0.0607. The report has
  `pages_source: client`. `compare_url` (your own page) is still fetched by us.

Your data is used only for this report: it is not cached for other customers, and a request with your `serp`
never reuses our cached results. Wrong data returns `422` with the field and the reason.

```bash
curl -H "Authorization: Bearer $KEY" -H 'content-type: application/json' "https://api.askaniela.com/v1/intent?wait=30" -d '{
  "query": "best running shoes", "market": "en-US",
  "serp": {"checked_at": "2026-11-08", "results": [
    {"position": 1, "url": "https://www.runnersworld.com/gear/a19663621/best-running-shoes/", "title": "Best Running Shoes 2026"},
    {"position": 2, "url": "https://www.rei.com/learn/expert-advice/running-shoes.html", "title": "How to Choose Running Shoes"},
    {"position": 3, "url": "https://www.nike.com/w/running-shoes", "title": "Running Shoes. Nike.com"}]}}'
```

## Intent in a page check

A page check (`POST /v1/judge`, site audits) can take a target phrase. The report then compares the page with the
search intent of that phrase and adds two checks: how well the page meets the needs of people searching for the phrase,
and whether it serves a different goal or uses the wrong form for it.

```bash
curl https://api.askaniela.com/v1/judge \
  -H "Authorization: Bearer $ANIELA_KEY" -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/loan-calculator", "query": "loan installment calculator", "market": "en-US"}'
```

- Without `query` both checks are listed under **Not assessed**. In site audits use a CSV with `url,query,market`.
- `report.intent` has the dominant intent, the best form, the typical length, the page's length band and form
  gaps (elements most top pages have and this page lacks).
- The phrase is charged like `basic` above, once per phrase and market in a run.

## What we do not read

`premium` and `compare` read the text of the top pages. Some top results have no text to read, and we say so in the
report instead of guessing:

- **Videos and audio** (for example YouTube, Vimeo, TikTok, Spotify): we do not analyse their content, neither the
  video nor a transcript. Such a result counts only by its type and title in the search results.
- **Login pages, PDF files without text, pages that load only with JavaScript, pages with very little text** (for
  example a shop listing) and **pages we could not fetch**: no length, elements or expectations from them.

`report.closer.unreadable` lists these results by kind (`video`, `audio`, `login`, `pdf`, `js_only`, `little_text`,
`not_fetched`) with their count, domains and a `message`, for example: "Videos: 5 of 9 top results (youtube.com). We
do not analyse the content of videos or audio (neither the media nor a transcript). The intent assessment is based on
the types and titles of the search results and on 4 pages with text." When most top results are videos, the
recommended form reflects that from the search results; we draw no conclusions about what the videos say.

When fewer than 3 top pages have text (or fewer than the number of pages you chose), the report still has the search
intent part (intents, recommended form, result types and domains), the list of top pages with the reason for each, and
the warning `pages_unreadable`, but no length, elements or expectations. Then `unreadable.basis` is `results_only`:
Ani does not analyse even the 1-2 pages that had text, and the `message` says so, for example: "Videos: 7 of 9 top
results (youtube.com). We do not analyse the content of videos or audio (neither the media nor a transcript). 2 of 9
top results had text, fewer than the 3 needed to compare pages, so Ani did not analyse them. The intent assessment is
based only on the types and titles of the search results." `readable` is then only the number of pages that gave text.
Such a result is charged for the work done: the Basic price of the phrase (search results bought, reused or your own, as
for Basic) plus the attempted page fetches at cost × 1.3, never more than the amount reserved; nothing only when nothing
paid happened (results and pages reused from recent checks). In a Query Pack the Intent part then costs like Basic
without the search results, which the pack pays once. A failed phrase (`status: failed`) explains why in the Query Pack field `intent_failure`.

## Limits and errors

| Status | Code | When |
|---|---|---|
| 422 | `validation_error` | Missing or too long `query`, unknown market, `max_age_days` out of range |
| 422 | `invalid_tier` | Unknown `tier` |
| 422 | `tier_unavailable` | The level is switched off |
| 422 | `invalid_request` | `compare` without `compare_url`, `compare_url` with another level, `compare` in a batch |
| 422 | `invalid_url` | `compare_url` is not a public `http(s)` address |
| 422 | `invalid_csv` | The CSV file cannot be read or has no phrases |
| 413 | `payload_too_large` | More than 100 phrases |
| 403 | `insufficient_scope` | The key lacks `judge` (create) or `reports:read` (read) |
| 404 | `intent_not_found` | Unknown report id, or a report from another organization |
| 429 | `quota_exceeded` | Not enough balance, or a spending limit reached ([Billing](https://docs.askaniela.com/guide/billing.md)) |
| 503 | `serp_unavailable` | Search results are temporarily unavailable. Nothing was charged, retry later |
| 503 | `start_uncertain` | The request may have been accepted and its price stays reserved until it is settled. `Idempotency-Key` does not protect this answer: check `GET /v1/intent` (or `?batch_id=`) and send the order again only if it is not there, otherwise you may pay for a second analysis |

Use `Idempotency-Key` on `POST /v1/intent` and `POST /v1/intent/batch` for safe retries. All error codes:
[Errors](https://docs.askaniela.com/reference/errors.md).

The report reflects search results for the selected market on the date in `snapshot_at`. Rankings change over time.
