# Record lookup

> Fetch full records for companies, people and documents you can already identify, in batches, with every value that was not found reported.

- Human-readable page: https://dashboard.sproutsdata.ai/docs/guides/record-lookup
- This document: https://dashboard.sproutsdata.ai/docs/agents/guides/record-lookup
- Index of every agent document: https://dashboard.sproutsdata.ai/llms.txt
- API base URL: https://api.sproutsdata.ai

## Summary

`POST /v1/entities/{kind}` returns full records for identifiers already held: ids from search rows, domains, LinkedIn URLs, names. Batch: one answer entry per value sent, found first, misses reported (never dropped). Use search to find records not yet identified.

## Routes

- `POST /v1/entities/companies`: body `{ids: string[1..1000], by?: "auto"|"id"|"domain"|"li_url"|"name" = "auto", cursor?: string}`.
- `POST /v1/entities/persons`: body `{ids: (string | {name: string, company?: string})[1..1000], by?: "auto"|"id"|"li_url"|"name" = "auto", cursor?: string}`. `{name, company}`: a name with the person's employer (domain, LinkedIn company page or name); needs `by` `name` or `auto`.
- `POST /v1/entities/patents`, `/academic-reports`, `/trends`: body `{ids: string[1..100], by?: "auto"|"id" = "auto", fields?: string[1..200], cursor?: string}`. By id only.
- `POST /v1/entities/news`, `/market-reports`, `/fundings`, `/job-openings`: body `{ids: string[1..100], by?: "auto"|"id"|"name" = "auto", fields?: string[1..200], cursor?: string}`. `auto`: ids when every value is a search-row `id`, names otherwise. Name = headline, report title, raising company, job's role.

## Rules

