Docs
Search⌘ K
  • Home
  • About The Graph
  • Supported Networks
  • Protocol Contracts
  • Subgraphs
    • Substreams
      • Token API
        • AI Suite
          • Indexing
            • Resources
              Subgraphs > Querying

              2 minutes

              Subgraph ID vs Deployment ID

              Managing and accessing Subgraphs relies on two distinct identification systems: Subgraph IDs and Deployment IDs.

              A Subgraph is identified by a Subgraph ID, and each version of the Subgraph is identified by a Deployment ID.

              When querying a Subgraph, either ID can be used, though it is generally suggested that the Deployment ID is used due to its ability to specify a specific version of a Subgraph.

              Both identifiers are accessible in Subgraph Studio:

              Highlights of where to find the Subgraph ID and Deployment ID

              Deployment ID

              The Deployment ID is the IPFS hash of the compiled manifest file, which refers to other files on IPFS instead of relative URLs on the computer. For example, the compiled manifest can be accessed via: https://ipfs.thegraph.com/ipfs/QmQKXcNQQRdUvNRMGJiE2idoTu9fo5F5MRtKztH4WyKxED. To change the Deployment ID, one can simply update the manifest file, such as modifying the description field as described in the Subgraph manifest documentation⁠.

              When queries are made using a Subgraph’s Deployment ID, we are specifying a version of that Subgraph to query. Using the Deployment ID to query a specific Subgraph version results in a more sophisticated and robust setup as there is full control over the Subgraph version being queried. However, this results in the need of updating the query code manually every time a new version of the Subgraph is published.

              Example endpoint that uses Deployment ID:

              https://gateway-arbitrum.network.thegraph.com/api/[api-key]/deployments/id/QmfYaVdSSekUeK6expfm47tP8adg3NNdEGnVExqswsSwaB

              Using Deployment IDs for queries offers precise version control but comes with specific implications:

              • Advantages: Complete control over which version you’re querying, ensuring consistent results
              • Challenges: Requires manual updates to query code when new Subgraph versions are published
              • Use case: Ideal for production environments where stability and predictability are crucial

              Subgraph ID

              The Subgraph ID is a unique identifier for a Subgraph. It remains constant across all versions of a Subgraph. It is recommended to use the Subgraph ID to query the latest version of a Subgraph, although there are some caveats.

              Be aware that querying using Subgraph ID may result in queries being responded to by an older version of the Subgraph due to the new version needing time to sync. Also, new versions could introduce breaking schema changes.

              Example endpoint that uses Subgraph ID: https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/FL3ePDCBbShPvfRJTaSCNnehiqxsPHzpLud6CpbHoeKW

              Using Subgraph IDs comes with important considerations:

              • Benefits: Automatically queries the latest version, reducing maintenance overhead
              • Limitations: May encounter version synchronization delays or breaking schema changes
              • Use case: Better suited for development environments or when staying current is more important than version stability

              Deployment ID vs Subgraph ID

              Here are the key differences between the two IDs:

              ConsiderationDeployment IDSubgraph ID
              Version PinningSpecific versionAlways latest
              Maintenance EffortHigh (manual updates)Low (automatic)
              Environment SuitabilityProductionDevelopment
              Sync Status AwarenessNot requiredCritical
              ⁠Edit on GitHub⁠

              GraphQL APIIntroduction
              On this page
              • Deployment ID
              • Subgraph ID
              • Deployment ID vs Subgraph ID
              The GraphStatusTestnetBrand AssetsForumSecurityPrivacy PolicyTerms of Service