# Startrail IPFS CDN gateway

Startrail runs a managed IPFS gateway on top of a CDN at:

```
https://cdn.startrail.io/ipfs/<cid>
```

This is the **recommended** gateway for resolving any IPFS CID surfaced by the Startrail platform — including:

* SRR metadata JSON (`metadataDigest` / `metadataCID` returned by the [subgraph](/subgraph/subgraph.md), the [Get SRR endpoints](/get-srr-api/description-of-srr-data.md), and the [Issue & Transfer endpoint](/issue-transfer-api/issue-and-transfer-srr-nft/issue-and-transfer.md))
* Image URLs inside SRR metadata (`thumbnailURL`, `image`, `external_url` when they reference an `ipfs://` or CID URL)
* Attachment files (`attachmentFiles[*]`) and digital components (`digitalComponents[*]`) referenced by their CID/hash

It returns the same content as any other public IPFS gateway, but with lower latency, better availability for Startrail-pinned content, and consistent CORS / cache behavior.

## Usage

Given a CID such as `bafkreiabepvyxyetkcb3xbjo3ocuyfo6psv3rc3yj34hequwcsilyvjima`, fetch it as:

```
https://cdn.startrail.io/ipfs/bafkreiabepvyxyetkcb3xbjo3ocuyfo6psv3rc3yj34hequwcsilyvjima
```

For metadata returned by the [Issue & Transfer endpoint](/issue-transfer-api/issue-and-transfer-srr-nft/issue-and-transfer.md), the response already includes a ready-to-use URL:

```json
{
  "results": [{
    "srr": {
      "tokenId": "227890056407",
      "metadataCID": "bafkrei...",
      "metadataURL": "https://cdn.startrail.io/ipfs/bafkrei..."
    }
  }]
}
```

## When the CID starts with `0x`

For SRRs issued before 2023, the `metadataDigest` may be a 32-byte hex string starting with `0x` rather than a CID. In that case the metadata is **not** available on IPFS; fetch it from the Startrail API instead via [Get Metadata by Token ID](/startrail-api/get-metadata-by-token-id.md).

## Other gateways

If for any reason you need an alternative, the same CID can be served by any public IPFS gateway (e.g. Cloudflare, Storacha, etc.). See [How to retrieve SRR metadata](/subgraph/how-to-retrieve-metadata.md) for examples. We still recommend the Startrail gateway for production traffic.


---

# 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/ipfs-cdn-gateway.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.
