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

# Setup & Authentication

> Getting started with the Edgee Console API - create tokens and authenticate requests

## What is the Console API?

The Edgee Console API is a management API that allows you to programmatically interact with your Edgee organization. It enables you to:

* Export usage and cost data for billing and analysis
* Configure custom provider keys (BYOK) for your organization
* Manage your organization's settings programmatically

> [!WARNING]
>
> **Important: Console API vs Gateway API**
>
> Do not confuse the Console API with the AI Gateway API:
>
> * **Console API** (`https://api.edgee.app`) - For managing your organization, exporting data, and configuring provider keys
> * **AI Gateway API** (`https://edgee.io`) - For making LLM requests (chat completions, messages, token counting)
>
> The Console API uses tokens created in the Console settings, while the AI Gateway API uses API keys created in the API Keys section. They are separate systems with different purposes.

## Base URL

All Console API requests use the following base URL:

```
https://api.edgee.app
```

## Create a personal API token

1. Open your account menu in the [console](https://www.edgee.ai).
2. Open **Account settings → Personal API Tokens** (`/~/account/tokens`).
3. Create a token, give it a descriptive name, and store its value securely.
4. Use this token for management requests to `https://api.edgee.app`.

Do not use an organization **API Keys** value here: those keys authenticate LLM requests to the Gateway API. A personal token acts with your account's access to organizations; do not give it to a coding agent as its Gateway key.

To find an organization ID for the examples below, call `GET /v1/organizations` with your personal token and select the organization you intend to manage.

## Authenticating Requests

The Edgee Console API uses bearer token authentication. Include your API token in the `Authorization` header with the `Bearer` scheme:

```bash theme={"dark"}
Authorization: Bearer <your_api_token>
```

### Examples

**Basic Request:**

```bash theme={"dark"}
curl "https://api.edgee.app/v1/organizations/{orgId}/logs/export?period=7d&format=csv" \
  -H "Authorization: Bearer ek_live_..."
```

**With Environment Variable:**

```bash theme={"dark"}
export EDGEE_CONSOLE_API_TOKEN="ek_live_..."

curl "https://api.edgee.app/v1/organizations/{orgId}/logs/export?period=7d" \
  -H "Authorization: Bearer $EDGEE_CONSOLE_API_TOKEN"
```

## Token Management

In the Edgee Console, you can manage all your API keys:

* **View tokens**: See all created API keys and their creation dates
* **Revoke tokens**: Immediately disable any token from the console
* **Rotate tokens**: Create new tokens and revoke old ones for security
* **Monitor usage**: Track API usage associated with each token

## Security

> [!WARNING]
>
> Your API tokens carry many privileges, so be sure to keep them secure!
>
> * Never commit tokens to version control
> * Don't share tokens in publicly accessible areas
> * Don't expose them in client-side code
> * Store them in environment variables or secure credential management systems
> * Revoke tokens if you suspect they've been compromised
> * Create separate tokens for different environments (development, staging, production)
> * Rotate your tokens regularly as part of your security practices

## Error Handling

If your token is invalid or expired, the API will return a `401 Unauthorized` response:

```json theme={"dark"}
{
  "error": "Unauthorized",
  "message": "Invalid or expired API token"
}
```

If your token doesn't have permission to access a resource, you'll receive a `403 Forbidden` response:

```json theme={"dark"}
{
  "error": "Forbidden",
  "message": "Your token does not have permission to access this resource"
}
```

## Next Steps

* Explore [Export Cost Data](https://www.edgee.ai/docs/api-reference/console-api-export-logs.md) to get usage and cost information
* Learn how to [Manage Gateway API Keys](https://www.edgee.ai/docs/api-reference/console-api-manage-gateway-api-keys.md) for your Gateway requests
* Set up [BYOK](https://www.edgee.ai/docs/api-reference/console-api-provider-keys.md) to manage custom provider keys


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.