# Brickroad API v1

## Getting started

Query flow: submit once, wait for completion, read sources and contacts, then save your results.

### 1. Get an API key

1. Sign in to Brickroad and select your organization.
2. Open [Settings → API keys](/settings/api-keys) and create a key.
3. Copy the full key. It is shown once; store it securely.

The key selects your organization. Keep it in your server or local environment, never in browser code or a public repository.

Base URL: `https://brickroad.network/api/v1`

Set these variables before using the examples:

```bash
export BASE_URL="https://brickroad.network/api/v1"
export BRICKROAD_API_TOKEN="br_live_your_token"
```

Every authenticated request uses `Authorization: Bearer $BRICKROAD_API_TOKEN`. Do not add an `orgId`; the key already selects it.

### 2. Check the queue (optional)

Before sending a batch, check your org's run queue:

```bash
curl -sS "$BASE_URL/ifa/queue" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

- `running` and `queued` count runs across your org, including teammates' queries.
- `available` shows free slots. Other work in your organization can use these slots too.
- When `status` is `ready`, submit your query. For `busy`, check again after 30 seconds or submit now and let it queue.
- For `unavailable`, check `reason`. See [Query Queue](/docs/api#query-queue) for the full response.

This check does not reserve a slot. Your submission can still queue.

### 3. Submit a query

In `query`, describe:

- The subject and geography.
- Minimum history and data update frequency.
- Delivery format and anything to exclude.

These instructions guide the model. Use [task profiles and prompt rules](/docs/api#scouts-api-settings) for reusable settings and fields. Use `strategyId` to select structured rules already saved in the app.

```bash
curl -sS $BASE_URL/ifa/queries \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query":"Find alternative data suppliers that measure North American EV battery supply chains. Prefer weekly updates, at least three years of history, and API or CSV delivery. Exclude generic market reports."}'
```

The response is HTTP 202. Save `response.queryId`; use it for each later call. A queued query is accepted work. Submit once and poll it.

### 4. Wait for completion

Set `QUERY_ID` to the returned `queryId`:

```bash
export QUERY_ID="your_query_id"
curl -sS $BASE_URL/ifa/queries/$QUERY_ID \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

