---
title: "Workspaces"
description: "REST endpoints for workspaces. Bearer-auth required."
section: "API"
group: "REST"
order: 87
---

## GET /api/workspaces

List workspaces.

**Query parameters**

- `limit` (optional): Page size (1–100, default 100).
- `after` (optional): Keyset cursor — return the page after this row (next page).
- `before` (optional): Keyset cursor — return the page before this row (prev page).
- `ids` (optional): Comma-separated list of IDs. Narrows results to these IDs within the caller's accessible scope (does not bypass access checks).
- `filter` (optional): Nested filter expression (`<Entity>Filter`): AND/OR/NOT + per-field comparison operators + relation traversal. JSON-encoded on the query string.
- `orderBy` (optional): Multi-key sort (`<Entity>OrderBy[]`): array of `{ field: direction }` applied in order. Directions: asc/desc plus the four explicit nulls variants. JSON-encoded on the query string.
- `organization_id` (optional): Filter to workspaces in this organization.
- `handle` (optional): Filter to a workspace with this handle. Combine with `organization_id` for org-scoped handle lookup.
- `include_deleted` (optional): Soft-deleted workspace visibility. `false` (default) — active rows only. `true` — active plus soft-deleted. `only` — soft-deleted only.
- `owner_id` (optional): Shorthand: filter where `ownerId` equals this value.
- `default_service_user_id` (optional): Shorthand: filter where `defaultServiceUserId` equals this value.
- `retention_tier` (optional): Shorthand: filter where `retentionTier` equals this value.

**Response**

```json
{
  "data": [
    {
      "id": "<...>",
      "organizationId": "<...>",
      "name": "<...>",
      "handle": "<...>",
      "ownerId": "<...>",
      "defaultServiceUserId": "<...>",
      "deletedAt": "<...>",
      "retentionTier": "<...>",
      "createdAt": "<...>",
      "updatedAt": "<...>"
    }
  ],
  "pageInfo": {
    "total": "number",
    "hasNextPage": "boolean",
    "hasPreviousPage": "boolean",
    "startCursor": "string",
    "endCursor": "string"
  }
}
```

## POST /api/workspaces

Create workspace

**Request body**

```json
{
  "organizationId": "string",
  "name": "string",
  "handle": "string"
}
```

**Response**

```json
{
  "id": "string",
  "organizationId": "string",
  "name": "string",
  "handle": "string",
  "ownerId": "string",
  "defaultServiceUserId": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## GET /api/workspaces/{id}

Get a workspace by ID.

**Path parameters**

- `id` (required): Workspace to retrieve.

**Response**

```json
{
  "id": "string",
  "organizationId": "string",
  "name": "string",
  "handle": "string",
  "ownerId": "string",
  "defaultServiceUserId": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## PATCH /api/workspaces/{id}

Update workspace

**Path parameters**

- `id` (required): The workspace's prefixed ID.

**Request body**

```json
{
  "name?": "string",
  "handle?": "string"
}
```

**Response**

```json
{
  "id": "string",
  "organizationId": "string",
  "name": "string",
  "handle": "string",
  "ownerId": "string",
  "defaultServiceUserId": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## DELETE /api/workspaces/{id}

Soft-delete a workspace.

**Path parameters**

- `id` (required): Workspace to soft-delete.

**Response**

```json
{
  "success": "boolean"
}
```

## GET /api/workspaces/{id}/email

Get workspace email settings

Returns the workspace's email gateway address, enabled state, and config.

**Path parameters**

- `id` (required): The workspace's prefixed ID.

**Response**

```json
{
  "address": "string",
  "enabled": "boolean",
  "config": {
    "maxBytes?": "<...>",
    "allowedSenders?": "<...>"
  }
}
```

## PATCH /api/workspaces/{id}/email

Update workspace email settings

Patch the workspace's email gateway settings (enable/disable, allowed senders, max bytes, etc.). Workspace admins only.

**Path parameters**

- `id` (required): The workspace's prefixed ID.

**Request body**

```json
{
  "enabled?": "boolean",
  "config?": {
    "maxBytes?": "integer",
    "allowedSenders?": ["<...>"]
  }
}
```

**Response**

```json
{
  "address": "string",
  "enabled": "boolean",
  "config": {
    "maxBytes?": "<...>",
    "allowedSenders?": "<...>"
  }
}
```

## DELETE /api/workspaces/{id}/purge

Permanently delete a soft-deleted workspace.

**Path parameters**

- `id` (required): Soft-deleted workspace to permanently delete.

**Response**

```json
{
  "success": "boolean"
}
```

## POST /api/workspaces/{id}/restore

Restore a soft-deleted workspace.

**Path parameters**

- `id` (required): Soft-deleted workspace to restore.

**Response**

```json
{
  "id": "string",
  "organizationId": "string",
  "name": "string",
  "handle": "string",
  "ownerId": "string",
  "defaultServiceUserId": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```
