# AI API reference

Base URL `https://api.beplan.io/v1`. Every operation is listed with its scope, permission, inputs, answers, errors and an example. Conventions: https://beplan.io/docs/api.md. OpenAPI document: https://beplan.io/docs/api/openapi.json.

## Get a workspace's AI settings

`GET /organizations/{organizationId}/workspaces/{workspaceId}/settings/ai` · operationId `aiSettings.get`

- Scope: `organization:read`
- Role permission: Manage workspace settings (`workspace:update`)
- Effect (`read`): Changes nothing.
- Stability: Beta (May still change before it is marked stable.) Since 2026-11-20.

Returns what Beplan's AI knows about the workspace when it writes: the brand, the audience, the tone and the rules, as free text (empty strings when not set). An assistant writing posts for this workspace should follow them too. Needs the role permission to manage the workspace.

**Parameters**

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `organizationId` | path | string | yes | 1–128 characters |
| `workspaceId` | path | string (uuid) | yes |  |

**200 OK**

- `data` (object, required, AiSettings)
  - `brand` (string, required): Who the workspace is: brand, topics, what it offers. Empty when not set.
  - `audience` (string, required): Who it writes for. Empty when not set.
  - `tone` (string, required): How it sounds ("warm, direct, a little playful"). Empty when not set.
  - `rules` (string, required): Dos and don'ts every AI suggestion follows. Empty when not set.

**Errors**

| Status | Code | Message |
|---|---|---|
| 403 | `MISSING_PERMISSION` | You don't have permission to do this. |
| 404 | `ORGANIZATION_NOT_FOUND` | This organization doesn't exist or you're not a member of it. |
| 404 | `WORKSPACE_NOT_FOUND` | This workspace doesn't exist or you don't have access to it. |

Also, like every operation: `VALIDATION_FAILED` (400), `APP_SUSPENDED` (401), `TOKEN_EXPIRED` (401), `TOKEN_REVOKED` (401), `UNAUTHENTICATED` (401), `INSUFFICIENT_SCOPE` (403), `INTEGRATION_BLOCKED_BY_ORGANIZATION` (403), `INTEGRATION_PENDING_APPROVAL` (403), `RATE_LIMITED` (429), `INTERNAL_ERROR` (500).

**Example: A coffee roaster**

```bash
curl -X GET "https://api.beplan.io/v1/organizations/Yx0k2N7mQf3bA9cRz1LwP/workspaces/3f6c2a8e-91b4-4d7e-a2c5-7e0b9d1f4a62/settings/ai" \
  -H "Authorization: Bearer beplan_pat_…"
```

Answers 200:

```json
{
  "data": {
    "brand": "Northwind Coffee: a small roastery in Lyon, single-origin beans and home brewing guides.",
    "audience": "Home baristas, 25–40, curious but not experts.",
    "tone": "Warm, direct, a little playful. No jargon.",
    "rules": "Never promise health benefits. Prices in euros."
  }
}
```


## Update a workspace's AI settings

`PATCH /organizations/{organizationId}/workspaces/{workspaceId}/settings/ai` · operationId `aiSettings.update`

- Scope: `workspaces:write`
- Role permission: Manage workspace settings (`workspace:update`)
- Effect (`write`): Changes data in Beplan.
- Stability: Beta (May still change before it is marked stable.) Since 2026-11-20.

Changes the AI settings sent (`brand` up to 2,000 characters, `audience` 2,000, `tone` 1,000, `rules` 4,000; trimmed). An empty string clears a setting; a field left out is unchanged. Every AI feature of the workspace (the editor's assistant, autofill) uses them from the next request. Answers with all four settings.

**Parameters**

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `organizationId` | path | string | yes | 1–128 characters |
| `workspaceId` | path | string (uuid) | yes |  |

**Request body** (JSON, required)

- `brand` (string, optional): New text, at most 2000 characters, trimmed; an empty string clears it, left out: unchanged. at most 2000 characters.
- `audience` (string, optional): New text, at most 2000 characters, trimmed; an empty string clears it, left out: unchanged. at most 2000 characters.
- `tone` (string, optional): New text, at most 1000 characters, trimmed; an empty string clears it, left out: unchanged. at most 1000 characters.
- `rules` (string, optional): New text, at most 4000 characters, trimmed; an empty string clears it, left out: unchanged. at most 4000 characters.

**200 OK**

- `data` (object, required, AiSettings)
  - `brand` (string, required): Who the workspace is: brand, topics, what it offers. Empty when not set.
  - `audience` (string, required): Who it writes for. Empty when not set.
  - `tone` (string, required): How it sounds ("warm, direct, a little playful"). Empty when not set.
  - `rules` (string, required): Dos and don'ts every AI suggestion follows. Empty when not set.

**Errors**

| Status | Code | Message |
|---|---|---|
| 400 | `VALIDATION_FAILED` | Some of the information sent is invalid. |
| 403 | `MISSING_PERMISSION` | You don't have permission to do this. |
| 404 | `ORGANIZATION_NOT_FOUND` | This organization doesn't exist or you're not a member of it. |
| 404 | `WORKSPACE_NOT_FOUND` | This workspace doesn't exist or you don't have access to it. |

Also, like every operation: `APP_SUSPENDED` (401), `TOKEN_EXPIRED` (401), `TOKEN_REVOKED` (401), `UNAUTHENTICATED` (401), `INSUFFICIENT_SCOPE` (403), `INTEGRATION_BLOCKED_BY_ORGANIZATION` (403), `INTEGRATION_PENDING_APPROVAL` (403), `PAYLOAD_TOO_LARGE` (413), `UNSUPPORTED_MEDIA_TYPE` (415), `RATE_LIMITED` (429), `INTERNAL_ERROR` (500).

**Example: A new tone**

```bash
curl -X PATCH "https://api.beplan.io/v1/organizations/Yx0k2N7mQf3bA9cRz1LwP/workspaces/3f6c2a8e-91b4-4d7e-a2c5-7e0b9d1f4a62/settings/ai" \
  -H "Authorization: Bearer beplan_pat_…" \
  -H "Content-Type: application/json" \
  -d '{
  "tone": "Calm and precise."
}'
```

Answers 200:

```json
{
  "data": {
    "brand": "Northwind Coffee: a small roastery in Lyon, single-origin beans and home brewing guides.",
    "audience": "Home baristas, 25–40, curious but not experts.",
    "tone": "Calm and precise.",
    "rules": "Never promise health benefits. Prices in euros."
  }
}
```


---
HTML version: https://beplan.io/docs/api/ai/
