---
title: "Three-Call Quickstart for the AEO API | AEO API"
description: "Create a brand with prompts, start a collection run with a credit cap, and read the result by run ID in three API calls."
url: "https://aeoapi.dev/docs/three-call-quickstart"
canonical: "https://aeoapi.dev/docs/three-call-quickstart"
last_updated: "2026-11-29"
---

# Three-call quickstart

Create a brand with the questions you want to track, start a collection run, and read the result by run ID.

Set the API origin and server-side key as shown in [Getting started](https://aeoapi.dev/docs/getting-started#environment). Use an editor, owner, or service key without a brand restriction and with `brands:write`, `prompts:write`, `collections:write`, and `collections:read`. You also need curl and Python 3.

Your account needs billing access to create a brand with prompts and to start a collection run. Use a `platform` and `mode` pair available to your account. If you need to check, follow the [source coverage guide](https://aeoapi.dev/docs/source-coverage).

Set `BRAND_REQUEST_KEY` and `COLLECTION_REQUEST_KEY` to separate new values. If you retry either write, send the same `Idempotency-Key` and request body.

## 1. Create a brand with prompts

Replace the example brand details and question with your own. [`POST /v2/brands`](https://aeoapi.dev/docs/api-reference#post-v2-brands) saves each text in `prompts` as a prompt. The response returns the brand ID in `data.id` and the prompt IDs in `data.prompt_ids`.

```
curl --fail-with-body "$AEO_API_BASE_URL/v2/brands" \
  -H "Authorization: Bearer $AEO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $BRAND_REQUEST_KEY" \
  --output brand-response.json \
  --data-binary @- <<'JSON'
{
  "name": "Example Plumbing",
  "domains": ["example.com"],
  "category_ids": ["gcid:plumber"],
  "markets": [{"country": "US", "city": "Chicago", "language": "en"}],
  "prompts": ["What should homeowners compare when choosing a plumber in Chicago?"]
}
JSON
```

## 2. Start a collection run

Export the pair as `COLLECTION_PLATFORM` and `COLLECTION_MODE`. Set `COLLECTION_MAX_UNITS` to the maximum number of credits you authorize, then export it. This command reads the IDs from the brand response and writes the collection request.

```
python3 - <<'PY' > collection.json
import json
import os
import sys

with open("brand-response.json") as response:
    brand = json.load(response)["data"]

json.dump({
    "workflow": "collect",
    "brand_id": brand["id"],
    "prompt_ids": brand["prompt_ids"],
    "market": brand["markets"][0],
    "sources": [{
        "platform": os.environ["COLLECTION_PLATFORM"],
        "mode": os.environ["COLLECTION_MODE"],
    }],
    "max_units": int(os.environ["COLLECTION_MAX_UNITS"]),
}, sys.stdout)
PY
```

Send the request with [`POST /v2/runs`](https://aeoapi.dev/docs/api-reference#post-v2-runs). The `collect` workflow can use credits up to the `max_units` limit in the request.

```
curl --fail-with-body "$AEO_API_BASE_URL/v2/runs" \
  -H "Authorization: Bearer $AEO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $COLLECTION_REQUEST_KEY" \
  --data-binary @collection.json \
  --output run-response.json
```

## 3. Read the result

Follow `data.poll_url` from `run-response.json`, or set `RUN_ID` to the returned `data.id`, including its `job:` prefix. Send [`GET /v2/runs/{run_id}`](https://aeoapi.dev/docs/api-reference#get-v2-runs-run_id) to read `data.state`.

```
curl --fail-with-body "$AEO_API_BASE_URL/v2/runs/$RUN_ID" \
  -H "Authorization: Bearer $AEO_API_KEY"
```

If the run is still in progress, wait and repeat the same GET. When it completes, `data.result` contains the collected-answers summary. Check it for accepted and failed counts and the observation IDs included in the response.
