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

# API Keys

> Generate and use a Solvea API key to call the Solvea OpenAPI from your own backend or integrations.

API keys let your backend, scripts, or third-party tools call the Solvea OpenAPI on behalf of your workspace. Each key is bound to the workspace that created it, so every request is automatically scoped — no extra tenant header required.

<Note>
  An API key carries the same access as your workspace. Treat it like a password — never commit it to a public repository, paste it into a chat, or ship it in client-side code.
</Note>

## Generate an API key

1. Open the Solvea dashboard at [app.solvea.cx](https://app.solvea.cx).

2. In the sidebar, go to **API Keys**.

   <Frame>
     <img src="https://mintcdn.com/solvea-a5b10e8e/LtJeBhLrfmsuz4qr/images/api-keys-sidebar.jpg?fit=max&auto=format&n=LtJeBhLrfmsuz4qr&q=85&s=c16f92cb60f83d6810aa0896171e0e45" alt="API Keys entry in the sidebar" width="2822" height="1470" data-path="images/api-keys-sidebar.jpg" />
   </Frame>

3. Click **Generate API Key**.

   <Frame>
     <img src="https://mintcdn.com/solvea-a5b10e8e/LtJeBhLrfmsuz4qr/images/api-keys-generate-button.jpg?fit=max&auto=format&n=LtJeBhLrfmsuz4qr&q=85&s=012a3524a33d141dbbb610970f471191" alt="Generate API Key button" width="2408" height="1442" data-path="images/api-keys-generate-button.jpg" />
   </Frame>

4. Confirm in the dialog that appears.

   <Frame>
     <img src="https://mintcdn.com/solvea-a5b10e8e/LtJeBhLrfmsuz4qr/images/api-keys-confirm-dialog.jpg?fit=max&auto=format&n=LtJeBhLrfmsuz4qr&q=85&s=33b1ca2c34192e1a06918a92ee8f9cf2" alt="Create API key confirmation dialog" width="1784" height="1108" data-path="images/api-keys-confirm-dialog.jpg" />
   </Frame>

5. Click the copy button on the right of the key to copy it to your clipboard, then use it in your application.

   <Frame>
     <img src="https://mintcdn.com/solvea-a5b10e8e/LtJeBhLrfmsuz4qr/images/api-keys-created.jpg?fit=max&auto=format&n=LtJeBhLrfmsuz4qr&q=85&s=376a737d531181830a3356cdf731916a" alt="Newly created API key with copy button" width="2378" height="1354" data-path="images/api-keys-created.jpg" />
   </Frame>

<Note>
  Each workspace can have only one API key at a time. To issue a new key, delete the existing one first (see [Rotate or delete a key](#rotate-or-delete-a-key)).
</Note>

### Key format

A Solvea API key starts with the `sk-` prefix followed by a random hex string. The `sk-` prefix makes the key easy to spot in logs and lets secret-scanning tools (GitHub, gitleaks, etc.) catch accidental commits.

## Use the API key

Every OpenAPI request needs a single header:

| Header          | Value         | Purpose                                                             |
| --------------- | ------------- | ------------------------------------------------------------------- |
| `Authorization` | `Bearer sk-…` | Authenticates the calling application and identifies your workspace |

### Base URL

The Solvea OpenAPI is served from `https://app.solvea.cx`. All endpoints live under the `/api_v2/...` path prefix.

### Example request

A quick way to verify your key works is to list the phone numbers available to your workspace:

```bash theme={null}
curl https://app.solvea.cx/api_v2/gpt/api/voice/phone-number/business/available \
  -H "Authorization: Bearer $SOLVEA_API_KEY"
```

```javascript Node.js theme={null}
const res = await fetch(
  "https://app.solvea.cx/api_v2/gpt/api/voice/phone-number/business/available",
  {
    headers: {
      Authorization: `Bearer ${process.env.SOLVEA_API_KEY}`,
    },
  },
);
```

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

requests.get(
    "https://app.solvea.cx/api_v2/gpt/api/voice/phone-number/business/available",
    headers={
        "Authorization": f"Bearer {os.environ['SOLVEA_API_KEY']}",
    },
)
```

A `200` response with a JSON body confirms the key is wired up correctly.

## Rotate or delete a key

To rotate a key (for example, after a suspected leak or when an employee leaves):

1. Go to **API Keys** in the dashboard.
2. Click the **delete** (trash) icon next to your existing key and confirm.
3. Click **Generate API Key** to create a new one, and update the secret in every system that uses it.

<Warning>
  Deletion takes effect immediately. Any service still using the old key will start receiving `401 Unauthorized` as soon as the key is removed, so update your secrets first or schedule a brief maintenance window.
</Warning>

## Error reference

Common responses you may see from the OpenAPI:

| HTTP  | Meaning                                                                         | What to check                                                                                        |
| ----- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `401` | Missing or invalid `Authorization` header, or the key has been deleted/disabled | Verify the `Bearer sk-…` value matches the key shown in the dashboard. Generate a new one if needed. |
| `403` | The key is valid but the workspace isn't allowed to access this resource        | Check the resource belongs to the workspace that owns this key.                                      |
| `422` | The request was authenticated but failed validation                             | Read the response `message` field for the specific reason.                                           |

## Security checklist

* Store keys in a secret manager, never in source control.
* Use a separate key per integration or environment.
* Rotate keys on a regular cadence and immediately if a leak is suspected.
* Restrict access to the **API Keys** page to people who need it.
* Watch your logs for the `sk-` prefix to catch accidental exposure.