- While status is `queued` or `running`, wait `nextPollAfterSeconds` before polling again.
- When status is `completed`, read the results.
- For `failed` or `cancelled`, see [Errors](/docs/api#errors).

A run can take 30 minutes or more. Let your script wait outside an LLM call.

### 5. Read final sources

```bash
curl -sS "$BASE_URL/ifa/queries/$QUERY_ID/sources?final=true" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

Each result carries the run's own findings and the supplier's shared catalog facts.

- Save `response.sources[].id` as `sourceId` for detail and contact calls.
- The result ID is different from `catalog.id`.
- Use `sourceKey` to match the same source across runs.

### 6. Read evidence and contacts

Set `SOURCE_ID` to one result's `id`. Repeat for each source you need:

```bash
export SOURCE_ID="your_source_id"
curl -sS $BASE_URL/ifa/queries/$QUERY_ID/sources/$SOURCE_ID \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
curl -sS $BASE_URL/ifa/queries/$QUERY_ID/sources/$SOURCE_ID/contacts \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

Detail includes full evidence and custom task-profile fields. Contacts returns normalized and raw contact data. Both calls need the `queryId` and `sourceId`; one does not replace the other.

### 7. Save results

Save the query, sources, evidence, and contacts in your own system.

For ZDR, run DELETE only after saving everything you need:

- It removes the query and its linked operational data.
- Later reads of that query return 404.
- It keeps your account.

```bash
curl -sS -X DELETE $BASE_URL/ifa/queries/$QUERY_ID \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

**Other workflows**

- [List Queries](/docs/api#list-queries): find existing runs.
- [Delivered Sources Feed](/docs/api#delivered-sources-feed): read delivered sources across your org.
- [Scouts and Streams](/docs/api#scouts-api-scouts-and-streams): keep a question running on a schedule. Recurrence is unavailable for ZDR organizations.

## Overview

### Endpoints

All paths start at `https://brickroad.network/api/v1`, which includes `/api/v1`. Authenticate with an organization API key as a Bearer token. Use [Getting started](/docs/api#guide-getting-started) for the complete query flow.

| Method | Path | Use |
| --- | --- | --- |
| GET | `/artifacts` | list the artifacts the org's jobs kept in its store |
| GET | `/artifacts/{artifactId}/download` | redirect to a 15-minute download link for one kept artifact |
| GET | `/bought-bodies/{token}` | download one file your organization bought, by the signed link a composed delivery lists; the link is the credential, no API key |
| GET | `/data-lab/campaigns` | list the token org's Data Lab campaigns that have a published version |
| POST | `/data-lab/campaigns/{campaignId}/compose` | compose a draft from a campaign's files and a spec: its match starts, and no row is copied |
| GET | `/data-lab/campaigns/{campaignId}/compose/{draftId}` | read a composed draft's recipe, and with rows=true start the live read of its files |
| GET | `/data-lab/campaigns/{campaignId}/compose/specs` | list the organization's specs a compose may name, with their fields |
| POST | `/data-lab/campaigns/{campaignId}/inventory` | start reading one page of a campaign's live Inventory, by cursor or by file ids |
| GET | `/data-lab/campaigns/{campaignId}/inventory/{jobId}` | fetch a live Inventory page read once: running, its rows with our readings, or gone |
| POST | `/data-lab/campaigns/{campaignId}/inventory/facets` | start counting a campaign's live Inventory by 1 to 6 facets |
| GET | `/data-lab/campaigns/{campaignId}/inventory/facets/{jobId}` | fetch a live Inventory counts read: running, its facet buckets, or gone |
| POST | `/data-lab/campaigns/{campaignId}/runs/selection` | ask for a PoV run on a selection of a campaign's files, which Brickroad launches |
| GET | `/data-lab/campaigns/{campaignId}/versions/{version}/{view}` | read one published campaign version as its owner card or its report |
| GET | `/ifa/prompt-rules` | list the token owner prompt rules |
| POST | `/ifa/prompt-rules` | create a token owner prompt rule |
| DELETE | `/ifa/prompt-rules/{ruleId}` | remove one token owner prompt rule |
| PATCH | `/ifa/prompt-rules/{ruleId}` | edit one token owner prompt rule |
| GET | `/ifa/queries` | list recent queries, newest first |
| POST | `/ifa/queries` | submit a new query, one scout run |
| DELETE | `/ifa/queries/{queryId}` | delete one query and its linked operational data in the token organization |
| GET | `/ifa/queries/{queryId}` | get query status and result links |
| POST | `/ifa/queries/{queryId}/cancel` | cancel a queued or running query |
| GET | `/ifa/queries/{queryId}/sources` | list sources produced by a completed query |
| GET | `/ifa/queries/{queryId}/sources/{sourceId}` | get one source with evidence cells |
| GET | `/ifa/queries/{queryId}/sources/{sourceId}/contacts` | get contact fields for one source |
| GET | `/ifa/queue` | read org query counts and available capacity |
| GET | `/ifa/streams` | list the token owner recurring Streams |
| DELETE | `/ifa/streams/{streamId}` | delete a Stream without deleting completed queries |
| GET | `/ifa/streams/{streamId}` | get one recurring Stream |
| PATCH | `/ifa/streams/{streamId}` | change Stream frequency or pause and resume it |
| GET | `/ifa/streams/{streamId}/queries` | list the queries created by one Stream |
| POST | `/ifa/streams/{streamId}/run` | run a Stream now without changing its cadence |
| GET | `/ifa/task-profiles` | list organization and token-owner task profiles |
| POST | `/ifa/task-profiles` | create a task profile |
| DELETE | `/ifa/task-profiles/{profileId}` | remove one task profile |
| GET | `/ifa/task-profiles/{profileId}` | read one task profile |
| PATCH | `/ifa/task-profiles/{profileId}` | edit one task profile |
| GET | `/scouts` | list the organization question Scouts |
| POST | `/scouts` | create a question Scout and start its first run |
| DELETE | `/scouts/{scoutId}` | remove a Scout without deleting its completed runs |
| GET | `/scouts/{scoutId}` | get one Scout |
| PATCH | `/scouts/{scoutId}` | change a Scout question, name, cadence or settings, or pause and resume it |
| GET | `/scouts/{scoutId}/runs` | list the query runs one Scout started |
| GET | `/signals` | list and filter published Signals for a paid or active-trial company |
| GET | `/signals/{signalId}` | read a published Signal and its company-scoped contacts |
| GET | `/signals/{signalId}/datasets/{datasetId}` | read one linked Signal dataset and related published theses |
| GET | `/sources/delivered` | org-wide feed of every source ever delivered, keyed by sourceKey, or one scout with scoutId |
| GET | `/user/me` | read the user, organization and token a bearer token acts as |

### Check Your Key

`GET /user/me`

Check which user and organization an API key acts as. Use it to test a new key before other calls.

```json
{
  "user": { "id": "usr_123", "email": "you@example.com", "name": "You" },
  "organization": { "id": "org_123", "name": "Example Org" },
  "token": { "id": "api_tok_123", "type": "personal", "scope": "all" }
}
```

- A missing or wrong key gets `401`.
- Only a personal key has a user. An organization key gets `403` `owner_required`.
- A key whose user or organization was removed gets `404` `not_found`.

```bash
curl -sS "$BASE_URL/user/me" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

### Errors

All errors use one shape:

```json
{
  "success": false,
  "error": {
    "code": "query_not_found",
    "message": "Query not found."
  }
}
```

Common errors:

| HTTP | Code | Meaning |
| --- | --- | --- |
| 400 | `invalid_body` | Request body must be JSON. |
| 400 | `invalid_since` | `since` is not an ISO 8601 timestamp. |
| 400 | `invalid_cursor` | `cursor` is not a valid pagination cursor. |
| 400 | `invalid_org` | The query-list `org` flag must be `true` or `false`. |
| 400 | `invalid_task_profile` | Task profile fields did not pass validation. See `error.details.issues`. |
| 400 | `invalid_task_profile_ids` | Query profile IDs are malformed or repeated. |
| 400 | `invalid_task_profile_selection` | More than one selected profile targets the same task. |
| 400 | `missing_query` | `query` is required for submit. |
| 400 | `invalid_stream` | `stream` is not an object. |
| 400 | `invalid_stream_interval` | Stream interval is not an integer from 1 through 365 days. |
| 400 | `invalid_stream_status` | Stream status is not `active` or `paused`. |
| 400 | `invalid_scout` | Scout fields did not pass validation, or a field the Scout routes do not take was sent. The message names each field. |
| 400 | `invalid_question` | Scout question is blank. |
| 400 | `invalid_ends_at` | Scout `endsAt` has already passed or is more than a year out. |
| 400 | `invalid_interval` | Scout `intervalDays` is missing for `every-n-days`, outside 2 through 90, or sent beside another cadence. |
| 400 | `invalid_rules` | Scout settings did not pass the strategy rule checks. |
| 400 | `invalid_prompt_rule` | Prompt instruction did not pass validation. See `error.details.issues`. |
| 400 | `invalid_prompt_rule_task_id` | Prompt-rule task ID is unsupported. See `error.details.supportedTaskIds` for the complete list. |
| 401 | `missing_token` | Missing `Authorization: Bearer ...`. |
| 401 | `invalid_token` | Token is malformed, unknown, or wrong secret. |
| 401 | `revoked_token` | Token was revoked. Create a new API key. |
| 402 | `billing_required` | Creating or resuming a Scout needs an active plan or trial. |
| 403 | `inactive_owner` | Personal token owner is no longer active in the org. |
| 403 | `token_scope` | A supplier token reaches only the supplier tools on Brickroad's MCP server, not this API. |
| 403 | `owner_required` | Route needs a personal-token owner, not a service token. |
| 403 | `owner_not_found` | Personal token owner record could not be loaded. |
| 403 | `task_profile_forbidden` | Only an organization owner or admin can change an organization profile. |
| 403 | `credit_limit_reached` | Org has no credits for another query. |
| 403 | `streams_not_enabled` | Org ZDR policy, plan, or billing state does not allow Streams. |
| 403 | `scouts_not_enabled` | Scouts are not switched on for the org. |
| 403 | `forbidden` | The API key's owner is not a member of the Scout's org. |
| 403 | `zdr_unavailable` | Zero-data-retention orgs cannot create or resume Scouts. |
| 404 | `query_not_found` | Query id does not exist in your token org, or belongs to another org. |
| 404 | `stream_not_found` | Stream id is outside the token owner and org scope, or does not exist. |
| 404 | `scout_not_found` | Scout id belongs to another org, was removed, or does not exist. |
| 404 | `strategy_not_found` | Scout `strategyId` is not one of the org's strategies. |
| 404 | `task_profile_not_found` | Profile id is disabled, outside the token scope, or does not exist. |
| 404 | `source_not_found` | Source id does not exist for that query/org. |
| 404 | `prompt_rule_not_found` | Prompt rule id does not belong to the token owner. |
| 409 | `no_active_agent` | Org has no running agent to take the query. |
| 409 | `task_profile_conflict` | A profile name or default slot conflicts in the same scope and task. |
| 409 | `prompt_rule_limit_reached` | Token owner already has 10 prompt rules. |
| 409 | `results_not_ready` | Query exists, but sources are not ready. Poll status first. |
| 409 | `stream_run_unavailable` | Stream run-now could not start because no credits or active agent are available. |
| 429 | `in_flight`, `token_hourly`, `org_hourly` | A Data Lab live Inventory read or compose is already running for the organization, or the key or the organization started its reads or composes for the hour. Wait the `Retry-After` header's seconds, then start again. |
| 500 | `server_misconfigured` | API token auth is not configured. |
| 500 | `internal_error` | Unexpected server error. |

Security rules:

- API tokens are org-scoped.
- You cannot pass `orgId` in the payload or URL to switch orgs.
- Query and source ids from another org return 404.
- Stream ids outside the token owner and org scope return 404.
- Scout ids outside the token org return 404.
- Logs never include raw query text.
- Raw tokens are shown once in the app and are never returned by public API routes.

## Scouts API · Runs

### Query Queue

`GET /ifa/queue`

Check your organization's run queue before submitting a batch.

- Includes teammates' queries. The API key selects the org; no `org=true` flag is needed.
- Returns counts only. It does not include query text, results, or user details.
- Counts each query once. Its steps do not count as extra queries.
- Other work in your organization uses the same slots and can reduce `available`. It is not included in `running` or `queued`.
- This is a snapshot, not a slot reservation. A later query submission can still queue.

```json
{
  "status": "busy",
  "reason": "capacity",
  "running": 2,
  "queued": 1,
  "limit": 2,
  "available": 0,
  "observedAt": "2026-10-14T12:00:00.000Z"
}
```

| Field | Meaning |
| --- | --- |
| `status` | `ready`, `busy`, or `unavailable` |
| `reason` | Why work must wait; `null` when ready |
| `running` | Active queries; `null` when the agent cannot be reached |
| `queued` | Queries waiting across the org |
| `limit` | Current slot limit; `null` when there is no active agent |
| `available` | Slots available for a new query; `null` when unknown |
| `observedAt` | Time of this check, in UTC |

`busy` means the slots are in use or reserved (`capacity`), or queries are waiting (`queued`). Waiting queries get priority, so `available` is zero while the run queue is not empty.

`unavailable` means `no_agent`, `starting`, `unreachable`, `draining`, `disk_low`, or `plan_read_only`. Unknown capacity is not shown as a free slot.

Poll every 30 seconds while waiting. Submit when `status` is `ready`, or submit earlier and let the query wait in the queue.

```bash
curl -sS "$BASE_URL/ifa/queue" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

### Submit Query

`POST /ifa/queries`

Request:

```json
{
  "query": "Find alternative data vendors for EV battery supply chain visibility"
}
```

Request fields:

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `query` | string | yes | Non-empty natural-language discovery request. |
| `preset` | string | no | `balanced` or `thorough`. Missing, null, or unknown values normalize to `balanced`. |
| `fastVerify` | boolean | no | Enables the faster verification path when true. |
| `steering` | object | no | Additional free-form query hints forwarded to the discovery worker. |
| `taskProfileIds` | string[] | no | Explicit named task profiles for this run. At most one profile can target each task. |
| `strategyId` | string | no | Saved org strategy. Omit for the org default, or use `"none"` to skip it. See strategy rules below. |
| `stream` | object | no | Creates a recurring Stream with this query as its first run. Omit it for a one-time query. |
| `stream.intervalDays` | integer | with `stream` | Number of days between runs, from 1 through 365. |

**Strategy rules**

- An omitted `strategyId` uses the org default for one-time queries and Streams.
- Use `"none"` when you do not want a strategy.
- An unknown or disabled strategy returns 404 `strategy_not_found`.
- Unsupported exclusion rules return 422 `strategy_not_enforceable`.
- Invalid saved settings return 422 `strategy_invalid`.
- An invalid or unsupported org default blocks runs that omit `strategyId`. Change the default or send `"none"`.

```bash
curl -sS $BASE_URL/ifa/queries \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query":"Find alternative data vendors for EV battery supply chain visibility"}'
```

Response is async. A query can take 30 minutes or more. Do not keep an LLM call open while waiting.

```json
{
  "queryId": "e61c14h8thwg2fqb3yqvx5ct",
  "streamId": null,
  "query": "Find alternative data vendors for EV battery supply chain visibility",
  "status": "queued",
  "createdAt": "2026-06-30T19:30:00.000Z",
  "updatedAt": null,
  "nextPollAfterSeconds": 300,
  "links": {
    "self": "/api/v1/ifa/queries/e61c14h8thwg2fqb3yqvx5ct",
    "sources": "/api/v1/ifa/queries/e61c14h8thwg2fqb3yqvx5ct/sources"
  }
}
```

- Submit returns HTTP 202 with status `queued` or `running`.
- Poll the returned `queryId` in either case.
- Submit and cancel require a personal API token with an active owner.

### Poll Status

`GET /ifa/queries/{queryId}`

```bash
curl -sS $BASE_URL/ifa/queries/e61c14h8thwg2fqb3yqvx5ct \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

Wait `nextPollAfterSeconds` between requests. Let your script wait outside an LLM call.

Response:

```json
{
  "queryId": "e61c14h8thwg2fqb3yqvx5ct",
  "streamId": null,
  "query": "Find alternative data vendors for EV battery supply chain visibility",
  "status": "completed",
  "createdAt": "2026-06-30T19:30:00.000Z",
  "updatedAt": "2026-06-30T19:58:00.000Z",
  "nextPollAfterSeconds": 0,
  "links": {
    "self": "/api/v1/ifa/queries/e61c14h8thwg2fqb3yqvx5ct",
    "sources": "/api/v1/ifa/queries/e61c14h8thwg2fqb3yqvx5ct/sources"
  }
}
```

Statuses:

- `queued`: accepted, waiting for an agent slot
- `running`: dispatched to the data-discovery worker
- `completed`: Discover, Enrich, Verify, and QA are done, and final results are saved.
- `failed`: query failed before or during discovery
- `cancelled`: user cancelled the query

#### Query Fields

| Field | Type | Meaning |
| --- | --- | --- |
| `queryId` | string | Query id used by status, cancel, source-list, source-detail, and contact routes. |
| `streamId` | string or null | Stream that created this query. Null for a one-time query. |
| `query` | string | Original query text. |
| `status` | string | One of the query statuses above. |
| `createdAt` | ISO 8601 string | When the query was accepted. |
| `updatedAt` | ISO 8601 string or null | Latest known source or completed-run update. |
| `nextPollAfterSeconds` | number | Suggested wait before the next status poll. Zero means no more polling is needed. |
| `links.self` | string | API-root-relative status URL. |
| `links.sources` | string | API-root-relative source-list URL. |
| `links.stream` | string when present | API-root-relative Stream URL. Present only when `streamId` is set. |

### List Queries

`GET /ifa/queries`

| Need | Request |
| --- | --- |
| Queries created by the API key owner | `GET /ifa/queries` |
| All users' queries in the key's org | `GET /ifa/queries?org=true` |

- By default, returns the API key owner's queries in the key's org.
- Add `org=true` to include teammates' queries in that org.
- A service key with no owner must use `org=true`.
- Includes queries created through the app and API.

**Page size**

- Set `limit` to 1–100. The default is 25.
- Invalid values use 25; values outside the range use the nearest allowed value.
- Results are newest first. Query ID breaks ties.

**Next page**

1. Pass `nextCursor` as `cursor`, unchanged.
2. Keep the same `org` value on each request.
3. Stop when `nextCursor` is null.

A cursor still works if its query is deleted. Restart from page one to see newly created queries. Do not build cursors from IDs or timestamps.

```bash
curl -sS "$BASE_URL/ifa/queries?limit=25" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

Response:

```json
{
  "queries": [
    {
      "queryId": "e61c14h8thwg2fqb3yqvx5ct",
      "streamId": null,
      "query": "Find alternative data vendors for EV battery supply chain visibility",
      "status": "completed",
      "createdAt": "2026-06-30T19:30:00.000Z",
      "updatedAt": "2026-06-30T19:58:00.000Z",
      "nextPollAfterSeconds": 0,
      "links": {
        "self": "/api/v1/ifa/queries/e61c14h8thwg2fqb3yqvx5ct",
        "sources": "/api/v1/ifa/queries/e61c14h8thwg2fqb3yqvx5ct/sources"
      }
    }
  ],
  "nextCursor": null
}
```

#### Read Every Query Page

This example reads all queries in the key's org. Remove `org=true` to read only the key owner's queries. Keep the same scope and pass `nextCursor` unchanged on every page.

```js
const queries = [];
let cursor = null;
do {
  const url = new URL(`${baseUrl}/ifa/queries`);
  url.searchParams.set("limit", "100");
  url.searchParams.set("org", "true");
  if (cursor) url.searchParams.set("cursor", cursor);
  const response = await fetch(url, {
    headers: { Authorization: `Bearer ${token}` },
  });
  if (!response.ok) throw new Error(`Query list failed: ${response.status}`);
  const page = await response.json();
  queries.push(...page.queries);
  cursor = page.nextCursor;
} while (cursor !== null);
```

- `baseUrl`: your API root, ending in `/api/v1`.
- `token`: your API key.

Stream query history and `/sources/delivered` use the same `limit`, `cursor`, and `nextCursor` pattern.

### Cancel Query

`POST /ifa/queries/{queryId}/cancel`

```bash
curl -sS -X POST $BASE_URL/ifa/queries/e61c14h8thwg2fqb3yqvx5ct/cancel \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

Response:

```json
{
  "queryId": "e61c14h8thwg2fqb3yqvx5ct",
  "status": "cancelled",
  "cancelled": true
}
```

Cancellation is best-effort. `cancelled: false` can mean:

- The query already finished or stopped.
- There is no active run to cancel.
- The query changed state while cancellation was requested.

Chained queries use the same stop action as the app, including after discovery.

If cancellation returns false, poll the query for its current status.

### Delete Query

`DELETE /ifa/queries/{queryId}`

Save results before deletion. Cancel stops unfinished work where possible; a query DELETE removes one query and its linked operational data; a Stream or Scout DELETE stops future recurrence and keeps completed queries. For ZDR, submit once, wait for completion, save results, then delete that query ID. DELETE keeps your account.

After you save the results you need, delete one explicit query ID:

```bash
curl -sS -X DELETE $BASE_URL/ifa/queries/e61c14h8thwg2fqb3yqvx5ct \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

Response:

```json
{
  "deleted": true,
  "queryId": "e61c14h8thwg2fqb3yqvx5ct"
}
```

This is an org-scoped operation:

- You can delete your own or a teammate's query in the key's org.
- Deleting another organization's query returns 404.
- DELETE removes linked operational data and keeps the account.
- For ZDR, it also removes unused private `sources` rows. Sources shared with another org, public sources, and sources independently found by a non-ZDR org stay.

A running query or data whose query ownership cannot be resolved returns 409. After successful deletion, GET of that query returns 404.

## Scouts API · Results

**Choose the result shape**

| Need | Request |
| --- | --- |
| Final results for one query | `GET /ifa/queries/{queryId}/sources?final=true` |
| Full evidence and custom fields for one result | `GET /ifa/queries/{queryId}/sources/{sourceId}` |
| Normalized and raw contact fields | `GET /ifa/queries/{queryId}/sources/{sourceId}/contacts` |
| Delivered results across all org queries | `GET /sources/delivered` |

- Query results join your run's findings with the shared catalog's facts about the source.
- Use a result's `id` as `sourceId`; `catalog.id` is different.
- Use `sourceKey` to match sources across runs.
- Custom task-profile values are in detail's `evidence`, not source summaries.

### Read Sources

`GET /ifa/queries/{queryId}/sources`

```bash
curl -sS "$BASE_URL/ifa/queries/e61c14h8thwg2fqb3yqvx5ct/sources" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

By default, returns one result per source group.

The group uses `entityGroupKey`, then `sourceKey` if no group key exists. A row with neither key stays separate.

- Known company subdomains and GitHub pages with matching owner evidence can share a key.
- Package pages need matching GitHub owner evidence to join that group.
- Pages on shared sites or with unclear ownership stay separate.
- Selection prefers Final, then enriched, then the best contact level and scores.

Use `final=true` for final results. This filter applies before grouping:

```bash
curl -sS "$BASE_URL/ifa/queries/e61c14h8thwg2fqb3yqvx5ct/sources?final=true" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

Use `raw=true` only when you need every discovered page:

```bash
curl -sS "$BASE_URL/ifa/queries/e61c14h8thwg2fqb3yqvx5ct/sources?raw=true" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

`raw` and `final` are independent controls:

| Parameters | Result |
| --- | --- |
| none | One representative per canonical entity across all candidates. |
| `final=true` | One representative per canonical entity from final delivery. |
| `raw=true` | Every discovered source page. |
| `raw=true&final=true` | Every final-delivery source row without entity grouping. |

Results come in the order the app lists the run's table, final rows first. With a custom ranking, they come in that ranking's order. Rows from runs that predate this order come after, by ranking score.

A completed query returns `{ "sources": [] }` when no sources match. This is a finished result, not a signal to keep polling.

Response:

```json
{
  "sources": [
    {
      "id": "a5wicze8iqj8md8q8fkvlm1d",
      "sourceKey": "example.com",
      "entityGroupKey": null,
      "name": "Example Data Co",
      "description": "Tracks specialty logistics signals.",
      "url": "https://example.com",
      "whyMatched": "mentions battery logistics coverage",
      "scores": {
        "ranking": 0.91,
        "novelty": 0.7,
        "relevance": 0.8,
        "accessibility": 0.6,
        "alpha": 0.75
      },
      "tags": {
        "geography": ["US"],
        "gics": [
          {
            "sector": "Industrials",
            "industryGroup": "Capital Goods",
            "industry": "Electrical Equipment",
            "subIndustry": "Electrical Components & Equipment"
          }
        ],
        "exchanges": ["NASDAQ"],
        "instruments": ["equities"],
        "sampleTickers": ["TSLA"],
        "tickers": ["TSLA", "equities"],
        "categories": ["supply_chain"]
      },
      "contactAvailable": true,
      "kind": "established",
      "mixTier": "established",
      "catalogueListed": true
    }
  ]
}
```

Use `sources[].id` from this response as `sourceId` for source detail and contacts.

The list returns source summaries. Use the flags above to choose grouped, raw, or final results. For full enriched evidence cells, read source detail.

#### Source Summary Fields

| Field | Type | Meaning |
| --- | --- | --- |
| `id` | string | Source id scoped to this query and organization. |
| `sourceKey` | string | Stable cross-run join key: the registrable-domain slug this source resolved to. The same supplier keeps the same `sourceKey` in every query and run of your organization, while `id` changes per query. Dedupe and diff deliveries on this field. |
| `entityGroupKey` | string or null | Canonical entity key when the pipeline grouped several pages or domains into one entity. Null when the source stands alone under its `sourceKey`. |
| `name` | string | Best available source or company name. Falls back to the entity key or URL. |
| `description` | string or null | Short source description when available. |
| `url` | string | Source website or product URL. |
| `whyMatched` | string or null | First available value from `why_matched`, `reasoning`, or the source discovery query. |
| `scores` | object | Public ranking, novelty, relevance, accessibility, and alpha scores. |
| `tags` | object | Public coverage classifications. Arrays are present even when empty. |
| `contactAvailable` | boolean | Whether a usable level 1-3 contact or contact evidence exists. |
| `kind` | string | The supplier's category, as the scouts view colours it: `established` when the run judged it an established provider or a data catalog lists it (a listing wins over the run's novel tag), `frontier` when the run tagged it novel and no catalog lists it, else `between`. |
| `mixTier` | string or null | The run's own results-mix tier for a delivered source: `established`, `novel` or `other`. Null for a source the run did not deliver, or a run without tiers. |
| `catalogueListed` | boolean or null | Whether a data catalog lists the supplier, from the catalog check alone. Null when no check was recorded. |
| `catalog` | object or null | Generic canonical `sources` data; see the field list below. |

#### Generic Catalog Source

List, detail, and delivered-source results include `catalog`:

- The supplier's shared catalog facts, matched by `sourceKey`.
- Top-level findings, scores, evidence, and contacts come from your own run's result.
- `raw=true` changes grouping, not this join.

`catalog` is nullable if no canonical row is available. `catalog.id` is the shared catalog id, while the top-level `id` remains the query result ID used for detail and contacts.

```json
{
  "catalog": {
    "id": "catalog-source-id",
    "slug": "example.com",
    "name": "Example Data Co",
    "sourceUrl": "https://example.com",
    "sampleUrl": null,
    "sourceKind": "provider",
    "tier": 1,
    "globalListing": false,
    "sourceMetadata": { "access": { "mode": "keyless" } },
    "score": null,
    "sourceCreatedAt": null,
    "createdAt": "2026-06-30T19:30:00.000Z",
    "updatedAt": "2026-06-30T19:58:00.000Z"
  }
}
```

**Excluded shared fields**

- `catalog` carries only the fields shown above; internal bookkeeping on the shared row is never served.
- `sourceMetadata` carries only the catalog's own keys (the description, enrichment, docs and sign-up links, pricing, the classification record, the curated scores and the access mode). Anything another organization's run wrote is not served, and a key added later is not served until it is listed.
- `sourceMetadata.access` carries only `mode` (the access tier) and `signup_url` (the supplier's sign-up page). How an endpoint is reached (probe verdicts and evidence, round-trip URLs, credential field names, repoints, recipes) is the platform's procedure: it serves every organization's agents and is never returned to a user.

Query-specific evidence and contacts come from your own run.

#### Scores

All score values are numbers or null. Component scores are normally from 0 to 1. The composite `ranking` score can exceed 1 for general-intent queries.

| Field | Meaning |
| --- | --- |
| `ranking` | Intent-aware ordering score. Explicit queries favor relevance, exploratory queries favor alpha, and general queries combine relevance and novelty. It can be null before ranking is materialized or for older/direct-read results. |
| `novelty` | How hard the source is to find through conventional research. |
| `relevance` | Topical fit to the interpreted query. |
| `accessibility` | Estimated procurement/contact feasibility. It does not guarantee that a contact or license is available. |
| `alpha` | Novelty multiplied by relevance. |

#### Coverage Tags

Coverage tags are AI-assisted classifications grounded in real market taxonomies and identifiers. They describe the data a source covers. They are not hidden inputs used to calculate the scores above.

| Field | Type | Meaning |
| --- | --- | --- |
| `geography` | string array | Legacy geography classifications when available. |
| `gics` | object array | Four-level GICS classifications. Every object contains `sector`, `industryGroup`, `industry`, and `subIndustry`. |
| `exchanges` | string array | Exchanges where the covered public companies trade. |
| `instruments` | string array | Asset types covered by the data. |
| `sampleTickers` | string array | Real example tickers the data may provide signal for. |
| `categories` | string array | Public name for the coverage-tag `dataCategory` array, such as `alternative`, `geospatial`, or `supply_chain`. |
| `tickers` | string array | Backward-compatible combination of `sampleTickers` and `instruments`. New integrations should use those fields directly. |

Tags can be empty when a source has not reached enrichment or when an older result predates coverage tagging.

### Read Source Detail

`GET /ifa/queries/{queryId}/sources/{sourceId}`

```bash
curl -sS $BASE_URL/ifa/queries/e61c14h8thwg2fqb3yqvx5ct/sources/a5wicze8iqj8md8q8fkvlm1d \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

Response:

```json
{
  "source": {
    "id": "a5wicze8iqj8md8q8fkvlm1d",
    "sourceKey": "example.com",
    "entityGroupKey": null,
    "name": "Example Data Co",
    "description": "Tracks specialty logistics signals.",
    "url": "https://example.com",
    "whyMatched": "mentions battery logistics coverage",
    "scores": {
      "ranking": 0.91,
      "novelty": 0.7,
      "relevance": 0.8,
      "accessibility": 0.6,
      "alpha": 0.75
    },
    "tags": {
      "geography": ["US"],
      "gics": [
        {
          "sector": "Industrials",
          "industryGroup": "Capital Goods",
          "industry": "Electrical Equipment",
          "subIndustry": "Electrical Components & Equipment"
        }
      ],
      "exchanges": ["NASDAQ"],
      "instruments": ["equities"],
      "sampleTickers": ["TSLA"],
      "tickers": ["TSLA", "equities"],
      "categories": ["supply_chain"]
    },
    "contactAvailable": true,
    "status": "enriched",
    "evidence": {
      "why_matched": {
        "value": "mentions battery logistics coverage",
        "status": "verified",
        "confidence": 0.92,
        "evidence": {
          "url": "https://example.com/product",
          "quote": "[redacted short supporting quote]"
        }
      },
      "dataset_type": {
        "value": "Shipment and inventory event data",
        "status": "verified",
        "confidence": 0.9,
        "evidence": {
          "url": "https://example.com/product"
        }
      },
      "data_format": {
        "value": "API and CSV",
        "status": "verified",
        "confidence": 0.9,
        "evidence": {
          "url": "https://example.com/docs"
        }
      },
      "email": {
        "value": "contact@example.com",
        "status": "verified",
        "confidence": 0.88,
        "evidence": {
          "url": "https://example.com/contact"
        }
      }
    }
  }
}
```

#### Detail-only Fields

The detail response contains every summary field plus:

| Field | Type | Meaning |
| --- | --- | --- |
| `status` | string | Current source pipeline status. |
| `evidence` | object | Dynamic map keyed by evidence column name. |

#### Evidence Cell Shape

Every key inside `evidence` uses this shape:

| Field | Type | Meaning |
| --- | --- | --- |
| `value` | string or null | Enriched value. Null means the column exists but no value was found. |
| `status` | string | Pipeline-defined verification or inference status. Handle unknown future values. |
| `confidence` | number | Confidence from 0 to 1. |
| `evidence` | any JSON value | Supporting URLs, quotes, metadata, or null. The exact proof shape can vary by column. |

#### Canonical Business Evidence Fields

These are the stable business fields clients can use when present:

| Category | Key | Meaning |
| --- | --- | --- |
| Identification | `company_name` | Normalized company or source name. |
| Dataset profile | `dataset_type` | Inferred kind of dataset and its time or subject coverage. |
| Dataset profile | `data_format` | Known or inferred delivery and storage formats. |
| Dataset profile | `implied_labels` | Labels, dimensions, or structure implied by the dataset. |
| Dataset profile | `use_cases` | Potential research, ML, or operational uses. |
| Scale | `registered_users` | Known or estimated registered user or customer count. |
| Scale | `mau_dau` | Known or estimated monthly and daily active users. |
| Scale | `content_volume` | Known or estimated volume of records, files, or content. |
| Scale | `growth_status` | Current activity and growth signal. |
| Historical depth | `product_launch` | Earliest known product or dataset launch. |
| Historical depth | `significant_scale` | When the product or dataset reached material scale. |
| Historical depth | `archive_depth` | Estimated historical lookback or archive coverage. |
| Contacts | `primary_contact` | Best available named contact. |
| Contacts | `primary_title` | Role or title of the primary contact. |
| Contacts | `primary_linkedin` | LinkedIn URL for the primary contact. |
| Contacts | `email` | Best available contact email. |
| Qualification | `scale_estimate` | Overall company or dataset scale assessment. |
| Qualification | `feasibility` | Estimated feasibility of contacting or licensing the data. |
| Qualification | `qualification_notes` | Important licensing, privacy, IP, or procurement notes. |
| Qualification | `recommended_next_step` | Suggested next research or outreach action. |
| Qualification | `found_in_catalogues` | Whether the source is already an established catalog supplier. |

- Read coverage from `tags` and public scores from `scores`.
- Extra diagnostic evidence keys can appear, but those keys are not a stable public contract. Do not require them in an integration.

#### Source Status and Sparse Results

- `discovered`: basic metadata only; business evidence and coverage tags can be empty.
- `enriched`: enrichment completed; unavailable individual fields can still be absent or null.
- `deferred`: the source was not selected for enrichment in this run.
- `enrich_failed`: enrichment was attempted but failed.
- `dedup_demoted`: the source was removed as a duplicate.
- `rule_excluded`: the run's rules left the source out before it was researched, for example because the query asked for vendors not yet listed on a data marketplace and this one is.
- Future status strings can be added. Clients should preserve unknown values instead of failing.

Absence and null are different:

- Missing evidence key: the pipeline did not return that column for this source.
- Evidence key with `value: null`: the column exists, but no value was found.
- Empty tag array: that classification was unavailable or not yet produced.
- Null score: that score was unavailable, not materialized, or from an older/direct-read result.

The API does not invent missing evidence. Discovered, deferred, failed, older, and partially enriched sources can all be sparse.

### Read Contacts

`GET /ifa/queries/{queryId}/sources/{sourceId}/contacts`

```bash
curl -sS $BASE_URL/ifa/queries/e61c14h8thwg2fqb3yqvx5ct/sources/a5wicze8iqj8md8q8fkvlm1d/contacts \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

Response:

```json
{
  "sourceId": "a5wicze8iqj8md8q8fkvlm1d",
  "primaryContact": {
    "name": "Jordan Lee",
    "title": "Head of Data Partnerships",
    "linkedinUrl": "https://www.linkedin.com/in/jordan-lee",
    "email": "contact@example.com"
  },
  "contacts": {
    "primary_contact": "Jordan Lee",
    "primary_title": "Head of Data Partnerships",
    "primary_linkedin": "https://www.linkedin.com/in/jordan-lee",
    "email": "contact@example.com"
  }
}
```

`primaryContact` is the stable normalized contact shape.

- All four keys are present; missing values are null.
- Values use the exact fallback order below.

| Normalized field | Evidence fallback order |
| --- | --- |
| `name` | `primary_contact`, `contact_name`, `contact` |
| `title` | `primary_title`, `contact_title`, `procurement_contact` |
| `linkedinUrl` | `primary_linkedin`, `contact_linkedin`, `linkedin` |
| `email` | `email`, `contact_email` |

`contacts` keeps non-empty raw values under their original names for backward compatibility and debugging.

**Possible keys**

- Primary contact: `primary_contact`, `primary_title`, `primary_linkedin`, `email`.
- Other named contact: `contact_name`, `contact_title`, `contact_linkedin`, `contact_email`.
- Other contact data: `contacts`, `contact`, `contact_info`, `procurement_contact`.

No fuzzy or regex-based guessing is used.

`contactAvailable` on source responses is true for contact levels 1 through 3 or when contact evidence exists. Level 4 means no usable contact was found.

If no contacts exist yet:

```json
{
  "sourceId": "a5wicze8iqj8md8q8fkvlm1d",
  "primaryContact": {
    "name": null,
    "title": null,
    "linkedinUrl": null,
    "email": null
  },
  "contacts": {}
}
```

### Delivered Sources Feed

`GET /sources/delivered`

Read delivered sources across your org, grouped by `sourceKey` and ordered by first delivery, instead of walking every query. Use `since` to sync new sources without reading each query, and `scoutId` for what one scout's runs delivered. It does not return every candidate from every run, only what was delivered.

```bash
curl -sS "$BASE_URL/sources/delivered?since=2026-09-01T00:00:00Z&limit=100" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

Query parameters:

| Parameter | Type | Meaning |
| --- | --- | --- |
| `scoutId` | string, optional | Only sources delivered by this scout's runs. The scout must be one of your org's, else 404 `scout_not_found`; a removed scout still answers, as its completed runs stay readable. With it, `firstDeliveredAt`, `seenInRunCount` and `deliveredInQueryIds` count that scout's runs alone. |
| `since` | ISO 8601 timestamp, optional | Only sources whose `firstDeliveredAt` is strictly after this instant. |
| `cursor` | string, optional | Opaque cursor from the previous page's `nextCursor`. |
| `limit` | integer, optional | Page size from 1 through 500. Default 100. Out-of-range values are clamped. Keep `scoutId` and `since` the same across pages. |

Response:

```json
{
  "sources": [
    {
      "id": "a5wicze8iqj8md8q8fkvlm1d",
      "sourceKey": "example.com",
      "entityGroupKey": null,
      "key": "example.com",
      "name": "Example Data Co",
      "description": "Tracks specialty logistics signals.",
      "url": "https://example.com",
      "whyMatched": "mentions battery logistics coverage",
      "scores": {
        "ranking": 0.91,
        "novelty": 0.7,
        "relevance": 0.8,
        "accessibility": 0.6,
        "alpha": 0.75
      },
      "tags": {
        "geography": ["US"],
        "gics": [],
        "exchanges": ["NASDAQ"],
        "instruments": ["equities"],
        "sampleTickers": ["TSLA"],
        "tickers": ["TSLA", "equities"],
        "categories": ["supply_chain"]
      },
      "contactAvailable": true,
      "firstDeliveredAt": "2026-09-02T14:05:11.000Z",
      "updatedAt": "2026-09-20T09:41:03.000Z",
      "seenInRunCount": 3,
      "deliveredInQueryIds": [
        "e61c14h8thwg2fqb3yqvx5ct",
        "k2m9x1q7p4vw8n3zr6t0ycfb"
      ],
      "latestQueryId": "k2m9x1q7p4vw8n3zr6t0ycfb",
      "links": {
        "source": "/api/v1/ifa/queries/k2m9x1q7p4vw8n3zr6t0ycfb/sources/a5wicze8iqj8md8q8fkvlm1d",
        "contacts": "/api/v1/ifa/queries/k2m9x1q7p4vw8n3zr6t0ycfb/sources/a5wicze8iqj8md8q8fkvlm1d/contacts"
      }
    }
  ],
  "nextCursor": "MjAyNi0wOS0wMlQxNDowNToxMS4wMDBafGV4YW1wbGUuY29t"
}
```

Each record is the source summary of the most recently updated delivered row for that key, plus feed fields:

| Field | Type | Meaning |
| --- | --- | --- |
| `key` | string | Grouping key: `sourceKey`, else `entityGroupKey`, else the URL. Unique within the feed. |
| `firstDeliveredAt` | string | First time any query delivered this key to your organization. Stable across later runs. |
| `updatedAt` | string | Most recent update to any delivered row for this key. |
| `seenInRunCount` | integer | Number of distinct queries that delivered this key. |
| `deliveredInQueryIds` | string[] | Every query id that delivered this key. |
| `latestQueryId` | string | Query whose row produced the summary fields and `id`. |
| `links` | object | Detail and contacts routes for that latest row. |

**Paging rules**

- Follow `nextCursor` until it is `null`, even if a page has fewer rows than `limit`.
- Policy-blocked URLs can make a page shorter.
- Cursors use `firstDeliveredAt` and `key`. Pass them unchanged; do not build them yourself.

The feed reads only your organization's own delivered rows to determine membership. The `catalog` join adds generic shared `sources` facts for those rows; other orgs' query evidence and contacts are never joined.

## Scouts API · Scouts and Streams

**Choose the scope**

| Scope | API | Create |
| --- | --- | --- |
| Organization | `/scouts` | Any org member creates a shared standing question. |
| API key owner | `/ifa/streams` | Submit a query with `stream.intervalDays`. |

Both produce normal query IDs for reading results. They are separate resources with separate IDs. Recurring Streams and Scouts are unavailable for ZDR organizations.

### Org Scouts

An org Scout repeats a shared question to find new sources.

- All org members manage the same Scouts in the app and API.
- Each run uses org credits and returns a `queryId`.
- Read results through the query and source endpoints.
- Personal Streams and org Scouts use separate endpoints and IDs.

#### Create a Scout

`POST /scouts`

Its first run starts immediately:

```bash
curl -sS -X POST $BASE_URL/scouts \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "question": "Find new North American battery recyclers",
    "cadence": "every-n-days",
    "intervalDays": 10,
    "resultsTarget": 20
  }'
```

Request fields:

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `question` | string | yes | The discovery question every run asks. Non-blank, at most 1000 characters. |
| `name` | string | no | Label, at most 60 characters. Omit it and the Scout is named for its question. |
| `cadence` | string | no | `once`, `daily`, `every-2-days` (default), or `every-n-days`. A `once` Scout runs only its first run. |
| `intervalDays` | integer | with `every-n-days` | Days between runs, from 2 through 90. Sent without `cadence`, it means `every-n-days`. Sent beside another cadence, it is refused. |
| `endsAt` | string or null | no | When the Scout stops running on its own, as an ISO 8601 instant: ahead of now and at most a year out. Omit it or send null to run forever. Ignored for a `once` Scout. |
| `strategyId` | string or null | no | The strategy its runs follow. Omit it or send null for the organization's default strategy. |
| `resultsTarget` | integer or null | no | How many sources a run aims to deliver, from 5 through 50. Null follows the strategy. |
| `fastVerify` | boolean or null | no | Enables the faster verification path. Null follows the strategy. |

Any other field is refused with 400 `invalid_scout`. The HTTP 201 response:

```json
{
  "scout": {
    "scoutId": "scout_id_here",
    "name": "North American battery recyclers",
    "question": "Find new North American battery recyclers",
    "cadence": "every-n-days",
    "intervalDays": 10,
    "endsAt": null,
    "status": "active",
    "strategyId": null,
    "resultsTarget": 20,
    "fastVerify": null,
    "nextRunAt": "2026-10-15T09:00:00.000Z",
    "lastRunAt": null,
    "runCount": 0,
    "createdAt": "2026-10-05T16:00:00.000Z",
    "updatedAt": "2026-10-05T16:00:00.000Z",
    "links": {
      "self": "/api/v1/scouts/scout_id_here",
      "runs": "/api/v1/scouts/scout_id_here/runs"
    }
  }
}
```

**Run fields**

- `nextRunAt` is null when paused, after `endsAt`, or for a `once` Scout.
- Passing `endsAt` stops runs without changing `status`.
- Move `endsAt` into the future or set it to null to allow runs again, subject to the Scout's status.
- `runCount` counts started queries; `lastRunAt` is the latest start time.
- The first run appears after the first scheduled cycle starts it.

#### List and get Scouts

`GET /scouts`

`GET /scouts/{scoutId}`

- List returns `{ "scouts": [...] }`, oldest first.
- Read one returns `{ "scout": {...} }`.

```bash
curl -sS $BASE_URL/scouts \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"

curl -sS $BASE_URL/scouts/scout_id_here \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

#### List Scout runs

`GET /scouts/{scoutId}/runs`

- Returns newest runs first in `runs`.
- `limit`: 1–100; default 25.
- Pass `nextCursor` as `cursor` until it is null.
- Run fields match Stream query history, with `scoutId` and `links.scout` added. `streamId` is null.

```bash
curl -sS "$BASE_URL/scouts/scout_id_here/runs?limit=25" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

```json
{
  "runs": [
    {
      "queryId": "query_id_here",
      "streamId": null,
      "scoutId": "scout_id_here",
      "query": "Find new North American battery recyclers",
      "status": "running",
      "createdAt": "2026-10-05T16:00:05.000Z",
      "updatedAt": null,
      "nextPollAfterSeconds": 300,
      "links": {
        "self": "/api/v1/ifa/queries/query_id_here",
        "sources": "/api/v1/ifa/queries/query_id_here/sources",
        "scout": "/api/v1/scouts/scout_id_here"
      }
    }
  ],
  "nextCursor": null
}
```

#### Update a Scout

`PATCH /scouts/{scoutId}`

Send at least one field:

- Question: `question`, `name`, or `strategyId`.
- Schedule: `cadence`, `intervalDays`, or `endsAt`.
- Results: `resultsTarget` or `fastVerify`.
- State: `status` to pause or resume.

Returns `{ "scout": {...} }`.

```bash
curl -sS -X PATCH $BASE_URL/scouts/scout_id_here \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"status":"paused"}'

curl -sS -X PATCH $BASE_URL/scouts/scout_id_here \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"status":"active","intervalDays":14}'
```

- A new question applies to the next run.
- Changing `resultsTarget` or `fastVerify` keeps other settings saved in the app.
- Resume waits for the next scheduled run; it does not start a run now.

#### Delete a Scout

`DELETE /scouts/{scoutId}`

Stops future runs. Completed runs remain readable through the query endpoints.

```bash
curl -sS -X DELETE $BASE_URL/scouts/scout_id_here \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

This returns `{ "scoutId": "scout_id_here", "deleted": true }`.

**Access rules**

- The key owner must be an org member; otherwise 403 `forbidden`.
- A key without an owner gets 403 `owner_required`.
- The org must have Scouts access; otherwise 403 `scouts_not_enabled`.
- Create and resume require an active plan or trial; otherwise 402 `billing_required`.
- The key's owner is recorded as the Scout's author.
- ZDR orgs cannot create or resume Scouts: 403 `zdr_unavailable`. Pause, edit, and delete remain available.

These endpoints manage question Scouts. News-based Scouts are managed in the app and are not returned here.

### Personal Streams

A personal Stream repeats the same query every `intervalDays`.

- The first query starts immediately.
- Each run uses org credits and returns a `queryId`.
- Read each run through the query and source endpoints.

#### Create a Stream

`POST /ifa/queries`

Create a Stream through the normal query submit route:

```bash
curl -sS $BASE_URL/ifa/queries \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "Find new North American battery recyclers",
    "stream": { "intervalDays": 7 }
  }'
