> ## Documentation Index
> Fetch the complete documentation index at: https://www.helius.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Migrate to Gatekeeper

> Step-by-step guide to migrate your application to Gatekeeper

Migrating to Gatekeeper takes **less than 5 minutes**. It's a simple URL change—your API key works without any modifications.

## Quick Migration

Simply replace your existing endpoint:

```javascript Before theme={"system"}
const url = "https://mainnet.helius-rpc.com/?api-key=YOUR_API_KEY";
```

```javascript After theme={"system"}
const url = "https://beta.helius-rpc.com/?api-key=YOUR_API_KEY";
```

**That's it!**

Test your application, monitor performance, and deploy when ready.

## Framework-Specific Examples

> [tab] Solana Web3.js
>
> ```javascript theme={"system"}
> import { Connection } from '@solana/web3.js';
>
> const connection = new Connection(
>   `https://beta.helius-rpc.com/?api-key=${YOUR_API_KEY}`,
>   'confirmed'
> );
> ```

> [tab] Anchor
>
> ```javascript theme={"system"}
> import { AnchorProvider } from '@coral-xyz/anchor';
> import { Connection } from '@solana/web3.js';
>
> const connection = new Connection(
>   `https://beta.helius-rpc.com/?api-key=${YOUR_API_KEY}`,
>   'confirmed'
> );
>
> const provider = new AnchorProvider(connection, wallet, {
>   commitment: 'confirmed'
> });
> ```

> [tab] Solana-py
>
> ```python theme={"system"}
> from solana.rpc.api import Client
>
> rpc_url = f"https://beta.helius-rpc.com/?api-key={YOUR_API_KEY}"
> client = Client(rpc_url)
> ```

> [tab] Rust
>
> ```rust theme={"system"}
> use solana_client::rpc_client::RpcClient;
>
> let rpc_url = format!("https://beta.helius-rpc.com/?api-key={}", YOUR_API_KEY);
> let client = RpcClient::new(rpc_url);
> ```

> [tab] Environment Variable
>
> ```bash theme={"system"}
> # .env file
> HELIUS_RPC_URL=https://beta.helius-rpc.com/?api-key=YOUR_API_KEY
> ```

## WebSocket Endpoints

If you're using WebSockets, update those endpoints too:

```javascript theme={"system"}
// Before
const ws = new WebSocket("wss://mainnet.helius-rpc.com/?api-key=YOUR_API_KEY");

// After
const ws = new WebSocket("wss://beta.helius-rpc.com/?api-key=YOUR_API_KEY");
```

## Migration Checklist

**1. Update endpoint URL**

Change `mainnet.helius-rpc.com` to `beta.helius-rpc.com`

**2. Test in development**

Verify all RPC calls work and authentication succeeds

**3. Monitor performance**

Check your metrics for improved latency and response times

**4. Deploy to production**

Roll out changes using your standard deployment process

## Gradual Rollout (Optional)

For a safer migration, you can use environment variables or feature flags:

```javascript theme={"system"}
// Environment-based
const endpoint = process.env.USE_GATEKEEPER
  ? "https://beta.helius-rpc.com"
  : "https://mainnet.helius-rpc.com";

const connection = new Connection(
  `${endpoint}?api-key=${YOUR_API_KEY}`,
  'confirmed'
);
```

```javascript theme={"system"}
// Percentage rollout (10% of traffic)
const useGatekeeper = Math.random() < 0.1;
const endpoint = useGatekeeper
  ? "https://beta.helius-rpc.com"
  : "https://mainnet.helius-rpc.com";
```

## Rollback

If needed, simply switch back to the standard endpoint:

```javascript theme={"system"}
const url = "https://mainnet.helius-rpc.com/?api-key=YOUR_API_KEY";
```

## Troubleshooting

> [accordion] Getting 401 Unauthorized errors
>
> Verify your API key is included: `?api-key=YOUR_API_KEY`

> [accordion] Not seeing performance improvements
>
> * Test from your production environment (not local dev)
> * Verify you're not hitting rate limits (check for 429 errors)
> * Contact support if issues persist

> [accordion] WebSocket connections failing
>
> * Use `wss://` (not `ws://`)
> * Ensure your API key is in the URL
> * Check firewall settings

> [accordion] Response formats look different
>
> Gatekeeper returns identical responses. Contact support immediately if you see differences.

## Need Help?

* **Email**: [support@helius.dev](mailto:support@helius.dev)
* **Discord**: [https://discord.com/invite/6GXdee3gBj](https://discord.com/invite/6GXdee3gBj)
* **Documentation**: [Gatekeeper Overview](https://www.helius.dev/docs/gatekeeper/overview.md)

> [card] [Questions about migration?](https://discord.com/invite/6GXdee3gBj)
>
> Join our Discord to chat with the team and other developers


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.