# 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="<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>" 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="<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>" 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.
