> ## 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:

<CodeGroup>
  ```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";
  ```
</CodeGroup>

**That's it!**

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

## Framework-Specific Examples

<Tabs>
  <Tab title="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>

  <Tab title="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>

  <Tab title="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>

  <Tab title="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>

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

## 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

<Steps>
  <Step title="Update endpoint URL">
    Change `mainnet.helius-rpc.com` to `beta.helius-rpc.com`
  </Step>

  <Step title="Test in development">
    Verify all RPC calls work and authentication succeeds
  </Step>

  <Step title="Monitor performance">
    Check your metrics for improved latency and response times
  </Step>

  <Step title="Deploy to production">
    Roll out changes using your standard deployment process
  </Step>
</Steps>

## 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

<AccordionGroup>
  <Accordion title="Getting 401 Unauthorized errors">
    Verify your API key is included: `?api-key=YOUR_API_KEY`
  </Accordion>

  <Accordion title="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>

  <Accordion title="WebSocket connections failing">
    * Use `wss://` (not `ws://`)
    * Ensure your API key is in the URL
    * Check firewall settings
  </Accordion>

  <Accordion title="Response formats look different">
    Gatekeeper returns identical responses. Contact support immediately if you see differences.
  </Accordion>
</AccordionGroup>

## Need Help?

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

<Card title="Questions about migration?" icon="comments" href="https://discord.com/invite/6GXdee3gBj">
  Join our Discord to chat with the team and other developers
</Card>