```

The HTTP 202 response includes the first query and the new Stream:

```json
{
  "queryId": "query_id_here",
  "streamId": "stream_id_here",
  "query": "Find new North American battery recyclers",
  "status": "queued",
  "createdAt": "2026-09-11T16:00:00.000Z",
  "updatedAt": null,
  "nextPollAfterSeconds": 300,
  "links": {
    "self": "/api/v1/ifa/queries/query_id_here",
    "sources": "/api/v1/ifa/queries/query_id_here/sources",
    "stream": "/api/v1/ifa/streams/stream_id_here"
  },
  "stream": {
    "streamId": "stream_id_here",
    "query": "Find new North American battery recyclers",
    "intervalDays": 7,
    "status": "active",
    "nextRunAt": "2026-09-18T16:00:00.000Z",
    "lastRunAt": null,
    "createdAt": "2026-09-11T16:00:00.000Z",
    "links": {
      "self": "/api/v1/ifa/streams/stream_id_here",
      "queries": "/api/v1/ifa/streams/stream_id_here/queries",
      "run": "/api/v1/ifa/streams/stream_id_here/run"
    }
  }
}
```

#### List Streams

`GET /ifa/streams`

List Streams owned by the personal API token owner:

```bash
curl -sS $BASE_URL/ifa/streams \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

