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

# Api keys

# API Key Developer Guide

## Overview

API keys provide a secure way to authenticate with the Oxygen API without requiring user credentials. This guide covers everything you need to know about implementing API key authentication in your applications.

## What are Oxygen API Keys?

API keys are secure tokens that identify your application to the Oxygen API. A unique string prefixed with `oxy_`

## API Documentation

For a complete reference of all available API endpoints, visit our **live Swagger API documentation** at `/apidoc`. This interactive documentation allows you to:

* Browse all available endpoints
* View request/response schemas
* Test API calls directly from your browser
* Download OpenAPI specifications

<Tip>
  The Swagger documentation is automatically updated and always reflects the
  current API version running on your Oxygen instance.
</Tip>

## Creating API Keys

### Through the Web Interface

1. Log into your Oxygen
2. User menu -> **API Keys**
3. Click **Create New API Key**
4. Provide a descriptive name for your key
5. Set an optional expiration date
6. Click **Create API Key**

**Important**: Copy your API key immediately after creation. For security reasons, you won't be able to view the full key again.

## Using API Keys

### Authentication Header

Include your API key in the `X-API-Key` header with every request. The REST
API is served by your Oxygen host under `/api`, and most resources are
workspace-scoped (`/api/{workspace_id}/...`):

```bash theme={null}
curl -H "X-API-Key: oxy_your_api_key_here" \
     https://app.oxygen-hq.com/api/{workspace_id}/agents
```

## Examples

### Quick Start Examples

Here are some quick examples to get you started with different programming languages:

#### Python

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

# Set up your API key
api_key = os.getenv('OXY_API_KEY')
headers = {'X-API-Key': api_key}

# List the agents in a workspace
response = requests.get(
    'https://app.oxygen-hq.com/api/{workspace_id}/agents', headers=headers
)
agents = response.json()
print(f"Found {len(agents)} agents")
```

#### JavaScript (Node.js)

```javascript theme={null}
const axios = require("axios");

const client = axios.create({
  baseURL: "https://app.oxygen-hq.com/api",
  headers: {
    "X-API-Key": process.env.OXY_API_KEY,
  },
});

// List the agents in a workspace
client
  .get("/{workspace_id}/agents")
  .then((response) => {
    console.log(`Found ${response.data.length} agents`);
  })
  .catch((error) => {
    console.error("Error:", error.response.data);
  });
```

#### cURL

```bash theme={null}
# List the agents in a workspace
curl -H "X-API-Key: $OXY_API_KEY" \
     https://app.oxygen-hq.com/api/{workspace_id}/agents

# List threads in a workspace
curl -H "X-API-Key: $OXY_API_KEY" \
     https://app.oxygen-hq.com/api/{workspace_id}/threads
```
