v2PostRuns
Start a workflow or request its estimate. The collection example prices a prompt and market before you request any answers.
See the REST reference for POST /v2/runs.
Signature
v2PostRuns(
body: Record<string, unknown>,
options?: {
signal?: AbortSignal;
idempotencyKey?: string;
},
): Promise<ApiResponse<unknown>>Parameters
body- JSON object for this action. The example includes the fields for estimate_collect.
options- Pass the named options in the signature. The selected action or view determines which fields are required.
options.signal- Optional AbortSignal to cancel the HTTP request.
options.idempotencyKey- The SDK generates a request key when you omit it. Pass the same key and body to retry this write in a separate call.
Return value
Promise<ApiResponse<unknown>>. A collection estimate returns estimated_credits, maximum_credits and answer_count in data. A start request can return a run to poll.
Errors
- The SDK throws AeoApiError if the API returns an error. Inspect status, code, fieldErrors and requestId.
- AeoTransportError means the request failed to connect or the client could not finish reading a successful response. Invalid JSON in a successful response throws SyntaxError. If you abort the request, the SDK throws the reason from the AbortSignal.
- For HTTP 422, check fieldErrors for the input field and validation message.
TypeScript example
import { AeoClient } from "@aeoapi/aeo-sdk";
const apiKey = process.env.AEO_API_KEY;
if (!apiKey) throw new Error("Set AEO_API_KEY on your server.");
const client = new AeoClient(apiKey, { baseUrl: "https://api.aeoapi.dev" });
// Substitute your own record IDs and values.
const body = {
"answer_mode": "standard",
"brand_id": "00000000-0000-4000-8000-000000000001",
"estimate": true,
"market": {
"country": "US",
"language": "en"
},
"max_units": 0,
"prompt_ids": [
"00000000-0000-4000-8000-000000000001"
],
"sources": [
{
"mode": "ui_normal",
"platform": "chatgpt"
}
],
"workflow": "collect"
};
const response = await client.v2PostRuns(body);
console.log(response.status, response.body);Requests by feature
Prompts and topics
AI answer collection and runs
Site audits and page checks
Citations
Answer accuracy
Retrieval simulator and content testing
- Estimate a pre-publish review
- Review a draft before publication
- Estimate a retrieval benchmark
- Benchmark a draft
- Estimate a regression test
- Compare staging and production
- Estimate paragraph win rates
- Simulate paragraph win rates
- Estimate passage overlap
- Compare passages with answers
- Estimate question coverage
- Check buyer question coverage
- Test passage position
- Compare personas and markets
- Find gaps in comparison evidence
- Check asset readability
Recommendations and visibility analyst
Content drafts and editorial generation
AI search topics
Submit to Brave
See TypeScript client setup for authentication, timeouts and retry settings.