This returns `{ "streams": [...] }`, ordered by the next run time.

#### Get a Stream

`GET /ifa/streams/{streamId}`

Read one of your Streams by ID.

#### List Stream queries

`GET /ifa/streams/{streamId}/queries`

- Returns newest runs first in `queries`.
- `limit`: 1–100; default 25.
- Pass `nextCursor` as `cursor` until it is null.
- Keep the same Stream ID across pages.

#### Update a Stream

`PATCH /ifa/streams/{streamId}`

Pause, resume, or change the cadence:

```bash
curl -sS -X PATCH $BASE_URL/ifa/streams/stream_id_here \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"status":"paused"}'

curl -sS -X PATCH $BASE_URL/ifa/streams/stream_id_here \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"status":"active","intervalDays":3}'
```

- Changing `intervalDays` schedules the next run that many days from now.
- Pause keeps the saved next-run time.
- An overdue Stream can run on the next hourly check after resume.

#### Run a Stream

`POST /ifa/streams/{streamId}/run`

Run it now without changing its cadence:

```bash
curl -sS -X POST $BASE_URL/ifa/streams/stream_id_here/run \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

The run-now route returns HTTP 202 with the new query payload.

#### Delete a Stream

`DELETE /ifa/streams/{streamId}`

Stops future recurrence. Completed query results stay available.

**Access rules**

- A personal API token can access only its owner's Streams in the key's org.
- Create, resume, change frequency, and run now require Streams access.
- Pause and delete remain available after losing that access.
- ZDR orgs cannot create or enable recurrence, including through an admin key or paid plan.
- For ZDR, omit `stream` to submit once. Recurrence returns 403 `streams_not_enabled` before saving a query, schedule, job, or credit charge.

## Scouts API · Settings

### Configure runs

Settings apply to future queries.

- Personal API keys manage their owner's profiles and read org profiles.
- Org owners and admins can also manage org profiles.
- The key selects the org; requests cannot select another org ID.

Choose configuration by what you want to change:

| Need | Where to set it | Effect |
| --- | --- | --- |
| Requirements for this question | `query` in `POST /ifa/queries` | Text instructions for one run. State subject, coverage, minimum history, data update frequency, delivery format, and exclusions. |
| Candidate counts, verification settings, extra evidence fields, or ranking weights | `/ifa/task-profiles` | Named settings for one phase. Save many, but select at most one for each phase in a run. |
| Instructions reused on future questions | `/ifa/prompt-rules` | Separate additive instructions. All enabled matching user and organization rules apply. |
| A saved strategy's structured filters | `strategyId` in `POST /ifa/queries` | Selects a strategy already saved for the org. v1 has no strategy create, edit, or list endpoint. |

Geography, history, data update frequency, and domain allow/deny lists are strategy rules.

- Task profiles reject these fields with `invalid_task_profile`.
- With v1, put these requirements in the query or prompt rules.
- Text guides the model. It does not create structured strategy filters.

Data update frequency means how often the source's data changes. A Stream's `intervalDays` controls when Brickroad repeats your query.

ZDR orgs can use one-time queries, task profiles, and prompt rules. Recurring Streams and Scouts are unavailable.

### Task Profiles

Task profiles are named settings for one core task. You can save many profiles for the same task. Only one profile is selected for each task in a run.

#### Profile settings

Supported `taskInputs`:

| Phase / `taskId` | Setting | Allowed value | Use |
| --- | --- | --- | --- |
| Discover / `ifa-discover` | `top_k` | integer 1–50 | Number of top candidates surfaced by Discover. The full searched and stored candidate pool can be larger; this is not the final result count. |
| Enrich / `ifa-enrich` | `max_sources_to_enrich` | integer 1–50 | Target source count to enrich. |
| Enrich / `ifa-enrich` | `overshoot_multiplier` | number 1–1.5 | Allows extra enrichment above the target, within the run's limits. |
| Enrich / `ifa-enrich` | `fill_to_target` | boolean | Enriches spare rows for QA to use. Pair with QA's `fill_to_target`. |
| Verify / `ifa-verify` | `budget_per_source` | number 0–5 | Maximum USD per source for rigorous evidence fetching when fast verification is off. |
| Verify / `ifa-verify` | `fast_verify` | boolean | `true` marks unverified claims grounded in bulk, without individual evidence checks. `false` fetches evidence for per-claim checks and verdicts. |
| QA / `ifa-qa` | `contact_floor` | integer 0–4 | Required contact level: 1 is strictest, 4 allows no contact, and 0 uses the query's intent-derived level. |
| QA / `ifa-qa` | `established_fraction` | number 0–1 | Share of final slots reserved for eligible catalog-listed sources. 0 keeps the default frontier-first selection. |
| QA / `ifa-qa` | `fill_to_target` | boolean | Fills slots freed by the QA audit from eligible spare rows. It does not remove quality gates or guarantee the target count. |

Custom fields use `extraFields`:

- Types: `text`, `integer`, `number`, `boolean`, or `enum`.
- Set a name, label, description, and required flag. Add bounds or enum options when needed.
- Enrich produces the values; Verify checks them; QA uses them.
- Read values from source detail's `evidence`. They are not in source summaries.

Fast verification still requires custom field values to satisfy their types and bounds. QA still runs in both modes. The rigorous fetch budget is a per-source evidence-fetch limit, not a cap on the whole query's model cost.

Ranking uses `rankingPolicy` and is supported only by `ifa-qa`:

- Use numeric extra fields declared in the same profile.
- Each ranking field must have bounds from 0 to 1.
- Weights must be positive and total 100.

Profiles add settings and fields. The pipeline, tools, and quality checks still apply. `extensions` must remain empty.

Selection order is deterministic:

1. A profile selected with `taskProfileIds`.
2. The key owner's default profile for that task.
3. The organization's default profile for that task.
4. No profile.

An explicit profile must belong to the token owner or the token's organization. Prompt rules are separate and remain additive.

#### Create a task profile

`POST /ifa/task-profiles`

Start with a simple Verify profile. This example uses rigorous verification with a USD 0.75 budget per source and makes it the token owner's default for future runs:

```bash
curl -sS -X POST $BASE_URL/ifa/task-profiles \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "scope": "user",
    "taskId": "ifa-verify",
    "name": "Rigorous verification",
    "enabled": true,
    "isDefault": true,
    "taskInputs": {
      "budget_per_source": 0.75,
      "fast_verify": false
    }
  }'
