# Account and keys

> Your workspace, credit balance, API keys and usage history.

Source: https://openpipe.health/docs/api/account/

None of the endpoints on this page spend credits. All of them act in one [workspace](https://openpipe.health/docs/workspaces.md): the one that created the API key, or the one a session token selects with `X-Oph-Workspace`.

## Get your account

```http
GET /api/me
```

```json
{
  "account": { "id": "8a1f…", "email": "you@example.com", "plan": "free" },
  "workspace": { "kind": "personal", "orgId": null, "role": "owner" },
  "credits": { "used": 42, "limit": 100 },
  "keys": [
    { "id": "c3d2…", "name": "notebook", "prefix": "oph_Ab12Cd34", "createdAt": "2026-12-01T17:02:11.000Z", "lastUsedAt": "2026-12-05T01:58:40.000Z" }
  ]
}
```

| Field | Meaning |
|---|---|
| `account` | The workspace's billing record. `id` is the workspace's account id and `plan` its plan. For an organization workspace, `email` is the address of the member who first opened it, not necessarily yours. |
| `workspace.kind` | `personal` or `organization` |
| `workspace.orgId` | The organization id, or `null` for a personal workspace |
| `workspace.role` | Your role in this request: `owner`, `admin` or `member`. A session in its personal workspace is `owner`. A request made with an API key always reports `member`. |
| `credits` | `used` counts the workspace's current calendar month; `limit` is its monthly allowance |
| `keys` | The workspace's active keys, newest first. Revoked keys are left out. Every member can see this list. |

## Create a key

```http
POST /api/keys
```

Needs a [session token](https://openpipe.health/docs/authentication.md#two-kinds-of-token) from an owner or admin of the workspace. The key is created in the workspace the request acts in, so send `X-Oph-Workspace` to create one for an organization.

| Body field | Type | Description |
|---|---|---|
| `name` | string | A label for the key. Cut to 60 characters. Defaults to `default`. |

Returns `201`:

```json
{ "id": "c3d2…", "name": "notebook", "prefix": "oph_Ab12Cd34", "createdAt": "2026-12-05T02:20:00.000Z", "key": "oph_Ab12Cd34…" }
```

`key` is returned only here. Store it now.

| Status | Message | Cause |
|---|---|---|
| `403` | `Sign in to do that; an API key cannot.` | Called with an API key |
| `403` | `Only workspace owners and admins can do that.` | Called by a member of an organization workspace |
| `409` | `A workspace can have 20 active keys. Revoke one first.` | The workspace already has 20 active keys |

## Revoke a key

```http
DELETE /api/keys/:id
```

Needs a session token from an owner or admin of the workspace, like creating a key. Any owner or admin can revoke any of the workspace's keys, not only the ones they created.

Returns `{ "revoked": "<id>" }`, or `404` with `No such key.` if the key does not exist, is already revoked, or belongs to another workspace. The `403` responses are the same as for [creating a key](#create-a-key).

## List usage

```http
GET /api/usage
```

The workspace's last 100 metered calls, newest first. In an organization workspace that is every member's and every key's calls together.

```json
{
  "rows": [
    { "id": 5120, "kind": "ask", "credits": 25, "meta": { "via": "api_key", "question": "Largest hospitals in Vermont by beds" }, "createdAt": "2026-12-05T02:14:09.000Z" }
  ]
}
```

`kind` is `search`, `lookup`, `ask` or `export`. `meta` records what was asked: the route and filters for a search, the question for Ask, the dashboard and tile or the list and its filters for an export. Records from before the SQL endpoint was removed have `kind` set to `sql`.

`meta.via` says how the call was made: `api_key`, `session`, or `mcp` for a tool call through the [MCP server](https://openpipe.health/docs/mcp.md). Session calls also carry `meta.user`, the id of the signed-in person. MCP calls carry `meta.tool`.

## Saved dashboards

Listing, opening, refreshing, renaming and deleting dashboards are on their own page: [Saved dashboards](https://openpipe.health/docs/api/saved.md). They are free too.

## Live feeds

`POST /api/live/usage` and `POST /api/live/pipeline` return `{ url, sealed }` for the app's live usage and data-pipeline views. They exist for the app and may change without notice.
