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

# Managing API Keys

> Create and manage API keys to invoke Braintrust experts programmatically.

API keys let you invoke Braintrust experts programmatically — from scripts, CI/CD pipelines, custom applications, or any HTTP client. Each key is tied to your account and carries your access permissions.

## Opening the API Keys Manager

1. Click the **settings icon** (gear icon) at the bottom-left of the sidebar, next to your name.

<Frame caption="Click the settings icon next to your name">
  <img src="https://mintcdn.com/devfactory/TEteLc1zUJOxCu2V/images/settings-icon-highlighted.png?fit=max&auto=format&n=TEteLc1zUJOxCu2V&q=85&s=236285132d81147a71f36495988579d5" alt="Settings icon highlighted at the bottom-left of the sidebar" width="2559" height="1439" data-path="images/settings-icon-highlighted.png" />
</Frame>

2. In the **Settings** modal, click **Manage API Keys**.

<Frame caption="Settings modal — click Manage API Keys">
  <img src="https://mintcdn.com/devfactory/TEteLc1zUJOxCu2V/images/manage-api-key-highlighted.png?fit=max&auto=format&n=TEteLc1zUJOxCu2V&q=85&s=d3488d8ea55883fbb878282ffe117aa3" alt="Settings modal with Manage API Keys button highlighted" width="2559" height="1439" data-path="images/manage-api-key-highlighted.png" />
</Frame>

## Creating an API Key

<Steps>
  <Step title="Enter a key name">
    Type a descriptive name in the field (for example: `ci-pipeline`, `slack-bot`, `local-dev`). Names help you identify which key belongs to which integration.
  </Step>

  <Step title="Click Create New Key">
    Click the **Create New Key** button. The key is created immediately.

    <Frame caption="API Keys modal — enter a name and click Create New Key">
      <img src="https://mintcdn.com/devfactory/TEteLc1zUJOxCu2V/images/create-new-key.png?fit=max&auto=format&n=TEteLc1zUJOxCu2V&q=85&s=aa7e21c33840c95b50390497492e3684" alt="API Keys modal with Create New Key button highlighted" width="1248" height="778" data-path="images/create-new-key.png" />
    </Frame>
  </Step>

  <Step title="Copy the key now">
    The full key is shown **once** — immediately after creation. Copy it and store it securely (for example, in a password manager or as an environment variable).

    <Frame caption="The full key is visible only at creation time — copy it immediately">
      <img src="https://mintcdn.com/devfactory/TEteLc1zUJOxCu2V/images/api-key-aftercreation.png?fit=max&auto=format&n=TEteLc1zUJOxCu2V&q=85&s=e0259af451aa33801d4d0e5f389d66cb" alt="API key created successfully with copy button highlighted" width="1201" height="637" data-path="images/api-key-aftercreation.png" />
    </Frame>

    <Warning>
      After you leave this view, the key is truncated for security. There is no way to retrieve the full value again. If you lose it, delete the key and create a new one.
    </Warning>
  </Step>
</Steps>

<Check>
  **Done.** You now have an API key. Use it as the `x-api-key` header on every API request.
</Check>

## Using Your API Key

Pass the key as a header on every request:

```
x-api-key: YOUR_API_KEY
```

Example:

```shell theme={null}
curl -s -N -X POST "https://braintrust.ti.trilogy.com/api/agents/invoke" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agent":"AGENT_ID","message":"What can you help me with?"}'
```

See [API Reference](/reference/api-reference) for the full request format.

## Deleting a Key

Click the **trash icon** next to any key in the list to delete it permanently. Deletion is immediate — any integration using that key will stop working.

<Tip>
  Before deleting a key used in production, rotate it: create the new key first, update all integrations, then delete the old key.
</Tip>

## Security Best Practices

* **Never commit API keys to source control.** Use environment variables or a secrets manager.
* **Never log keys in plain text.** Treat them like passwords.
* **Use one key per integration.** This makes it easy to revoke access for a single system without affecting others.
* **Use HTTPS only.** The API rejects plain HTTP connections.

## Next Steps

<CardGroup cols={2}>
  <Card title="API Reference" icon="code" href="/reference/api-reference">
    Full request format, streaming events, async mode, and error codes.
  </Card>

  <Card title="Triggers" icon="clock" href="/automation/triggers">
    Run experts on a schedule without any code.
  </Card>
</CardGroup>