```

Save `taskProfile.id` to select this profile in a query.

- Use `scope: "organization"` for an org profile; the key owner must be an org owner or admin.
- An enabled user default takes priority over the org default for that phase.

For custom ranking, this QA profile keeps its required Enrich signals and QA ranking policy together:

```bash
curl -sS -X POST $BASE_URL/ifa/task-profiles \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "scope": "user",
    "taskId": "ifa-qa",
    "name": "History and delivery fit",
    "enabled": true,
    "isDefault": true,
    "extraFields": [
      {
        "name": "history_breadth",
        "label": "History breadth",
        "type": "number",
        "description": "Score breadth of usable history from 0 to 1.",
        "required": true,
        "min": 0,
        "max": 1,
        "producerTask": "ifa-enrich"
      },
      {
        "name": "delivery_fit",
        "label": "Delivery fit",
        "type": "number",
        "description": "Score delivery latency fit from 0 to 1.",
        "required": true,
        "min": 0,
        "max": 1,
        "producerTask": "ifa-enrich"
      }
    ],
    "rankingPolicy": {
      "version": 1,
      "criteria": [
        { "field": "history_breadth", "weight": 60 },
        { "field": "delivery_fit", "weight": 40 }
      ]
    }
  }'
```

Profile fields:

| Field | Rule |
| --- | --- |
| `scope` | `user` or `organization`. Organization writes require owner or admin role. Scope cannot change after creation. |
| `taskId` | A supported core task ID. Cannot change after creation. |
| `name` | One to 100 characters. Unique within scope and task, ignoring case. |
| `enabled` | Disabled profiles stay stored but cannot be selected or used as defaults. |
| `isDefault` | At most one default per scope and task. Saving a new default clears the old default in that scope. |
| `taskInputs` | Supported settings within their allowed types and limits. Request values and org defaults take priority. |
| `extraFields` | Typed evidence fields. Ranking fields must be numeric, declared in this profile, and bounded from 0 to 1. |
| `rankingPolicy` | Optional weighted ranking for a task that declares support. Criteria must be unique and weights must total 100. |
| `extensions` | Reserved. Must be empty. |

#### List and get task profiles

`GET /ifa/task-profiles`

`GET /ifa/task-profiles/{profileId}`

List visible user and org profiles, or read one by ID. Each response includes `revision` and `profileHash`. A run saves both with its settings before work starts.

Task input priority, highest first:

1. Values on the query request.
2. Existing org defaults.
3. The selected task profile.
4. Built-in task defaults.

Existing org defaults still take priority over profiles. Moving them into profiles requires removing the old defaults in the same change.

The create response uses HTTP 201. For the simple Verify example above:

```json
{
  "taskProfile": {
    "id": "profile_id_here",
    "scope": "user",
    "taskId": "ifa-verify",
    "name": "Rigorous verification",
    "enabled": true,
    "isDefault": true,
    "schemaVersion": 1,
    "revision": 1,
    "taskInputs": {
      "budget_per_source": 0.75,
      "fast_verify": false
    },
    "extraFields": [],
    "rankingPolicy": null,
    "extensions": {},
    "profileHash": "sha256:1234567890abcdef",
    "createdAt": "2026-09-02T20:00:00.000Z",
    "updatedAt": "2026-09-02T20:00:00.000Z"
  }
}
```

Select non-default profiles when starting a query:

```bash
curl -sS $BASE_URL/ifa/queries \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "Find alternative data sources for freight activity",
    "taskProfileIds": ["profile_id_here"]
  }'
```

#### Update a task profile

`PATCH /ifa/task-profiles/{profileId}`

Edit a profile for future runs:

```bash
curl -sS -X PATCH $BASE_URL/ifa/task-profiles/profile_id_here \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"taskInputs":{"budget_per_source":0.5,"fast_verify":false}}'
```

**Update rules**

- Omitted fields stay unchanged.
- `taskInputs` replaces the full object; `extraFields` replaces the full array. Send every entry you want to keep.
- You can also change `name`, `enabled`, `isDefault`, and `rankingPolicy`.
- `scope` and `taskId` cannot change.
- Queued and active runs keep their saved settings.

#### Delete a task profile

`DELETE /ifa/task-profiles/{profileId}`

Removes the profile and keeps query results. To remove a query and its data, use query DELETE.

### Prompt Rules

- Prompt rules add instructions to future matching tasks for the key owner.
- Enabled rules apply automatically.
- Create a stored rule first. Do not send `promptRules` in a query request.

`taskId` selects where the rule applies:

| Task ID | Applies to | Generic example |
| --- | --- | --- |
| `ifa-query` | The whole run, and every phase of it | Prefer primary sources over aggregators throughout the run. |
| `ifa-discover` | Candidate search and discovery | Search operational software and supply-chain companies before established data vendors. |
| `ifa-enrich` | Candidate profiling and enrichment | Record the operational event that creates each proposed data asset. |
| `ifa-verify` | Evidence grounding and verification | Verify ownership and update cadence from official sources. |
| `ifa-qa` | Final inclusion and quality review | Exclude candidates whose ownership or update cadence remains unknown. |

Omitting `taskId` keeps the original behavior and stores the rule as `ifa-query`. An unsupported task ID returns `invalid_prompt_rule_task_id` with the complete `supportedTaskIds` list.

#### Create a prompt rule

`POST /ifa/prompt-rules`

This rule asks Discover to search selected regions. It guides the model; it does not create a structured filter or guarantee verified coverage for every final row.

```bash
curl -sS -X POST $BASE_URL/ifa/prompt-rules \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "taskId": "ifa-discover",
    "instruction": "Only return sources with data coverage in Canada, the United States, or Western Europe. Exclude all other regions.",
    "enabled": true
  }'
```

Response:

```json
{
  "promptRule": {
    "id": "b6xjd3f9jzq9ne0f9glwm2nd",
    "taskId": "ifa-discover",
    "instruction": "Only return sources with data coverage in Canada, the United States, or Western Europe. Exclude all other regions.",
    "enabled": true,
    "createdAt": "2026-08-10T20:00:00.000Z",
    "updatedAt": "2026-08-10T20:00:00.000Z"
  }
}
```

- `instruction`: 1–2000 characters after trimming.
- Each owner can store up to 10 rules across all supported task IDs.

#### List prompt rules

`GET /ifa/prompt-rules`

```bash
curl -sS $BASE_URL/ifa/prompt-rules \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

Response:

```json
{
  "promptRules": [
    {
      "id": "b6xjd3f9jzq9ne0f9glwm2nd",
      "taskId": "ifa-discover",
      "instruction": "Only return sources with data coverage in Canada, the United States, or Western Europe. Exclude all other regions.",
      "enabled": true,
      "createdAt": "2026-08-10T20:00:00.000Z",
      "updatedAt": "2026-08-10T20:00:00.000Z"
    }
  ],
  "supportedTaskIds": [
    "ifa-query",
    "ifa-discover",
    "ifa-enrich",
    "ifa-verify",
    "ifa-qa"
  ]
}
```

#### Update a prompt rule

`PATCH /ifa/prompt-rules/{ruleId}`

Use `PATCH /ifa/prompt-rules/{ruleId}` to change `taskId`, `instruction`, `enabled`, or any combination:

```bash
curl -sS -X PATCH \
  $BASE_URL/ifa/prompt-rules/b6xjd3f9jzq9ne0f9glwm2nd \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"taskId":"ifa-qa","enabled":false}'
```

Response:

```json
{
  "promptRule": {
    "id": "b6xjd3f9jzq9ne0f9glwm2nd",
    "taskId": "ifa-qa",
    "instruction": "Only return sources with data coverage in Canada, the United States, or Western Europe. Exclude all other regions.",
    "enabled": false,
    "createdAt": "2026-08-10T20:00:00.000Z",
    "updatedAt": "2026-08-10T20:15:00.000Z"
  }
}
```

#### Delete a prompt rule

`DELETE /ifa/prompt-rules/{ruleId}`

