Use the Token Metadata API archive

Discover how to use the Hiro Archive to spin up a Token Metadata API.


Since the Token Metadata API depends on a Stacks Blockchain API, you will need to first launch a Stacks Blockchain API configured for the same Stacks network.

If you don't already have one, you can follow these instructions to launch one with an archive.

Where to download archives

Token Metadata API archives for each network can be found at the following locations:

The file name patterns are as follows:

  • archive: token-metadata-api-pg-<DATABASE VERSION>-<API VERSION>-<DATE(YYYYMMDD)>.dump
  • shasum: token-metadata-api-pg-<DATABASE VERSION>-<API VERSION>-<DATE(YYYYMMDD)>.sha256

There is a continually updated archive and shasum which always points to the most recent upload:

  • archive: token-metadata-api-pg-<DATABASE VERSION>-latest.dump
  • shasum: token-metadata-api-pg-<DATABASE VERSION>-latest.sha256

or the most recent upload for a particular version:

  • archive: token-metadata-api-pg-<DATABASE VERSION>-<API VERSION>-latest.dump
  • shasum: token-metadata-api-pg-<DATABASE VERSION>-<API VERSION>-latest.sha256

Restoring the Token Metadata API using the Hiro Archive

  1. Download the archive and shasum for the appropriate network.
  2. Verify the archive with the shasum.
  3. Import the archive file into a running Postgres database (may take up to an hour depending on database specs and tuning):
        pg_restore --username postgres --verbose --jobs 4 --dbname token_metadata_api /path/to/archive/file
  4. Launch the Token Metadata API service.
  5. Verify the restoration was successful by viewing the total number of tokens and contracts tracked in the service. If the total number of each property is greater than zero, the restoration was successful.
    1. It may take a few minutes for the local node to respond on this endpoint.