# Responses reference

> Every field of searchSDK search and contents responses: results, pages, cost, attempts, warnings and cost bounds.

Source: https://searchsdk.dev/docs/reference/responses

Every response field, read from the SDK's types. Both responses share the common fields.

## Common fields

| Name | Type | Meaning |
| --- | --- | --- |
| `provider` | `ProviderId` | The provider that answered (a fallback, when `fallback_used` is in `warnings`). |
| `cost` | `Cost` | What the successful attempt cost (see Cost). |
| `requestId` | `string \| null` | The provider's request id, or `null`. |
| `latencyMs` | `number` | Milliseconds from the start of the call to the answer. |
| `warnings` | `Warning<ProviderId>[]` | Non-fatal notes (see Warnings). |
| `attempts` | `Attempt<ProviderId>[]` | Every attempt, skipped ones included, in order. |
| `raw` | `unknown` | The provider's parsed JSON body. |

## SearchResponse

| Name | Type | Meaning |
| --- | --- | --- |
| `results` | `SearchResult[]` | Normalized results; `[]` is a success. |

### SearchResult

| Name | Type | Meaning |
| --- | --- | --- |
| `url` | `string` | The result's address. |
| `title` | `string \| null` | Title, or `null`. |
| `excerpts` | `string[]` | Text the provider matched; the kind (description, content chunks, highlights) is on each provider's page. |
| `publishedAt` | `string \| null` | Publication time as an ISO 8601 string, or `null`. |
| `author` | `string \| null` | Author, or `null`. |
| `rank` | `number` | Position, from 1. |
| `providerFields` | `Record<string, unknown>` | Provider-scoped values such as scores and ids. Not comparable across providers. |

## ContentsResponse

| Name | Type | Meaning |
| --- | --- | --- |
| `pages` | `Page[]` | One page per requested URL, in order. |

### Page

| Name | Type | Meaning |
| --- | --- | --- |
| `url` | `string` | The URL as requested. |
| `status` | `"ok" \| "failed"` | `ok` or `failed`. One failed page never fails the call. |
| `finalUrl` | `string \| null` | Address after redirects, or `null`. |
| `title` | `string \| null` | Title, or `null`. |
| `content` | `string \| null` | Page text, Markdown or plain per provider, or `null`. |
| `publishedAt` | `string \| null` | Publication time, or `null`. |
| `author` | `string \| null` | Author, or `null`. |
| `error` | `{ code: string \| null; message: string \| null } \| null` | For a failed page: the provider's code and message (`missing` when the provider returned nothing for the URL). |

## Cost

| Name | Type | Meaning |
| --- | --- | --- |
| `usd` | `number \| null` | USD, or `null` when the price is not known. Never 0 for unknown. |
| `estimated` | `boolean` | False only for an exact provider-reported figure, or when nothing was sent. |
| `source` | `CostSource` | `reported`, `reported-credits`, `computed`, `unknown` or `none`. |
| `credits?` | `number` | Credits the provider reported, for credit pricing. |

## Attempt

| Name | Type | Meaning |
| --- | --- | --- |
| `provider` | `ProviderId` | Provider tried. |
| `outcome` | `"ok" \| "error" \| "skipped"` | `ok`, `error` or `skipped` (no key, or an option the provider cannot honour). |
| `code?` | `ErrorCode` | Error code of a failed or skipped attempt. |
| `status?` | `number` | HTTP status, when one arrived. |
| `startMs` | `number` | Milliseconds from the start of the call. |
| `durationMs` | `number` | How long the attempt took. |
| `retryAfterMs?` | `number` | The provider's `Retry-After`, in milliseconds. |
| `billed` | `Billed` | `yes` (a 2xx), `possible` (sent, no answer) or `no` (not sent, or an error status). |
| `cost` | `Cost` | This attempt's own cost; for `possible`, what it costs if it was billed. |

## Warning

| Name | Type | Meaning |
| --- | --- | --- |
| `code` | `string` | Warning code (see Warnings). |
| `provider` | `ProviderId` | Provider it concerns. |
| `message?` | `string` | The provider's message, when it sent one. |
| `count?` | `number` | How many rows or pages it concerns. |

## CostBound

Returned by `costBound(spec, kind, input)`. `listPrice(spec, kind, { count })` returns a `Cost`.

| Name | Type | Meaning |
| --- | --- | --- |
| `usd` | `number \| null` | The most one request can cost at the highest documented rate, or `null` when it cannot be bounded. |
| `unknownBecause?` | `"option" \| "count" \| "price"` | Why `usd` is null: `option` (a cost option has no price), `count` (the billed count is unbounded) or `price` (not public). |
| `requiresOverageOff?` | `true` | Present when the bound holds only while paid use past a free allowance stays off on the account. |
