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

# Workspace

> Inspect and update your workspace; check current-period usage.

The workspace is the top-level tenant in Salty. Every record (people, companies, deals, …) and every API key belongs to exactly one workspace.

## Endpoints

| Method  | Path                | Purpose                                                |
| ------- | ------------------- | ------------------------------------------------------ |
| `GET`   | `/workspace`        | Current workspace + plan + counts                      |
| `GET`   | `/workspace/usage`  | API calls in the last 24h + current-period totals      |
| `PATCH` | `/workspace`        | Update `name` and `hard_cap_api_calls`                 |
| `GET`   | `/workspace/export` | Full JSON export of every record + your schema         |
| `POST`  | `/workspace/delete` | Delete the workspace (admin/JWT only, type-to-confirm) |

## `GET /workspace`

```bash theme={null}
curl $SALTY_API/workspace \
  -H "Authorization: Bearer $SALTY_API_KEY"
```

```json theme={null}
{
  "id": "7f4e5a82-d58d-4dfc-b23c-58586ff05253",
  "slug": "dev",
  "name": "Dev",
  "plan": "pro",
  "records_count": 0,
  "api_calls_used_this_period": 0,
  "hard_cap_api_calls": null,
  "created_at": "2026-05-24T02:02:09.393Z"
}
```

## `GET /workspace/usage`

```json theme={null}
{
  "api_calls_used_this_period": 1247,
  "api_calls_last_24h": 312,
  "records_count": 542,
  "plan": "pro"
}
```

## `PATCH /workspace`

Editable fields: `name`, `hard_cap_api_calls` (set to `null` to remove the cap).

```bash theme={null}
curl -X PATCH $SALTY_API/workspace \
  -H "Authorization: Bearer $SALTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Acme Inc.","hard_cap_api_calls":50000}'
```

Things you **can't** change via API: `slug`, `plan`, `dodo_customer_id`. Plan changes go through the billing UI.

## `GET /workspace/export`

Download everything in your workspace as a single JSON document — people, companies, deals, notes, tasks, activities, custom objects + their records, and your schema. No lock-in; available on demand.

```bash theme={null}
curl $SALTY_API/workspace/export \
  -H "Authorization: Bearer $SALTY_API_KEY" \
  -o salty-export.json
```

The document includes a `counts` summary and one array per object type (only active records — trashed records are excluded).

## `POST /workspace/delete`

Permanently delete the workspace. **Admin only** — it must be called with a logged-in user's session token (JWT), not an API key. Pass the workspace `slug` as `confirm`. It immediately revokes every API key and OAuth token; the data is purged after the trash window.

```bash theme={null}
curl -X POST $SALTY_API/workspace/delete \
  -H "Authorization: Bearer <user-jwt>" \
  -H "Content-Type: application/json" \
  -d '{"confirm":"acme"}'
```

Returns `204`. Called with an API key it returns `401 jwt_required`; a `confirm` that doesn't match the slug returns `400`. Most people do this from the dashboard **Account** page instead.
