Skip to content

    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.

    POST /v2/runs

    • Body workflow is managed.
    • Body estimate is true. Default is false.

    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

    Request parameters
    NameWhereTypeRequiredDescription
    Idempotency-KeyheaderstringYes

    Request body

    {
      "brand_id": "00000000-0000-4000-8000-000000000001",
      "estimate": true,
      "market": {
        "country": "US",
        "language": "en"
      },
      "workflow": "managed"
    }
    Request body fields 1
    NameTypeRequiredDescription
    all_locationsbooleanNo
    allow_country_levelbooleanNoAllow a country-level answer when the source cannot apply the requested location.
    answer_mode"standard" | "new"NoUse standard for the normal answer or new to request a new answer.
    brand_idstring (uuid)Yes
    estimatetrueYes
    location_idsarray of string (uuid)No
    marketobjectYes``components.schemas.Market``.
    market.citystring | nullNo
    market.countrystringYes
    market.languagestringYes
    market.latitudenumber | nullNo
    market.location_idstring (uuid) | nullNo
    market.longitudenumber | nullNo
    market.postal_codestring | nullNo
    market.regionstring | nullNo
    sourcesarray of object | nullNo
    sources.device"desktop" | "mobile" | "unknown" | nullNo
    sources.mode"ui_normal" | "ui_search" | "api_normal" | "api_web" | "ai_mode" | "ai_overview" | "organic_search"ConditionalThe 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"ConditionalThe platform where the answer was observed.
    sources.providerstring | nullNo
    websitestring | nullNo
    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.json
    import 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.

    HTTP 200 response fields 1
    NameTypeRequiredDescription
    dataobjectYesThe requested result. See the fields below for its contents.
    data.brand_idstringYesIdentifies the brand this result belongs to.
    data.eligible_enginesarray of objectYes
    data.eligible_engines[].applied_locationobject | nullNo
    data.eligible_engines[].applied_location.citystring | nullNo
    data.eligible_engines[].applied_location.countrystring | nullNo
    data.eligible_engines[].applied_location.granularity"country" | "region" | "city" | "postal" | "coordinates"Conditional
    data.eligible_engines[].applied_location.latitudenumber | nullNo
    data.eligible_engines[].applied_location.longitudenumber | nullNo
    data.eligible_engines[].applied_location.postal_codestring | nullNo
    data.eligible_engines[].applied_location.regionstring | nullNo
    data.eligible_engines[].charge_per_stepintegerYes
    data.eligible_engines[].reserve_per_stepintegerYes
    data.eligible_engines[].sourceobjectYes
    data.eligible_engines[].unenforced_controlsarray of stringYes
    data.estimate_fingerprintstringYes
    data.estimated_creditsintegerYesThe expected credit cost for this selection.
    data.excluded_sourcesarray of objectYesSources 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_idstring (uuid)No
    data.expires_atstringYes
    data.location_totalsarray of objectNo
    data.location_totals[].eligible_enginesarray of objectNo
    data.location_totals[].eligible_engines[].sourceobjectConditional
    data.location_totals[].eligible_engines[].unenforced_controlsarray of stringConditional
    data.location_totals[].estimated_creditsintegerConditional
    data.location_totals[].location_idstring (uuid)Conditional
    data.location_totals[].marketobjectConditional
    data.location_totals[].market.citystring | null | nullNo
    data.location_totals[].market.countrystringConditional
    data.location_totals[].market.languagestringConditional
    data.location_totals[].market.latitudenumber | nullNo
    data.location_totals[].market.location_idstring (uuid)No
    data.location_totals[].market.longitudenumber | nullNo
    data.location_totals[].market.postal_codestring | nullNo
    data.location_totals[].market.regionstring | null | nullNo
    data.location_totals[].maximum_creditsintegerConditional
    data.location_totals[].prompt_countintegerConditional
    data.maximum_creditsintegerYesThe upper credit estimate for this selection.
    data.poll_urlstringYesSend an authenticated GET request to this URL to read the current result.
    data.prompt_countintegerYes
    data.prompt_set_revisionstringYes
    data.run_idstring | nullNoIdentifies the run. Keep any prefix when using it in a request.
    data.websitestring | nullYes
    metaobjectYesInformation 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.

    AI answer collection and runs reference