---
title: Deploying Using Subgraph Studio
sidebarTitle: Deploy to Studio
---

Learn how to deploy your Subgraph to Subgraph Studio.

> Note: When you deploy a Subgraph, you push it to Subgraph Studio, where you'll be able to test it. It's important to remember that deploying is not the same as publishing. When you publish a Subgraph, you're publishing it onchain.

## Subgraph Studio Overview

In [Subgraph Studio](https://thegraph.com/studio/), you can do the following:

- View a list of Subgraphs you've created
- Manage, view details, and visualize the status of a specific Subgraph
- Create and manage your API keys for specific Subgraphs
- Restrict your API keys to specific domains and allow only certain Indexers to query with them
- Create your Subgraph
- Deploy your Subgraph using The Graph CLI
- Test your Subgraph in the playground environment
- Integrate your Subgraph in staging using the development query URL
- Publish your Subgraph to The Graph Network
- Manage your billing

## Install The Graph CLI

Before deploying, you must install The Graph CLI.

You must have [Node.js](https://nodejs.org/) and a package manager of your choice (`npm`, `yarn` or `pnpm`) installed to use The Graph CLI. Check for the [most recent](https://github.com/graphprotocol/graph-tooling/releases?q=%40graphprotocol%2Fgraph-cli&expanded=true) CLI version.

### Install with yarn

```bash
yarn global add @graphprotocol/graph-cli
```

### Install with npm

```bash
npm install -g @graphprotocol/graph-cli
```

## Get Started

1. Open [Subgraph Studio](https://thegraph.com/studio/).
2. Connect your wallet to sign in.
   - You can do this via MetaMask, Coinbase Wallet, WalletConnect, or Safe.
3. After you sign in, your unique deploy key will be displayed on your Subgraph details page.
   - The deploy key allows you to publish your Subgraphs or manage your API keys and billing. It is unique but can be regenerated if you think it has been compromised.

> Important: You need an API key to query Subgraphs

### How to Create a Subgraph in Subgraph Studio

<VideoEmbed title="How to Deploy a Subgraph - A Step-By-Step Walkthrough" youtube="nGIFuC69bSA" />

> For additional written detail, review the [Quick Start](/subgraphs/quick-start/).

### Subgraph Compatibility with The Graph Network

To be supported by Indexers on The Graph Network, Subgraphs must index a [supported network](/supported-networks/). For a full list of supported and unsupported features, check out the [Feature Support Matrix](https://github.com/graphprotocol/indexer/blob/main/docs/feature-support-matrix.md) repo.

## Initialize Your Subgraph

Once your Subgraph has been created in Subgraph Studio, you can initialize its code through the CLI using this command:

```bash
graph init <SUBGRAPH_SLUG>
```

You can find the `<SUBGRAPH_SLUG>` value on your Subgraph details page in Subgraph Studio, see image below:

![Subgraph Studio - Slug](/img/doc-subgraph-slug.png)

After running `graph init`, you will be asked to input the contract address, network, and an ABI that you want to query. This will generate a new folder on your local machine with some basic code to start working on your Subgraph. You can then finalize your Subgraph to make sure it works as expected.

## Graph Auth

Before you can deploy your Subgraph to Subgraph Studio, you need to log into your account within the CLI. To do this, you will need your deploy key, which you can find under your Subgraph details page.

Then, use the following command to authenticate from the CLI:

```bash
graph auth <DEPLOY KEY>
```

## Deploying a Subgraph

Once you are ready, you can deploy your Subgraph to Subgraph Studio.

> Deploying a Subgraph with the CLI pushes it to the Studio, where you can test it and update the metadata. This action won't publish your Subgraph to the decentralized network.

> **Note**: Each account is limited to 3 deployed (unpublished) Subgraphs. If you reach this limit, you must archive or publish existing Subgraphs before deploying new ones.

Use the following CLI command to deploy your Subgraph:

```bash
graph deploy <SUBGRAPH_SLUG>
```

After running this command, the CLI will ask for a version label.

- It's strongly recommended to use [semver](https://semver.org/) for versioning like `0.0.1`. That said, you are free to choose any string as version such as `v1`, `version1`, or `asdf`.
- The labels you create will be visible in Graph Explorer and can be used by curators to decide if they want to signal on a specific version or not, so choose them wisely.

## Testing Your Subgraph

After deploying, you can test your Subgraph (either in Subgraph Studio or in your own app, with the deployment query URL), deploy another version, update the metadata, and publish to [Graph Explorer](https://thegraph.com/explorer) when you are ready.

> **Note**: The development query URL is limited to 3,000 queries per day.

Use Subgraph Studio to check the logs on the dashboard and look for any errors with your Subgraph.

## Publish Your Subgraph

In order to publish your Subgraph successfully, review [publishing a Subgraph](/subgraphs/developing/deploying-publishing/publishing-a-subgraph/).

## Versioning Your Subgraph with the CLI

If you want to update your Subgraph, you can do the following:

- You can deploy a new version to Studio using the CLI (it will only be private at this point).
- Once you're happy with it, you can publish your new deployment to [Graph Explorer](https://thegraph.com/explorer).
- This action will create a new version of your Subgraph that Curators can start signaling on and Indexers can index.

You can also update your Subgraph's metadata without publishing a new version. You can update your Subgraph details in Studio (under the profile picture, name, description, etc.) by checking an option called **Update Details** in [Graph Explorer](https://thegraph.com/explorer). If this is checked, an onchain transaction will be generated that updates Subgraph details in Explorer without having to publish a new version with a new deployment.

> Note: There are costs associated with publishing a new version of a Subgraph to the network. In addition to the transaction fees, you must also fund a part of the curation tax on the auto-migrating signal. You cannot publish a new version of your Subgraph if Curators have not signaled on it. For more information, please read more [here](/resources/roles/curating/).

## Automatic Archiving of Subgraph Versions

Whenever you deploy a new Subgraph version in Subgraph Studio, the previous version will be archived. Archived versions won't be indexed/synced and therefore cannot be queried. You can unarchive an archived version of your Subgraph in Subgraph Studio.

> Note: Previous versions of non-published Subgraphs deployed to Studio will be automatically archived.

![Subgraph Studio - Unarchive](/img/Unarchive.png)