```bash
curl -sS -X DELETE \
  $BASE_URL/ifa/prompt-rules/b6xjd3f9jzq9ne0f9glwm2nd \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

Response:

```json
{
  "deleted": true
}
```

Deletion is idempotent. It returns `{ "deleted": false }` when no matching rule exists.

## Scouts API · MCP tools

The same operations for an MCP client, one tool per route or route family. Connect as [the MCP chapter](/docs/mcp) shows, with the same API key. Tool names are stable: a client that calls them today keeps working. Tool names keep the `ifa_` prefix the routes carry: `ifa_submit_query` is `POST /ifa/queries`, and so on down the table.

| Tool | What it does | Access |
| --- | --- | --- |
| `ifa_queue_status` | Read running and queued query counts for the token organization, its slot limit, and current availability. Other work in the organization can use the same slots. Returns counts only. This snapshot does not reserve a slot. | Reads |
| `ifa_submit_query` | Submit a discovery query, one scout run. This spends organization credits, returns immediately with a queryId, and the run can take 30 minutes or more. Do not retry on timeout — poll ifa_get_query instead. | Writes |
| `ifa_list_queries` | List the token owner’s queries, newest first. Set org=true to include teammates in the token organization. Pass nextCursor as cursor until nextCursor is null. | Reads |
| `ifa_get_query` | Get one query by queryId, including status and links to its sources. Poll this after submit; do not resubmit. | Reads |
| `ifa_cancel_query` | Cancel a queued or running query. Cancellation is best-effort; cancelled can be false if the run is already past the cancellable window. | Writes |
| `ifa_delete_query` | Delete one query and its linked operational data in the token organization. A running query is cancelled first. The shared catalog facts other runs rely on are kept. | Writes |
| `ifa_list_streams` | List the recurring Streams owned by the personal API token owner. | Reads |
| `ifa_get_stream` | Get one recurring Stream, including its cadence, status, and next run time. | Reads |
| `ifa_list_stream_queries` | List the query runs created by one recurring Stream. Pass nextCursor as cursor until nextCursor is null. Use each queryId with normal query and source tools. | Reads |
| `ifa_update_stream` | Change a Stream interval or set its status to active or paused. | Writes |
| `ifa_delete_stream` | Delete a Stream and stop future recurrence. Existing query results remain available. | Writes |
| `ifa_run_stream` | Run a Stream now without changing its next scheduled run. This spends organization credits. | Writes |
| `ifa_list_scouts` | List the organization’s question Scouts. Requires an API key owned by a member of the organization. | Reads |
| `ifa_get_scout` | Get one question Scout, including its cadence, status, and next run time. | Reads |
| `ifa_create_scout` | Create a question Scout that re-asks one discovery question on a cadence (once, daily, every-2-days, or every-n-days with intervalDays), forever or until endsAt. Its first run starts immediately and every run spends organization credits. | Writes |
| `ifa_update_scout` | Change a Scout’s question, name, cadence, intervalDays, endsAt (null runs it forever), strategy, resultsTarget or fastVerify, or set its status to active or paused. | Writes |
| `ifa_delete_scout` | Remove a Scout and stop its future runs. Its completed runs remain available. | Writes |
| `ifa_list_scout_runs` | List the query runs one Scout started, newest first. Pass nextCursor as cursor until nextCursor is null. Use each queryId with normal query and source tools. | Reads |
| `ifa_list_sources` | List sources produced by a completed query, in the order the app lists the run's table (a custom ranking's order when one is set). Requires queryId from ifa_get_query. Each source carries kind (established, between or frontier: the category the scouts view colours it with), mixTier (the run's results-mix tier, or null) and catalogueListed (a data catalog lists it). | Reads |
| `ifa_get_source` | Get one source with evidence cells. Requires queryId and sourceId from ifa_list_sources. | Reads |
| `ifa_get_source_contacts` | Get contact fields for one source. Requires queryId and sourceId. | Reads |
| `ifa_list_delivered_sources` | List every source ever delivered to the organization, deduplicated on sourceKey and ordered by first delivery. Pass scoutId for what one scout's runs delivered, since (ISO 8601) for incremental sync, limit 1-500 (default 100), and follow nextCursor until it is null. Each source carries kind, mixTier and catalogueListed, as ifa_list_sources does. | Reads |
| `ifa_task_profile` | List, read, create, update, or delete a task profile. Use action=list|get|create|update|delete. get/update/delete require profileId. create requires scope, taskId, and name. Organization-scoped writes need an owner or admin token. | Writes |
| `ifa_prompt_rule` | List, create, update, or delete a token-owner prompt rule. Use action=list|create|update|delete. update/delete require ruleId. create requires instruction. | Writes |

## Sample and Delivery

Samples and deliveries have no API routes yet. Both happen in the app: Get sample and the Sourcing desk are in [Sample](/docs/sample), the deal record, contracts and the endpoint in [Delivery](/docs/delivery). What your scouts delivered is already readable here, in the [Delivered Sources Feed](/docs/api#delivered-sources-feed). When sample and delivery routes land they join this reference under these names, additive, with no change to the routes above.

## Data Lab API

`GET /data-lab/campaigns`

`GET /data-lab/campaigns/{campaignId}/versions/{version}/{view}`

Read your organization's published Data Lab campaigns: the list, then one published version as its owner card (`view` `owner_card`) or its full report (`view` `report`). A supplier account mints a `data_lab` key for these reads and for the live Inventory below; it reaches no other route and expires 90 days after it is minted or renewed. An `all` key reads them too.

```bash
curl -sS "$BASE_URL/data-lab/campaigns" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

Response:

```json
{
  "campaigns": [
    {
      "id": "c8x2kq0example",
      "title": "Example archive assessment",
      "productTitle": null,
      "updatedAt": "2026-11-18T09:00:00.000Z",
      "latest": {
        "n": 2,
        "publishedAt": "2026-11-18T09:00:00.000Z",
        "asOf": "2026-11-17T00:00:00.000Z",
        "stageReached": 3,
        "reference": "E9803D09"
      },
      "earlier": []
    }
  ]
}
```

`GET /data-lab/campaigns/{campaignId}/versions/{version}/{view}` answers `{ "campaignId", "title", "version", "view", "document" }`, where `document` is the version's record cut for that view, the same document the Data Lab page shows.

- A campaign of another organization, or a version that is not published, gets `404` `not_found`.
- A `view` other than `owner_card` or `report` gets `400` `invalid_view`, and a `version` that is not a positive integer gets `400` `invalid_version`.
- While your organization's Data Lab is not open, both reads get `404` `not_found`.
- An organization key gets `403` `owner_required`: use a personal key.

### Live Inventory

`POST /data-lab/campaigns/{campaignId}/inventory`

`GET /data-lab/campaigns/{campaignId}/inventory/{jobId}`

`POST /data-lab/campaigns/{campaignId}/inventory/facets`

`GET /data-lab/campaigns/{campaignId}/inventory/facets/{jobId}`

Read a campaign's live Inventory: the files of your catalog that the campaign's approved scan covers, each with our latest reading of it, and counts of those files by facet. A read runs on your organization's agent, so it takes two calls. The `POST` starts the read and answers `202` with `{ "job_id": "..." }` at once. The `GET` with that `jobId` fetches its result. Only the key that started a read fetches it.

```bash
curl -sS -X POST "$BASE_URL/data-lab/campaigns/c8x2kq0example/inventory" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"limit":100,"where":{"media_class":["video"]}}'

curl -sS "$BASE_URL/data-lab/campaigns/c8x2kq0example/inventory/$JOB_ID" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

A page read's body:

| Field | Type | Meaning |
| --- | --- | --- |
| `after` | integer, optional | The previous page's `next_after`. Leave it out for the first page. |
| `limit` | integer, optional | Rows per page, 1 through 500. Default 100. |
| `ids` | integer[], optional | 1 through 500 owner file ids, each once, to read those files alone. Not with `after` or `limit`. |
| `where` | object, optional | A filter, below. |

A counts read's body is `{ "facets": [...], "where": {...} }`, with 1 through 6 facets, each named once.

A `where` filter takes these keys. Each one narrows the read, and they are combined with AND:

| Key | Values |
| --- | --- |
| `media_class` | `video`, `audio`, `image`, `font`, `document`, `project_file`, `archive`, `other` |
| `content_type` | Codes such as `VIDEO` (upper case, digits and `_`). |
| `entry_state` | `stored`, `external_reference`, `unavailable` |
| `project_id` | Up to 1,000 owner project ids (integers). |
| `created` | `{ "from": "YYYY-MM-DD", "to": "YYYY-MM-DD" }`, either end optional. |
| `size` | `{ "over_2gb": true }` or `false`. |
| `language` | BCP-47 tags. |
| `codec` | Lower-case codec names. |

The facets a counts read names are the same eight. A body key outside these lists gets `400` `invalid_body`, so a body can't widen the campaign's approved scope. A read that names `language` or `codec` is refused as `facet_unmapped` until the campaign's crosswalk maps them.

A fetch answers by the read's `state`:

- `202` with `{ "state": "running" }` while the read runs. Fetch again in a second or so.
- `200` with `"state": "done"` and the result, as below.
- `410` once the result was fetched already or has expired, 10 minutes after the read ended. A page is served once, and so are counts that name `project_id`. A read is found for an hour after it started: after that its fetch answers `404`.

A page read's result:

```json
{
  "state": "done",
  "as_of": "2026-11-19T00:12:03Z",
  "rows": [
    {
      "owner_id": 1234,
      "owner_public_id": "f_example",
      "project_id": 12,
      "name": "example-file.mov",
      "size_bytes": 52428800,
      "created": "2026-03-02T10:00:00Z",
      "entry_state": "stored",
      "media_class": "video",
      "content_type": "VIDEO",
      "row_version": null,
      "reading": {
        "assessed": true,
        "not_assessed_reason": null,
        "media_class": "video",
        "content_type": "VIDEO",
        "integrity_reading": "unique",
        "privacy_reading": "review_needed",
        "rights_reading": "review_needed",
        "over_2gb": false,
        "probe_status": "not_probed"
      },
      "assessed_at": "2026-11-18T22:40:00Z",
      "stale": null
    }
  ],
  "next_after": 1234
}
```

- `next_after` is `null` on the last page.
- `reading` is `null` for a file we haven't assessed yet.
- `stale` is `true` when the file changed since our reading, `false` when it didn't, and `null` when either side has no version.

A counts read's result:

```json
{
  "state": "done",
  "counts": {
    "as_of": "2026-11-19T00:12:03Z",
    "total": 1200,
    "facets": {
      "media_class": {
        "buckets": [{ "key": "video", "count": 300 }],
        "other": 12,
        "truncated": false
      }
    }
  }
}
```

Each facet keeps its 200 largest buckets. The rest count under `other`, and `truncated` is then `true`.

Limits on starting a read (a fetch is not counted):

- One read runs at a time per organization. A start while one runs gets `429` `in_flight`.
- A key starts at most 60 reads an hour, and the organization 120. Past them, a start gets `429` `token_hourly` or `org_hourly`.
- A `429` carries a `Retry-After` header with the seconds to wait before starting again.

Other answers:

- While your organization's live Inventory is not open, every call gets `404` `not_found`. So does a campaign of another organization, or a read another key started.
- `409` `no_scan`: the campaign has no approved scan yet. `409` `no_bridge`: the campaign's catalog connection is not proved. `409` `no_agent` or `agent_unsupported`: your organization's agent is not running, or does not read catalogs. `409` `zdr_org`: a zero-retention organization's catalog is not read live.
- `409` `counts_unsupported`: facet counts aren't available on Brickroad yet, for any catalog. Page reads work as usual, and nothing was started.
- `400` `ids_invalid`: `ids` must name 1 through 500 files, each once. `422` `ids_refused`: some ids are not files the campaign's scan assessed, listed in `error.details.ids`.
- A read the catalog refused gets `422` with its code: `facet_unmapped`, `facet_value_invalid`, `page_invalid`, `scope_invalid`, `statement_timeout` or `lease_refused`. `error.details.facet` names the facet when there is one.
- `409` `read_failed`: the read failed. Start it again.

The MCP tools `data_lab_inventory_page`, `data_lab_inventory_result`, `data_lab_facet_counts` and `data_lab_facet_counts_result` make the same calls. A tool answers `running` and `gone` as its `state`, and a `429` carries the seconds to wait in `error.details.retry_after`.

### Compose a draft

`POST /data-lab/campaigns/{campaignId}/compose`

`GET /data-lab/campaigns/{campaignId}/compose/{draftId}`

Compose a draft from some of a campaign's files and a data spec. The draft is a recipe your organization owns: the files' owner ids, the spec, and the mapping of the spec's fields onto your catalog's columns, which a match on your organization's agent works out. No row is copied into the draft. Its rows are read live from your catalog when you ask for them.

```bash
curl -sS -X POST "$BASE_URL/data-lab/campaigns/c8x2kq0example/compose" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"owner_ids":[1234,1235],"spec_id":"r7k2example"}'

curl -sS "$BASE_URL/data-lab/campaigns/c8x2kq0example/compose/$DRAFT_ID" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

The body:

| Field | Type | Meaning |
| --- | --- | --- |
| `owner_ids` | integer[] | 1 through 500 owner file ids, each once. Each must be a file the campaign's scan assessed. |
| `spec_id` | string | The id of your organization's request whose data spec the draft maps. |

`GET /data-lab/campaigns/{campaignId}/compose/specs` lists the specs a compose may name: your organization's requests whose spec names 1 to 64 fields, newest first and at most 50, as `{ "specs": [{ "spec_id": "...", "created_at": "...", "fields": [{ "name": "...", "type": "..." }] }] }`.

A compose answers `201` with `{ "draft_id": "..." }` while the match runs. Read the draft until its `status` is `ready`, `unmatched` or `failed`:

```json
{
  "draft_id": "d4m9example",
  "campaign_id": "c8x2kq0example",
  "kind": "file",
  "status": "ready",
  "owner_ids": [1234, 1235],
  "spec": { "schema": [{ "name": "size bytes", "type": "integer" }] },
  "spec_request_id": "r7k2example",
  "mapping": {
    "verdict": "stack",
    "for_schema": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
    "mapped": { "size bytes": { "from": { "column": "size_bytes" }, "by": "name" } }
  },
  "unmatched": null,
  "created_at": "2026-11-19T12:00:00Z",
  "updated_at": "2026-11-19T12:00:04Z"
}
```

- `mapping` names, for each spec field, the catalog column it is read from. It is `null` until the draft is `ready`.
- `unmatched` is set when the match found no single mapping: its `verdict` (`join`, `no` or `undecided`) and the `reasons` it gave.
- Add `?rows=true` to read a `ready` draft's rows: the answer then carries `rows_job_id`, a live Inventory page read of the draft's files, fetched once with `GET /data-lab/campaigns/{campaignId}/inventory/{jobId}`. It counts as a start under the live Inventory's limits.

Other answers:

- While your organization's live Inventory is not open, every call gets `404` `not_found`. So does a campaign or a draft of another organization.
- `400` `invalid_body`: the body is not `owner_ids` and `spec_id` as above. `400` `invalid_options`: `rows` is not `true` or `false`.
- `422` `owner_ids_refused`: some ids are not files the campaign's scan assessed, listed in `error.details.ids`. `404` `spec_not_found`: no request of your organization has that id and a spec.
- `409` `zdr_org`: an organization with zero data retention composes nothing. `409` `no_agent`: your organization's agent is not running. `409` `draft_not_ready`: `rows` asked of a draft that is not `ready`.
- One compose matches at a time per organization. A compose while one is matching gets `429` `in_flight`.
- A key composes at most 60 drafts an hour, and the organization 120. Past them, a compose gets `429` `token_hourly` or `org_hourly`. A `429` carries a `Retry-After` header with the seconds to wait.

The MCP tools `data_lab_list_specs`, `data_lab_compose` and `data_lab_get_draft` make the same calls, with `rows` as a boolean argument.

