AI answer collection and runs
Estimate a managed check
See the eligible and excluded sources, expected credits and maximum reservation before starting a managed check. The estimate expires after 15 minutes.
- Body
workflowismanaged. - Body
estimateistrue. Default isfalse.
Authentication and access
- Authentication
- Bearer API key
- Scopes
- collections:write
- Roles
- editor, owner, service
- Plans
- Optimizer, Analyzer
- Credits
- The estimate uses zero credits.
Read data.estimated_credits for the estimate and data.maximum_credits for the upper limit.
Parameters
| Name | Where | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | Yes |
Request body
{
"brand_id": "00000000-0000-4000-8000-000000000001",
"estimate": true,
"market": {
"country": "US",
"language": "en"
},
"workflow": "managed"
}| Name | Type | Required | Description |
|---|---|---|---|
all_locations | boolean | No | |
allow_country_level | boolean | No | Allow a country-level answer when the source cannot apply the requested location. |
answer_mode | "standard" | "new" | No | Use standard for the normal answer or new to request a new answer. |
brand_id | string (uuid) | Yes | |
estimate | true | Yes | |
location_ids | array of string (uuid) | No | |
market | object | Yes | ``components.schemas.Market``. |
market.city | string | null | No | |
market.country | string | Yes | |
market.language | string | Yes | |
market.latitude | number | null | No | |
market.location_id | string (uuid) | null | No | |
market.longitude | number | null | No | |
market.postal_code | string | null | No | |
market.region | string | null | No | |
sources | array of object | null | No | |
sources.device | "desktop" | "mobile" | "unknown" | null | No | |
sources.mode | "ui_normal" | "ui_search" | "api_normal" | "api_web" | "ai_mode" | "ai_overview" | "organic_search" | Conditional | The mode used to collect the answer. The unverified value appears only in evidence. |
sources.platform | "chatgpt" | "gemini" | "claude" | "perplexity" | "google" | "bing" | "brave" | "meta_ai" | "grok" | "universal" | Conditional | The platform where the answer was observed. |
sources.provider | string | null | No | |
website | string | null | No | |
workflow | "managed" | Yes |
Request examples
Set AEO_API_BASE_URL to https://api.aeoapi.dev and AEO_API_KEY to your server-side API key. Set the other environment variables to the values for your request.
Save the JSON request body as request.json. Replace sample IDs, revisions and other values with your own.
curl --fail-with-body -X POST "$AEO_API_BASE_URL/v2/runs" \
-H "Authorization: Bearer $AEO_API_KEY" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-H "Content-Type: application/json" \
--data-binary @request.jsonimport json
from pathlib import Path
from os import environ
from aeo_sdk import AeoClient
body = json.loads(Path("request.json").read_text())
with AeoClient(environ["AEO_API_KEY"], base_url=environ["AEO_API_BASE_URL"]) as client:
response = client.v2_post_runs(
body=body,
idempotency_key=environ["IDEMPOTENCY_KEY"],
)
print(response.body)import { AeoClient } from "@aeoapi/aeo-sdk";
import { readFile } from "node:fs/promises";
const client = new AeoClient(process.env.AEO_API_KEY!, {
baseUrl: process.env.AEO_API_BASE_URL!,
});
const body = JSON.parse(await readFile("request.json", "utf8"));
const response = await client.v2PostRuns(
body,
{
idempotencyKey: process.env.IDEMPOTENCY_KEY!,
},
);
console.log(response.body);Responses
HTTP 200
Successful Response
application/json
Response fields are listed below.
| Name | Type | Required | Description |
|---|---|---|---|
data | object | Yes | The requested result. See the fields below for its contents. |
data.brand_id | string | Yes | Identifies the brand this result belongs to. |
data.eligible_engines | array of object | Yes | |
data.eligible_engines[].applied_location | object | null | No | |
data.eligible_engines[].applied_location.city | string | null | No | |
data.eligible_engines[].applied_location.country | string | null | No | |
data.eligible_engines[].applied_location.granularity | "country" | "region" | "city" | "postal" | "coordinates" | Conditional | |
data.eligible_engines[].applied_location.latitude | number | null | No | |
data.eligible_engines[].applied_location.longitude | number | null | No | |
data.eligible_engines[].applied_location.postal_code | string | null | No | |
data.eligible_engines[].applied_location.region | string | null | No | |
data.eligible_engines[].charge_per_step | integer | Yes | |
data.eligible_engines[].reserve_per_step | integer | Yes | |
data.eligible_engines[].source | object | Yes | |
data.eligible_engines[].unenforced_controls | array of string | Yes | |
data.estimate_fingerprint | string | Yes | |
data.estimated_credits | integer | Yes | The expected credit cost for this selection. |
data.excluded_sources | array of object | Yes | Sources omitted from the estimate. Location estimates include the affected location_id with each exclusion. Location exclusions have reason location_not_supported. Sources outside your plan have reason feature_not_offered. |
data.excluded_sources[].location_id | string (uuid) | No | |
data.expires_at | string | Yes | |
data.location_totals | array of object | No | |
data.location_totals[].eligible_engines | array of object | No | |
data.location_totals[].eligible_engines[].source | object | Conditional | |
data.location_totals[].eligible_engines[].unenforced_controls | array of string | Conditional | |
data.location_totals[].estimated_credits | integer | Conditional | |
data.location_totals[].location_id | string (uuid) | Conditional | |
data.location_totals[].market | object | Conditional | |
data.location_totals[].market.city | string | null | null | No | |
data.location_totals[].market.country | string | Conditional | |
data.location_totals[].market.language | string | Conditional | |
data.location_totals[].market.latitude | number | null | No | |
data.location_totals[].market.location_id | string (uuid) | No | |
data.location_totals[].market.longitude | number | null | No | |
data.location_totals[].market.postal_code | string | null | No | |
data.location_totals[].market.region | string | null | null | No | |
data.location_totals[].maximum_credits | integer | Conditional | |
data.location_totals[].prompt_count | integer | Conditional | |
data.maximum_credits | integer | Yes | The upper credit estimate for this selection. |
data.poll_url | string | Yes | Send an authenticated GET request to this URL to read the current result. |
data.prompt_count | integer | Yes | |
data.prompt_set_revision | string | Yes | |
data.run_id | string | null | No | Identifies the run. Keep any prefix when using it in a request. |
data.website | string | null | Yes | |
meta | object | Yes | Information about this response, including any warnings or pagination details. |
Errors
Read code and message in the error response. Keep request_id when you contact support.
- HTTP 400
invalid_request - HTTP 401
unauthenticated - HTTP 402
quota_exceeded - HTTP 403
forbidden - HTTP 404
not_found - HTTP 422
validation_error - HTTP 429
rate_limited