> For the complete documentation index, see [llms.txt](https://chaincontext.gitbook.io/help-center/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chaincontext.gitbook.io/help-center/account/api-reference.md).

# API Reference

{% hint style="warning" %}
This page is a work in progress. Full API documentation is coming soon.
{% endhint %}

## Base URL

```
https://api.chaincontext.dev
```

## Authentication

All API requests require authentication via session cookie (dashboard) or API key (programmatic access).

### API key authentication

Include your API key in the `Authorization` header:

```
Authorization: Bearer sk_your_api_key
```

Generate API keys in Dashboard → Project Settings → **API Keys**.

## Endpoints overview

### Projects

| Method   | Path                          | Description             |
| -------- | ----------------------------- | ----------------------- |
| `GET`    | `/api/teams/:teamId/projects` | List projects in a team |
| `POST`   | `/api/teams/:teamId/projects` | Create a project        |
| `GET`    | `/api/projects/:id`           | Get project details     |
| `PATCH`  | `/api/projects/:id`           | Update project          |
| `DELETE` | `/api/projects/:id`           | Delete project          |

### Tools

| Method   | Path                      | Description      |
| -------- | ------------------------- | ---------------- |
| `GET`    | `/api/projects/:id/tools` | List tools       |
| `POST`   | `/api/projects/:id/tools` | Create a tool    |
| `GET`    | `/api/tools/:id`          | Get tool details |
| `PATCH`  | `/api/tools/:id`          | Update tool      |
| `DELETE` | `/api/tools/:id`          | Delete tool      |
| `POST`   | `/api/tools/:id/test`     | Test a tool      |

### Resources

| Method   | Path                          | Description       |
| -------- | ----------------------------- | ----------------- |
| `GET`    | `/api/projects/:id/resources` | List resources    |
| `POST`   | `/api/projects/:id/resources` | Create a resource |
| `PATCH`  | `/api/resources/:id`          | Update resource   |
| `DELETE` | `/api/resources/:id`          | Delete resource   |

### Prompts

| Method   | Path                        | Description     |
| -------- | --------------------------- | --------------- |
| `GET`    | `/api/projects/:id/prompts` | List prompts    |
| `POST`   | `/api/projects/:id/prompts` | Create a prompt |
| `PATCH`  | `/api/prompts/:id`          | Update prompt   |
| `DELETE` | `/api/prompts/:id`          | Delete prompt   |

### Deployment

| Method | Path                                            | Description         |
| ------ | ----------------------------------------------- | ------------------- |
| `POST` | `/api/teams/:teamId/projects/:id/deploy`        | Deploy project      |
| `GET`  | `/api/teams/:teamId/projects/:id/deploy-status` | Check deploy status |
| `POST` | `/api/teams/:teamId/projects/:id/undeploy`      | Undeploy project    |

### Analytics

| Method | Path                                 | Description         |
| ------ | ------------------------------------ | ------------------- |
| `GET`  | `/api/projects/:id/analytics`        | Get analytics data  |
| `GET`  | `/api/projects/:id/analytics/recent` | Get recent activity |

### Billing

| Method | Path                    | Description             |
| ------ | ----------------------- | ----------------------- |
| `POST` | `/api/billing/checkout` | Start Stripe checkout   |
| `POST` | `/api/billing/portal`   | Get Customer Portal URL |
