Query Points and Billing infromation APIs

Query Points and Billing infromation APIs

Table of Contents

  1. Get Information About Your API Key With a Query
  2. Know How Many Points a Query Consumes for its ID
  3. References

Get Information About Your API Key With a Query

We will learn:

  • Get details of our API Key
  • Get our Billing Day
  • Remaining Points
  • And other relevant information about our API Key

Requirements:

To obtain the details of our API Key we will use the following query

query activePeriodInformation {
  utilities {
    activePeriod (apiKey: "YOUR_API_KEY"){
      pointsRemaining
      points
      isPaid
      isPointsConsumed
      isSpent
      isBlocked
      starts {
        date
      }
      ends {
        date
      }
      billingDay
    }
  }
}

We need to replace YOUR_API_KEY with our API Key


Yeah, but why do I want to know those details if we can see them on the Bitquery page?

This could be useful to implement it in the logic of our applications, but what for?
Imagine that you have 100k points and your application consumes an average of 10k points per day, implementing something like this you can keep an internal metric (as well as know when to make different queries).

Know How Many Points a Query Consumes for its ID

We will learn:

  • Know how much a query consumes

Requirements:

  • A Query ID

With the following query we will be able to know how much a query consumes with its ID

query activePeriodInformation {
  utilities {
    metrics(queryId: "QUERY-ID") {
      points
    }
  }
}

We need to replace QUERY-ID with our Query ID


References

If you have any specific problem, maybe these links will help you:

Bitquery Official Page

Bitquery Forum

Bitquery on Telegram

1 Like