Skip to content

    Group tracked questions into a topic

    Create a billing topic when you want to report on several billing questions together. The topic contains references to prompts the brand already tracks.

    Before you start

    Set BRAND_ID to an active brand’s ID and AEO_API_KEY to an editor, owner or service key with prompts:read and prompts:write. Topics are available on Analyzer and Optimizer.

    1. Pick the questions

    curl --fail-with-body --get 'https://api.aeoapi.dev/v2/prompts' \
      -H "Authorization: Bearer $AEO_API_KEY" \
      --data-urlencode "brand_id=$BRAND_ID" \
      --data-urlencode 'view=topic_suggestions' \
      --data-urlencode 'query=billing'

    Each matching entry in data has an id, text and version. Choose a question whose wording belongs in the report. Set PROMPT_ID to its ID. If the list is empty, change the search text or check which prompts the brand tracks.

    2. Create the topic

    Generate TOPIC_ID once with uuidgen. This example adds one question. Include other selected IDs in prompt_ids if needed.

    curl --fail-with-body -X PATCH 'https://api.aeoapi.dev/v2/prompts' \
      -H "Authorization: Bearer $AEO_API_KEY" \
      -H 'Content-Type: application/json' \
      --data-binary @- <<JSON
    {
      "action": "topic",
      "brand_id": "$BRAND_ID",
      "topic_id": "$TOPIC_ID",
      "name": "Billing",
      "prompt_ids": ["$PROMPT_ID"],
      "expected_revision": 0
    }
    JSON

    The result includes the topic’s id, prompt_ids and revision. On an edit, supply the current expected_revision and the full list of prompts you want to keep.

    3. Check membership before reporting

    curl --fail-with-body --get 'https://api.aeoapi.dev/v2/prompts' \
      -H "Authorization: Bearer $AEO_API_KEY" \
      --data-urlencode "brand_id=$BRAND_ID" \
      --data-urlencode 'view=topics'

    Find the topic by ID and compare its prompt_ids with the questions you selected. Pass the topic ID as topic_id when reading a monthly report.