# Page context: title, headings and meta vs content

Source: https://docs.askaniela.com/guide/page-context/

`POST /v1/context` checks one page (a URL or your own text) and tells you how well its **title, H1, meta
description and every H2/H3** match what the page is really about. On top of that you can get page categories,
the page's fit to a site you audited, the page vector, and Ani's tips on how to fix weak elements.

Every `strength` is 0-100: a ranking of how close an element is to the page content. It is not a probability.
Elements marked `weak: true` drift from the content - these are the ones to fix.

## One page

```bash
curl -H "Authorization: Bearer $KEY" -H 'content-type: application/json' \
  -d '{"url": "https://example.com/sailing-course", "categories": ["iab"], "site": "example.com", "fix": true}' \
  https://api.askaniela.com/v1/context
```

Or send text (markdown: `# H1`, `## H2`, `### H3`) with optional `title` and `meta`:

```bash
curl -H "Authorization: Bearer $KEY" -H 'content-type: application/json' \
  -d '{"text": "# Sailing courses\n## Boat handling\n...", "title": "Sailing courses in Gdynia", "meta": "", "categories": []}' \
  https://api.askaniela.com/v1/context
```

```json
{"id": "ctx_oau7jbagcim63n6s", "url": "https://example.com/sailing-course", "status": "ok", "coherence": 81,
 "pairs": {"title_h1": 92, "h1_meta": 12, "meta_core": 4, "title_core": 88, "h1_core": 90},
 "facts": ["meta_short"],
 "elements": [
   {"element": "title", "text": "Sailing courses in Gdynia", "strength": 88, "weak": false, "template": false},
   {"element": "meta", "text": "Cheap car insurance quotes online", "strength": 4, "weak": true, "template": false},
   {"element": "h2", "text": "Contact us", "weak": false, "template": true}],
 "categories": {"iab": {"taxonomy": "iab", "primary": {"id": "483", "name": "Sports", "strength": 91}, "paths": []}},
 "site_fit": {"strength": 74, "audit_id": "aud_kikaf4hg6un5rylc", "pages": 120},
 "fix_status": "ok",
 "fixes": [{"element": "meta", "current": "Cheap car insurance quotes online",
            "why": "The description talks about insurance while the page sells sailing courses.",
            "do": "Describe the course: who it is for, where it runs and what you learn.",
            "example": "Sailing courses in Gdynia for beginners: boat handling, sail trim and safety on the water with [instructor name]."}],
 "charged_usd": 0.00656, "price_breakdown_usd": {"check": 0.001, "categories": 0.00006, "fetch": 0.0015, "fix": 0.004}}
```

## Fields

| Field | Meaning |
|---|---|
| `elements[]` | title, H1, meta description, H2 and H3 with `strength` 0-100 and `weak`. `template: true` = heading repeated across your audited site (needs `site`); it is not measured |
| `coherence` | how well the headings as a whole follow the content, 0-100 |
| `pairs` | element pairs: title-H1, H1-meta, meta-content, title-content, H1-content |
| `facts` | structure facts: `no_title`, `title_short`, `title_long`, `no_h1`, `multiple_h1`, `no_meta`, `meta_short`, `meta_long`, `h3_without_h2` |
| `categories` | `iab` / `google` categories, the same shape as [page labels](https://docs.askaniela.com/guide/labels.md); `"categories": []` turns them off |
| `site_fit` | with `site`: how close the page is to the main topics of that domain's latest site audit in your organisation, 0-100. `null` with `site_fit_reason`: `no_site`, `no_site_audit` (no audit with stored page vectors yet), `too_few_pages`, `other_profile` |
| `fixes` | with `fix: true`: for each weak element what is wrong, what to change and an example text. Ani writes the tips; we check that each tip refers to the real element text, others are dropped. `fix_status`: `ok`, `nothing_to_fix`, `failed` (not charged). `lang`: `en` or `pl` |
| `vector` | with `include_vector: true`: the page content embedding (`dims`, `profile`, `values`). Vectors from different profiles are not comparable |

Every check stores the page vector under its `id` (encrypted in private projects), so later checks such as site fit
can reuse it. Site audits store vectors of their pages too.

## Price

You pay per check, only for what succeeded. Free estimate: `POST /v1/context/estimate`.

| Part | Price |
|---|---|
| Check (coherence, vector, site fit) | 0.0010 USD |
| Categories | as [page labels](https://docs.askaniela.com/guide/labels.md): 0.03 USD per 1M document tokens per taxonomy (typical page 0.00006 USD) |
| Page fetch (URL) | 0.0015 USD |
| JavaScript rendering (`render_js: true`) | 0.0060 USD |
| Fix tips (`fix: true`, only when there is something to fix) | 0.0040 USD |

Typical URL with IAB categories: 0.0031 USD (3.10 USD per 1000); with fix tips 0.0071 USD. Text without
categories: 0.0010 USD. We hold the maximum before the check and return the unused part; each call is charged in
steps of 0.0001 USD, rounded up.

Scope: `context:write`. Limit: 60 requests per minute per key, 300 per organisation (429 `context_rate_limited`).
