Skip to content

    Check AI answers against approved facts

    Use an accuracy check to investigate a specific claim, such as an answer that quotes an old price. The check needs saved answers and approved facts for the same brand.

    Before you start

    Set BRAND_ID and an OBSERVATION_ID from a saved collection check. Use a billable Analyzer or Optimizer account and an editor, owner or service key in AEO_API_KEY. Starting the check needs prompts:write. Reading approved facts and results needs analytics:read.

    1. Confirm the facts are available

    curl --fail-with-body --get 'https://api.aeoapi.dev/v2/analytics/accuracy_facts' \
      -H "Authorization: Bearer $AEO_API_KEY" \
      --data-urlencode "brand_id=$BRAND_ID" \
      --data-urlencode 'status=approved'

    Check that the approved facts cover the claim and market you want to investigate. If a claim has no matching fact, save the brand’s approved facts before you run the check.

    2. Get the price for the selected answers

    curl --fail-with-body 'https://api.aeoapi.dev/v2/runs' \
      -H "Authorization: Bearer $AEO_API_KEY" \
      -H 'Content-Type: application/json' \
      --data-binary @- <<JSON
    {
      "workflow": "check_answer_accuracy",
      "estimate": true,
      "brand_id": "$BRAND_ID",
      "observation_ids": ["$OBSERVATION_ID"]
    }
    JSON

    Read data.estimated_units, data.max_units, data.check_count and data.expires_at. Save data.estimate_id in ESTIMATE_ID. If you accept the ceiling, set MAX_UNITS to the quoted max_units.

    3. Start the check

    Set CHECK_KEY to a new UUID. Keep it with the request body in case the response is interrupted.

    curl --fail-with-body 'https://api.aeoapi.dev/v2/runs' \
      -H "Authorization: Bearer $AEO_API_KEY" \
      -H "Idempotency-Key: $CHECK_KEY" \
      -H 'Content-Type: application/json' \
      --data-binary @- <<JSON
    {
      "workflow": "check_answer_accuracy",
      "brand_id": "$BRAND_ID",
      "estimate_id": "$ESTIMATE_ID",
      "max_units": $MAX_UNITS
    }
    JSON

    HTTP 202 returns data.poll_url. Store that relative path in POLL_PATH.

    4. Read the verdict for each claim

    curl --fail-with-body "https://api.aeoapi.dev$POLL_PATH" \
      -H "Authorization: Bearer $AEO_API_KEY"

    Wait between reads while data.status is in_progress. When it is completed, match each entry in data.result.checks to its observation_id. Read the individual claims before using the overall accuracy_score. A contradicted claim disagrees with a fact. For not_covered or insufficient_evidence, check whether the reviewer needs another fact or source.

    Read the citation analysis guide to find pages cited alongside the answers you reviewed.