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

# Authentication

> Set a Trajectory API key.

## API key

Create a key under **Settings → API keys**.

```bash theme={null}
export TRAJECTORY_API_KEY="YOUR_TRAJECTORY_API_KEY"
```

```python theme={null}
from trajectory import Client

client = Client()
organization = client.organizations.retrieve_current()
print(organization)
```

`Client()` sends the key as `X-API-Key`. The default API is `https://api.trajectory.ai`. Set `TRAJECTORY_BASE_URL` for another destination.

## Managed spec (benchmark) sessions

A spec task receives `TRAJECTORY_API_KEY`. Use `Client()` normally.
`trajectories.create()` returns the run's trajectory ID; pass that ID to model, reward, and
completion calls. The Backend resolves the model endpoint. See [Bring your
spec](https://docs.trajectory.ai/guides/spec.md). [Production traces](https://docs.trajectory.ai/guides/production-traces.md) use the organization
API key throughout their lifecycle.


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