> ## Documentation Index
> Fetch the complete documentation index at: https://developers.orchestrasolutions.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate API Key

> Test your API key and verify connectivity.

<Info>
  This page is part of the **REST API Guides**. [View all REST API guides →](/guides/rest-api/charge)
</Info>

<Tip>
  Quick health check: verify your API key is valid and Orchestra is reachable with a single GET request. Use this before troubleshooting integration issues.
</Tip>

Validate that your API key is correctly configured and the Orchestra API is reachable.

**Endpoint**: `GET /Utils/apiKey`

## Validate Your Key

<CodeGroup>
  ```javascript Node.js theme={null}
  const response = await fetch('https://api.orchestrasolutions.com/Utils/apiKey', {
    headers: {
      'X-Api-Key': 'YOUR_API_KEY'
    }
  });

  if (response.ok) {
    const result = await response.json();
    console.log('API key valid:', result);
  } else {
    console.error('Invalid API key');
  }
  ```

  ```bash cURL theme={null}
  curl https://api.orchestrasolutions.com/Utils/apiKey \
    -H "X-Api-Key: YOUR_API_KEY"
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.orchestrasolutions.com/Utils/apiKey',
      headers={
          'X-Api-Key': 'YOUR_API_KEY'
      }
  )

  if response.status_code == 200:
      print('API key valid:', response.json())
  else:
      print('Invalid API key')
  ```
</CodeGroup>

<Card title="API Reference" icon="code" href="/api-reference/utils/validate-apikey">
  Complete response fields and status codes
</Card>

## Use Cases

### Health Check

Include in your application's startup or health check routine:

```javascript theme={null}
async function checkOrchestraConnection() {
  try {
    const response = await fetch('https://api.orchestrasolutions.com/Utils/apiKey', {
      headers: { 'X-Api-Key': process.env.ORCHESTRA_API_KEY }
    });

    if (!response.ok) {
      throw new Error('Invalid Orchestra API key');
    }

    const { isSandbox } = await response.json();
    console.log(`Orchestra connected (${isSandbox ? 'sandbox' : 'production'})`);
    return true;
  } catch (error) {
    console.error('Orchestra connection failed:', error.message);
    return false;
  }
}
```

### Environment Verification

Confirm you're using the correct key for your environment:

```javascript theme={null}
const result = await response.json();

if (process.env.NODE_ENV === 'production' && result.isSandbox) {
  console.warn('Warning: Using sandbox API key in production!');
}
```

## Related

<CardGroup cols={2}>
  <Card title="Generate API Key" icon="key" href="/getting-started/generate-api-key">
    Create a new API key
  </Card>

  <Card title="Testing & Going Live" icon="rocket" href="/concepts/testing-and-going-live">
    Sandbox vs production
  </Card>
</CardGroup>
