# SEO & AI Search (totalum-sdk/seo)

> Research what ranks on Google and what AI assistants answer, for a country and language (ISO codes): Google results with "People also ask" and the AI Overview, AI Mode, Maps, what ChatGPT, Claude, Gemini and Perplexity answer and cite, keyword ideas with volume and difficulty, Google Trends, a domain's keywords, competitors, keyword gaps and backlinks, and an on-page analysis of any public page. Each research call is billed in credits (usage.credits) and counts in the plan's SEO calls per minute and per month; call it from a cron job or an owner's action and save the result, never on every page view. Plus IndexNow for verified custom domains (free).

`import … from 'totalum-sdk/seo'`, or the same namespace on `totalum` from `'totalum-sdk'`. Install, configuration and errors: [Totalum SDK](https://www.totalum.app/docs/sdk).

Research what ranks on Google and what AI assistants answer, for a country and language (ISO codes): Google
results with "People also ask" and the AI Overview, AI Mode, Maps, what ChatGPT, Claude, Gemini and Perplexity answer
and cite, keyword ideas with volume and difficulty, Google Trends, a domain's keywords, competitors, keyword gaps and
backlinks, and an on-page analysis of any public page. Each research call is billed in credits (`usage.credits`) and
counts in the plan's SEO calls per minute and per month; call it from a cron job or an owner's action and save the
result, never on every page view. Plus IndexNow for verified custom domains (free).

```ts
const { keywords } = await totalum.seo.keywords.ideas({ keywords: ['dentista barcelona'], country: 'es', language: 'es', limit: 20 });
const serp = await totalum.seo.serp.google({ keyword: keywords[0].keyword, country: 'es', language: 'es', city: 'Barcelona' });
await totalum.seo.notifyChanged(['https://www.acme.com/blog/launch']);
```

| Method or type | What it does |
|---|---|
| [`totalumSeo`](#totalumseo) | Creates the `seo` namespace (the same object as `totalum.seo`, scope `seo`): search and AI-answer research — Google results, AI Overviews and AI Mode, Maps, what ChatGPT, Claude, Gemini and Perplexity answer and cite, keyword ideas and volumes, competitors and keyword gaps, backlinks and on-page analysis — for a country and language (ISO codes, e.g. |
| [`seo.notifyChanged`](#seonotifychanged) | Tells the search engines that use IndexNow (Bing, Yandex, Seznam, Naver, …) that these pages of the project's custom domain were added or changed, so they are crawled again soon, and fetches each domain's `/sitemap.xml` so it is fresh. |
| [`seo.indexNowKey`](#seoindexnowkey) | The project's IndexNow key: the template serves it at `/<key>.txt` so search engines can check the submissions are yours. |
| [`seo.locations`](#seolocations) | The countries and languages the research methods accept, and for each country the languages keyword, domain and AI data exist in (search results take any listed language). |
| [`seo.serp.google`](#seoserpgoogle) | Google's results for a keyword as searched from a country (or one of its cities), in a language: the organic results, the featured snippet, "People also ask", related searches and the AI Overview with its sources. |
| [`seo.serp.aiMode`](#seoserpaimode) | Google's AI Mode answer for a question and the pages it cites, where Google offers AI Mode. |
| [`seo.serp.maps`](#seoserpmaps) | Google Maps results for a search (local businesses): name, category, address, phone, website, rating and reviews — the local competitors of a business. |
| [`seo.ai.answer`](#seoaianswer) | What an AI assistant (ChatGPT, Claude, Gemini or Perplexity) answers to a question, with the web searches it ran, the pages it cited and their domains — to see which brands and sites the AIs recommend (GEO). |
| [`seo.ai.chatgptSearch`](#seoaichatgptsearch) | ChatGPT's search answer for a query as shown to users in a country: the answer, the sources and search results it showed, and the brands it named. |
| [`seo.ai.mentions`](#seoaimentions) | Where a domain, or a keyword or brand, is mentioned in AI answers (Google's AI Overviews; ChatGPT for the United States in English): the questions and answers, or the most cited domains or pages. |
| [`seo.ai.keywordVolume`](#seoaikeywordvolume) | How often keywords are asked to AI assistants per month (AI search volume), per keyword. |
| [`seo.keywords.ideas`](#seokeywordsideas) | Keyword ideas around seed keywords (phrases containing the first seed first, then wider ideas), each with its monthly Google search volume, cost per click, competition, difficulty and intent — to choose what a page or an article targets. |
| [`seo.keywords.related`](#seokeywordsrelated) | The searches Google relates to a keyword ("related searches", followed `depth` hops), with the same data as `ideas` — topic clusters and article ideas. |
| [`seo.keywords.overview`](#seokeywordsoverview) | The search data of keywords you already have (up to 700): volume, cost per click, competition, difficulty, intent and the last 12 months. |
| [`seo.keywords.trends`](#seokeywordstrends) | Google Trends interest over time (0–100) for up to 5 keywords, worldwide or in a country — seasonality and which wording is rising. |
| [`seo.domain.keywords`](#seodomainkeywords) | The keywords a domain ranks for on Google in a country, with its position, the ranking URL and the estimated traffic — what a competitor gets its visits from. |
| [`seo.domain.competitors`](#seodomaincompetitors) | The domains that compete with a domain on Google in a country (most shared keywords first). |
| [`seo.domain.keywordGap`](#seodomainkeywordgap) | The keyword gap between a domain and a competitor: the keywords the competitor ranks for and the domain does not (`missing`), or that both rank for (`shared`). |
| [`seo.domain.backlinks`](#seodomainbacklinks) | A domain's backlink profile: authority rank, backlinks, referring domains, spam score and where its links come from. |
| [`seo.page.analyze`](#seopageanalyze) | Reads one public page as a search engine does: title, description, canonical, headings, word count, links, images, structured data, social tags, an on-page score with the issues found, and its main text by section — the structure of a page that ranks. |
| [`SeoAiAnswerInput`](#seoaianswerinput) | The question of `seo.ai.answer()`. |
| [`SeoAiAnswerOutput`](#seoaiansweroutput) | The assistant's answer. |
| [`SeoAiKeywordVolumeInput`](#seoaikeywordvolumeinput) | The keywords of `seo.ai.keywordVolume()`. |
| [`SeoAiKeywordVolumeOutput`](#seoaikeywordvolumeoutput) | AI search volume per keyword. |
| [`SeoAiMentionsInput`](#seoaimentionsinput) | The target of `seo.ai.mentions()`: exactly one of `domain` or `keyword`. |
| [`SeoAiMentionsOutput`](#seoaimentionsoutput) | Mentions in AI answers; the field present depends on `view`. |
| [`SeoBacklinksSummaryInput`](#seobacklinkssummaryinput) | The domain of `seo.domain.backlinks()`. |
| [`SeoBacklinksSummaryOutput`](#seobacklinkssummaryoutput) | A domain's backlink profile. |
| [`SeoChatGptSearchInput`](#seochatgptsearchinput) | The query of `seo.ai.chatgptSearch()`. |
| [`SeoChatGptSearchOutput`](#seochatgptsearchoutput) | ChatGPT's search answer. |
| [`SeoDomainCompetitorsInput`](#seodomaincompetitorsinput) | The domain of `seo.domain.competitors()`. |
| [`SeoDomainCompetitorsOutput`](#seodomaincompetitorsoutput) | A domain's search competitors. |
| [`SeoDomainKeywordsInput`](#seodomainkeywordsinput) | The domain of `seo.domain.keywords()`. |
| [`SeoDomainKeywordsOutput`](#seodomainkeywordsoutput) | The keywords a domain ranks for. |
| [`SeoIndexNowKey`](#seoindexnowkey-type) | The project's IndexNow key. |
| [`SeoKeyword`](#seokeyword) | One keyword's Google search data in the country and language asked. |
| [`SeoKeywordGapInput`](#seokeywordgapinput) | The two domains of `seo.domain.keywordGap()`. |
| [`SeoKeywordGapOutput`](#seokeywordgapoutput) | The keyword gap between two domains. |
| [`SeoKeywordIdeasInput`](#seokeywordideasinput) | The seeds of `seo.keywords.ideas()`. |
| [`SeoKeywordOverviewInput`](#seokeywordoverviewinput) | The keywords of `seo.keywords.overview()`. |
| [`SeoKeywordRelatedInput`](#seokeywordrelatedinput) | The keyword of `seo.keywords.related()`. |
| [`SeoKeywordsOutput`](#seokeywordsoutput) | Keywords with their search data. |
| [`SeoKeywordTrendsInput`](#seokeywordtrendsinput) | The keywords of `seo.keywords.trends()`. |
| [`SeoKeywordTrendsOutput`](#seokeywordtrendsoutput) | Google Trends interest over time. |
| [`SeoLocationsOutput`](#seolocationsoutput) | The places the research methods accept. |
| [`SeoNotifyOutput`](#seonotifyoutput) | The answer of `seo.notifyChanged()`. |
| [`SeoPageAnalyzeInput`](#seopageanalyzeinput) | The page of `seo.page.analyze()`. |
| [`SeoPageAnalyzeOutput`](#seopageanalyzeoutput) | One page as a search engine reads it. |
| [`SeoSerpAiModeInput`](#seoserpaimodeinput) | The question of `seo.serp.aiMode()`. |
| [`SeoSerpAiModeOutput`](#seoserpaimodeoutput) | Google AI Mode's answer. |
| [`SeoSerpGoogleInput`](#seoserpgoogleinput) | The search of `seo.serp.google()`. |
| [`SeoSerpGoogleOutput`](#seoserpgoogleoutput) | Google's results page for the keyword. |
| [`SeoSerpMapsInput`](#seoserpmapsinput) | The search of `seo.serp.maps()`. |
| [`SeoSerpMapsOutput`](#seoserpmapsoutput) | Google Maps places for the search. |
| [`SeoSource`](#seosource) | A page an answer cites or a result links to. |

## `totalumSeo`

```ts
totalumSeo(options?: TotalumClientOptions): TotalumSeo
```

Creates the `seo` namespace (the same object as `totalum.seo`, scope `seo`): search and AI-answer research —
Google results, AI Overviews and AI Mode, Maps, what ChatGPT, Claude, Gemini and Perplexity answer and cite,
keyword ideas and volumes, competitors and keyword gaps, backlinks and on-page analysis — for a country and
language (ISO codes, e.g. `es`/`es`), billed in credits (every result carries `usage.credits`); plus IndexNow for
verified custom domains, free. The plan limits the research calls per minute and per month.

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `options` | [`TotalumClientOptions`](https://www.totalum.app/docs/sdk/types#totalumclientoptions) | no | The project key, API URL and environment; each falls back to its environment variable. |
| `options.key` | `string` | no | Project key `tlm_pk_…`; default `TOTALUM_PROJECT_KEY`. Server-side only. |
| `options.apiUrl` | `string` | no | The Totalum API's URL: default `TOTALUM_SDK_API_URL`, else `https://sdk-api.totalum.app`. |
| `options.env` | `'dev' \| 'live'` | no | Sent as `x-totalum-env` on every call (the database it targets, and dev vs live usage); default `TOTALUM_ENV`, else `live`. |

**Returns** [`TotalumSeo`](#totalumseo) — The `seo` namespace: the methods below.

**Example**

```ts
import { totalumSeo } from 'totalum-sdk/seo';

const seo = totalumSeo();
const { keywords } = await seo.keywords.ideas({ keywords: ['dentista'], country: 'es', language: 'es' });
```

The namespace's type is exported as `TotalumSeo` (`import type { TotalumSeo } from 'totalum-sdk/seo'`).

## `seo.notifyChanged`

```ts
seo.notifyChanged(urls: string[]): Promise<SeoNotifyOutput>
```

Tells the search engines that use IndexNow (Bing, Yandex, Seznam, Naver, …) that these pages of the project's
custom domain were added or changed, so they are crawled again soon, and fetches each domain's `/sitemap.xml` so
it is fresh. Call it after publishing a post or editing a product page. Only verified custom domains are sent:
for Totalum's own hosts the answer is `indexNow: 'skipped_no_custom_domain'`. Free.

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `urls` | `string[]` | yes | Full URLs on the project's hostnames. |

**Returns** `Promise<SeoNotifyOutput>` — How many URLs were accepted and what was sent.

| Field | Type | Always present | Description |
|---|---|---|---|
| `accepted` | `number` | yes | How many URLs were sent to IndexNow. |
| `indexNow` | `'error' \| 'sent' \| 'skipped_no_custom_domain'` | yes | `sent`; `skipped_no_custom_domain` when the project has no verified custom domain (Totalum's own hosts are never sent); `error` when IndexNow refused them. |
| `sitemapsPinged` | `boolean` | yes | Whether each domain's `/sitemap.xml` answered. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `URL_NOT_PROJECT_HOST` | 400 | A URL is not on one of the project's hostnames; `details.url`. |
| `INDEXNOW_ERROR` | 502 | IndexNow refused the submission. |
| `ENGINE_UNAVAILABLE` | 502 | SEO is unavailable; retry shortly. |

**Example**

```ts
const out = await totalum.seo.notifyChanged(['https://www.acme.com/blog/launch', 'https://www.acme.com/pricing']);
```

Result:

```json
{ "accepted": 2, "indexNow": "sent", "sitemapsPinged": true }
```

## `seo.indexNowKey`

```ts
seo.indexNowKey(): Promise<SeoIndexNowKey>
```

The project's IndexNow key: the template serves it at `/<key>.txt` so search engines can check the submissions
are yours. Free.

**Returns** `Promise<SeoIndexNowKey>` — The key and the URL it is served at.

| Field | Type | Always present | Description |
|---|---|---|---|
| `key` | `string` | yes | The key. |
| `keyLocation` | `string` | yes | The URL where the site serves it (`https://<host>/<key>.txt`). |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `ENGINE_UNAVAILABLE` | 502 | SEO is unavailable; retry shortly. |

**Example**

```ts
const { key, keyLocation } = await totalum.seo.indexNowKey();
```

Result:

```json
{ "key": "99d8cc52…", "keyLocation": "https://acme.totalum.app/99d8cc52….txt" }
```

## `seo.locations`

```ts
seo.locations(): Promise<SeoLocationsOutput>
```

The countries and languages the research methods accept, and for each country the languages keyword, domain
and AI data exist in (search results take any listed language). Free.

**Returns** `Promise<SeoLocationsOutput>` — Every country and language code.

| Field | Type | Always present | Description |
|---|---|---|---|
| `countries` | `({ country, name, dataLanguages })[]` | yes | Every country. |
| `countries.country` | `string` | yes | Its ISO 3166-1 alpha-2 code. |
| `countries.name` | `string` | yes | Its English name. |
| `countries.dataLanguages` | `string[]` | yes | The languages keyword, domain and AI data exist in there; search results take any language. |
| `languages` | `({ language, name })[]` | yes | Every language. |
| `languages.language` | `string` | yes | Its code. |
| `languages.name` | `string` | yes | Its English name. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `FORBIDDEN_SCOPE` | 403 | The key lacks the `seo` scope. |

**Example**

```ts
const { countries } = await totalum.seo.locations();
```

Result:

```ts
{ "countries": [{ "country": "es", "name": "Spain", "dataLanguages": ["es"] }, …], "languages": [{ "language": "ca", "name": "Catalan" }, …] }
```

## `seo.serp.google`

```ts
seo.serp.google(input: { country, city?, language, keyword, depth?, device? }): Promise<{ keyword, totalResults, organic, featuredSnippet, peopleAlsoAsk, relatedSearches, aiOverview, usage }>
```

Google's results for a keyword as searched from a country (or one of its cities), in a language: the organic
results, the featured snippet, "People also ask", related searches and the AI Overview with its sources. Use
it to see what ranks and what the page that ranks must answer.

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `input` | `{ country, city?, language, keyword, depth?, device? }` | yes | The keyword, where it is searched from and how many results. |
| `input.country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `input.city` | `string` | no | A city of `country` (`Barcelona`): the results as seen there. Allowed: at least 2 characters, at most 80 characters. |
| `input.language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `input.keyword` | `string` | yes | What is searched, as a user types it. Allowed: at least 1 character, at most 700 characters. |
| `input.depth` | `number` | no | How many results to read, 10 to 100. Allowed: ≥ 10, ≤ 100, default `10`. |
| `input.device` | `'mobile' \| 'desktop'` | no | `desktop` or `mobile` results. Allowed: default `"desktop"`. |

**Returns** `Promise<{ keyword, totalResults, organic, featuredSnippet, peopleAlsoAsk, relatedSearches, aiOverview, usage }>` — The results page and the credits it cost.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keyword` | `string` | yes | The keyword searched. |
| `totalResults` | `number \| null` | yes | How many results Google reports. |
| `organic` | `({ position, title, url, domain, snippet, breadcrumb })[]` | yes | The organic results, in rank order. |
| `organic.position` | `number` | yes | The rank among organic results, from 1. |
| `organic.title` | `string \| null` | yes | The result's title. |
| `organic.url` | `string` | yes | The ranking page's URL. |
| `organic.domain` | `string \| null` | yes | The ranking page's host. |
| `organic.snippet` | `string \| null` | yes | The text Google shows under the title. |
| `organic.breadcrumb` | `string \| null` | yes | The path Google shows above the title. |
| `featuredSnippet` | `{ title, snippet, url, domain } \| null` | yes | The answer box at the top, when Google shows one. |
| `featuredSnippet.title` | `string \| null` | yes | Its title. |
| `featuredSnippet.snippet` | `string \| null` | yes | Its text. |
| `featuredSnippet.url` | `string` | yes | The page it quotes. |
| `featuredSnippet.domain` | `string \| null` | yes | That page's host. |
| `peopleAlsoAsk` | `({ question, answer })[]` | yes | The "People also ask" questions. |
| `peopleAlsoAsk.question` | `string` | yes | The question. |
| `peopleAlsoAsk.answer` | `{ title, url, domain, snippet } \| null` | yes | The page Google answers it from, when shown. |
| `peopleAlsoAsk.answer.title` | `string \| null` | yes | The page's title. |
| `peopleAlsoAsk.answer.url` | `string` | yes | The page's URL. |
| `peopleAlsoAsk.answer.domain` | `string \| null` | yes | The page's host. |
| `peopleAlsoAsk.answer.snippet` | `string \| null` | yes | The answer text. |
| `relatedSearches` | `string[]` | yes | The related searches at the bottom of the page. |
| `aiOverview` | `{ text, sources } \| null` | yes | Google's AI Overview, when it shows one. |
| `aiOverview.text` | `string` | yes | The overview, as Markdown. |
| `aiOverview.sources` | [`SeoSource[]`](#seosource) | yes | The pages it cites. |
| `usage` | `{ credits }` | yes | What the call cost. |
| `usage.credits` | `number` | yes | Credits charged for this call. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `SEO_CITY_NOT_FOUND` | 400 | No such city in `country`. |
| `NOT_AVAILABLE_IN_COUNTRY` | 400 | No data for that country and language. |
| `RATE_LIMIT_EXCEEDED` | 429 | The plan's SEO calls per minute or per month are used up; `details.period`. |
| `PROVIDER_TIMEOUT` | 504 | The search took too long; retry. |
| `PROVIDER_UNAVAILABLE` | 503 | Search data is unavailable; retry later. |

**Example**

```ts
const page = await totalum.seo.serp.google({ keyword: 'dentista barcelona', country: 'es', language: 'es', city: 'Barcelona' });
```

Result:

```json
{
  "keyword": "dentista barcelona",
  "totalResults": 3150000,
  "organic": [{ "position": 1, "title": "Clínica Dental …", "url": "https://www.example.es/", "domain": "www.example.es", "snippet": "…", "breadcrumb": "https://www.example.es" }],
  "featuredSnippet": null,
  "peopleAlsoAsk": [{ "question": "¿Cuánto cuesta un empaste en Barcelona?", "answer": null }],
  "relatedSearches": ["dentista barcelona urgencias"],
  "aiOverview": null,
  "usage": { "credits": 0.1429 }
}
```

## `seo.serp.aiMode`

```ts
seo.serp.aiMode(input: { country, language, keyword, device? }): Promise<{ sources, keyword, answer, usage }>
```

Google's AI Mode answer for a question and the pages it cites, where Google offers AI Mode.

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `input` | `{ country, language, keyword, device? }` | yes | The question and where it is asked from. |
| `input.country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `input.language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `input.keyword` | `string` | yes | The question, as a user asks it. Allowed: at least 1 character, at most 700 characters. |
| `input.device` | `'mobile' \| 'desktop'` | no | `desktop` or `mobile`. Allowed: default `"desktop"`. |

**Returns** `Promise<{ sources, keyword, answer, usage }>` — The answer, its sources and the credits it cost.

| Field | Type | Always present | Description |
|---|---|---|---|
| `sources` | [`SeoSource[]`](#seosource) | yes | The pages it cites. |
| `keyword` | `string` | yes | The question asked. |
| `answer` | `string` | yes | The answer, as Markdown. |
| `usage` | `{ credits }` | yes | What the call cost. |
| `usage.credits` | `number` | yes | Credits charged for this call. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `NOT_AVAILABLE_IN_COUNTRY` | 400 | Google does not offer AI Mode there, or no data for that country and language. |
| `RATE_LIMIT_EXCEEDED` | 429 | The plan's SEO calls per minute or per month are used up; `details.period`. |
| `PROVIDER_TIMEOUT` | 504 | The search took too long; retry. |
| `PROVIDER_UNAVAILABLE` | 503 | Search data is unavailable; retry later. |

**Example**

```ts
const ai = await totalum.seo.serp.aiMode({ keyword: 'best budgeting apps', country: 'us', language: 'en' });
```

Result:

```json
{ "keyword": "best budgeting apps", "answer": "Popular choices include …", "sources": [{ "title": "…", "url": "https://…", "domain": "…" }], "usage": { "credits": 0.2858 } }
```

## `seo.serp.maps`

```ts
seo.serp.maps(input: { country, city?, language, keyword, depth? }): Promise<{ keyword, results, usage }>
```

Google Maps results for a search (local businesses): name, category, address, phone, website, rating and
reviews — the local competitors of a business.

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `input` | `{ country, city?, language, keyword, depth? }` | yes | The search, where it is made from and how many results. |
| `input.country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `input.city` | `string` | no | A city of `country`: the places as seen there. Allowed: at least 2 characters, at most 80 characters. |
| `input.language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `input.keyword` | `string` | yes | What is searched on Maps (`dentista`, `pizzeria`). Allowed: at least 1 character, at most 700 characters. |
| `input.depth` | `number` | no | How many places to read, 1 to 100. Allowed: ≥ 1, ≤ 100, default `20`. |

**Returns** `Promise<{ keyword, results, usage }>` — The places, best first, and the credits it cost.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keyword` | `string` | yes | The search. |
| `results` | `({ position, title, category, address, city, phone, website, rating, reviews, priceLevel, latitude, longitude, placeId, claimed })[]` | yes | The places, in rank order. |
| `results.position` | `number` | yes | The rank, from 1. |
| `results.title` | `string` | yes | The place's name. |
| `results.category` | `string \| null` | yes | Its main category. |
| `results.address` | `string \| null` | yes | Its address. |
| `results.city` | `string \| null` | yes | Its city. |
| `results.phone` | `string \| null` | yes | Its phone number. |
| `results.website` | `string \| null` | yes | Its website. |
| `results.rating` | `number \| null` | yes | Its average rating, 1–5. |
| `results.reviews` | `number \| null` | yes | How many reviews it has. |
| `results.priceLevel` | `string \| null` | yes | Its price level, when shown. |
| `results.latitude` | `number \| null` | yes | Latitude. |
| `results.longitude` | `number \| null` | yes | Longitude. |
| `results.placeId` | `string \| null` | yes | Google's place id. |
| `results.claimed` | `boolean \| null` | yes | Whether the owner claimed the listing. |
| `usage` | `{ credits }` | yes | What the call cost. |
| `usage.credits` | `number` | yes | Credits charged for this call. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `SEO_CITY_NOT_FOUND` | 400 | No such city in `country`. |
| `NOT_AVAILABLE_IN_COUNTRY` | 400 | No data for that country and language. |
| `RATE_LIMIT_EXCEEDED` | 429 | The plan's SEO calls per minute or per month are used up; `details.period`. |
| `PROVIDER_TIMEOUT` | 504 | The search took too long; retry. |
| `PROVIDER_UNAVAILABLE` | 503 | Search data is unavailable; retry later. |

**Example**

```ts
const { results } = await totalum.seo.serp.maps({ keyword: 'dentista', country: 'es', language: 'es', city: 'Barcelona', depth: 10 });
```

Result:

```ts
{ "keyword": "dentista", "results": [{ "position": 1, "title": "Clínica Dental …", "category": "Dentista", "rating": 4.9, "reviews": 812, … }], "usage": { "credits": 0.1429 } }
```

## `seo.ai.answer`

```ts
seo.ai.answer(input: { country?, prompt, model?, platform?, webSearch? }): Promise<{ sources, model, platform, answer, citedDomains, searchQueries, usage }>
```

What an AI assistant (ChatGPT, Claude, Gemini or Perplexity) answers to a question, with the web searches it
ran, the pages it cited and their domains — to see which brands and sites the AIs recommend (GEO). Among the
dearer research calls: ask a few real questions, not dozens.

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `input` | `{ country?, prompt, model?, platform?, webSearch? }` | yes | The question, the assistant and the country its web search runs from. |
| `input.country` | `string` | no | The country its web search runs from (ISO 3166-1 alpha-2). |
| `input.prompt` | `string` | yes | The question, as a user asks the assistant. Allowed: at least 1 character, at most 500 characters. |
| `input.model` | `string` | no | A model id of that assistant; omitted = a current fast model. |
| `input.platform` | `'claude' \| 'chatgpt' \| 'gemini' \| 'perplexity'` | no | The assistant: `chatgpt`, `claude`, `gemini` or `perplexity`. Allowed: default `"chatgpt"`. |
| `input.webSearch` | `boolean` | no | Whether the assistant may search the web (as it does for users); `true` by default. Allowed: default `true`. |

**Returns** `Promise<{ sources, model, platform, answer, citedDomains, searchQueries, usage }>` — The answer, its sources and the credits it cost.

| Field | Type | Always present | Description |
|---|---|---|---|
| `sources` | [`SeoSource[]`](#seosource) | yes | The pages it cited. |
| `model` | `string` | yes | The model that answered. |
| `platform` | `'claude' \| 'chatgpt' \| 'gemini' \| 'perplexity'` | yes | The assistant asked. |
| `answer` | `string` | yes | The answer, as Markdown. |
| `citedDomains` | `string[]` | yes | The domains of those pages. |
| `searchQueries` | `string[]` | yes | The web searches the assistant ran. |
| `usage` | `{ credits }` | yes | What the call cost. |
| `usage.credits` | `number` | yes | Credits charged for this call. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `SEO_REQUEST_REJECTED` | 400 | The question or model was refused; `details.field`. |
| `RATE_LIMIT_EXCEEDED` | 429 | The plan's SEO calls per minute or per month are used up; `details.period`. |
| `PROVIDER_TIMEOUT` | 504 | The answer took too long; retry. |
| `PROVIDER_UNAVAILABLE` | 503 | The AI data is unavailable; retry later. |

**Example**

```ts
const a = await totalum.seo.ai.answer({ prompt: 'Mejor clínica dental en Barcelona', platform: 'chatgpt', country: 'es' });
```

Result:

```json
{ "platform": "chatgpt", "model": "…", "answer": "Algunas de las clínicas mejor valoradas …", "sources": [{ "title": "…", "url": "https://…", "domain": "…" }], "citedDomains": ["www.doctoralia.es"], "searchQueries": ["mejor clínica dental barcelona"], "usage": { "credits": 2.1883 } }
```

## `seo.ai.chatgptSearch`

```ts
seo.ai.chatgptSearch(input: SeoChatGptSearchInput): Promise<{ sources, keyword, answer, searchQueries, searchResults, brands, usage }>
```

ChatGPT's search answer for a query as shown to users in a country: the answer, the sources and search results
it showed, and the brands it named.

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `input` | [`SeoChatGptSearchInput`](#seochatgptsearchinput) | yes | The query and the country and language. |
| `input.country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `input.language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `input.keyword` | `string` | yes | The query, as a user types it in ChatGPT. Allowed: at least 1 character, at most 2000 characters. |

**Returns** `Promise<{ sources, keyword, answer, searchQueries, searchResults, brands, usage }>` — The answer, its sources, brands and the credits it cost.

| Field | Type | Always present | Description |
|---|---|---|---|
| `sources` | `({ title, url, domain, snippet, publishedAt })[]` | yes | The pages it cites. |
| `sources.title` | `string \| null` | yes | The page's title. |
| `sources.url` | `string` | yes | The page's URL. |
| `sources.domain` | `string \| null` | yes | The page's host. |
| `sources.snippet` | `string \| null` | yes | The text it quotes, when given. |
| `sources.publishedAt` | `string \| null` | yes | The page's date, when known. |
| `keyword` | `string` | yes | The query. |
| `answer` | `string` | yes | The answer, as Markdown. |
| `searchQueries` | `string[]` | yes | The searches it ran. |
| `searchResults` | [`SeoSource[]`](#seosource) | yes | The search results it showed. |
| `brands` | `({ name, category })[]` | yes | The brands and products it named. |
| `brands.name` | `string` | yes | The brand or product named. |
| `brands.category` | `string \| null` | yes | What it is, when known. |
| `usage` | `{ credits }` | yes | What the call cost. |
| `usage.credits` | `number` | yes | Credits charged for this call. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `NOT_AVAILABLE_IN_COUNTRY` | 400 | No data for that country and language. |
| `RATE_LIMIT_EXCEEDED` | 429 | The plan's SEO calls per minute or per month are used up; `details.period`. |
| `PROVIDER_TIMEOUT` | 504 | The answer took too long; retry. |
| `PROVIDER_UNAVAILABLE` | 503 | The AI data is unavailable; retry later. |

**Example**

```ts
const s = await totalum.seo.ai.chatgptSearch({ keyword: 'best budgeting app', country: 'us', language: 'en' });
```

Result:

```json
{ "keyword": "best budgeting app", "answer": "…", "sources": [], "searchResults": [], "brands": [{ "name": "YNAB", "category": "Software" }], "searchQueries": ["best budgeting app 2026"], "usage": { "credits": 0.2858 } }
```

## `seo.ai.mentions`

```ts
seo.ai.mentions(input: { country, language, domain?, keyword?, platform?, limit?, view? }): Promise<{ pages?, mentions?, totalCount, domains?, usage }>
```

Where a domain, or a keyword or brand, is mentioned in AI answers (Google's AI Overviews; ChatGPT for the
United States in English): the questions and answers, or the most cited domains or pages. Give exactly one
of `domain` or `keyword`. The dearest research call: use it once per brand, not per page.

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `input` | `{ country, language, domain?, keyword?, platform?, limit?, view? }` | yes | The domain or keyword, the place, the AI and the view. |
| `input.country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `input.language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `input.domain` | `string` | no | Mentions of this domain (cited by AI answers). Allowed: at most 253 characters. |
| `input.keyword` | `string` | no | Or mentions of this keyword or brand name in AI questions and answers. Allowed: at least 1 character, at most 250 characters. |
| `input.platform` | `'chatgpt' \| 'google'` | no | `google` (AI Overviews) or `chatgpt` (United States, English only); omitted = both. |
| `input.limit` | `number` | no | At most this many rows. Allowed: ≥ 1, ≤ 100, default `20`. |
| `input.view` | `'mentions' \| 'top-domains' \| 'top-pages'` | no | `mentions` (the questions and answers), `top-domains` or `top-pages` (the most cited). Allowed: default `"mentions"`. |

**Returns** `Promise<{ pages?, mentions?, totalCount, domains?, usage }>` — The mentions (or top domains or pages) and the credits it cost.

| Field | Type | Always present | Description |
|---|---|---|---|
| `pages` | `({ mentions, aiSearchVolume, url })[]` | no | The most cited pages (`view: top-pages`). |
| `pages.mentions` | `number` | yes | How many answers cite it. |
| `pages.aiSearchVolume` | `number \| null` | yes | The monthly AI search volume of those answers. |
| `pages.url` | `string` | yes | The page. |
| `mentions` | `({ platform, question, answer, sources, brands, aiSearchVolume })[]` | no | The questions and answers (`view: mentions`). |
| `mentions.platform` | `'chatgpt' \| 'google'` | yes | `google` (AI Overview) or `chatgpt`. |
| `mentions.question` | `string` | yes | The question asked. |
| `mentions.answer` | `string` | yes | The AI answer. |
| `mentions.sources` | [`SeoSource[]`](#seosource) | yes | The pages it cites. |
| `mentions.brands` | `({ name, category })[]` | yes | The brands it names. |
| `mentions.brands.name` | `string` | yes | The brand or product named. |
| `mentions.brands.category` | `string \| null` | yes | What it is, when known. |
| `mentions.aiSearchVolume` | `number \| null` | yes | How often the question is asked per month. |
| `totalCount` | `number` | yes | How many mentions exist in all. |
| `domains` | `({ mentions, aiSearchVolume, domain })[]` | no | The most cited domains (`view: top-domains`). |
| `domains.mentions` | `number` | yes | How many answers cite it. |
| `domains.aiSearchVolume` | `number \| null` | yes | The monthly AI search volume of those answers. |
| `domains.domain` | `string` | yes | The domain. |
| `usage` | `{ credits }` | yes | What the call cost. |
| `usage.credits` | `number` | yes | Credits charged for this call. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `VALIDATION_ERROR` | 400 | Neither or both of `domain` and `keyword`. |
| `NOT_AVAILABLE_IN_COUNTRY` | 400 | No data for that country and language. |
| `RATE_LIMIT_EXCEEDED` | 429 | The plan's SEO calls per minute or per month are used up; `details.period`. |
| `PROVIDER_UNAVAILABLE` | 503 | The AI data is unavailable; retry later. |

**Example**

```ts
const m = await totalum.seo.ai.mentions({ keyword: 'budgeting app', country: 'us', language: 'en', view: 'top-domains', limit: 5 });
```

Result:

```json
{ "totalCount": 1814, "domains": [{ "domain": "www.nerdwallet.com", "mentions": 416, "aiSearchVolume": 316550 }], "usage": { "credits": 7.5 } }
```

## `seo.ai.keywordVolume`

```ts
seo.ai.keywordVolume(input: SeoAiKeywordVolumeInput): Promise<{ keywords, usage }>
```

How often keywords are asked to AI assistants per month (AI search volume), per keyword.

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `input` | [`SeoAiKeywordVolumeInput`](#seoaikeywordvolumeinput) | yes | Up to 1,000 keywords and the place. |
| `input.country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `input.language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `input.keywords` | `string[]` | yes | Up to 1,000 keywords. Allowed: at least 1 item, at most 1000 items. |

**Returns** `Promise<{ keywords, usage }>` — The AI search volume per keyword and the credits it cost.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keywords` | `({ keyword, aiSearchVolume, monthlySearches })[]` | yes | One row per keyword. |
| `keywords.keyword` | `string` | yes | The keyword. |
| `keywords.aiSearchVolume` | `number \| null` | yes | How often it is asked to AI assistants per month. |
| `keywords.monthlySearches` | `({ year, month, aiSearchVolume })[]` | yes | The last 12 months, newest first. |
| `keywords.monthlySearches.year` | `number` | yes | The year. |
| `keywords.monthlySearches.month` | `number` | yes | The month, 1–12. |
| `keywords.monthlySearches.aiSearchVolume` | `number \| null` | yes | AI searches that month. |
| `usage` | `{ credits }` | yes | What the call cost. |
| `usage.credits` | `number` | yes | Credits charged for this call. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `NOT_AVAILABLE_IN_COUNTRY` | 400 | No data for that country and language. |
| `RATE_LIMIT_EXCEEDED` | 429 | The plan's SEO calls per minute or per month are used up; `details.period`. |
| `PROVIDER_UNAVAILABLE` | 503 | The AI data is unavailable; retry later. |

**Example**

```ts
const v = await totalum.seo.ai.keywordVolume({ keywords: ['budget planner'], country: 'us', language: 'en' });
```

Result:

```json
{ "keywords": [{ "keyword": "budget planner", "aiSearchVolume": 3241, "monthlySearches": [{ "year": 2026, "month": 10, "aiSearchVolume": 3241 }] }], "usage": { "credits": 0.7215 } }
```

## `seo.keywords.ideas`

```ts
seo.keywords.ideas(input: { country, language, keywords, limit? }): Promise<{ keywords, usage }>
```

Keyword ideas around seed keywords (phrases containing the first seed first, then wider ideas), each with its
monthly Google search volume, cost per click, competition, difficulty and intent — to choose what a page or an
article targets.

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `input` | `{ country, language, keywords, limit? }` | yes | Up to 20 seed keywords, the place and how many ideas. |
| `input.country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `input.language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `input.keywords` | `string[]` | yes | Up to 20 seed keywords; ideas containing the first one come first. Allowed: at least 1 item, at most 20 items. |
| `input.limit` | `number` | no | At most this many ideas. Allowed: ≥ 1, ≤ 100, default `50`. |

**Returns** `Promise<{ keywords, usage }>` — The ideas and the credits it cost.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keywords` | [`SeoKeyword[]`](#seokeyword) | yes | The keywords, most relevant first. |
| `usage` | `{ credits }` | yes | What the call cost. |
| `usage.credits` | `number` | yes | Credits charged for this call. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `NOT_AVAILABLE_IN_COUNTRY` | 400 | No keyword data for that country and language. |
| `RATE_LIMIT_EXCEEDED` | 429 | The plan's SEO calls per minute or per month are used up; `details.period`. |
| `PROVIDER_UNAVAILABLE` | 503 | Keyword data is unavailable; retry later. |

**Example**

```ts
const { keywords } = await totalum.seo.keywords.ideas({ keywords: ['dentista barcelona'], country: 'es', language: 'es', limit: 20 });
```

Result:

```json
{ "keywords": [{ "keyword": "dentista barcelona", "searchVolume": 4400, "cpc": 2.1, "competition": 0.4, "competitionLevel": "medium", "difficulty": 31, "intent": "commercial", "trend": { "monthly": 0, "quarterly": 22, "yearly": -18 }, "monthlySearches": [{ "year": 2026, "month": 10, "searchVolume": 4400 }] }], "usage": { "credits": 2.0572 } }
```

## `seo.keywords.related`

```ts
seo.keywords.related(input: { country, language, keyword, limit?, depth? }): Promise<{ keywords, usage }>
```

The searches Google relates to a keyword ("related searches", followed `depth` hops), with the same data as
`ideas` — topic clusters and article ideas.

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `input` | `{ country, language, keyword, limit?, depth? }` | yes | The keyword, the place, the depth and how many. |
| `input.country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `input.language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `input.keyword` | `string` | yes | The keyword. Allowed: at least 1 character, at most 80 characters. |
| `input.limit` | `number` | no | At most this many keywords. Allowed: ≥ 1, ≤ 100, default `50`. |
| `input.depth` | `number` | no | How many hops of related searches to follow, 1 to 3. Allowed: ≥ 1, ≤ 3, default `1`. |

**Returns** `Promise<{ keywords, usage }>` — The related keywords and the credits it cost.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keywords` | [`SeoKeyword[]`](#seokeyword) | yes | The keywords, most relevant first. |
| `usage` | `{ credits }` | yes | What the call cost. |
| `usage.credits` | `number` | yes | Credits charged for this call. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `NOT_AVAILABLE_IN_COUNTRY` | 400 | No keyword data for that country and language. |
| `RATE_LIMIT_EXCEEDED` | 429 | The plan's SEO calls per minute or per month are used up; `details.period`. |
| `PROVIDER_UNAVAILABLE` | 503 | Keyword data is unavailable; retry later. |

**Example**

```ts
const { keywords } = await totalum.seo.keywords.related({ keyword: 'emergency fund', country: 'us', language: 'en', limit: 20 });
```

Result:

```ts
{ "keywords": [{ "keyword": "how much emergency fund", "searchVolume": 2900, "difficulty": 22, "intent": "informational", … }], "usage": { "credits": 0.9343 } }
```

## `seo.keywords.overview`

```ts
seo.keywords.overview(input: SeoKeywordOverviewInput): Promise<{ keywords, usage }>
```

The search data of keywords you already have (up to 700): volume, cost per click, competition, difficulty,
intent and the last 12 months.

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `input` | [`SeoKeywordOverviewInput`](#seokeywordoverviewinput) | yes | The keywords and the place. |
| `input.country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `input.language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `input.keywords` | `string[]` | yes | Up to 700 keywords. Allowed: at least 1 item, at most 700 items. |

**Returns** `Promise<{ keywords, usage }>` — One row per keyword found and the credits it cost.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keywords` | [`SeoKeyword[]`](#seokeyword) | yes | The keywords, most relevant first. |
| `usage` | `{ credits }` | yes | What the call cost. |
| `usage.credits` | `number` | yes | Credits charged for this call. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `NOT_AVAILABLE_IN_COUNTRY` | 400 | No keyword data for that country and language. |
| `RATE_LIMIT_EXCEEDED` | 429 | The plan's SEO calls per minute or per month are used up; `details.period`. |
| `PROVIDER_UNAVAILABLE` | 503 | Keyword data is unavailable; retry later. |

**Example**

```ts
const { keywords } = await totalum.seo.keywords.overview({ keywords: ['implantes dentales barcelona', 'ortodoncia invisible barcelona'], country: 'es', language: 'es' });
```

Result:

```ts
{ "keywords": [{ "keyword": "implantes dentales barcelona", "searchVolume": 1900, "difficulty": 28, … }], "usage": { "credits": 0.8743 } }
```

## `seo.keywords.trends`

```ts
seo.keywords.trends(input: { country?, language?, keywords, timeRange? }): Promise<{ keywords, timeline, usage }>
```

Google Trends interest over time (0–100) for up to 5 keywords, worldwide or in a country — seasonality and
which wording is rising.

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `input` | `{ country?, language?, keywords, timeRange? }` | yes | The keywords, the place (optional) and the period. |
| `input.country` | `string` | no | The country (ISO 3166-1 alpha-2); omitted = worldwide. |
| `input.language` | `string` | no | The language; omitted = all. |
| `input.keywords` | `string[]` | yes | Up to 5 keywords, compared on one scale. Allowed: at least 1 item, at most 5 items. |
| `input.timeRange` | `'past_7_days' \| 'past_30_days' \| 'past_90_days' \| 'past_12_months' \| 'past_5_years'` | no | The period: `past_7_days`, `past_30_days`, `past_90_days`, `past_12_months` or `past_5_years`. Allowed: default `"past_12_months"`. |

**Returns** `Promise<{ keywords, timeline, usage }>` — The timeline and the credits it cost.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keywords` | `string[]` | yes | The keywords, in the order of `values`. |
| `timeline` | `({ from, to, values })[]` | yes | One row per period, oldest first. |
| `timeline.from` | `string` | yes | The first day of the period. |
| `timeline.to` | `string` | yes | The last day. |
| `timeline.values` | `(number \| null)[]` | yes | Each keyword's interest, 0–100 (100 = the peak of the chart). |
| `usage` | `{ credits }` | yes | What the call cost. |
| `usage.credits` | `number` | yes | Credits charged for this call. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `RATE_LIMIT_EXCEEDED` | 429 | The plan's SEO calls per minute or per month are used up; `details.period`. |
| `PROVIDER_UNAVAILABLE` | 503 | Trends data is unavailable; retry later. |

**Example**

```ts
const t = await totalum.seo.keywords.trends({ keywords: ['budget app', 'expense tracker'], country: 'us' });
```

Result:

```json
{ "keywords": ["budget app", "expense tracker"], "timeline": [{ "from": "2025-11-23", "to": "2025-11-29", "values": [71, 40] }], "usage": { "credits": 0.7858 } }
```

## `seo.domain.keywords`

```ts
seo.domain.keywords(input: { country, language, domain, limit? }): Promise<{ domain, keywords, totalCount, usage }>
```

The keywords a domain ranks for on Google in a country, with its position, the ranking URL and the estimated
traffic — what a competitor gets its visits from.

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `input` | `{ country, language, domain, limit? }` | yes | The domain, the place and how many keywords. |
| `input.country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `input.language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `input.domain` | `string` | yes | A bare domain (`example.com`); a URL is cut to its host. Allowed: at most 253 characters. |
| `input.limit` | `number` | no | At most this many keywords. Allowed: ≥ 1, ≤ 100, default `50`. |

**Returns** `Promise<{ domain, keywords, totalCount, usage }>` — The ranked keywords, best first, and the credits it cost.

| Field | Type | Always present | Description |
|---|---|---|---|
| `domain` | `string` | yes | The domain. |
| `keywords` | `({ keyword, searchVolume, cpc, difficulty, intent, position, url, traffic })[]` | yes | The keywords, by traffic. |
| `keywords.keyword` | `string` | yes | The keyword. |
| `keywords.searchVolume` | `number \| null` | yes | Average monthly Google searches in the country and language asked; `null` when unknown. |
| `keywords.cpc` | `number \| null` | yes | Average cost per click of the keyword's ads, in USD; `null` when no ads run on it. |
| `keywords.difficulty` | `number \| null` | yes | How hard it is to rank in the top 10, 0 (easy) to 100 (hardest). |
| `keywords.intent` | `'informational' \| 'navigational' \| 'commercial' \| 'transactional' \| null` | yes | What the searcher wants: `informational` (to learn), `navigational` (a specific site), `commercial` (to compare before buying) or `transactional` (to buy or book now). |
| `keywords.position` | `number` | yes | Its Google position for the keyword. |
| `keywords.url` | `string \| null` | yes | The page that ranks. |
| `keywords.traffic` | `number \| null` | yes | Estimated monthly visits from this keyword. |
| `totalCount` | `number` | yes | How many keywords it ranks for in all. |
| `usage` | `{ credits }` | yes | What the call cost. |
| `usage.credits` | `number` | yes | Credits charged for this call. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `NOT_AVAILABLE_IN_COUNTRY` | 400 | No data for that country and language. |
| `RATE_LIMIT_EXCEEDED` | 429 | The plan's SEO calls per minute or per month are used up; `details.period`. |
| `PROVIDER_UNAVAILABLE` | 503 | Domain data is unavailable; retry later. |

**Example**

```ts
const d = await totalum.seo.domain.keywords({ domain: 'example.es', country: 'es', language: 'es', limit: 20 });
```

Result:

```ts
{ "domain": "example.es", "totalCount": 1273, "keywords": [{ "keyword": "…", "position": 1, "url": "https://example.es/p", "traffic": 2.97, "searchVolume": 880, … }], "usage": { "credits": 0.9 } }
```

## `seo.domain.competitors`

```ts
seo.domain.competitors(input: { country, language, domain, limit? }): Promise<{ domain, competitors, usage }>
```

The domains that compete with a domain on Google in a country (most shared keywords first).

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `input` | `{ country, language, domain, limit? }` | yes | The domain, the place and how many competitors. |
| `input.country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `input.language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `input.domain` | `string` | yes | A bare domain (`example.com`). Allowed: at most 253 characters. |
| `input.limit` | `number` | no | At most this many competitors. Allowed: ≥ 1, ≤ 100, default `20`. |

**Returns** `Promise<{ domain, competitors, usage }>` — The competitors and the credits it cost.

| Field | Type | Always present | Description |
|---|---|---|---|
| `domain` | `string` | yes | The domain. |
| `competitors` | `({ domain, sharedKeywords, avgPosition, organicKeywords, traffic })[]` | yes | The competitors, most shared keywords first. |
| `competitors.domain` | `string` | yes | The competitor's domain. |
| `competitors.sharedKeywords` | `number` | yes | Keywords both rank for. |
| `competitors.avgPosition` | `number \| null` | yes | The competitor's average position on those. |
| `competitors.organicKeywords` | `number \| null` | yes | How many keywords the competitor ranks for. |
| `competitors.traffic` | `number \| null` | yes | The competitor's estimated monthly organic visits. |
| `usage` | `{ credits }` | yes | What the call cost. |
| `usage.credits` | `number` | yes | Credits charged for this call. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `NOT_AVAILABLE_IN_COUNTRY` | 400 | No data for that country and language. |
| `RATE_LIMIT_EXCEEDED` | 429 | The plan's SEO calls per minute or per month are used up; `details.period`. |
| `PROVIDER_UNAVAILABLE` | 503 | Domain data is unavailable; retry later. |

**Example**

```ts
const c = await totalum.seo.domain.competitors({ domain: 'example.es', country: 'es', language: 'es', limit: 5 });
```

Result:

```json
{ "domain": "example.es", "competitors": [{ "domain": "rival.es", "sharedKeywords": 540, "avgPosition": 18.2, "organicKeywords": 9000, "traffic": 12000 }], "usage": { "credits": 0.9086 } }
```

## `seo.domain.keywordGap`

```ts
seo.domain.keywordGap(input: { country, language, domain, competitor, limit?, mode? }): Promise<{ domain, keywords, competitor, usage }>
```

The keyword gap between a domain and a competitor: the keywords the competitor ranks for and the domain does
not (`missing`), or that both rank for (`shared`).

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `input` | `{ country, language, domain, competitor, limit?, mode? }` | yes | The domain, the competitor, the place, the mode and how many. |
| `input.country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `input.language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `input.domain` | `string` | yes | Your domain. Allowed: at most 253 characters. |
| `input.competitor` | `string` | yes | The competitor's domain. Allowed: at most 253 characters. |
| `input.limit` | `number` | no | At most this many keywords. Allowed: ≥ 1, ≤ 100, default `50`. |
| `input.mode` | `'shared' \| 'missing'` | no | `missing`: the competitor ranks and `domain` does not; `shared`: both rank. Allowed: default `"missing"`. |

**Returns** `Promise<{ domain, keywords, competitor, usage }>` — The keywords with both positions and the credits it cost.

| Field | Type | Always present | Description |
|---|---|---|---|
| `domain` | `string` | yes | Your domain. |
| `keywords` | `({ keyword, searchVolume, cpc, difficulty, intent, competitorPosition, competitorUrl, domainPosition, domainUrl })[]` | yes | The keywords. |
| `keywords.keyword` | `string` | yes | The keyword. |
| `keywords.searchVolume` | `number \| null` | yes | Average monthly Google searches in the country and language asked; `null` when unknown. |
| `keywords.cpc` | `number \| null` | yes | Average cost per click of the keyword's ads, in USD; `null` when no ads run on it. |
| `keywords.difficulty` | `number \| null` | yes | How hard it is to rank in the top 10, 0 (easy) to 100 (hardest). |
| `keywords.intent` | `'informational' \| 'navigational' \| 'commercial' \| 'transactional' \| null` | yes | What the searcher wants: `informational` (to learn), `navigational` (a specific site), `commercial` (to compare before buying) or `transactional` (to buy or book now). |
| `keywords.competitorPosition` | `number \| null` | yes | The competitor's position. |
| `keywords.competitorUrl` | `string \| null` | yes | The competitor's ranking page. |
| `keywords.domainPosition` | `number \| null` | yes | Your position; `null` when you do not rank. |
| `keywords.domainUrl` | `string \| null` | yes | Your ranking page, if any. |
| `competitor` | `string` | yes | The competitor's domain. |
| `usage` | `{ credits }` | yes | What the call cost. |
| `usage.credits` | `number` | yes | Credits charged for this call. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `NOT_AVAILABLE_IN_COUNTRY` | 400 | No data for that country and language. |
| `RATE_LIMIT_EXCEEDED` | 429 | The plan's SEO calls per minute or per month are used up; `details.period`. |
| `PROVIDER_UNAVAILABLE` | 503 | Domain data is unavailable; retry later. |

**Example**

```ts
const g = await totalum.seo.domain.keywordGap({ domain: 'example.es', competitor: 'rival.es', country: 'es', language: 'es' });
```

Result:

```ts
{ "domain": "example.es", "competitor": "rival.es", "keywords": [{ "keyword": "…", "competitorPosition": 3, "competitorUrl": "https://rival.es/p", "domainPosition": null, "domainUrl": null, … }], "usage": { "credits": 0.9 } }
```

## `seo.domain.backlinks`

```ts
seo.domain.backlinks(input: SeoBacklinksSummaryInput): Promise<{ domain, rank, backlinks, referringDomains, referringDomainsNofollow, referringMainDomains, referringIps, brokenBacklinks, spamScore, firstSeen, topTlds, topCountries, usage }>
```

A domain's backlink profile: authority rank, backlinks, referring domains, spam score and where its links come
from.

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `input` | [`SeoBacklinksSummaryInput`](#seobacklinkssummaryinput) | yes | The domain. |
| `input.domain` | `string` | yes | A bare domain (`example.com`). Allowed: at most 253 characters. |

**Returns** `Promise<{ domain, rank, backlinks, referringDomains, referringDomainsNofollow, referringMainDomains, referringIps, brokenBacklinks, spamScore, firstSeen, topTlds, topCountries, usage }>` — The summary and the credits it cost.

| Field | Type | Always present | Description |
|---|---|---|---|
| `domain` | `string` | yes | The domain. |
| `rank` | `number \| null` | yes | Authority, 0–1000. |
| `backlinks` | `number \| null` | yes | Links pointing to it. |
| `referringDomains` | `number \| null` | yes | Domains linking to it. |
| `referringDomainsNofollow` | `number \| null` | yes | Of those, the ones whose links are all nofollow. |
| `referringMainDomains` | `number \| null` | yes | Distinct main domains linking to it. |
| `referringIps` | `number \| null` | yes | Distinct IP addresses linking to it. |
| `brokenBacklinks` | `number \| null` | yes | Links to pages of it that no longer exist. |
| `spamScore` | `number \| null` | yes | How spammy its link profile looks, 0–100. |
| `firstSeen` | `string \| null` | yes | When a link to it was first seen. |
| `topTlds` | `Record<string, number>` | yes | Linking domains per top-level domain (`com` → count). |
| `topCountries` | `Record<string, number>` | yes | Linking domains per country (`US` → count). |
| `usage` | `{ credits }` | yes | What the call cost. |
| `usage.credits` | `number` | yes | Credits charged for this call. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `RATE_LIMIT_EXCEEDED` | 429 | The plan's SEO calls per minute or per month are used up; `details.period`. |
| `PROVIDER_UNAVAILABLE` | 503 | Backlink data is unavailable; retry later. |

**Example**

```ts
const b = await totalum.seo.domain.backlinks({ domain: 'example.es' });
```

Result:

```ts
{ "domain": "example.es", "rank": 212, "backlinks": 667, "referringDomains": 235, "spamScore": 11, …, "usage": { "credits": 1.7169 } }
```

## `seo.page.analyze`

```ts
seo.page.analyze(input: SeoPageAnalyzeInput): Promise<{ url, links, images, statusCode, title, description, score, content, canonical, headings, wordCount, hasStructuredData, issues, social, usage }>
```

Reads one public page as a search engine does: title, description, canonical, headings, word count, links,
images, structured data, social tags, an on-page score with the issues found, and its main text by section —
the structure of a page that ranks.

**Parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `input` | [`SeoPageAnalyzeInput`](#seopageanalyzeinput) | yes | The page's URL. |
| `input.url` | `string` | yes | The public `http(s)` URL of the page. Allowed: a URL. |

**Returns** `Promise<{ url, links, images, statusCode, title, description, score, content, canonical, headings, wordCount, hasStructuredData, issues, social, usage }>` — The page analysis and the credits it cost.

| Field | Type | Always present | Description |
|---|---|---|---|
| `url` | `string` | yes | The page read (after redirects). |
| `links` | `{ internal, external }` | yes | Its links. |
| `links.internal` | `number \| null` | yes | Links to its own site. |
| `links.external` | `number \| null` | yes | Links to other sites. |
| `images` | `number \| null` | yes | How many images. |
| `statusCode` | `number \| null` | yes | Its HTTP status. |
| `title` | `string \| null` | yes | Its `<title>`. |
| `description` | `string \| null` | yes | Its meta description. |
| `score` | `number \| null` | yes | An on-page score, 0–100. |
| `content` | `({ heading, level, text })[]` | yes | Its main text by section. |
| `content.heading` | `string \| null` | yes | The section's heading. |
| `content.level` | `number \| null` | yes | The heading level (1 = H1). |
| `content.text` | `string` | yes | The section's text. |
| `canonical` | `string \| null` | yes | Its canonical URL. |
| `headings` | `{ h1, h2, h3 }` | yes | Its headings. |
| `headings.h1` | `string[]` | yes | The H1s. |
| `headings.h2` | `string[]` | yes | The H2s. |
| `headings.h3` | `string[]` | yes | The H3s. |
| `wordCount` | `number \| null` | yes | Words of text. |
| `hasStructuredData` | `boolean \| null` | yes | Whether it has schema.org structured data. |
| `issues` | `string[]` | yes | Problems found, e.g. `title_too_long`, `no_image_alt`, `no_h1_tag`. |
| `social` | `Record<string, string>` | yes | Its Open Graph and Twitter tags (`og:title` → value). |
| `usage` | `{ credits }` | yes | What the call cost. |
| `usage.credits` | `number` | yes | Credits charged for this call. |

**Errors** — besides the [errors every call can throw](https://www.totalum.app/docs/sdk#errors):

| Code | HTTP | When |
|---|---|---|
| `SEO_REQUEST_REJECTED` | 400 | The page could not be read; `details.field`. |
| `RATE_LIMIT_EXCEEDED` | 429 | The plan's SEO calls per minute or per month are used up; `details.period`. |
| `PROVIDER_TIMEOUT` | 504 | The page took too long; retry. |
| `PROVIDER_UNAVAILABLE` | 503 | Page analysis is unavailable; retry later. |

**Example**

```ts
const p = await totalum.seo.page.analyze({ url: 'https://www.example.es/' });
```

Result:

```ts
{ "url": "https://www.example.es/", "statusCode": 200, "title": "Ejemplo", "headings": { "h1": ["Ejemplo"], "h2": ["…"], "h3": [] }, "wordCount": 2418, "hasStructuredData": true, "score": 91.59, "issues": ["title_too_long"], "content": [{ "heading": "Ejemplo", "level": 1, "text": "…" }], …, "usage": { "credits": 0.0215 } }
```

## `SeoAiAnswerInput`

The question of `seo.ai.answer()`.

| Name | Type | Required | Description |
|---|---|---|---|
| `prompt` | `string` | yes | The question, as a user asks the assistant. Allowed: at least 1 character, at most 500 characters. |
| `platform` | `'claude' \| 'chatgpt' \| 'gemini' \| 'perplexity'` | yes | The assistant: `chatgpt`, `claude`, `gemini` or `perplexity`. Allowed: default `"chatgpt"`. |
| `webSearch` | `boolean` | yes | Whether the assistant may search the web (as it does for users); `true` by default. Allowed: default `true`. |
| `model` | `string` | no | A model id of that assistant; omitted = a current fast model. |
| `country` | `string` | no | The country its web search runs from (ISO 3166-1 alpha-2). |

## `SeoAiAnswerOutput`

The assistant's answer.

| Field | Type | Always present | Description |
|---|---|---|---|
| `platform` | `'claude' \| 'chatgpt' \| 'gemini' \| 'perplexity'` | yes | The assistant asked. |
| `model` | `string` | yes | The model that answered. |
| `answer` | `string` | yes | The answer, as Markdown. |
| `sources` | [`SeoSource[]`](#seosource) | yes | The pages it cited. |
| `citedDomains` | `string[]` | yes | The domains of those pages. |
| `searchQueries` | `string[]` | yes | The web searches the assistant ran. |

## `SeoAiKeywordVolumeInput`

The keywords of `seo.ai.keywordVolume()`.

| Name | Type | Required | Description |
|---|---|---|---|
| `country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `keywords` | `string[]` | yes | Up to 1,000 keywords. Allowed: at least 1 item, at most 1000 items. |

## `SeoAiKeywordVolumeOutput`

AI search volume per keyword.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keywords` | `({ keyword, aiSearchVolume, monthlySearches })[]` | yes | One row per keyword. |
| `keywords.keyword` | `string` | yes | The keyword. |
| `keywords.aiSearchVolume` | `number \| null` | yes | How often it is asked to AI assistants per month. |
| `keywords.monthlySearches` | `({ year, month, aiSearchVolume })[]` | yes | The last 12 months, newest first. |
| `keywords.monthlySearches.year` | `number` | yes | The year. |
| `keywords.monthlySearches.month` | `number` | yes | The month, 1–12. |
| `keywords.monthlySearches.aiSearchVolume` | `number \| null` | yes | AI searches that month. |

## `SeoAiMentionsInput`

The target of `seo.ai.mentions()`: exactly one of `domain` or `keyword`.

| Name | Type | Required | Description |
|---|---|---|---|
| `view` | `'mentions' \| 'top-domains' \| 'top-pages'` | yes | `mentions` (the questions and answers), `top-domains` or `top-pages` (the most cited). Allowed: default `"mentions"`. |
| `limit` | `number` | yes | At most this many rows. Allowed: ≥ 1, ≤ 100, default `20`. |
| `country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `platform` | `'chatgpt' \| 'google'` | no | `google` (AI Overviews) or `chatgpt` (United States, English only); omitted = both. |
| `domain` | `string` | no | Mentions of this domain (cited by AI answers). Allowed: at most 253 characters. |
| `keyword` | `string` | no | Or mentions of this keyword or brand name in AI questions and answers. Allowed: at least 1 character, at most 250 characters. |

## `SeoAiMentionsOutput`

Mentions in AI answers; the field present depends on `view`.

| Field | Type | Always present | Description |
|---|---|---|---|
| `totalCount` | `number` | yes | How many mentions exist in all. |
| `mentions` | `({ platform, question, answer, sources, brands, aiSearchVolume })[]` | no | The questions and answers (`view: mentions`). |
| `mentions.platform` | `'chatgpt' \| 'google'` | yes | `google` (AI Overview) or `chatgpt`. |
| `mentions.question` | `string` | yes | The question asked. |
| `mentions.answer` | `string` | yes | The AI answer. |
| `mentions.sources` | [`SeoSource[]`](#seosource) | yes | The pages it cites. |
| `mentions.brands` | `({ name, category })[]` | yes | The brands it names. |
| `mentions.brands.name` | `string` | yes | The brand or product named. |
| `mentions.brands.category` | `string \| null` | yes | What it is, when known. |
| `mentions.aiSearchVolume` | `number \| null` | yes | How often the question is asked per month. |
| `domains` | `({ mentions, aiSearchVolume, domain })[]` | no | The most cited domains (`view: top-domains`). |
| `domains.mentions` | `number` | yes | How many answers cite it. |
| `domains.aiSearchVolume` | `number \| null` | yes | The monthly AI search volume of those answers. |
| `domains.domain` | `string` | yes | The domain. |
| `pages` | `({ mentions, aiSearchVolume, url })[]` | no | The most cited pages (`view: top-pages`). |
| `pages.mentions` | `number` | yes | How many answers cite it. |
| `pages.aiSearchVolume` | `number \| null` | yes | The monthly AI search volume of those answers. |
| `pages.url` | `string` | yes | The page. |

## `SeoBacklinksSummaryInput`

The domain of `seo.domain.backlinks()`.

| Name | Type | Required | Description |
|---|---|---|---|
| `domain` | `string` | yes | A bare domain (`example.com`). Allowed: at most 253 characters. |

## `SeoBacklinksSummaryOutput`

A domain's backlink profile.

| Field | Type | Always present | Description |
|---|---|---|---|
| `domain` | `string` | yes | The domain. |
| `rank` | `number \| null` | yes | Authority, 0–1000. |
| `backlinks` | `number \| null` | yes | Links pointing to it. |
| `referringDomains` | `number \| null` | yes | Domains linking to it. |
| `referringDomainsNofollow` | `number \| null` | yes | Of those, the ones whose links are all nofollow. |
| `referringMainDomains` | `number \| null` | yes | Distinct main domains linking to it. |
| `referringIps` | `number \| null` | yes | Distinct IP addresses linking to it. |
| `brokenBacklinks` | `number \| null` | yes | Links to pages of it that no longer exist. |
| `spamScore` | `number \| null` | yes | How spammy its link profile looks, 0–100. |
| `firstSeen` | `string \| null` | yes | When a link to it was first seen. |
| `topTlds` | `Record<string, number>` | yes | Linking domains per top-level domain (`com` → count). |
| `topCountries` | `Record<string, number>` | yes | Linking domains per country (`US` → count). |

## `SeoChatGptSearchInput`

The query of `seo.ai.chatgptSearch()`.

| Name | Type | Required | Description |
|---|---|---|---|
| `country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `keyword` | `string` | yes | The query, as a user types it in ChatGPT. Allowed: at least 1 character, at most 2000 characters. |

## `SeoChatGptSearchOutput`

ChatGPT's search answer.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keyword` | `string` | yes | The query. |
| `answer` | `string` | yes | The answer, as Markdown. |
| `sources` | `({ title, url, domain, snippet, publishedAt })[]` | yes | The pages it cites. |
| `sources.title` | `string \| null` | yes | The page's title. |
| `sources.url` | `string` | yes | The page's URL. |
| `sources.domain` | `string \| null` | yes | The page's host. |
| `sources.snippet` | `string \| null` | yes | The text it quotes, when given. |
| `sources.publishedAt` | `string \| null` | yes | The page's date, when known. |
| `searchResults` | [`SeoSource[]`](#seosource) | yes | The search results it showed. |
| `brands` | `({ name, category })[]` | yes | The brands and products it named. |
| `brands.name` | `string` | yes | The brand or product named. |
| `brands.category` | `string \| null` | yes | What it is, when known. |
| `searchQueries` | `string[]` | yes | The searches it ran. |

## `SeoDomainCompetitorsInput`

The domain of `seo.domain.competitors()`.

| Name | Type | Required | Description |
|---|---|---|---|
| `limit` | `number` | yes | At most this many competitors. Allowed: ≥ 1, ≤ 100, default `20`. |
| `country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `domain` | `string` | yes | A bare domain (`example.com`). Allowed: at most 253 characters. |

## `SeoDomainCompetitorsOutput`

A domain's search competitors.

| Field | Type | Always present | Description |
|---|---|---|---|
| `domain` | `string` | yes | The domain. |
| `competitors` | `({ domain, sharedKeywords, avgPosition, organicKeywords, traffic })[]` | yes | The competitors, most shared keywords first. |
| `competitors.domain` | `string` | yes | The competitor's domain. |
| `competitors.sharedKeywords` | `number` | yes | Keywords both rank for. |
| `competitors.avgPosition` | `number \| null` | yes | The competitor's average position on those. |
| `competitors.organicKeywords` | `number \| null` | yes | How many keywords the competitor ranks for. |
| `competitors.traffic` | `number \| null` | yes | The competitor's estimated monthly organic visits. |

## `SeoDomainKeywordsInput`

The domain of `seo.domain.keywords()`.

| Name | Type | Required | Description |
|---|---|---|---|
| `limit` | `number` | yes | At most this many keywords. Allowed: ≥ 1, ≤ 100, default `50`. |
| `country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `domain` | `string` | yes | A bare domain (`example.com`); a URL is cut to its host. Allowed: at most 253 characters. |

## `SeoDomainKeywordsOutput`

The keywords a domain ranks for.

| Field | Type | Always present | Description |
|---|---|---|---|
| `domain` | `string` | yes | The domain. |
| `totalCount` | `number` | yes | How many keywords it ranks for in all. |
| `keywords` | `({ keyword, searchVolume, cpc, difficulty, intent, position, url, traffic })[]` | yes | The keywords, by traffic. |
| `keywords.keyword` | `string` | yes | The keyword. |
| `keywords.searchVolume` | `number \| null` | yes | Average monthly Google searches in the country and language asked; `null` when unknown. |
| `keywords.cpc` | `number \| null` | yes | Average cost per click of the keyword's ads, in USD; `null` when no ads run on it. |
| `keywords.difficulty` | `number \| null` | yes | How hard it is to rank in the top 10, 0 (easy) to 100 (hardest). |
| `keywords.intent` | `'informational' \| 'navigational' \| 'commercial' \| 'transactional' \| null` | yes | What the searcher wants: `informational` (to learn), `navigational` (a specific site), `commercial` (to compare before buying) or `transactional` (to buy or book now). |
| `keywords.position` | `number` | yes | Its Google position for the keyword. |
| `keywords.url` | `string \| null` | yes | The page that ranks. |
| `keywords.traffic` | `number \| null` | yes | Estimated monthly visits from this keyword. |

## `SeoIndexNowKey` type

The project's IndexNow key.

| Field | Type | Always present | Description |
|---|---|---|---|
| `key` | `string` | yes | The key. |
| `keyLocation` | `string` | yes | The URL where the site serves it (`https://<host>/<key>.txt`). |

## `SeoKeyword`

One keyword's Google search data in the country and language asked.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keyword` | `string` | yes | The keyword. |
| `searchVolume` | `number \| null` | yes | Average monthly Google searches in the country and language asked; `null` when unknown. |
| `cpc` | `number \| null` | yes | Average cost per click of the keyword's ads, in USD; `null` when no ads run on it. |
| `competition` | `number \| null` | yes | How many advertisers bid on it, 0 (none) to 1 (most). |
| `competitionLevel` | `'low' \| 'medium' \| 'high' \| null` | yes | The same as a level: `low`, `medium` or `high`. |
| `difficulty` | `number \| null` | yes | How hard it is to rank in the top 10, 0 (easy) to 100 (hardest). |
| `intent` | `'informational' \| 'navigational' \| 'commercial' \| 'transactional' \| null` | yes | What the searcher wants: `informational` (to learn), `navigational` (a specific site), `commercial` (to compare before buying) or `transactional` (to buy or book now). |
| `trend` | `{ monthly, quarterly, yearly } \| null` | yes | The change of its search volume, in percent. |
| `trend.monthly` | `number \| null` | yes | Against the previous month. |
| `trend.quarterly` | `number \| null` | yes | Against three months ago. |
| `trend.yearly` | `number \| null` | yes | Against a year ago. |
| `monthlySearches` | `({ year, month, searchVolume })[]` | yes | The last 12 months, newest first. |
| `monthlySearches.year` | `number` | yes | The year. |
| `monthlySearches.month` | `number` | yes | The month, 1–12. |
| `monthlySearches.searchVolume` | `number \| null` | yes | Google searches that month. |

## `SeoKeywordGapInput`

The two domains of `seo.domain.keywordGap()`.

| Name | Type | Required | Description |
|---|---|---|---|
| `mode` | `'shared' \| 'missing'` | yes | `missing`: the competitor ranks and `domain` does not; `shared`: both rank. Allowed: default `"missing"`. |
| `limit` | `number` | yes | At most this many keywords. Allowed: ≥ 1, ≤ 100, default `50`. |
| `country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `domain` | `string` | yes | Your domain. Allowed: at most 253 characters. |
| `competitor` | `string` | yes | The competitor's domain. Allowed: at most 253 characters. |

## `SeoKeywordGapOutput`

The keyword gap between two domains.

| Field | Type | Always present | Description |
|---|---|---|---|
| `domain` | `string` | yes | Your domain. |
| `competitor` | `string` | yes | The competitor's domain. |
| `keywords` | `({ keyword, searchVolume, cpc, difficulty, intent, competitorPosition, competitorUrl, domainPosition, domainUrl })[]` | yes | The keywords. |
| `keywords.keyword` | `string` | yes | The keyword. |
| `keywords.searchVolume` | `number \| null` | yes | Average monthly Google searches in the country and language asked; `null` when unknown. |
| `keywords.cpc` | `number \| null` | yes | Average cost per click of the keyword's ads, in USD; `null` when no ads run on it. |
| `keywords.difficulty` | `number \| null` | yes | How hard it is to rank in the top 10, 0 (easy) to 100 (hardest). |
| `keywords.intent` | `'informational' \| 'navigational' \| 'commercial' \| 'transactional' \| null` | yes | What the searcher wants: `informational` (to learn), `navigational` (a specific site), `commercial` (to compare before buying) or `transactional` (to buy or book now). |
| `keywords.competitorPosition` | `number \| null` | yes | The competitor's position. |
| `keywords.competitorUrl` | `string \| null` | yes | The competitor's ranking page. |
| `keywords.domainPosition` | `number \| null` | yes | Your position; `null` when you do not rank. |
| `keywords.domainUrl` | `string \| null` | yes | Your ranking page, if any. |

## `SeoKeywordIdeasInput`

The seeds of `seo.keywords.ideas()`.

| Name | Type | Required | Description |
|---|---|---|---|
| `limit` | `number` | yes | At most this many ideas. Allowed: ≥ 1, ≤ 100, default `50`. |
| `country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `keywords` | `string[]` | yes | Up to 20 seed keywords; ideas containing the first one come first. Allowed: at least 1 item, at most 20 items. |

## `SeoKeywordOverviewInput`

The keywords of `seo.keywords.overview()`.

| Name | Type | Required | Description |
|---|---|---|---|
| `country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `keywords` | `string[]` | yes | Up to 700 keywords. Allowed: at least 1 item, at most 700 items. |

## `SeoKeywordRelatedInput`

The keyword of `seo.keywords.related()`.

| Name | Type | Required | Description |
|---|---|---|---|
| `depth` | `number` | yes | How many hops of related searches to follow, 1 to 3. Allowed: ≥ 1, ≤ 3, default `1`. |
| `limit` | `number` | yes | At most this many keywords. Allowed: ≥ 1, ≤ 100, default `50`. |
| `country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `keyword` | `string` | yes | The keyword. Allowed: at least 1 character, at most 80 characters. |

## `SeoKeywordsOutput`

Keywords with their search data.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keywords` | [`SeoKeyword[]`](#seokeyword) | yes | The keywords, most relevant first. |

## `SeoKeywordTrendsInput`

The keywords of `seo.keywords.trends()`.

| Name | Type | Required | Description |
|---|---|---|---|
| `keywords` | `string[]` | yes | Up to 5 keywords, compared on one scale. Allowed: at least 1 item, at most 5 items. |
| `timeRange` | `'past_7_days' \| 'past_30_days' \| 'past_90_days' \| 'past_12_months' \| 'past_5_years'` | yes | The period: `past_7_days`, `past_30_days`, `past_90_days`, `past_12_months` or `past_5_years`. Allowed: default `"past_12_months"`. |
| `country` | `string` | no | The country (ISO 3166-1 alpha-2); omitted = worldwide. |
| `language` | `string` | no | The language; omitted = all. |

## `SeoKeywordTrendsOutput`

Google Trends interest over time.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keywords` | `string[]` | yes | The keywords, in the order of `values`. |
| `timeline` | `({ from, to, values })[]` | yes | One row per period, oldest first. |
| `timeline.from` | `string` | yes | The first day of the period. |
| `timeline.to` | `string` | yes | The last day. |
| `timeline.values` | `(number \| null)[]` | yes | Each keyword's interest, 0–100 (100 = the peak of the chart). |

## `SeoLocationsOutput`

The places the research methods accept.

| Field | Type | Always present | Description |
|---|---|---|---|
| `countries` | `({ country, name, dataLanguages })[]` | yes | Every country. |
| `countries.country` | `string` | yes | Its ISO 3166-1 alpha-2 code. |
| `countries.name` | `string` | yes | Its English name. |
| `countries.dataLanguages` | `string[]` | yes | The languages keyword, domain and AI data exist in there; search results take any language. |
| `languages` | `({ language, name })[]` | yes | Every language. |
| `languages.language` | `string` | yes | Its code. |
| `languages.name` | `string` | yes | Its English name. |

## `SeoNotifyOutput`

The answer of `seo.notifyChanged()`.

| Field | Type | Always present | Description |
|---|---|---|---|
| `accepted` | `number` | yes | How many URLs were sent to IndexNow. |
| `indexNow` | `'error' \| 'sent' \| 'skipped_no_custom_domain'` | yes | `sent`; `skipped_no_custom_domain` when the project has no verified custom domain (Totalum's own hosts are never sent); `error` when IndexNow refused them. |
| `sitemapsPinged` | `boolean` | yes | Whether each domain's `/sitemap.xml` answered. |

## `SeoPageAnalyzeInput`

The page of `seo.page.analyze()`.

| Name | Type | Required | Description |
|---|---|---|---|
| `url` | `string` | yes | The public `http(s)` URL of the page. Allowed: a URL. |

## `SeoPageAnalyzeOutput`

One page as a search engine reads it.

| Field | Type | Always present | Description |
|---|---|---|---|
| `url` | `string` | yes | The page read (after redirects). |
| `statusCode` | `number \| null` | yes | Its HTTP status. |
| `title` | `string \| null` | yes | Its `<title>`. |
| `description` | `string \| null` | yes | Its meta description. |
| `canonical` | `string \| null` | yes | Its canonical URL. |
| `headings` | `{ h1, h2, h3 }` | yes | Its headings. |
| `headings.h1` | `string[]` | yes | The H1s. |
| `headings.h2` | `string[]` | yes | The H2s. |
| `headings.h3` | `string[]` | yes | The H3s. |
| `wordCount` | `number \| null` | yes | Words of text. |
| `links` | `{ internal, external }` | yes | Its links. |
| `links.internal` | `number \| null` | yes | Links to its own site. |
| `links.external` | `number \| null` | yes | Links to other sites. |
| `images` | `number \| null` | yes | How many images. |
| `hasStructuredData` | `boolean \| null` | yes | Whether it has schema.org structured data. |
| `score` | `number \| null` | yes | An on-page score, 0–100. |
| `issues` | `string[]` | yes | Problems found, e.g. `title_too_long`, `no_image_alt`, `no_h1_tag`. |
| `social` | `Record<string, string>` | yes | Its Open Graph and Twitter tags (`og:title` → value). |
| `content` | `({ heading, level, text })[]` | yes | Its main text by section. |
| `content.heading` | `string \| null` | yes | The section's heading. |
| `content.level` | `number \| null` | yes | The heading level (1 = H1). |
| `content.text` | `string` | yes | The section's text. |

## `SeoSerpAiModeInput`

The question of `seo.serp.aiMode()`.

| Name | Type | Required | Description |
|---|---|---|---|
| `device` | `'mobile' \| 'desktop'` | yes | `desktop` or `mobile`. Allowed: default `"desktop"`. |
| `country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `keyword` | `string` | yes | The question, as a user asks it. Allowed: at least 1 character, at most 700 characters. |

## `SeoSerpAiModeOutput`

Google AI Mode's answer.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keyword` | `string` | yes | The question asked. |
| `answer` | `string` | yes | The answer, as Markdown. |
| `sources` | [`SeoSource[]`](#seosource) | yes | The pages it cites. |

## `SeoSerpGoogleInput`

The search of `seo.serp.google()`.

| Name | Type | Required | Description |
|---|---|---|---|
| `depth` | `number` | yes | How many results to read, 10 to 100. Allowed: ≥ 10, ≤ 100, default `10`. |
| `device` | `'mobile' \| 'desktop'` | yes | `desktop` or `mobile` results. Allowed: default `"desktop"`. |
| `country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `keyword` | `string` | yes | What is searched, as a user types it. Allowed: at least 1 character, at most 700 characters. |
| `city` | `string` | no | A city of `country` (`Barcelona`): the results as seen there. Allowed: at least 2 characters, at most 80 characters. |

## `SeoSerpGoogleOutput`

Google's results page for the keyword.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keyword` | `string` | yes | The keyword searched. |
| `totalResults` | `number \| null` | yes | How many results Google reports. |
| `organic` | `({ position, title, url, domain, snippet, breadcrumb })[]` | yes | The organic results, in rank order. |
| `organic.position` | `number` | yes | The rank among organic results, from 1. |
| `organic.title` | `string \| null` | yes | The result's title. |
| `organic.url` | `string` | yes | The ranking page's URL. |
| `organic.domain` | `string \| null` | yes | The ranking page's host. |
| `organic.snippet` | `string \| null` | yes | The text Google shows under the title. |
| `organic.breadcrumb` | `string \| null` | yes | The path Google shows above the title. |
| `featuredSnippet` | `{ title, snippet, url, domain } \| null` | yes | The answer box at the top, when Google shows one. |
| `featuredSnippet.title` | `string \| null` | yes | Its title. |
| `featuredSnippet.snippet` | `string \| null` | yes | Its text. |
| `featuredSnippet.url` | `string` | yes | The page it quotes. |
| `featuredSnippet.domain` | `string \| null` | yes | That page's host. |
| `peopleAlsoAsk` | `({ question, answer })[]` | yes | The "People also ask" questions. |
| `peopleAlsoAsk.question` | `string` | yes | The question. |
| `peopleAlsoAsk.answer` | `{ title, url, domain, snippet } \| null` | yes | The page Google answers it from, when shown. |
| `peopleAlsoAsk.answer.title` | `string \| null` | yes | The page's title. |
| `peopleAlsoAsk.answer.url` | `string` | yes | The page's URL. |
| `peopleAlsoAsk.answer.domain` | `string \| null` | yes | The page's host. |
| `peopleAlsoAsk.answer.snippet` | `string \| null` | yes | The answer text. |
| `relatedSearches` | `string[]` | yes | The related searches at the bottom of the page. |
| `aiOverview` | `{ text, sources } \| null` | yes | Google's AI Overview, when it shows one. |
| `aiOverview.text` | `string` | yes | The overview, as Markdown. |
| `aiOverview.sources` | [`SeoSource[]`](#seosource) | yes | The pages it cites. |

## `SeoSerpMapsInput`

The search of `seo.serp.maps()`.

| Name | Type | Required | Description |
|---|---|---|---|
| `depth` | `number` | yes | How many places to read, 1 to 100. Allowed: ≥ 1, ≤ 100, default `20`. |
| `country` | `string` | yes | The country searched from, as an ISO 3166-1 alpha-2 code (`es`, `us`, any case). |
| `language` | `string` | yes | The language of the search, as an ISO 639-1 code (`es`, `ca`, `en`) or a regional tag (`pt-BR`). `seo.locations()` lists them. |
| `keyword` | `string` | yes | What is searched on Maps (`dentista`, `pizzeria`). Allowed: at least 1 character, at most 700 characters. |
| `city` | `string` | no | A city of `country`: the places as seen there. Allowed: at least 2 characters, at most 80 characters. |

## `SeoSerpMapsOutput`

Google Maps places for the search.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keyword` | `string` | yes | The search. |
| `results` | `({ position, title, category, address, city, phone, website, rating, reviews, priceLevel, latitude, longitude, placeId, claimed })[]` | yes | The places, in rank order. |
| `results.position` | `number` | yes | The rank, from 1. |
| `results.title` | `string` | yes | The place's name. |
| `results.category` | `string \| null` | yes | Its main category. |
| `results.address` | `string \| null` | yes | Its address. |
| `results.city` | `string \| null` | yes | Its city. |
| `results.phone` | `string \| null` | yes | Its phone number. |
| `results.website` | `string \| null` | yes | Its website. |
| `results.rating` | `number \| null` | yes | Its average rating, 1–5. |
| `results.reviews` | `number \| null` | yes | How many reviews it has. |
| `results.priceLevel` | `string \| null` | yes | Its price level, when shown. |
| `results.latitude` | `number \| null` | yes | Latitude. |
| `results.longitude` | `number \| null` | yes | Longitude. |
| `results.placeId` | `string \| null` | yes | Google's place id. |
| `results.claimed` | `boolean \| null` | yes | Whether the owner claimed the listing. |

## `SeoSource`

A page an answer cites or a result links to.

| Field | Type | Always present | Description |
|---|---|---|---|
| `title` | `string \| null` | yes | The page's title. |
| `url` | `string` | yes | The page's URL. |
| `domain` | `string \| null` | yes | The page's host. |
