# How to retrieve SRR metadata

The following is the method to retrieve the SRR metadata using the Subgraph.

For querying to subgraph, please check [this doc](https://thegraph.com/docs/en/subgraphs/querying/introduction/).

## Open the subgraph

Open the following page in your browser.

[Subgraph startrail-polygon](https://api.goldsky.com/api/public/project_cmgzivx09001u5np2h5sr10rb/subgraphs/startrail-polygon/subgraph-v1.20.0/gn)

## Query

Paste the following query into the left pane of the screen and press the execute button.

```
{
  srrs(where: { tokenId: "469529826613"}) {
    tokenId
    metadataDigest
  }
}
```

The result of execution is here.

![Alt text](/files/OC7GJoU6LrqqHFIKFrPG)

This metadataDigest is an IPFS CID. Please refer to [this page for an explanation of IPFS](https://ipfs.tech/). You can request the IPFS CID using an IPFS gateway as follows.

**Recommended: the Startrail IPFS CDN gateway**

```
# https://cdn.startrail.io/ipfs/{IPFS CID}
```

This is a managed gateway operated by Startbahn that pins all Startrail content; see [Startrail IPFS CDN gateway](/subgraph/ipfs-cdn-gateway.md) for details.

Other public gateways will work too, for example Cloudflare's:

```
# https://cloudflare-ipfs.com/ipfs/{IPFS CID}
```

Or [Storacha Network](https://storacha.network/)'s:

```
# https://{IPFS CID}.w3s.link/
```

You can find more IPFS gateways in [here](https://ipfs.github.io/public-gateway-checker/).

[Metadata in IPFS](https://cdn.startrail.io/ipfs/bafkreigb2wjgin53xgmaiqxvdn4g2iw6cnmp4e3w3nzopmom53sjborque)

## Important note

For SRRs issued before 2023, the metadataDigest may contain a string starting with `0x`. This can be verified with a tokenId like the one below:

```
{
  srrs(where: { tokenId: "38726816"}) {
    tokenId
    metadataDigest
  }
}
```

```
{
  "data": {
    "srrs": [
      {
        "tokenId": "38726816",
        "metadataDigest": "0x88466c2441cbe0751039298affb14257baea05f15f6c17ed98682de9ab643b06"
      }
    ]
  }
}
```

In this case, the metadata is not be uploaded to IPFS. To retrieve the metadata, use the Startrail API endpoint via [Get Metadata by Token ID](/startrail-api/get-metadata-by-token-id.md).


---

# 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.startrail.io/subgraph/how-to-retrieve-metadata.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.
