> ## Documentation Index
> Fetch the complete documentation index at: https://60db.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Learn how to authenticate with the 60db API

## API Key Authentication

60db uses API key authentication to secure all API requests. Your API key should be included in the `Authorization` header of every request.

### Getting Your API Key

<Steps>
  <Step title="Login to Dashboard">
    Navigate to [app.60db.ai](https://app.60db.ai) and log in
  </Step>

  <Step title="Access API Keys">Go to Settings → Developer → API Keys</Step>

  <Step title="Create Key">
    Click "Create API Key" and provide a descriptive name
  </Step>

  <Step title="Store Securely">
    Copy and store your API key in a secure location
  </Step>
</Steps>

## Using Your API Key

### With SDKs

<Tabs>
  <Tab title="JavaScript/TypeScript">
    ```typescript theme={null}
    import { SixtyDBClient } from '60db';

    const client = new SixtyDBClient('your-api-key');

    // Text to Speech
    const audio = await client.textToSpeech({
      text: 'Hello, world!',
      voice_id: 'default-voice',
      speed: 1.0 // 0.5 to 2.0 (default 1.0)
    });

    // Get all voices
    const voices = await client.getVoices();

    // Get all languages
    const languages = await client.getLanguages();
    ```

    You can also specify a custom base URL:

    ```typescript theme={null}
    const client = new SixtyDBClient({
      apiKey: 'your-api-key',
      baseUrl: 'https://custom-api.60db.com'
    });
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from sixtydb import SixtyDBClient

    client = SixtyDBClient('your-api-key')

    # Text to Speech
    audio = await client.text_to_speech(
        text='Hello, world!',
        voice_id='default-voice',
        speed=1.0  # 0.5 to 2.0 (default 1.0)
    )

    # Get all voices
    voices = await client.get_voices()

    # Get all languages
    languages = await client.get_languages()
    ```

    You can also specify a custom base URL:

    ```python theme={null}
    client = SixtyDBClient(
        api_key='your-api-key',
        base_url='https://custom-api.60db.com'
    )
    ```
  </Tab>
</Tabs>

### Direct API Calls

If you're making direct HTTP requests, include your API key in the `Authorization` header:

```bash theme={null}
curl https://api.60db.ai/voices \
  -H "Authorization: Bearer your-api-key"
```

## Security Best Practices

<Warning>
  Never expose your API key in client-side code, public repositories, or version
  control systems.
</Warning>

### Environment Variables

Store your API key in environment variables:

<Tabs>
  <Tab title="Node.js">
    Create a `.env` file:

    ```bash theme={null}
    SIXTYDB_API_KEY=your-api-key
    ```

    Use it in your code:

    ```typescript theme={null}
    const client = new SixtyDBClient(process.env.SIXTYDB_API_KEY);
    ```
  </Tab>

  <Tab title="Python">
    Create a `.env` file:

    ```bash theme={null}
    SIXTYDB_API_KEY=your-api-key
    ```

    Use it in your code:

    ```python theme={null}
    import os
    from sixtydb import SixtyDBClient

    client = SixtyDBClient(os.getenv('SIXTYDB_API_KEY'))
    ```
  </Tab>
</Tabs>

### Key Rotation

Regularly rotate your API keys for enhanced security:

1. Create a new API key
2. Update your application to use the new key
3. Test that everything works correctly
4. Delete the old API key

## Rate Limiting

API requests are rate-limited based on your subscription plan:

| Plan       | Requests per Minute | Requests per Day |
| ---------- | ------------------- | ---------------- |
| Free       | 10                  | 1,000            |
| Starter    | 60                  | 10,000           |
| Pro        | 300                 | 100,000          |
| Enterprise | Custom              | Custom           |

<Info>
  Rate limit headers are included in every API response: - `X-RateLimit-Limit`:
  Maximum requests allowed - `X-RateLimit-Remaining`: Remaining requests in
  current window - `X-RateLimit-Reset`: Time when the rate limit resets
</Info>

## Error Handling

When authentication fails, you'll receive a `401 Unauthorized` response:

```json theme={null}
{
  "error": "Unauthorized",
  "message": "Invalid API key"
}
```

Common authentication errors:

| Status Code | Error             | Description                               |
| ----------- | ----------------- | ----------------------------------------- |
| 401         | Unauthorized      | Invalid or missing API key                |
| 403         | Forbidden         | API key doesn't have required permissions |
| 429         | Too Many Requests | Rate limit exceeded                       |
