> For the complete documentation index, see [llms.txt](https://docs.aavegotchi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aavegotchi.com/developers/subgraphs/core-matic-subgraph.md).

# Core Matic Subgraph

The probably best way to discover the subgraph is the GraphQL Playground from thegraph itself: [Try the Playground](https://thegraph.com/legacy-explorer/subgraph/aavegotchi/aavegotchi-core-matic?version=current)

The full documentation can be found in the repository [here](https://githublink)

If you want connect to the endpoint please use the following endpoint: `https://api.thegraph.com/subgraphs/name/aavegotchi/aavegotchi-core-matic` Below you can find some possible use cases:

## Examples

### Get traits and modified traits of specific Aavegotchi

You can get information about the traits of the gotchi with the following query

```
{
  aavegotchi(id: 4430) {
    numericTraits, modifiedNumericTraits
  }
}
```

It will return an array with integers which represents the values of the six different traits. The order is: Energy, Aggression, Spookiness, Brain Size, Eye Shape, Eye Color

```
{
  "data": {
    "aavegotchi": {
      "modifiedNumericTraits": [
        18,
        68,
        10,
        48,
        82,
        22
      ],
      "numericTraits": [
        17,
        68,
        10,
        48,
        82,
        22
      ]
    }
  }
}
```

### Get Bazaar Listings of items which are a potion

Its also possible to fetch present and historic listings on the bazaar. If you want to fetch all available potions. You must first fetch the itemTypeID of the items you want to fetch and insert the IDs afterwards in your getListings Query:

```
{
  itemTypes(where:{name_contains: "Potion"}) {
  name, id
}
```

will return

```
 "itemTypes": [
  {
    "id": "126",
    "name": "Kinship Potion"
  },
  {
    "id": "127",
    "name": "Greater Kinship Potion"
  },
  {
    "id": "128",
    "name": "XP Potion"
  },
  {
    "id": "129",
    "name": "Greater XP Potion"
  }
]
```

Afterwards you can get the Listings with:

```
erc1155Listings(where: {id_in: ["126", "127","128","129"]}) {
  priceInWei, seller, quantity, erc1155TypeId, erc1155TokenAddress
}
```

which will return

```
"erc1155Listings": [
  {
    "erc1155TokenAddress": "0x86935f11c86623dec8a25696e1c19a8659cbf95d",
    "erc1155TypeId": "78",
    "priceInWei": "200000000000000000000",
    "quantity": "1",
    "seller": "0xded1fd193cd8b55c2f9c42b3257d5a9088c7d137"
  },
  {
    "erc1155TokenAddress": "0x86935f11c86623dec8a25696e1c19a8659cbf95d",
    "erc1155TypeId": "106",
    "priceInWei": "1100000000000000000000",
    "quantity": "1",
    "seller": "0x75ddb7ab958135bbe2dab48d6286826f6aa5e3b4"
  },
  {
    "erc1155TokenAddress": "0x86935f11c86623dec8a25696e1c19a8659cbf95d",
    "erc1155TypeId": "105",
    "priceInWei": "3000000000000000000000",
    "quantity": "1",
    "seller": "0xf3152f7f73b3cc394708e6c465c4bc8598cc44f5"
  },
  {
    "erc1155TokenAddress": "0x86935f11c86623dec8a25696e1c19a8659cbf95d",
    "erc1155TypeId": "128",
    "priceInWei": "398000000000000000000",
    "quantity": "5",
    "seller": "0xbeaea5d64b81e48e9f91870cbc8ca5f00d8c396f"
  }
],
```

### Get user data

In case you need all the data from a specifc user you fetch also the user entities. The user contains arrays of from user bought & owned portals, as well as owned gotchis.

```
user(id: "0x1ad3d72e54fb0eb46e87f82f77b284fc8a66b16c") {
      portalsOwned{id }, portalsBought {id},gotchisOwned { id, name },id
}
```

returns

```
{
  "data": {
    "user": {
      "gotchisOwned": [
        {
          "id": "4430",
          "name": "ChillETH"
        }
      ],
      "id": "0x1ad3d72e54fb0eb46e87f82f77b284fc8a66b16c",
      "portalsBought": [],
      "portalsOwned": [
        {
          "id": "4430"
        }
      ]
    }
  }
}
```

Be sure that the ID is case sensitive and you have to provide the address as lowercase!

### Get statistics

We also maintain some statistics on the subgraph. Such as portals bought, portal opened and aavegotchis claimed, but also some market data. You can query for volumes from the market:

```
{
  statistics {
    portalsBought,
    portalsOpened,
    aavegotchisClaimed,
    erc721TotalVolume,
    erc1155TotalVolume
  }
}
```

you will get something like

```
{
  "data": {
    "statistics": [
      {
        "aavegotchisClaimed": "7136",
        "erc1155TotalVolume": "9486555714498572424804980",
        "erc721TotalVolume": "11126949887492653499800000",
        "portalsBought": "10000",
        "portalsOpened": "7761"
      }
    ]
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.aavegotchi.com/developers/subgraphs/core-matic-subgraph.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
