Skip to content

    Check available credits and sources

    A collection can use different numbers of credits depending on the questions and answer sources you choose. Read the account balance before you set a spending cap.

    Before you start

    Load a server-side key into AEO_API_KEY. You need account:read for the plan and sources, and usage:read for the balance. These reads use zero credits on Analyzer and Optimizer.

    1. Identify the billing period

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

    Check data.plan and data.status. Save billing_period_start and billing_period_end from data if you show the current allowance to a customer.

    2. Find the sources the account can use

    curl --fail-with-body 'https://api.aeoapi.dev/v2/account?view=sources' \
      -H "Authorization: Bearer $AEO_API_KEY"

    Read the entries in data.capabilities before offering a source in your application. For a location-specific collection, check the source’s targeting options.

    3. Read the remaining credits

    curl --fail-with-body 'https://api.aeoapi.dev/v2/account?view=usage' \
      -H "Authorization: Bearer $AEO_API_KEY"

    Show data.remaining_units with the returned period_start and period_end. consumed_units counts credits spent. reserved_units covers work that has already reserved part of the allowance. Check breakdown when you need to explain where the credits went.

    Use the balance to choose a budget, then estimate a collection for the questions and source you intend to track.