Tags are used to ensure a consistent GraphQL endpoint. They serve as pointers or aliases to specific versions, allowing you to swap in new subgraphs without needing to update your front-end code.

By default, subgraph API endpoints are named according to the subgraph name and version. So, when you update your subgraph to a new version, you’ll have to update your front-end to point to the new endpoint.

With tags, you can easily manage subgraph versions and seamlessly upgrade to a new version without changing the URL.

In this example, we assume that you’ve already deployed a subgraph with the name and version test/blocks/1.0.0. We’ll show you how to create a tag and update it to point to another subgraph version.

1

Start by creating a tag and associating it with your subgraph

Click on the deployed subgraph name to enter the details page, then find the “TAGS” section to create a tag.

2

We’ve now created a new tag called "new". Now, our GraphQL endpoint can use the tag name "new".

3

You can now see the GraphQL link after tagging.

Version GraphQL link:
https://api.0xgraph.xyz/api/public/{id}/subgraphs/test/blocks/{version}/gn
Tag GraphQL link:
https://api.0xgraph.xyz/api/public/{id}/subgraphs/test/blocks/{tag}/gn

Let’s say you’ve upgraded your test/blocks to version 2.0.0 and want to start querying it with your new GraphQL endpoint. It’s as simple as creating the tag again on the new version.

Now your queries will be routed to the 2.0.0 version of the subgraph seamlessly.