### Run a PoV on a selection

`POST /data-lab/campaigns/{campaignId}/runs/selection`

```bash
curl -sS -X POST "$BASE_URL/data-lab/campaigns/c8x2kq0example/runs/selection" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"kind": "file", "owner_ids": [1042, 1043, 1051]}'
```

Asks for a PoV run on the files you picked from the live Inventory. The body is `kind` (`file`) and `owner_ids`, 1 through 500 file ids, each once. The run takes what the campaign already has: its approved scan's readings and scope, and the benchmark of its last cascade. Nothing else is sent.

The call answers `202` with `{ "request_id": "...", "status": "requested" }`. Brickroad launches the run from the request, and no key launches one.

- `422` `ids_refused`: some ids are not files the campaign's scan assessed, listed in `error.details.ids`. `422` `ids_invalid`: the ids are not whole numbers, each once.
- `422` `no_confirmed_readings` or `chain_default_missing`: the campaign has no approved scan or no earlier cascade to run from. `409` `zdr_org`: a zero-retention organization's catalog is not run on.
- `400` `invalid_body`: the body has a key other than `kind` and `owner_ids`, or is not JSON.
- One run on a selection waits or runs at a time per organization, so a request while one does gets `429` `in_flight`. A key asks at most 5 times an hour and the organization 10, past which a request gets `429` `token_hourly` or `org_hourly`. A `429` carries a `Retry-After` header.
- While your organization's live Inventory is not open, the call gets `404` `not_found`, as it does for a campaign of another organization.

The MCP tool `data_lab_start_run` makes the same call, with `campaignId` beside the body's fields.

### Data Lab MCP tools

The same operations for an MCP client, one tool per route or route family. Connect as [the MCP chapter](/docs/mcp) shows, with the same API key. Tool names are stable: a client that calls them today keeps working. A `data_lab` key reaches these tools and no other.

| Tool | What it does | Access |
| --- | --- | --- |
| `data_lab_list_campaigns` | List the token organization's Data Lab campaigns that have a published version, newest activity first, each with its latest and earlier published versions (number, dates, stage reached and reference). Answers not_found while the organization's Data Lab is not open. | Reads |
| `data_lab_get_report` | Read one published version of one of the organization's Data Lab campaigns, as its owner card (view owner_card) or its full report (view report). Another organization's campaign, or a version not published, answers not_found. | Reads |
| `data_lab_inventory_page` | Start reading one page of a Data Lab campaign's live Inventory: the files of the owner's catalog that the campaign's approved scan covers. Read by cursor (after, the previous page's next_after, absent for the first page; limit 1 to 500, default 100) or by ids (1 to 500 owner file ids, each once, without after or limit), narrowed by where (media_class, content_type, entry_state, project_id, created, size, language, codec; each narrows, none widens the scope). Answers {job_id} at once; fetch the page with data_lab_inventory_result. One read runs at a time per organization, and a token starts at most 60 reads an hour and the organization 120; past a cap the call answers 429 with details.retry_after, the seconds to wait before starting again. Answers not_found while the organization's live Inventory is not open, and for a campaign or read that is not the organization's own. | Writes |
| `data_lab_inventory_result` | Fetch a page read that this token started with data_lab_inventory_page, once. Answers state running while the read runs (call again shortly), state done with as_of, rows (each owner file with our latest reading of it, assessed_at and stale) and next_after (null on the last page), or state gone once the page was fetched already or expired, 10 minutes after the read ended. A read the catalog refused answers its code (facet_unmapped, facet_value_invalid, page_invalid, scope_invalid, statement_timeout or lease_refused), and a failed read answers read_failed: start it again. Answers not_found while the organization's live Inventory is not open, and for a campaign or read that is not the organization's own. | Reads |
| `data_lab_facet_counts` | Start counting a Data Lab campaign's live Inventory by 1 to 6 facets, each named once (media_class, content_type, entry_state, project_id, created, size, language, codec), narrowed by where as data_lab_inventory_page takes it. Answers {job_id} at once; fetch the counts with data_lab_facet_counts_result. Answers 409 counts_unsupported, starting nothing, while facet counts aren't available on Brickroad yet, for any catalog; page reads work as usual. One read runs at a time per organization, and a token starts at most 60 reads an hour and the organization 120; past a cap the call answers 429 with details.retry_after, the seconds to wait before starting again. Answers not_found while the organization's live Inventory is not open, and for a campaign or read that is not the organization's own. | Writes |
| `data_lab_facet_counts_result` | Fetch a counts read that this token started with data_lab_facet_counts. Answers state running while the read runs (call again shortly), state done with counts (as_of, total, and for each facet its buckets, other and truncated), or state gone: counts by project_id are served once and expire 10 minutes after the read ended. A read the catalog refused answers its code, with details.facet naming the facet, and a failed read answers read_failed: start it again. Answers not_found while the organization's live Inventory is not open, and for a campaign or read that is not the organization's own. | Reads |
| `data_lab_list_specs` | List the data specs a compose may name, for a Data Lab campaign: the organization's own requests whose spec names 1 to 64 fields, newest first and at most 50, each as spec_id (the request id data_lab_compose takes), created_at, and its fields' names and types. Answers not_found while the organization's live Inventory is not open, and for a campaign or read that is not the organization's own. | Reads |
| `data_lab_compose` | Compose a draft from a Data Lab campaign's files and a data spec: owner_ids names 1 to 500 of the files the campaign's scan assessed, each once, and spec_id names the spec by its request id. The draft is a recipe the organization owns: its files' ids, the spec, and the mapping a match gives the spec's fields onto the catalog's columns. No row is copied. Answers draft_id at once while the match runs; read the draft with data_lab_get_draft until its status is ready, unmatched or failed. Ids the campaign does not hold answer owner_ids_refused with details.ids, a spec of another organization answers spec_not_found, an organization with zero data retention composes nothing (zdr_org), and one compose matches at a time per organization (in_flight), at most 60 an hour per token and 120 per organization (token_hourly, org_hourly), each with details.retry_after in seconds. Answers not_found while the organization's live Inventory is not open, and for a campaign or read that is not the organization's own. | Writes |
| `data_lab_get_draft` | Read a draft composed with data_lab_compose: its status (matching, ready, unmatched or failed), its files' owner ids, the spec, and once ready the mapping of each spec field onto a catalog column; unmatched names the match's verdict and reasons. With rows true, a ready draft also starts the live read of its files and answers rows_job_id: fetch those rows once with data_lab_inventory_result. That read is a start under the live Inventory's caps, and a draft that is not ready answers draft_not_ready. Answers not_found while the organization's live Inventory is not open, and for a campaign or read that is not the organization's own. | Writes |
| `data_lab_start_run` | Ask for a PoV run on a selection of a Data Lab campaign's files: kind file and owner_ids, 1 to 500 owner file ids from the live Inventory, each once. The run takes what the campaign already has (its approved scan's readings and scope, and its last cascade's benchmark); nothing else is typed. Answers {request_id, status: requested}: Brickroad launches the run, and no token or tool launches one. Refused 422 ids_refused for files the campaign's scan didn't assess (details.ids), 422 no_confirmed_readings or chain_default_missing for a campaign with nothing to run from, and 409 zdr_org for a zero-retention organization. One run on a selection waits or runs at a time per organization, and a token asks at most 5 times an hour and the organization 10; past a cap the call answers 429 with details.retry_after, the seconds to wait. Answers not_found while the organization's live Inventory is not open, and for a campaign or read that is not the organization's own. | Writes |

## Signals

Use your organization API key from Settings. Both personal and company-owned keys use the company attached to the key. A request cannot select another company.

**Access rules**

- The company must be enabled, with a non-free plan and a future current period end.
- Allowed status: `active`, `trialing`, or `canceling`.
- Paid and canceling plans work until the paid-through date. Trials work until expiry.
- Free, expired, `past_due`, `unpaid`, disabled, or `canceled` companies get 403. Missing or expired period end also gets 403.
- Completing billing onboarding alone does not grant access. Each request checks current access.
- Reads do not use credits. Signals email preferences do not block eligible API reads.

These endpoints read published research:

- Responses are JSON with `Cache-Control: private, no-store`.
- Reads do not publish data, change contacts, or mark an article as read.
- The API key's last-used time may update. Normal API logging applies.

### List Published Signals

`GET /signals`

```bash
curl -sS "$BASE_URL/signals?sector=Industrials&sector=Energy&ticker=cat&unlisted=true&limit=20" -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

| Parameter | Rule |
| --- | --- |
| `q` | Trimmed, case-insensitive text search. See search fields below. |
| `sector` | Repeat for several exact, case-sensitive sector labels. Choices combine with OR. |
| `ticker` | Trimmed, case-insensitive exact match against the Signal's tickers. |
| `unlisted` | true keeps only offCatalogue datasets. false or omitted keeps all datasets. |
| `limit` | Positive integer. Default 20; values above 100 clamp to 100. Empty/invalid values return 400. |
| `cursor` | Pass nextCursor unchanged. Omit for the first page. Malformed or empty values return 400. |

**Paging**

- Filters apply before paging. Signals are ordered by `ref`, highest first.
- Pass `nextCursor` as `cursor` with the same filters. Start again when changing filters.
- New higher refs do not repeat a previous page.
- Stop when `nextCursor` is null.
- No matches returns empty `signals` and `wire` arrays, empty `contactsBySourceKey`, and a null cursor.

**Text search covers**

| Data | Fields |
| --- | --- |
| Signal | Title, summary, tickers, and query text. |
| Dataset | Company name, name, description, sectors, and instruments. |
| Specification | Claim values, sample tickers, exchanges, and categories. |
| Event | Headline, read, publisher, matched ticker, rule, and URL hostname. |

**Filter order**

1. Apply sector and `unlisted` filters to datasets.
2. A Signal title, summary, or ticker text match keeps its remaining datasets.
3. Otherwise, keep matching datasets. If none match but an event matches, keep the remaining datasets and only matching events.
4. A filtered Signal needs at least one remaining dataset. Without filters, Signals with no datasets are also included.

Apply supplied filters together in this order.

**Result order**

- The list can narrow datasets. It puts unlisted datasets first, then sorts by novelty, highest first.
- Signal detail includes all published datasets in their saved order.
- `wire` contains events for returned Signals, newest event first.

```json
{
  "signals": [
    {
      "id": "signal_id_here",
      "ref": 12,
      "slug": "2026-09-22",
      "title": "Supply chains are repricing",
      "summary": "Shipment data can explain the change.",
      "tickers": [
        "CAT"
      ],
      "openedAt": "2026-09-22T12:00:00.000Z",
      "publishedAt": "2026-09-22T14:00:00.000Z",
      "queries": [
        {
          "id": "query_id_here",
          "text": "Industrial shipment data"
        }
      ],
      "datasets": [
        {
          "id": "dataset_id_here",
          "name": "Shipment dataset",
          "description": "Daily industrial shipments.",
          "foundBy": "query_id_here",
          "sectors": [
            "Industrials"
          ],
          "instruments": [
            "equities"
          ],
          "historyYears": 5,
          "historyNote": "From 2021",
          "accessTier": 2,
          "novelty": 0.8,
          "offCatalogue": true,
          "sourceKey": "example.com",
          "pageHref": "/signals/2026-09-22/dataset_id_here",
          "spec": {
            "claims": {
              "datasetType": {
                "value": "Shipment records",
                "statedOn": "https://example.com/data"
              }
            },
            "coverage": {
              "gics": [],
              "exchanges": [
                "NYSE"
              ],
              "categories": [
                "shipments"
              ],
              "sampleTickers": [
                "CAT"
              ]
            },
            "listings": {
              "count": 0,
              "names": []
            }
          },
          "companyName": "Example Data"
        }
      ]
    }
  ],
  "wire": [
    {
      "id": "event_id_here",
      "signalId": "signal_id_here",
      "at": "2026-09-22T13:00:00.000Z",
      "headline": "Shipments shift",
      "read": "Supply changes.",
      "publisher": "Example News",
      "url": "https://news.example.com/shipments",
      "matchedTicker": "CAT",
      "rule": null
    }
  ],
  "contactsBySourceKey": {
    "example.com": [
      {
        "name": "Sam Example",
        "title": "Data partnerships",
        "email": "sam@example.com"
      }
    ]
  },
  "nextCursor": null
}
```

| List response field | Meaning |
| --- | --- |
| signals[] | Published research Signals; fields below. |
| wire[] | Supporting news events; fields below. |
| contactsBySourceKey | Request Sample recipients keyed by each returned dataset's sourceKey. |
| nextCursor | API paging only; null after the last page. |

### Read One Signal

`GET /signals/{signalId}`

Use `signals[].id` from the list response as `signalId`.

```bash
curl -sS "$BASE_URL/signals/signal_id_here" -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

