Asteroid Protocol API
Last updated
Last updated
Test out the API instantly here: Apollo Graph
Developers can use GraphQL to query the public Asteroid API via the public endpoint at https://new-api.asteroidprotocol.io/v1/graphql.
Prefer Python? Any GraphQL client like https://github.com/graphql-python/gql should work.
You can also use publicly-available GraphQL tool such as Apollo Graph. Simply, paste the Asteroid Protocol endpoint (https://new-api.asteroidprotocol.io/v1/graphql) into the sandbox field:
Then, you can submit queries in the operation field and click the "run" button to see the results.
To find CFT-20 holders, paste the following query in the operation field, then click "run":
In this example query, we’re pulling 10 addresses that hold “STAKE” tokens, and we’re showing the total amount of STAKE that they hold. To pull more than 10 addresses at a time, increase or eliminate the "limit" field from your query. To query a different token, replace "STAKE" with your desired ticker (as all tickers are required to be unique).
Note that the API strips the decimal point from the "amount" field, so you’ll need to manually add a decimal point after the first 6 digits from the right. For example, in the image below you can see that the API indicates that the address ending in "…ux3z" holds 22780000000 STAKE. When we manually re-add the decimal point, we see the human-readable value, which is 22,780.000000 STAKE.
To find collection holders, paste the following query in the Playground:
This example returns all holders of the Mong collection. You can find the symbol for a collection by visiting its landing page in the marketplace and copying it from the URL. For example, check out the highlighted portion of the link for the Mong collection: https://asteroidprotocol.io/app/collection/MONG
Paste the following query into the operation field and click the "run" button. In this case, the token is ROIDS (which has an id or "_eq" of "1"):
You can find the _eq for any token by visiting the token's landing page. Simply replace ROIDS in this URL, https://asteroidprotocol.io/app/token/ROIDS, with your desired ticker. Then, the token's unique ID will appear in the top right of the screen:
Paste the following query into the operation field and click the "run" button. Be sure to replace the text that says “paste_your_cosmos_address_here” with your actual Cosmos Hub address. Then, click the “run” button to get a list of all the inscriptions, which your address has created.
The API will return your query results in JSON. You can copy that JSON into a JSON-to-CSV converter here: https://konklone.io/json/
Paste the following query in the operation field and click "run":
Let's look at the metadata for a specific inscription (in this case, Inscription #11087, which was randomly chosen). Paste the following query in the operation field and click "run":
Paste the following query in the operation field and click "run":
Paste the following query in the operation field and click "run":