# GraphQL (deprecated)

## API version 0.3

{% hint style="danger" %}
GraphQL APIs are deprecated for now. We will provide new APIs when our new Norge v2 indexer is complete.
{% endhint %}

## Avascan API

Avascan is the most complete, fast and privacy-focused explorer for the Avalanche network. With Avascan API developers can build apps and tools. You can start queries by accessing the [GraphQL Avascan API Playground](https://graphql.avascan.info).

{% hint style="warning" %}
Note: currently queries only show results for X-Chain. P-Chain and C-Chain are not indexed yet.
{% endhint %}

## Blockchains

Avalanche is the 'internet of blockchains', and as such, you can browse and extract info about a given blockchain. Currently, there are only three permissionless blockchains nicknamed *P-Chain*, *X-Chain* and *C-Chain*. There are also permissioned blockchains, and both permissionless and permissioned will likely increase in number when the mainnet is launched. You can browse blockchains with a simple query: you will get the number of blockchains in the Avalanche network.

```bash
query {
  blockchains {
    count
  }
}
```

You can also get more specific information about a single blockchain.

{% tabs %}
{% tab title="Query 1" %}

```bash
query {
  blockchains(limit: 5, offset: 0) {
    count
    results {
      id
      name
      subnet
      vm
```

{% endtab %}

{% tab title="Query 2" %}

```
query {
  blockchains(id: "2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM") {
    count
    results {
      id
      name
      subnet
      vmID
    }
  }
}
```

{% endtab %}
{% endtabs %}

## Transactions

If you want more info on a specific blockchain, query its transactions. Do it by passing the `assetID` and you can order it by any attribute, `desc` or `asc`. You need to specify the attributes you want to get in the result response, as shown below:

```
query {
  transactions(
    assetID: "3ofDwYQKgBvsZQTBXJnqdvcns4aGikwSnGie2kc6xWJM7MAGb"
    limit: 10
    offset: 0
    orderBy: { acceptedAt: "desc" }
  ) {
    count
    results {
      ... on XBaseTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
      }
      ... on XCreateAssetTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
      ... on XExportTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
      ... on XImportTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
    }
  }
}
```

{% hint style="warning" %}
Note: ordering by certain variables may not be available yet.
{% endhint %}

You can also filter the transactions to obtain the ones that are specific to a certain asset filtering by `assetID`:

```bash
query {
  transactions(
    assetID: "3ofDwYQKgBvsZQTBXJnqdvcns4aGikwSnGie2kc6xWJM7MAGb"
    limit: 10
    offset: 0
    orderBy: { acceptedAt: "desc" }
  ) {
    count
    results {
      ... on XBaseTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
      }
      ... on XCreateAssetTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
      ... on XExportTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
      ... on XImportTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
    }
  }
}
```

Or you can filter by `address`:

```bash
query {
  transactions(
    address: "X-avax149ssfat0569urv3xgppnz08ffrch5yjkzfs3xz"
    limit: 10
    offset: 0
    orderBy: { acceptedAt: "desc" }
  ) {
    count
    results {
      ... on XBaseTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
      }
      ... on XCreateAssetTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
      ... on XExportTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
      ... on XImportTransaction {
        inputs {
          output {
            id
            transactionID
            outputIndex
            assetID
            outputType
            amount
            locktime
            threshold
            addresses
            redeemingTransactionID
            type
          }
          credentials {
            address
            publicKey
            signature
          }
        }
        outputs {
          id
          transactionID
          outputIndex
          assetID
          outputType
          amount
          locktime
          threshold
          addresses
          redeemingTransactionID
          type
        }
        id
        chainID
        type
        acceptedAt
      }
    }
  }
}
```

## Address outputs

Get a series of UTXO-related info for a specific address by including a `redeemingTransactionID` that shows if the output related to that address has already been spent.

```bash
query {
  outputs: outputs(address: "X-avax149ssfat0569urv3xgppnz08ffrch5yjkzfs3xz") {
    count
    results {
      ... on XOutput {
        id
        transactionID
        outputIndex
        assetID
        outputType
        amount
        locktime
        threshold
        addresses
        redeemingTransactionID
        type
      }
    }
  }
}
```

## Get the list of validators

Get a complete list of validators, both *active* and *pending*. You can order the result by `startTime`, `endTime`, `weight`, `address`, `subnet` or `id`.

```bash
query {
  validators(
    status: "active"
    limit: 10
    offset: 0
    orderBy: { endTime: "asc" }
  ) {
    count
    results {
      id
      weight
      beneficiary {
        addresses
      }
      startTime
      endTime
      subnet
      status
      delegatedWeights
      delegations
      subnets {
        weight
        startTime
        endTime
        subnet
        status
        delegatedWeights
        delegations
      }
    }
  }
}
```

## Get the list of delegators

```bash
query {
  transactions(
    chainID: "p-chain"
    limit: 10
    type: "P_ADD_DEFAULT_SUBNET_DELEGATOR"
    offset: 0
    orderBy: { acceptedAt: "desc" }
  ) {
    count
    results {
      ... on PAddDefaultSubnetDelegator {
        id
        chainID
        type
        acceptedAt
        weight
        from
        nodeID
        beneficiary {
          addresses
        }
        startTime
        endTime
      }
    }
  }
}
```

The Avascan API Platform is still under heavy development, and many more endpoints will become available soon.

[Join our Discord](https://discord.gg/CQJGs5B) chat to stay updated and connect with the team, ask for new features or give feedback.


---

# 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.avascan.info/api/api-v1-deprecated/quickstart-graphql.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.
