> For the complete documentation index, see [llms.txt](https://docs.xp-protocol.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xp-protocol.io/products/xp-protocol/integrations/xp-subgraph.md).

# XP Subgraph

The HUDDLN XP subgraph allows you to access any XP data submitted by our partners.

The data is also accessible on-chain with smart contract calls, but for a majority of use cases accessing the data through a subgraph is the best option.

**XP subgraph URL:** [**https://thegraph.com/hosted-service/subgraph/bcaklovi/huddln-xp-mainnet**](https://thegraph.com/hosted-service/subgraph/bcaklovi/huddln-xp-mainnet)<br>

**XP subgraph endpoint URL:** [**https://api.thegraph.com/subgraphs/name/bcaklovi/huddln-xp-mainnet**<br>](<https://api.thegraph.com/subgraphs/name/bcaklovi/huddln-xp-mainnet&#xA;>)

#### Here are some example queries for common use cases:

Search for a user's score based on their wallet address:

```
{
  scoreboards(where: {project: "0xe8472970fa4c25d53db67811a25a31e037a7168f719b645da63e99984701666d", address: "0xc7e8ac5caccbe263e09638c8069c85513e23ffbb"}) {
    id
    totalScore
    address
  }
}
```

[<br>](<https://api.thegraph.com/subgraphs/name/bcaklovi/huddln-xp-system&#xA;>)

The HUDDLN XP subgraph allows you to access any XP data submitted by our partners.

The data is also accessible on-chain with smart contract calls, but for a majority of use cases accessing the data through a subgraph is the best option.

**XP subgraph URL:**[ ](https://thegraph.com/hosted-service/subgraph/bcaklovi/huddln-xp-system)[`https://thegraph.com/hosted-service/subgraph/bcaklovi/huddln-xp-system`](https://thegraph.com/hosted-service/subgraph/bcaklovi/huddln-xp-system)

**XP subgraph endpoint URL:** [`https://api.thegraph.com/subgraphs/name/bcaklovi/huddln-xp-system`<br>](<https://api.thegraph.com/subgraphs/name/bcaklovi/huddln-xp-system&#xA;>)

#### Here are some example queries for common use cases:

Search for a user's score based on their score type and wallet address:

```
{
  scores(where: {project: "PROJECT_ID_HERE", scoreType: "SCORE_TYPE_HERE", address: "USER_ADDRESS_HERE"}) {
    id
    points
    scoreType
    address
  }
}
```

List all users within a project based on their total score (all score types added together) in descending order:&#x20;

```
{
  scoreboards(where: {project: "PROJECT_ID_HERE"}, orderBy: totalScore, orderDirection: desc) {
    id
    address
    totalScore
  }
}
```

List all scoreboards for a particular project (scoreboard includes all of a user's scores within that project):

```
{
  scoreboards(where: {project: "PROJECT_ID_HERE"}) {
    id
    address
    scores {
      id
      points
      scoreType
    }
  }
}
```

List all actions for a particular project (action includes a name, how many points received for it and a direction. Direction of 0 is increasing, the direction of 1 is decreasing):

```
{
  actions(where: {project: "PROJECT_ID_HERE"}) {
    id
    name
    points
    direction
  }
}

```

Find the total score for a user within a particular project, based on their wallet address:

```
{
  scoreboards(where: {project: "PROJECT_ID_HERE", address: "USER_ADDRESS_HERE"}) {
    id
    address
    totalScore
  }
}
```


---

# 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 dynamically by asking a question.

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

```
GET https://docs.xp-protocol.io/products/xp-protocol/integrations/xp-subgraph.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
