Skip to main content
Use the REST API to create Virtual Environments from scripts, CI/CD jobs, or any backend. The same endpoints back the dashboard. For the full request and response schemas, see the REST API reference.

Before you begin

  • A Tenderly access key. Export it as TENDERLY_ACCESS_KEY in your shell.
  • Your account and project slugs, available in the URL of your Tenderly Dashboard.
export TENDERLY_ACCESS_KEY=# the key you copied

Create a single-network Virtual Environment

1
Call the API
2
POST to the vnets endpoint with your fork and chain configuration:
3
RESPONSE=$(curl --request POST \
  --url https://api.tenderly.co/api/v1/account/me/project/project/vnets \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header "X-Access-Key: ${TENDERLY_ACCESS_KEY}" \
  --data '{
    "slug": "my-staging-testnet-25",
    "display_name": "My Staging TestNet",
    "fork_config":            { "network_id": 1, "block_number": "latest" },
    "virtual_network_config": { "chain_config": { "chain_id": 73571 } },
    "sync_state_config":      { "enabled": false, "commitment_level": "latest" },
    "explorer_page_config":   { "enabled": false, "verification_visibility": "bytecode" }
  }')
4
Extract the Admin RPC URL
5
The rpcs array on the response contains the Admin and Public RPC URLs. Pull the Admin RPC out for the rest of your script:
6
ADMIN_RPC=$(echo $RESPONSE | jq -r '.rpcs[] | select(.name == "Admin RPC") | .url')

Create a Multichain Virtual Environment

A Multichain Virtual Environment is created in a single call via the multivnets endpoint. All networks in the call are grouped under one stack_id, which is what makes cross-chain bridging possible between them.
multivnet-create.sh
curl --location 'https://api.tenderly.co/api/v1/account/me/project/project/multivnets' \
  --header 'accept: application/json, text/plain, */*' \
  --header "X-Access-Key: ${TENDERLY_ACCESS_KEY}" \
  --header 'content-type: application/json' \
  --data '{
    "vnets": [
      {
        "slug": "mainnet-staging",
        "fork_config":            { "network_id": 1,     "block_number": "latest" },
        "virtual_network_config": { "chain_config": { "chain_id": 1 } }
      },
      {
        "slug": "arbitrum-staging",
        "fork_config":            { "network_id": 42161, "block_number": "latest" },
        "virtual_network_config": { "chain_config": { "chain_id": 42161 } }
      },
      {
        "slug": "base-staging",
        "fork_config":            { "network_id": 8453,  "block_number": "latest" },
        "virtual_network_config": { "chain_config": { "chain_id": 8453 } }
      }
    ]
  }'
Each entry in the vnets array creates one network inside the Multichain Virtual Environment. The response returns a stack_id and an array of Virtual Environment objects, each with its own RPC endpoints. See the REST API reference for the field-by-field schema.

Next steps