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

# 🔑 Team API Keys

> API keys that belong to a team and spend its credits.

A team API key belongs to a team. Whatever it spends comes from the team's credits, and it keeps working after the person who made it leaves the team. Use one for a script, a service, or a CI job that works for the team. For your own work, use your [personal API key](https://docs.oxen.ai/getting-started/auth), which acts as you.

## Create a key

Keys live in the team's settings on [oxen.ai](https://www.oxen.ai), under **Integrations**, then **API keys**. The page is also at `https://www.oxen.ai/YOUR_TEAM/settings/api-keys`. Every team member can see the list. Only team admins can create or revoke keys.

![A team's API keys page with active keys above revoked and expired keys](https://mintcdn.com/oxenai/91G6AHvUXhIXw_1h/images/team-api-keys.png?fit=max\&auto=format\&n=91G6AHvUXhIXw_1h\&q=85\&s=573043194b1edd5009830b019f998cb5)

Click **Create API key** and fill in three fields.

* **Name** should say what the key is for, because commits the key makes carry the author `<key name> (<team name>)` and the email `noreply@oxen.ai`.
* **Role** is Viewer or Editor. [Roles](#roles) lists what each can do.
* **Expiration** is 3 days, 7 days, 30 days (the default), 1 year, Never, or a custom date. The key expires at the end of the chosen day.

The next dialog, **Save your API key**, shows the key once. It starts with `oxen_sk_`. Copy it before you close the dialog, because from then on the list shows only its last four characters. A lost key can't be recovered, so revoke it and make another.

## Use a key

Send a team key the same way as a personal key. These examples read it from the `OXEN_API_KEY` environment variable.

```bash cURL theme={null}
curl -X POST https://hub.oxen.ai/api/ai/chat/completions \
  -H "Authorization: Bearer $OXEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "messages": [{"role": "user", "content": "What is Oxen.ai?"}]
  }'
```

```bash CLI theme={null}
oxen config --auth hub.oxen.ai $OXEN_API_KEY
oxen clone https://hub.oxen.ai/YOUR_TEAM/YOUR_REPO
```

```python Python theme={null}
import os
import oxen
from oxen.auth import config_auth

config_auth(os.environ["OXEN_API_KEY"])
oxen.clone("YOUR_TEAM/YOUR_REPO")
```

The CLI and Python library keep one key per host in `~/.config/oxen/auth_config.toml`. Setting a team key there replaces your personal key on that machine.

## Roles

A **viewer** key is read only. It can clone and pull the team's repositories, read data frames and run SQL queries on them, list models (`GET /api/ai/models`), and see the team's API keys and generation history. The writes and generations an editor key can make get a `403` from a viewer key.

An **editor** key can also do these things:

* Run chat completions (`POST /api/ai/chat/completions`) and queued image, video, and audio generations (`POST /api/ai/queue`, then `GET /api/ai/queue/<id>` for the result), billed to the team.
* Push to the team's repositories with the CLI.
* Create repositories in the team, upload files, and work in workspaces.

A key's name and role are fixed. To change either, revoke the key and make a new one.

## Expire and revoke

The list shows each key's name, role, creator, creation date, last use, and expiration. Revoked and expired keys move to their own table below the active ones.

A team admin revokes a key from its row in the list. New requests with that key get a `401` right away, and a generation still waiting in the queue fails when its turn comes. Revoking can't be undone.

## Limits

Team keys can't read the team's credit balance, cancel or retry a generation, or manage keys and team members. They also can't run plain language queries on data frames (text to SQL), which need a person signed in. A route that hasn't been opened to team keys refuses them with a `401` or a `403`.


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