> For the complete documentation index, see [llms.txt](https://docs.startrail.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.startrail.io/startrail-api/get-metadata-by-token-id.md).

# Get Metadata By tokenid

tokenid of ERC721 specification.

The following URL points to the test environment. Replace it with the production's url (`https://api.startrail.io/startrail`) as necessary.

Please note that there are two endpoints here:

1. [tokenid only](#get-metadata-by-tokenid-only-endpoint)
2. [tokenid + contract address](#get-metadata-by-tokenid-and-collection-contract-address-endpoint)

## Get metadata by tokenid only endpoint

{% openapi src="/files/67PSeDEtDDMW3Fl8otOp" path="/api/v1/srr/metadata/{tokenFile}" method="get" %}
[api-stg-startrail.json](https://3244648189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOu6aN3RW264zdJsOQMJ2%2Fuploads%2FyaCSxHAWrGk5xRNQdnKS%2Fapi-stg-startrail.json?alt=media\&token=ba84be5d-9079-41a7-9f6b-6ceaf8ffe906)
{% endopenapi %}

If the tokenid belongs to a collection contract you should use the [following endpoint](#get-metadata-by-tokenid-and-collection-contract-address-endpoint) that gets the `contractAddress` as well, otherwise use the [above endpoint.](#get-metadata-by-tokenid-only-endpoint)

## Get metadata by tokenid and collection contract address endpoint

{% openapi src="/files/67PSeDEtDDMW3Fl8otOp" path="/api/v1/srr/metadata/{contractAddress}/{tokenFile}" method="get" %}
[api-stg-startrail.json](https://3244648189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOu6aN3RW264zdJsOQMJ2%2Fuploads%2FyaCSxHAWrGk5xRNQdnKS%2Fapi-stg-startrail.json?alt=media\&token=ba84be5d-9079-41a7-9f6b-6ceaf8ffe906)
{% endopenapi %}

## Swagger Endpoint (Test Environment)

[Swagger to Get metadata JSON for a given token.](https://api-stg.startrail.startbahn.jp/api/#/default/SRRController_getMetadataJSONByTokenID)

[Swagger to Get collection metadata JSON for a given token.](https://api-stg.startrail.startbahn.jp/api/#/default/SRRController_getCollectionMetadataJSONByTokenID)

## Required Permissions

No required permission. This endpoint is public as the information is also public.


---

# 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.startrail.io/startrail-api/get-metadata-by-token-id.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.
