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

# API Overview

> Base URL, authentication, and public endpoints.

Base URL:

```text theme={"theme":"github-light"}
https://api.trybrein.com/api/v1
```

## Authentication

Most endpoints require either a Clerk session from the dashboard or an API key from the CLI.

```bash theme={"theme":"github-light"}
curl https://api.trybrein.com/api/v1/workspaces/acme/repos \
  -H "x-api-key: drift_your_api_key_here"
```

<Warning>
  Treat API keys as secrets. Driftless stores keys encrypted and only shows the raw value once when created.
</Warning>

## Public endpoints

These endpoints do not require authentication:

| Method | Path                | Purpose                         |
| ------ | ------------------- | ------------------------------- |
| `GET`  | `/health`           | Runtime health check            |
| `GET`  | `/version`          | API version and deploy metadata |
| `POST` | `/workspaces`       | Workspace bootstrap             |
| `GET`  | `/blog/posts`       | Public blog index               |
| `GET`  | `/blog/posts/:slug` | Public blog post                |
| `POST` | `/webhooks/clerk`   | Clerk webhook receiver          |

## Auth and API keys

| Method   | Path                             | Purpose                                |
| -------- | -------------------------------- | -------------------------------------- |
| `GET`    | `/me`                            | Current identity and workspace context |
| `POST`   | `/workspaces/:slug/api-keys`     | Create an API key for that workspace   |
| `GET`    | `/workspaces/:slug/api-keys`     | List a workspace's API keys            |
| `DELETE` | `/workspaces/:slug/api-keys/:id` | Revoke an API key                      |

## Commercial usage

| Method | Path                                 | Purpose                                                                                                                |
| ------ | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
| `GET`  | `/workspaces/:slug/commercial-usage` | Read plan, monthly requests and credits, renewal date, promotional research availability, and the contact-sales action |

The Explore allowance is 10 commercial-intelligence requests and 25 credits per
calendar month, with at most 5 delivered results per request. Founder is USD 29
per month with 50 requests, 250 credits, and at most 10 results per request.
Every workspace may redeem one deep-research turn without using either balance.
One top-level
request counts once; internal tool calls do not. Cerebro, CRM, navigation, and
capability discovery are free. Successful market-data responses include
`commercial_usage`. An exhausted allowance returns HTTP `402` with a stable
`COMMERCIAL_*` code, `retryable: false`, the current `usage`, and
`next_action.kind: "contact_sales"`.

## OAuth

OAuth 2.0 endpoints for MCP client applications:

| Method | Path               | Purpose                                      |
| ------ | ------------------ | -------------------------------------------- |
| `GET`  | `/oauth/authorize` | Authorization consent screen                 |
| `POST` | `/oauth/token`     | Exchange authorization code for access token |
| `POST` | `/oauth/register`  | Register an OAuth client                     |
| `POST` | `/oauth/revoke`    | Revoke an access token                       |

## Resource references

Detailed endpoint references by resource:

* [Collections, Records, and Entities](/api/collections)
* [Broker and Connections](/api/broker)
* [Comments, Areas, and Tags](/api/collaboration)
* [Topics](/api/topics)
* [Integrations](/api/integrations)
* [Workspaces](/api/workspaces)
* [Repos](/api/repos)
* [Market Data](/api/market-data)
* [Errors](/api/errors)
