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

# API Keys

> Create, rotate, and manage API keys that authenticate your inference requests to the Lilac API. Each key is scoped to an organization.

API keys authenticate your inference requests. Each key is scoped to an organization.

## Creating an API Key

<Steps>
  <Step title="Open the dashboard">
    Navigate to [console.getlilac.com](https://console.getlilac.com) and select your organization.
  </Step>

  <Step title="Go to API Keys">
    Click **API Keys** in the sidebar.
  </Step>

  <Step title="Create a key">
    Click **Create API Key**, give it a name, and copy the key immediately.

    <Warning>
      API keys are only shown once at creation. Store it securely — you cannot retrieve it later.
    </Warning>
  </Step>
</Steps>

## Using Your API Key

Include your API key in the `Authorization` header:

```bash theme={null}
Authorization: Bearer your-lilac-api-key
```

Or pass it directly to the OpenAI SDK:

```python theme={null}
from openai import OpenAI

client = OpenAI(
    base_url="https://api.getlilac.com/v1",
    api_key="your-lilac-api-key",
)
```

## Revoking a Key

To revoke a key, go to **API Keys** in the dashboard and click **Delete** next to the key you want to remove. Revoked keys stop working immediately.

## Best Practices

* Create separate keys for different environments (development, staging, production).
* Rotate keys periodically.
* Never commit keys to version control — use environment variables instead.
* Revoke keys immediately if they may have been exposed.
