On this page
API reference · Get started

Getting started

Follow the query flow from API key to saved results.

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 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 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 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.

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

API reference — Docs — Brickroad | Brickroad