# Developer API

The Tabhive Developer API lets paid users integrate their workspaces, spaces, groups, and tabs with scripts and other applications.

## Availability

The Developer API is available to **Pro**, **Lifetime**, and eligible **Team** plan users. It is not available to Free users.

The API currently supports workspaces, spaces, groups, and adding tabs to groups. Delete, move, reorder, bulk, and tab-update operations are not available in v1.

## Base URL

```text
https://www.tabhive.app/api/v1
```

## Authentication

Create an API key in **Settings → API → API Keys**. You can create up to three keys. The full key is shown only once, so copy it when it is created.

Send the key with every request using either header:

```http
Authorization: Bearer thb_...
```

or:

```http
X-API-Key: thb_...
```

Every API key can read and write through all supported Developer API endpoints. Workspace membership and role permissions still apply: read requests require workspace membership, while create and update requests require **Editor** or **Owner** access.

## Common response format

Successful responses return JSON. Dates are ISO 8601 strings, IDs are returned as strings or numbers according to the resource, and errors have this shape:

```json
{
  "error": "Workspace not found",
  "code": "not_found"
}
```

Common status codes:

| Status | Meaning                                           |
| ------ | ------------------------------------------------- |
| `400`  | Invalid ID or request body                        |
| `401`  | Missing or invalid API key                        |
| `403`  | Paid plan required or insufficient workspace role |
| `404`  | Resource not found or not accessible              |
| `500`  | Unexpected server error                           |

## Workspaces

### List workspaces

```http
GET /workspaces
```

Returns every workspace the authenticated user belongs to.

```json
[
  {
    "id": "3c5c7e8f-3f0d-4c89-9a0e-0e9f1f1f7e8d",
    "name": "Personal",
    "description": null,
    "is_default": true,
    "role": "owner",
    "created_at": "2026-10-09T06:00:00.000Z"
  }
]
```

### Get a workspace

```http
GET /workspaces/{workspaceId}
```

Returns one workspace and the authenticated user’s role in it.

## Spaces

### List spaces in a workspace

```http
GET /workspaces/{workspaceId}/spaces
```

### Create a space

```http
POST /workspaces/{workspaceId}/spaces
Content-Type: application/json
```

```json
{
  "name": "Research"
}
```

### Get a space

```http
GET /spaces/{spaceId}
```

### Rename a space

```http
PATCH /spaces/{spaceId}
Content-Type: application/json
```

```json
{
  "name": "Reading list"
}
```

## Groups

### List groups in a space

```http
GET /spaces/{spaceId}/groups
```

### Create a group

```http
POST /spaces/{spaceId}/groups
Content-Type: application/json
```

```json
{
  "name": "Product research",
  "note": "Links to review this week",
  "color": "blue",
  "icon": "🔎",
  "is_session": false
}
```

Only `name` is required. Supported colors are `grey`, `blue`, `red`, `yellow`, `green`, `pink`, `purple`, `cyan`, and `orange`.

### Get a group

```http
GET /groups/{groupId}
```

Returns the group and its saved tabs.

### Update a group

```http
PATCH /groups/{groupId}
Content-Type: application/json
```

Send one or more of these fields:

```json
{
  "name": "Product research",
  "note": "Updated links to review",
  "color": "purple",
  "icon": "📚",
  "is_session": true
}
```

## Tabs

### Add a tab to a group

```http
POST /groups/{groupId}/tabs
Content-Type: application/json
```

```json
{
  "url": "https://linear.app/method",
  "title": "Linear Method",
  "note": "Read this weekend",
  "description": "Product management guidance",
  "keywords": "product,planning"
}
```

Only `url` is required. The URL must use `http` or `https`. If `title` is omitted, the URL is used as the title. Tabhive resolves the favicon on the server; `favicon_url` is not accepted in the request.

## Example request

```bash
curl https://www.tabhive.app/api/v1/workspaces \\
  -H "Authorization: Bearer thb_..."
```

## Limits and security

* Keep API keys private and treat them like passwords.
* The plaintext key is returned only when it is created.
* Tabhive stores a secure hash of each key, not the plaintext key.
* You can revoke keys from **Settings → API → API Keys**.

<Cards>
  <Card title="Connect AI Apps (MCP)" href="/mcp" description="Use an API key or OAuth to connect AI apps" />

  <Card title="Workspaces" href="/workspaces" description="Organize tabs across workspaces" />

  <Card title="Groups" href="/groups" description="Organize tabs with groups" />
</Cards>
