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

# Authenticate Dolva API Requests with Bearer Tokens

> Dolva uses HTTP Bearer token authentication. Learn how to obtain your API token and include it correctly in every protected request.

Dolva authenticates requests using HTTP Bearer tokens. Every request to a protected endpoint must include a valid token in the `Authorization` header. Requests without a token, or with an invalid token, are rejected with a `401 Unauthorized` response.

## Getting Your API Token

Sign up or log in at [dolva.ai](https://dolva.ai) and navigate to your account dashboard to retrieve your API token. Treat your token like a password — never share it or commit it to source control.

<Warning>
  Your API token grants full access to your Dolva account. Store it securely using environment variables or a secrets manager — never hard-code it in your application code.
</Warning>

## Using Your Token

Include your token in the `Authorization` header of every API request using the `Bearer` scheme:

```text theme={null}
Authorization: Bearer dv-xxxxxxxx
```

### Examples

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://api.dolva.ai/v1/analyze/emotion \
    -H "Authorization: Bearer dv-xxxxxxxx" \
    -F "audio=@recording.wav"
  ```

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

  headers = {"Authorization": "Bearer dv-xxxxxxxx"}

  with open("recording.wav", "rb") as f:
      response = requests.post(
          "https://api.dolva.ai/v1/analyze/emotion",
          headers=headers,
          files={"audio": f}
      )
  ```

  ```javascript Node.js theme={null}
  import fetch from "node-fetch";
  import FormData from "form-data";
  import fs from "fs";

  const form = new FormData();
  form.append("audio", fs.createReadStream("recording.wav"));

  const response = await fetch("https://api.dolva.ai/v1/analyze/emotion", {
    method: "POST",
    headers: {
      Authorization: "Bearer dv-xxxxxxxx",
      ...form.getHeaders(),
    },
    body: form,
  });

  const data = await response.json();
  ```
</CodeGroup>

## Using Environment Variables

Avoid hard-coding your token. Store it in an environment variable instead:

<CodeGroup>
  ```bash Shell theme={null}
  export DOLVA_API_TOKEN="your_token_here"
  ```

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

  token = os.environ["DOLVA_API_TOKEN"]
  headers = {"Authorization": f"Bearer {token}"}
  ```

  ```javascript Node.js theme={null}
  const token = process.env.DOLVA_API_TOKEN;
  const headers = { Authorization: `Bearer ${token}` };
  ```
</CodeGroup>

## Authentication Errors

| HTTP Status        | Meaning                          | What To Do                                                                  |
| ------------------ | -------------------------------- | --------------------------------------------------------------------------- |
| `401 Unauthorized` | Missing or invalid token         | Check that your token is correct and included in the `Authorization` header |
| `403 Forbidden`    | Token valid but lacks permission | Contact support if you believe this is an error                             |

<Tip>
  The `GET /health` endpoint does not require authentication and can be used to verify network connectivity without a token.
</Tip>