- Companies/persons: `by: "id"` looks up by search-row `id` (up to 1,000). Every other `by`, `auto` (the default) included, resolves each value and caps the call at 50 values (422 above that). `auto` classifies each value by its shape. A domain, LinkedIn URL or id returns one record; a name returns every candidate, up to 10 (one record named exactly as asked comes back alone). To narrow a crowded name: a person's employer (`{name, company}`), a company's domain.
- Named documents: the default `by` is `auto`: ids when every value is a search-row `id`, names otherwise (capped at 50 values unless `by` is `id`); a name returns every matching record, best first. Send `"by": "id"` or `"by": "name"` to say which.
- Document `fields`: only those fields; omit for the default projection; `"*"` adds bulk fields (a report's body, a trend's roster), which can be very large.
- A company record's `technology` list is cut to 25 entries, as on search rows.
- Person records never include emails or phone numbers; use enrichment (https://dashboard.sproutsdata.ai/docs/agents/guides/enrichment).
- Unknown body keys are 422.

## Answer (`EntitiesEnvelope`)

- `results[]`: one per value sent: `{id and query: the value as sent, matched_by: "id"|"domain"|"li_url"|"name"|null, category, found: bool, matches: object[], total: int, has_more: bool}`. Found values first, then misses, each group in sent order. `total`: records the value matches in all; `has_more`: more match than `matches` shows.
- `matches[]`: full records, best first, each with its public `id` (the same id search gives), the `query` and `matched_by` it came from, and `match`: `exact`, `contains` (the name holds the words) or `fuzzy` (a typo match, only when nothing else matched). Prefer `exact`; never pick the first of several; confirm a `fuzzy` record with the user before using it.
- Envelope `total`: number of values looked up. Pages: up to 50 records per call, never splitting a value's records; when `has_more` is true, resend the same body with `cursor` = `next_cursor`. `resolved_search`, `suggestion`, `columns` null.
- `attribution[]`, `degradation[]`, `meta` (`credits_charged`, `credits_balance`, `request_id`).
- Record fields: https://dashboard.sproutsdata.ai/docs/agents/guides/record-lookup/complete-records

## Cost

- Default: 1 credit per value that finds a record, however many records it shows (a name matching several records counts once, on the page it appears on). Live figure: `POST /v1/credits/quote`.
- Free: misses; values whose records the workspace unlocked in the last 90 days (via a lookup, a saved list or an export).
- Charged all or nothing per call: if the balance cannot pay for the records found, 402 `credits.insufficient` and nothing is charged.
- Optional `Idempotency-Key`: same key, same request, same credential, same UTC day = one charge.
- Scope `dsp.entities.read`.

## Examples

```json
{ "by": "domain", "ids": ["stripe.com", "adyen.com"] }
```

```json
{ "by": "li_url", "ids": ["https://www.linkedin.com/in/jane-doe-example"] }
```

```json
{ "by": "name", "ids": [{ "name": "Jane Doe", "company": "stripe.com" }] }
```

```json
{ "by": "id", "ids": ["ID_FROM_A_SEARCH_ROW"] }
```

(The last one on `/v1/entities/news`; on `/v1/entities/patents` `by` may be left out.)

## Operations

### POST /v1/entities/companies

Look up companies

- URL: `POST https://api.sproutsdata.ai/v1/entities/companies`
- Scopes (any one): `dsp.entities.read`
- Cost: billed: an answer with results spends credits, an empty one is free
- Idempotency-Key header: optional

Companies by the `id` search returned, or found by domain, LinkedIn URL or name with `by` (every candidate, up to 10, for a name). 50 records a page: send the same body with `cursor` for the next.

Headers:

- `Idempotency-Key` (string): Send one to make a retry safe: a retry with the same key on the same UTC day is charged once.

Request body (JSON, required):

- `ids` (array of string, required): Limits: 1 to 1000 items.
- `by` (string): `auto` (the default) classifies each value; `id` for the `id` values search returned, or `domain`, `li_url` or `name`. One of: `"auto"`, `"id"`, `"domain"`, `"li_url"`, `"name"`. Default `"auto"`.
- `cursor` (string or null): `next_cursor` from the previous page. Send the same body with it. Limits: at most 8192 characters.

Response 200 (application/json): Successful Response
Response fields:

- `meta` (object, required)
  - `as_of` (string (date-time), required)
  - `request_id` (string, required)
  - `credential` (string): One of: `"api_key"`, `"session"`. Default `"api_key"`.
  - `credits_balance` (number or null): What the workspace has available after this request, in credits (credits held for running agent runs excluded). `null` when not metered or not known just now; `GET /v1/credits` always has it.
  - `credits_charged` (number or null): What this request cost, in credits. `null` when not metered.
  - `environment` (string): Deprecated: always `live` (there are no test keys). Will be removed. One of: `"live"`. Default `"live"`.
- `results` (array of object, required)
  - `category` (string, required): What a returned row is. The same names as ``SearchCategory``. One of: `"company"`, `"person"`, `"patent"`, `"academic_report"`, `"news_article"`, `"market_report"`, `"trend"`, `"funding_round"`, `"job_opening"`.
  - `found` (boolean, required)
  - `id` (string, required): The value as sent.
  - `query` (string, required): The value as sent; each record carries it too.
  - `has_more` (boolean): More records match than `matches` shows: narrow the value. Default `false`.
  - `matched_by` (string or null): How the value was read: `id`, `domain`, `li_url` or `name`.
  - `matches` (array of object): Each record, with its public `id` (the one search gives it), the `query` it came from, `matched_by`, and `match`: `exact`, `contains` or `fuzzy` (a typo match).
  - `total` (integer): Records the value matches in all. Default `0`. Limits: at least 0.
- `total` (integer, required): Values in the lookup, on every page. Limits: at least 0.
- `attribution` (array of object)
  - `source_corpus` (string, required): Where rows came from: each is its own index with its own refresh cadence, so ``attribution[].as_of`` is per corpus. One of: `"gtm_index"`, `"affiliations"`, `"patents"`, `"academic_reports"`, `"news"`, `"market_reports"`, `"trends"`, `"fundings"`, `"job_openings"`.
  - `as_of` (string (date-time) or null)
  - `domain` (string or null)
  - `quote` (string or null): RESERVED for per-fact citation.
  - `url` (string or null): RESERVED for per-fact citation.
- `columns` (null)
- `coverage` (null)
- `degradation` (array of object)
  - `detail` (string, required)
  - `impact` (string, required): One of: `"recall"`, `"precision"`, `"freshness"`, `"fields"`.
  - `reason` (string, required): Why an answer is less than it should be. Closed, so a client can branch on it. One of: `"vector_coverage_incomplete"`, `"mode_downgraded"`, `"field_not_indexed"`, `"pagination_truncated"`, `"corpus_unavailable"`, `"anchor_list_capped"`, `"axis_not_applicable"`, `"planner_step_incomplete"`, `"upstream_advisory"`, `"no_match"`, `"topic_not_required"`, `"sparse_filter"`, `"anchor_not_exact"`.
  - `source_corpus` (string or null): Where rows came from: each is its own index with its own refresh cadence, so ``attribution[].as_of`` is per corpus. One of: `"gtm_index"`, `"affiliations"`, `"patents"`, `"academic_reports"`, `"news"`, `"market_reports"`, `"trends"`, `"fundings"`, `"job_openings"`.
- `has_more` (boolean): Default `false`.
- `next_cursor` (string or null): Send the same body with this `cursor` for the next page.
- `resolved_search` (null)
- `suggestion` (null)
- `total_is_estimate` (boolean): Default `false`.

Errors:

- 401: No credential, or one that does not verify (`auth.unauthorized`).
- 403: The credential lacks the scope this route needs (`auth.insufficient_scope`), or the signed-in user has not chosen a workspace (`auth.workspace_required`).
- 409: Conflicts with what is there: a list name in use, a size limit reached (`lists.*`), or an `Idempotency-Key` already used today for a different request (`idempotency.conflict`).
- 422: The request is invalid (`request.invalid`), or its cursor is (`pagination.*`).
- 503: A service this request needs is unavailable, or the API is at capacity. See `Retry-After`.
- 504: The request did not finish within its time budget (`upstream.timeout`).

Example request:

```bash
curl -X POST "https://api.sproutsdata.ai/v1/entities/companies" \
  -H "X-API-Key: $SPROUTS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "by": "domain",
       "ids": [
         "stripe.com",
         "adyen.com"
       ]
     }'
```

### POST /v1/entities/persons

Look up people

- URL: `POST https://api.sproutsdata.ai/v1/entities/persons`
- Scopes (any one): `dsp.entities.read`
- Cost: billed: an answer with results spends credits, an empty one is free
- Idempotency-Key header: optional

People by the `id` search returned, or found by LinkedIn URL or name with `by` (every candidate, up to 10, for a name; a name may carry its employer). 50 records a page: send the same body with `cursor` for the next.

Headers:

- `Idempotency-Key` (string): Send one to make a retry safe: a retry with the same key on the same UTC day is charged once.

Request body (JSON, required):

- `ids` (array of object (one of 1 shapes), required): The `id` values search returned, LinkedIn URLs or names; a name may be `{name, company}` with the person's employer (a domain, LinkedIn company page or name). Limits: 1 to 1000 items.
  - When PersonName:
    - `name` (string, required): Limits: 1 to 300 characters.
    - `company` (string or null): The employer: its domain, LinkedIn company page or name. Limits: at most 500 characters.
- `by` (string): `auto` (the default) classifies each value; `id` for the `id` values search returned, or `li_url` or `name`. One of: `"auto"`, `"id"`, `"li_url"`, `"name"`. Default `"auto"`.
- `cursor` (string or null): `next_cursor` from the previous page. Send the same body with it. Limits: at most 8192 characters.

Response 200 (application/json): Successful Response
Response fields:

- `meta` (object, required)
  - `as_of` (string (date-time), required)
  - `request_id` (string, required)
  - `credential` (string): One of: `"api_key"`, `"session"`. Default `"api_key"`.
  - `credits_balance` (number or null): What the workspace has available after this request, in credits (credits held for running agent runs excluded). `null` when not metered or not known just now; `GET /v1/credits` always has it.
  - `credits_charged` (number or null): What this request cost, in credits. `null` when not metered.
  - `environment` (string): Deprecated: always `live` (there are no test keys). Will be removed. One of: `"live"`. Default `"live"`.
- `results` (array of object, required)
  - `category` (string, required): What a returned row is. The same names as ``SearchCategory``. One of: `"company"`, `"person"`, `"patent"`, `"academic_report"`, `"news_article"`, `"market_report"`, `"trend"`, `"funding_round"`, `"job_opening"`.
  - `found` (boolean, required)
  - `id` (string, required): The value as sent.
  - `query` (string, required): The value as sent; each record carries it too.
  - `has_more` (boolean): More records match than `matches` shows: narrow the value. Default `false`.
  - `matched_by` (string or null): How the value was read: `id`, `domain`, `li_url` or `name`.
  - `matches` (array of object): Each record, with its public `id` (the one search gives it), the `query` it came from, `matched_by`, and `match`: `exact`, `contains` or `fuzzy` (a typo match).
  - `total` (integer): Records the value matches in all. Default `0`. Limits: at least 0.
- `total` (integer, required): Values in the lookup, on every page. Limits: at least 0.
- `attribution` (array of object)
  - `source_corpus` (string, required): Where rows came from: each is its own index with its own refresh cadence, so ``attribution[].as_of`` is per corpus. One of: `"gtm_index"`, `"affiliations"`, `"patents"`, `"academic_reports"`, `"news"`, `"market_reports"`, `"trends"`, `"fundings"`, `"job_openings"`.
  - `as_of` (string (date-time) or null)
  - `domain` (string or null)
  - `quote` (string or null): RESERVED for per-fact citation.
  - `url` (string or null): RESERVED for per-fact citation.
- `columns` (null)
- `coverage` (null)
- `degradation` (array of object)
  - `detail` (string, required)
  - `impact` (string, required): One of: `"recall"`, `"precision"`, `"freshness"`, `"fields"`.
  - `reason` (string, required): Why an answer is less than it should be. Closed, so a client can branch on it. One of: `"vector_coverage_incomplete"`, `"mode_downgraded"`, `"field_not_indexed"`, `"pagination_truncated"`, `"corpus_unavailable"`, `"anchor_list_capped"`, `"axis_not_applicable"`, `"planner_step_incomplete"`, `"upstream_advisory"`, `"no_match"`, `"topic_not_required"`, `"sparse_filter"`, `"anchor_not_exact"`.
  - `source_corpus` (string or null): Where rows came from: each is its own index with its own refresh cadence, so ``attribution[].as_of`` is per corpus. One of: `"gtm_index"`, `"affiliations"`, `"patents"`, `"academic_reports"`, `"news"`, `"market_reports"`, `"trends"`, `"fundings"`, `"job_openings"`.
- `has_more` (boolean): Default `false`.
- `next_cursor` (string or null): Send the same body with this `cursor` for the next page.
- `resolved_search` (null)
- `suggestion` (null)
- `total_is_estimate` (boolean): Default `false`.

Errors:

- 401: No credential, or one that does not verify (`auth.unauthorized`).
- 403: The credential lacks the scope this route needs (`auth.insufficient_scope`), or the signed-in user has not chosen a workspace (`auth.workspace_required`).
- 409: Conflicts with what is there: a list name in use, a size limit reached (`lists.*`), or an `Idempotency-Key` already used today for a different request (`idempotency.conflict`).
- 422: The request is invalid (`request.invalid`), or its cursor is (`pagination.*`).
- 503: A service this request needs is unavailable, or the API is at capacity. See `Retry-After`.
- 504: The request did not finish within its time budget (`upstream.timeout`).

Example request:

```bash
curl -X POST "https://api.sproutsdata.ai/v1/entities/persons" \
  -H "X-API-Key: $SPROUTS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "by": "li_url",
       "ids": [
         "https://www.linkedin.com/in/jane-doe-example"
       ]
     }'
```

## Errors to handle

- 422 `request.invalid`: too many values (over 1,000 by id, over 50 when resolving, over 100 for documents), unknown `by`, unknown keys.
- 402 `credits.insufficient`; 429 `quota.burst_exceeded` (honor `Retry-After`).

## See also

- https://dashboard.sproutsdata.ai/docs/agents/guides/record-lookup/complete-records
- https://dashboard.sproutsdata.ai/docs/agents/api-reference/entities-companies
- https://dashboard.sproutsdata.ai/docs/agents/api-reference/entities-persons
- https://dashboard.sproutsdata.ai/docs/agents/api-reference/entities-documents
