# 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](https://3244648189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOu6aN3RW264zdJsOQMJ2%2Fuploads%2Fgit-blob-b8120bda68b025805dc131b64a083febe87ba321%2Fsubgraph.png?alt=media)

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.

For example. Using Cloudflare's gateway

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

For example. [Storacha Network](https://storacha.network/)'s gateway

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

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

[Metadata in IPFS](https://cloudflare-ipfs.com/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](https://docs.startrail.io/startrail-api/get-metadata-by-token-id).
