# Get Metadata By tokenid

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