# GraphQL Queries

### GraphQL URIs

### Mainnet

{% embed url="<https://api.andromedaprotocol.io/graphql/mainnet>" %}

### Testnet

{% embed url="<https://api.andromedaprotocol.io/graphql/testnet>" %}

### Examples

You can find all the available queries in the Docs section on the right of the playground:

{% hint style="warning" %}
If unsure about one of the query fields, you can find more info about it in the ADOs documentation page in the [smart contract docs](https://docs.andromedaprotocol.io/andromeda/andromeda-digital-objects/introduction-to-ados).
{% endhint %}

<figure><img src="/files/ItwS1mausPGenUs0upBc" alt=""><figcaption></figcaption></figure>

Here is an example of querying a CW20 ADO for information:

```graphql
query CW20($contractAddress: String!) {
  ADO {
    cw20(address: $contractAddress) {
      address
      marketingInfo {
        description
        logo
        marketing
        project
      }
      minter {
        cap
        minter
      }
    }
  }
}

```

#### Result

{% hint style="warning" %}
Dont forget the set a value for the  Query variables.
{% endhint %}

<figure><img src="/files/UxhHJ3sUtd9VsuxPgYSP" alt=""><figcaption></figcaption></figure>

You can also try the query by running the following in your terminal:

{% code overflow="wrap" fullWidth="false" %}

```bash
curl 'https://api.andromedaprotocol.io/graphql/testnet' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Connection: keep-alive' \
-H 'DNT: 1' \
-H 'Origin: https://api.andromedaprotocol.io' \
--data-binary '{"query":"query CW20($contractAddress: String!) {\n  ADO {\n    cw20(address: $contractAddress) {\n      address\n      marketingInfo {\n        description\n        logo\n        marketing\n        project\n      }\n      minter {\n        cap\n        minter\n      }\n    }\n  }\n}\n","variables":{"contractAddress":"andr10n3zrq9z7e5qmqhryazxmgjx7tkjumyudtv34j6vzlpst5r8g9xsex8zav"}}' --compressed
```

{% endcode %}

Query chain Ids for all chains:

```graphql
query chainConfigs{
  chainConfigs{
    allConfigs{
      chainId
    }
  }
}
```

Result

<figure><img src="/files/CJoHBWcJASmyluWc1jH4" alt=""><figcaption></figcaption></figure>

{% code overflow="wrap" %}

```bash
curl 'https://api.andromedaprotocol.io/graphql/testnet' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Connection: keep-alive' \
-H 'DNT: 1' \
-H 'Origin: https://api.andromedaprotocol.io' \
--data-binary '{"query":"query chainConfigs{\n  chainConfigs{\n    allConfigs{\n      chainId\n    }\n  }\n}","variables":{"contractAddress":"andr10n3zrq9z7e5qmqhryazxmgjx7tkjumyudtv34j6vzlpst5r8g9xsex8zav"}}' --compressed
```

{% endcode %}

You can find more GQL query formats [here](https://github.com/andromedaprotocol/andromeda.js/blob/development/packages/gql/schema/master-schema.graphql).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.andromedaprotocol.io/andromeda.js/queries/graphql-queries.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
