Docs
Search⌘ K
  • Home
  • About The Graph
  • Supported Networks
  • Protocol Contracts
  • Subgraphs
    • Substreams
      • Indexer Software
        • Gateway Software
          • Data Services
            • AI Tooling
            • Resources
              Subgraphs > Gateway Providers > Graph Foundation

              3 minutes

              Subgraph Studio Billing & API Management

              Subgraph Studio API Key Management

              This guide shows you how to create, manage, and secure Subgraph Studio API keys, which authenticate queries to The Graph Foundation’s Gateway (gateway.thegraph.com) Subgraph Studio API keys authenticate users and devices, authorize access to specific endpoints, enforce rate limits, and track usage on The Graph Foundation’s Gateway.

              Subgraph Studio API keys work only with The Graph Foundation’s Gateway. Multiple Gateway Operators serve every published Subgraph, and each one issues its own keys. Learn more on Subgraph Gateway Providers.

              Create a New Subgraph Studio API Key

              1. Create a Subgraph Studio account
              2. Click the API Keys tab in the navigation menu
              3. Click the Create API Key button

              A side pane will pop up:

              1. Enter a name for your API key
              2. Optional: You can enable a period spending limit
              3. Click Create API Key
              Create API Key Window

              Using Your Subgraph Studio API Key

              Always keep your API key in environment variables or a secure secrets manager. Do not hardcode it in your codebase or expose it in client-side apps.

              When you query The Graph from your dapp, you can use your API key in two ways:

              1. In the URL (optimal method for Subgraph queries):

                Include the API Key directly to your query endpoint:

                1https://gateway.thegraph.com/api/<YOUR_API_KEY>/subgraphs/id/<SUBGRAPH_ID>
              2. As a bearer Token:

                Include your API Key in the Authorization request header for added security:

                1Authorization: Bearer <YOUR_API_KEY>

                Curl command example:

                1curl -X POST \2-H "Content-Type: application/json" \3-H "Authorization: Bearer {api-key}" \4-d '{"query": "{ graphNetworks(first: 5) { id controller graphToken epochManager } graphAccounts(first: 5) { id names { id } defaultName { id } createdAt } }", "operationName": "Subgraphs", "variables": {}}' \5https://gateway.thegraph.com/api/subgraphs/id/DZz4kDTdmzWLWsV373w2bSmoar3umKKH9y82SUKr5qmp

              Check out Querying from an App for more details.

              Managing Subgraph Studio API Keys

              The “API keys” table lists existing API keys and allows you to manage or delete them. For each key, you can see its status, the cost for the current period, the spending limit for the current period, and the total number of queries.

              How to Set Spending Limits

              Managing your spending limit is an optional monthly spending limit for a given API key in USD. This limit is per billing period (calendar month).

              1. Find your API key in the API keys table
              2. Click the “three dots” icon next to the key
              3. Select “Manage spending limit”
              4. Enter your desired monthly limit in USD
              5. Click Save

              How to Rename an API Key

              1. Click the “three dots” icon next to the key
              2. Select “Rename API key”
              3. Enter the new name
              4. Click Save

              How to Regenerate an API Key

              Regenerating an API key will invalidate the previous key immediately. Update your applications with the new key to prevent service interruption.

              1. Click the “three dots” icon next to the key
              2. Select “Regenerate API key”
              3. Confirm the action in the pop up dialog

              Subgraph Studio API Key Details

              Monitoring Usage

              1. Click on your API key to view the Details page
              2. Check the Overview section for:
                • Total number of queries
                • GRT spent
                • Current usage statistics

              Restricting Domain Access

              1. Click on your API key to open the Details page
              2. Navigate to the Security section
              3. Click “Add Domain”
              4. Enter the authorized domain name
              5. Click Save

              Limiting Subgraph Access

              1. In the API key Details page
              2. Navigate to the Security section
              3. Click “Assign Subgraphs”
              4. Select the Subgraphs you want to authorize
              5. Click Save

              Subgraph Studio Billing & Security Management

              Manage email notifications

              1. Click to Billing in the Studio nav bar
              2. Choose the bell icon next to “Upgrade plan”
              3. Add or remove emails and toggle on “Billing alerts”

              Manage security settings

              1. Click to Billing in the Studio nav bar
              2. Choose “Security” on the left side
              3. Manage session security related to:
                • API keys
                • Subgraph changes
                • Payments
                • Account details
              4. Be sure to “Save security settings”
              ⁠Edit on GitHub⁠

              Subgraph Studiox402 Payments
              On this page
              • Subgraph Studio API Key Management
              • Create a New Subgraph Studio API Key
              • Using Your Subgraph Studio API Key
              • Managing Subgraph Studio API Keys
              • How to Set Spending Limits
              • How to Rename an API Key
              • How to Regenerate an API Key
              • Subgraph Studio API Key Details
              • Monitoring Usage
              • Restricting Domain Access
              • Limiting Subgraph Access
              • Subgraph Studio Billing & Security Management
              • Manage email notifications
              • Manage security settings
              The GraphStatusTestnetBrand AssetsForumSecurityPrivacy PolicyTerms of Service