```json
{
  "signal": {
    "id": "signal_id_here",
    "ref": 12,
    "slug": "2026-09-22",
    "title": "Supply chains are repricing",
    "summary": "Shipment data can explain the change.",
    "tickers": [
      "CAT"
    ],
    "openedAt": "2026-09-22T12:00:00.000Z",
    "publishedAt": "2026-09-22T14:00:00.000Z",
    "queries": [
      {
        "id": "query_id_here",
        "text": "Industrial shipment data"
      }
    ],
    "datasets": [
      {
        "id": "dataset_id_here",
        "name": "Shipment dataset",
        "description": "Daily industrial shipments.",
        "foundBy": "query_id_here",
        "sectors": [
          "Industrials"
        ],
        "instruments": [
          "equities"
        ],
        "historyYears": 5,
        "historyNote": "From 2021",
        "accessTier": 2,
        "novelty": 0.8,
        "offCatalogue": true,
        "sourceKey": "example.com",
        "pageHref": "/signals/2026-09-22/dataset_id_here",
        "spec": {
          "claims": {
            "datasetType": {
              "value": "Shipment records",
              "statedOn": "https://example.com/data"
            }
          },
          "coverage": {
            "gics": [],
            "exchanges": [
              "NYSE"
            ],
            "categories": [
              "shipments"
            ],
            "sampleTickers": [
              "CAT"
            ]
          },
          "listings": {
            "count": 0,
            "names": []
          }
        },
        "companyName": "Example Data"
      }
    ]
  },
  "wire": [
    {
      "id": "event_id_here",
      "signalId": "signal_id_here",
      "at": "2026-09-22T13:00:00.000Z",
      "headline": "Shipments shift",
      "read": "Supply changes.",
      "publisher": "Example News",
      "url": "https://news.example.com/shipments",
      "matchedTicker": "CAT",
      "rule": null
    }
  ],
  "contactsBySourceKey": {
    "example.com": [
      {
        "name": "Sam Example",
        "title": "Data partnerships",
        "email": "sam@example.com"
      }
    ]
  }
}
```

| Detail response field | Meaning |
| --- | --- |
| signal | Full published Signal, its queries, and all included datasets. |
| wire[] | That Signal's supporting events. |
| contactsBySourceKey | Request Sample recipients for included finds. |

### Read One Linked Dataset

`GET /signals/{signalId}/datasets/{datasetId}`

Use an included dataset's `id` as `datasetId`.

- The dataset needs a `sourceKey` and non-empty `spec`.
- Unknown, unpublished, excluded, unrelated, or incomplete datasets return 404.
- Datasets with null `spec` still appear in full Signal detail.

```bash
curl -sS "$BASE_URL/signals/signal_id_here/datasets/dataset_id_here" -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

```json
{
  "dataset": {
    "id": "dataset_id_here",
    "name": "Shipment dataset",
    "description": "Daily industrial shipments.",
    "foundBy": "query_id_here",
    "sectors": [
      "Industrials"
    ],
    "instruments": [
      "equities"
    ],
    "historyYears": 5,
    "historyNote": "From 2021",
    "accessTier": 2,
    "novelty": 0.8,
    "offCatalogue": true,
    "sourceKey": "example.com",
    "pageHref": "/signals/2026-09-22/dataset_id_here",
    "spec": {
      "claims": {
        "datasetType": {
          "value": "Shipment records",
          "statedOn": "https://example.com/data"
        }
      },
      "coverage": {
        "gics": [],
        "exchanges": [
          "NYSE"
        ],
        "categories": [
          "shipments"
        ],
        "sampleTickers": [
          "CAT"
        ]
      },
      "listings": {
        "count": 0,
        "names": []
      }
    },
    "companyName": "Example Data"
  },
  "signal": {
    "id": "signal_id_here",
    "ref": 12,
    "slug": "2026-09-22",
    "title": "Supply chains are repricing",
    "summary": "Shipment data can explain the change.",
    "tickers": [
      "CAT"
    ],
    "openedAt": "2026-09-22T12:00:00.000Z",
    "publishedAt": "2026-09-22T14:00:00.000Z",
    "queries": [
      {
        "id": "query_id_here",
        "text": "Industrial shipment data"
      }
    ],
    "datasets": [
      {
        "id": "dataset_id_here",
        "name": "Shipment dataset",
        "description": "Daily industrial shipments.",
        "foundBy": "query_id_here",
        "sectors": [
          "Industrials"
        ],
        "instruments": [
          "equities"
        ],
        "historyYears": 5,
        "historyNote": "From 2021",
        "accessTier": 2,
        "novelty": 0.8,
        "offCatalogue": true,
        "sourceKey": "example.com",
        "pageHref": "/signals/2026-09-22/dataset_id_here",
        "spec": {
          "claims": {
            "datasetType": {
              "value": "Shipment records",
              "statedOn": "https://example.com/data"
            }
          },
          "coverage": {
            "gics": [],
            "exchanges": [
              "NYSE"
            ],
            "categories": [
              "shipments"
            ],
            "sampleTickers": [
              "CAT"
            ]
          },
          "listings": {
            "count": 0,
            "names": []
          }
        },
        "companyName": "Example Data"
      }
    ]
  },
  "theses": [
    {
      "id": "signal_id_here",
      "ref": 12,
      "slug": "2026-09-22",
      "title": "Supply chains are repricing",
      "publishedAt": "2026-09-22T14:00:00.000Z"
    }
  ],
  "contacts": [
    {
      "name": "Sam Example",
      "title": "Data partnerships",
      "email": "sam@example.com"
    }
  ]
}
```

| Dataset detail field | Meaning |
| --- | --- |
| dataset | The selected dataset; fields below. |
| signal | Parent Signal and included datasets; fields below. |
| theses[] | Related published Signals for the same source, including the parent. Each has id, ref, slug, title, and publishedAt. |
| contacts[] | Request Sample recipients for this find. Empty array when absent. |

### Signal Fields

These fields apply to signals[] in list, signal in Signal detail, and signal in dataset detail.

| Field | Meaning |
| --- | --- |
| id | Stable Signal ID used by detail endpoints. |
| ref | Signal reference number and publication order. |
| slug | Signal page slug. |
| title | Signal title. |
| summary | Research summary. |
| tickers[] | Covered tickers. |
| openedAt | Opening date, ISO timestamp. |
| publishedAt | Publication date, ISO timestamp or null for legacy rows. |
| queries[].id | Query ID matched by a dataset's foundBy. |
| queries[].text | Query text for the datasets. |
| datasets[] | Included datasets; fields below. |

### Dataset Fields

These fields apply to every datasets[] row and the selected dataset.

| Field | Meaning |
| --- | --- |
| id | Dataset ID used by the detail endpoint. |
| name | Dataset name. The app uses companyName as its heading when available. |
| description | Dataset description. |
| foundBy | Search provenance; joins queries[].id. |
| sectors[] | Sector labels and sector filter. |
| instruments[] | Instrument coverage. |
| historyYears | History depth; number or null. |
| historyNote | Stated history context; string or null. |
| accessTier | Published access tier; number or null. |
| novelty | Published novelty score used for list ordering. |
| offCatalogue | Unlisted badge and filter. |
| sourceKey | Supplier catalog identity, string or null. Not an original discovery URL; no URL is inferred. |
| pageHref | Dataset page path, or null when it has no page. |
| companyName | Resolved supplier heading or null. |
| spec | Checkable supplier specs or null for older snapshots. |
| spec.claims | Dataset type, format, structure, archive depth, and use cases; each claim has value and nullable statedOn evidence. Only available claims appear. |
| spec.coverage.gics[] | Sector/industry taxonomy: sector, industryGroup, industry, subIndustry. |
| spec.coverage.exchanges[] | Exchange coverage. |
| spec.coverage.categories[] | Dataset coverage categories. |
| spec.coverage.sampleTickers[] | Supplier sample tickers. |
| spec.listings | Catalog count and names, or null. |

### Event and Contact Fields

| Event field | Meaning |
| --- | --- |
| id | Headline identity. |
| signalId | Parent Signal. |
| at | Headline timestamp, ISO. |
| headline | Headline text. |
| read | Editorial interpretation. |
| publisher | Publication name. |
| url | Original headline link. |
| matchedTicker | Supporting ticker or null. |
| rule | Published event classification or null. |

**Contact rules**

- Shared visible catalog contacts take precedence.
- Without a usable shared email, use only the key company's own scout contacts. Other company memberships do not widen access.
- Arrays contain only `name`, `title`, and `email`.
- Missing contacts are omitted from `contactsBySourceKey`; dataset detail returns `contacts: []`.
- Empty names and titles stay empty strings. The API does not invent them.

| Contact field | Meaning |
| --- | --- |
| name | Named Request Sample recipient. |
| title | Recipient's role. |
| email | Request Sample email destination. |

Internal weights, audit IDs, raw discovery rows, source records, grid cells, private notes, and other companies' private contacts are excluded.

### Signals Errors

Standard error body:

```json
{"success":false,"error":{"code":"signals_subscription_required","message":"Signals API access requires a current paid subscription or an active trial."}}
```

| HTTP | Code | Cause |
| --- | --- | --- |
| 401 | missing_token, invalid_token, revoked_token | Missing, invalid, or revoked bearer key. |
| 403 | inactive_owner | Key owner no longer has allowed company membership. |
| 403 | signals_subscription_required | Company is not currently paid or on an active trial. |
| 400 | invalid_limit, invalid_cursor, invalid_unlisted | Invalid list parameter. |
| 404 | signal_not_found | Unknown or unpublished Signal. |
| 404 | signal_dataset_not_found | Unknown, excluded, unlinked, unpublished, or thin dataset. |
| 500 | internal_error | Unexpected server failure. |

## Run Artifacts

`GET /artifacts`

List the files your organization's jobs kept in its store, oldest first. A job keeps a file when its task declares the file as an artifact. Each row is the file as the store sealed it: its size and sha256. These routes answer 404 until Brickroad switches them on for your organization.

```bash
curl -sS "$BASE_URL/artifacts?since=2026-11-01T00:00:00Z&limit=100" \
  -H "Authorization: Bearer $BRICKROAD_API_TOKEN"
```

Query parameters:

| Parameter | Type | Meaning |
| --- | --- | --- |
| `jobId` | string, optional | Only the artifacts of this job. |
| `since` | ISO 8601 timestamp, optional | Only artifacts recorded at or after this instant. |
| `cursor` | string, optional | Opaque cursor from the previous page's `nextCursor`. |
| `limit` | integer, optional | Page size from 1 through 500. Default 100. Out-of-range values are clamped. |

Response:

```json
{
  "artifacts": [
    {
      "id": "q3c0d9w8kq1l7x2m5n4b6v8z",
      "jobId": "j8e2r4t6y8u0i2o4p6a8s0d2",
      "name": "rows.csv",
      "bytes": 48213,
      "sha256": "9f2c…",
      "createdAt": "2026-11-20T18:04:12.511Z"
    }
  ],
  "nextCursor": null
}
```

Follow `nextCursor` until it is `null`. Pass it unchanged.

`GET /artifacts/{artifactId}/download`

Answers 302 to a download link for one artifact. The link works for 15 minutes and downloads the file as an attachment. With `Accept: application/json` the answer is `{"url", "expiresAt", "bytes", "sha256"}` instead. Check the file's sha256 against the row's. An id that is not one of your organization's artifacts answers 404.

### Run Artifacts MCP tools

The same operations for an MCP client, one tool per route or route family. Connect as [the MCP chapter](/docs/mcp) shows, with the same API key. Tool names are stable: a client that calls them today keeps working. These tools are listed only while run artifacts are switched on for your organization.

| Tool | What it does | Access |
| --- | --- | --- |
| `artifacts_list` | List the files your organization's jobs kept in its store, oldest first: each with its id, job, name, size and sha256. Pass jobId for one job's, since (ISO 8601) for incremental sync, limit 1-500 (default 100), and follow nextCursor until null. | Reads |
| `artifacts_get_url` | Get a 15-minute download link for one of your organization's kept artifacts, by its id from artifacts_list, with its size and sha256 to check the file against. | Reads |

## Client examples

### JavaScript / TypeScript Helper Pattern

```ts
type BrickroadQuery = {
  queryId: string;
  status: "queued" | "running" | "completed" | "failed" | "cancelled";
  nextPollAfterSeconds: number;
  links: { self: string; sources: string };
};

const baseUrl = process.env.BRICKROAD_API_BASE_URL ?? "https://brickroad.network/api/v1";
const token = process.env.BRICKROAD_API_TOKEN;
if (!token) throw new Error("missing BRICKROAD_API_TOKEN");

async function brickroad<T>(path: string, init: RequestInit = {}): Promise<T> {
  const response = await fetch(`${baseUrl}${path}`, {
    ...init,
    headers: {
      authorization: `Bearer ${token}`,
      "content-type": "application/json",
      ...init.headers,
    },
  });
  const body = await response.json();
  if (!response.ok) {
    throw new Error(`${response.status} ${body.error?.code}: ${body.error?.message}`);
  }
  return body as T;
}

const created = await brickroad<BrickroadQuery>("/ifa/queries", {
  method: "POST",
  body: JSON.stringify({
    query: "Find alternative data vendors for EV battery supply chain visibility",
  }),
});

let current = created;
while (["queued", "running"].includes(current.status)) {
  await new Promise((resolve) =>
    setTimeout(resolve, current.nextPollAfterSeconds * 1000),
  );
  current = await brickroad<BrickroadQuery>(`/ifa/queries/${created.queryId}`);
}

const sources = await brickroad(`/ifa/queries/${created.queryId}/sources`);
console.log(sources);
```

### Python Helper Pattern

```python
import os
import time
import requests

BASE_URL = "https://brickroad.network/api/v1"
TOKEN = os.environ["BRICKROAD_API_TOKEN"]
HEADERS = {"Authorization": f"Bearer {TOKEN}"}

created = requests.post(
    f"{BASE_URL}/ifa/queries",
    headers={**HEADERS, "Content-Type": "application/json"},
    json={"query": "Find alternative data vendors for EV battery supply chain visibility"},
    timeout=30,
).json()

query_id = created["queryId"]

while True:
    status = requests.get(
        f"{BASE_URL}/ifa/queries/{query_id}",
        headers=HEADERS,
        timeout=30,
    ).json()
    if status["status"] in ["completed", "failed", "cancelled"]:
        break
    time.sleep(status.get("nextPollAfterSeconds", 300))

sources = requests.get(
    f"{BASE_URL}/ifa/queries/{query_id}/sources",
    headers=HEADERS,
    params={"view": "summary"},
    timeout=30,
).json()
print(sources)
```
