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

# Authentication

> Learn how to authenticate with the Verlon AI API

Verlon AI uses API keys to authenticate requests. Your API keys grant access to your gates, usage data, and configuration.

## Getting Your API Key

1. Sign in to your [Dashboard](https://verlon.ai/dashboard)
2. Navigate to **API Keys** in the sidebar
3. Click **Create New Key**
4. Give your key a descriptive name (e.g., "Production", "Development")
5. Copy the key immediately - you won't be able to see it again

<Warning>
  **Keep your API keys secure!** Never commit them to version control, share them publicly, or expose them in client-side code.
</Warning>

## Using Your API Key

### With the SDK

Pass your API key when initializing the Verlon client:

```typescript theme={null}
import { Verlon } from '@verlon-ai/sdk';

const verlon = new Verlon({
  apiKey: 'your-api-key-here'
});
```

### With Environment Variables

Store your API key in environment variables for security:

```bash .env theme={null}
VERLON_API_KEY=your_api_key_here
```

Then reference it in your code:

```typescript theme={null}
import { Verlon } from '@verlon-ai/sdk';

const verlon = new Verlon({
  apiKey: process.env.VERLON_API_KEY
});
```

### With Direct API Calls

Include your API key in the `Authorization` header:

```bash theme={null}
curl https://api.verlon.ai/v1/chat/completions \
  -H "Authorization: Bearer your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "gate_id": "your-gate-id",
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'
```

## Key Management Best Practices

<AccordionGroup>
  <Accordion title="Rotate keys regularly" icon="rotate">
    Create new keys and delete old ones periodically to maintain security. Verlon AI allows multiple active keys per account.
  </Accordion>

  <Accordion title="Use different keys for different environments" icon="code-branch">
    Create separate keys for development, staging, and production environments. This makes it easier to rotate keys and track usage.
  </Accordion>

  <Accordion title="Delete compromised keys immediately" icon="trash">
    If you suspect a key has been exposed, delete it from your Dashboard immediately and create a new one.
  </Accordion>

  <Accordion title="Monitor key usage" icon="chart-line">
    Check your Dashboard regularly to review which keys are being used and their associated costs.
  </Accordion>
</AccordionGroup>

## Key Permissions

All Verlon AI API keys have full access to your account:

* Make inference requests through your gates
* Read and modify gates and configuration
* Manage API keys
* Access usage logs and analytics

<Note>
  Since all keys have full permissions, treat them with the same level of security you would treat a password.
</Note>

## Troubleshooting

### Invalid API Key Error

If you receive an authentication error:

1. Verify your API key is correctly copied (no extra spaces)
2. Check that the key hasn't been deleted in your Dashboard
3. Ensure you're using the correct format: `Bearer your-api-key`

### Rate Limits

API keys are subject to rate limits based on your plan. If you're hitting rate limits:

* Implement exponential backoff in your code
* Consider upgrading your plan for higher limits
* Contact support for custom rate limits

## Next Steps

<CardGroup cols={2}>
  <Card title="Create Your First Gate" icon="door-open" href="/dashboard/creating-gates">
    Set up a gate to start making requests
  </Card>

  <Card title="Make Your First Request" icon="rocket" href="/getting-started/quickstart">
    Follow the quickstart guide to make your first API call
  </Card>
</CardGroup>
