# Clients API

> The clients of an agency workspace. With curl and TypeScript examples.

## `GET /v1/clients`

List the clients of the workspace, newest first

Operation `listClients`. Scopes: `sites:read`.

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer (1 to 100, default 20) | no | Page size, 1 to 100. |
| `cursor` | query | string | no | Opaque `next_cursor` of the previous page, for the same list and filters. Omit for the first page. |

**Responses**

| Status | Meaning | Content type |
| --- | --- | --- |
| `200` | One page of clients. | `application/json` |
| `400` | `validation_failed` (bad `limit` or filter) or `invalid_cursor`. | `application/problem+json` |
| `401` | `unauthenticated`: no credentials, or credentials that prove nothing. | `application/problem+json` |
| `403` | `insufficient_scope`: the credential lacks a scope this route needs (see `missing_scopes`). `permission_denied`: the current workspace role does not allow the action. `oauth_consent_required`: an OAuth token whose person has not yet chosen the workspace and the permissions (see `consent_url`). `mfa_required`: a portal session that must still verify or set up MFA (see `mfa_reason`). `workspace_suspended`: Taggor suspended the workspace; every credential acting in it is refused until it is lifted. | `application/problem+json` |
| `405` | `method_not_allowed`: the path exists, but not for this method; `Allow` lists the methods it answers. | `application/problem+json` |
| `429` | `rate_limited`: the limit of the route class (`rate_limit.limit_class`: read, write, publish, heavy, approval, diff, metrics, destructive or ip) was reached. Wait `Retry-After` seconds. `rate_limiter_unavailable` (503) is answered for `heavy` routes and destructive calls when the limiter itself fails, and for a valid OAuth token with no grant when the consent-link limiter fails (never a 401, so an MCP client does not log in again). | `application/problem+json` |
| `500` | `internal_error` (nothing about the failure; quote `request_id`) or `configuration_error`. | `application/problem+json` |
| `503` | `database_unavailable`: the API could not reach its database (timeout, dropped connection). Wait `Retry-After` seconds and send the same request again: repeating is safe with the same `Idempotency-Key`; without it a POST may already have been applied. | `application/problem+json` |

```sh title="curl"
curl "https://api.taggor.dev/v1/clients" \
  -H "Authorization: Bearer $TAGGOR_API_KEY"
```

```ts title="TypeScript"
const response = await fetch("https://api.taggor.dev/v1/clients", {
  headers: { authorization: `Bearer ${process.env.TAGGOR_API_KEY}` },
});
if (!response.ok) throw new Error(await response.text());
const result: unknown = await response.json();
console.log(result);
```

```json title="Example response"
{
  "data": [
    {
      "id": "cl_0123456789abcdefghjkmnpqrs",
      "name": "Padaria Sol",
      "contact": "Ana, ana@cliente.example",
      "notes": null,
      "created_at": "2026-11-03T12:00:00.000Z",
      "updated_at": "2026-11-03T12:00:00.000Z"
    }
  ],
  "next_cursor": null,
  "has_more": false
}
```

## `POST /v1/clients`

Create a client of the agency workspace

Operation `createClient`. Scopes: `sites:write`.

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `idempotency-key` | header | string | no | Makes a retry safe: see [Idempotency](https://taggor.dev/docs/reference/api.md#idempotency). |

**Request body** (`application/json`, required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string (up to 100 characters) | yes | What the client is called. |
| `contact` | string or null (up to 200 characters) | no | How to reach the client (free text, stored as is; Taggor never writes to it). |
| `notes` | string or null (up to 2000 characters) | no | The agency's private notes about the client. |

**Responses**

| Status | Meaning | Content type |
| --- | --- | --- |
| `201` | The client. | `application/json` |
| `400` | `validation_failed`: a bad path parameter or body field. | `application/problem+json` |
| `401` | `unauthenticated`: no credentials, or credentials that prove nothing. | `application/problem+json` |
| `402` | `workspace_payment_required`: the workspace needs a paid plan and has none, so it accepts no change; reading and exporting still work. A person pays in the portal, under Settings, Plan and billing. | `application/problem+json` |
| `403` | `insufficient_scope`: the credential lacks a scope this route needs (see `missing_scopes`). `permission_denied`: the current workspace role does not allow the action. `oauth_consent_required`: an OAuth token whose person has not yet chosen the workspace and the permissions (see `consent_url`). `mfa_required`: a portal session that must still verify or set up MFA (see `mfa_reason`). `cross_site_request`: authenticated by the session cookie, but not from the portal (another `Origin`, or not `Content-Type: application/json`). `workspace_suspended`: Taggor suspended the workspace; every credential acting in it is refused until it is lifted. | `application/problem+json` |
| `405` | `method_not_allowed`: the path exists, but not for this method; `Allow` lists the methods it answers. | `application/problem+json` |
| `409` | `idempotency_request_in_progress`: a request with this key is still running; retry after `Retry-After` seconds. | `application/problem+json` |
| `413` | `payload_too_large`: the request body is over the limit of the route (256 KiB for JSON). | `application/problem+json` |
| `415` | `unsupported_media_type`: the body was sent with a `Content-Type` other than `application/json`. Send the body as JSON with `Content-Type: application/json`. | `application/problem+json` |
| `422` | `idempotency_key_reused`: this key was used in the last 24 h with a different request. | `application/problem+json` |
| `429` | `rate_limited`: the limit of the route class (`rate_limit.limit_class`: read, write, publish, heavy, approval, diff, metrics, destructive or ip) was reached. Wait `Retry-After` seconds. `rate_limiter_unavailable` (503) is answered for `heavy` routes and destructive calls when the limiter itself fails, and for a valid OAuth token with no grant when the consent-link limiter fails (never a 401, so an MCP client does not log in again). | `application/problem+json` |
| `500` | `internal_error` (nothing about the failure; quote `request_id`) or `configuration_error`. | `application/problem+json` |
| `503` | `database_unavailable`: the API could not reach its database (timeout, dropped connection). Wait `Retry-After` seconds and send the same request again: repeating is safe with the same `Idempotency-Key`; without it a POST may already have been applied. | `application/problem+json` |

```sh title="curl"
curl -X POST "https://api.taggor.dev/v1/clients" \
  -H "Authorization: Bearer $TAGGOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Padaria Sol",
  "contact": "Ana, ana@cliente.example",
  "notes": "Renova em março"
}'
```

```ts title="TypeScript"
const response = await fetch("https://api.taggor.dev/v1/clients", {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.TAGGOR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({
    "name": "Padaria Sol",
    "contact": "Ana, ana@cliente.example",
    "notes": "Renova em março"
  }),
});
if (!response.ok) throw new Error(await response.text());
const result: unknown = await response.json();
console.log(result);
```

```json title="Example response"
{
  "id": "cl_0123456789abcdefghjkmnpqrs",
  "name": "Padaria Sol",
  "contact": "Ana, ana@cliente.example",
  "notes": null,
  "created_at": "2026-11-03T12:00:00.000Z",
  "updated_at": "2026-11-03T12:00:00.000Z"
}
```

## `GET /v1/clients/{client_id}`

Read one client of the workspace

Operation `getClient`. Scopes: `sites:read`.

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_id` | path | string | yes | Public client id. |

**Responses**

| Status | Meaning | Content type |
| --- | --- | --- |
| `200` | The client. | `application/json` |
| `400` | `validation_failed`: a bad path parameter or body field. | `application/problem+json` |
| `401` | `unauthenticated`: no credentials, or credentials that prove nothing. | `application/problem+json` |
| `403` | `insufficient_scope`: the credential lacks a scope this route needs (see `missing_scopes`). `permission_denied`: the current workspace role does not allow the action. `oauth_consent_required`: an OAuth token whose person has not yet chosen the workspace and the permissions (see `consent_url`). `mfa_required`: a portal session that must still verify or set up MFA (see `mfa_reason`). `workspace_suspended`: Taggor suspended the workspace; every credential acting in it is refused until it is lifted. | `application/problem+json` |
| `404` | `not_found`: no client with this id in the caller's workspace (also another workspace's). | `application/problem+json` |
| `405` | `method_not_allowed`: the path exists, but not for this method; `Allow` lists the methods it answers. | `application/problem+json` |
| `429` | `rate_limited`: the limit of the route class (`rate_limit.limit_class`: read, write, publish, heavy, approval, diff, metrics, destructive or ip) was reached. Wait `Retry-After` seconds. `rate_limiter_unavailable` (503) is answered for `heavy` routes and destructive calls when the limiter itself fails, and for a valid OAuth token with no grant when the consent-link limiter fails (never a 401, so an MCP client does not log in again). | `application/problem+json` |
| `500` | `internal_error` (nothing about the failure; quote `request_id`) or `configuration_error`. | `application/problem+json` |
| `503` | `database_unavailable`: the API could not reach its database (timeout, dropped connection). Wait `Retry-After` seconds and send the same request again: repeating is safe with the same `Idempotency-Key`; without it a POST may already have been applied. | `application/problem+json` |

```sh title="curl"
curl "https://api.taggor.dev/v1/clients/cl_0123456789abcdefghjkmnpqrs" \
  -H "Authorization: Bearer $TAGGOR_API_KEY"
```

```ts title="TypeScript"
const response = await fetch("https://api.taggor.dev/v1/clients/cl_0123456789abcdefghjkmnpqrs", {
  headers: { authorization: `Bearer ${process.env.TAGGOR_API_KEY}` },
});
if (!response.ok) throw new Error(await response.text());
const result: unknown = await response.json();
console.log(result);
```

```json title="Example response"
{
  "id": "cl_0123456789abcdefghjkmnpqrs",
  "name": "Padaria Sol",
  "contact": "Ana, ana@cliente.example",
  "notes": null,
  "created_at": "2026-11-03T12:00:00.000Z",
  "updated_at": "2026-11-03T12:00:00.000Z"
}
```

## `PATCH /v1/clients/{client_id}`

Change a client's name, contact or notes

Operation `updateClient`. Scopes: `sites:write`.

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_id` | path | string | yes | Public client id. |

**Request body** (`application/json`, required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string (up to 100 characters) | no | What the client is called. |
| `contact` | string or null (up to 200 characters) | no | A new contact, or `null` to clear it. |
| `notes` | string or null (up to 2000 characters) | no | New notes, or `null` to clear them. |

**Responses**

| Status | Meaning | Content type |
| --- | --- | --- |
| `200` | The client after the change. | `application/json` |
| `400` | `validation_failed`: a bad path parameter or body field. | `application/problem+json` |
| `401` | `unauthenticated`: no credentials, or credentials that prove nothing. | `application/problem+json` |
| `402` | `workspace_payment_required`: the workspace needs a paid plan and has none, so it accepts no change; reading and exporting still work. A person pays in the portal, under Settings, Plan and billing. | `application/problem+json` |
| `403` | `insufficient_scope`: the credential lacks a scope this route needs (see `missing_scopes`). `permission_denied`: the current workspace role does not allow the action. `oauth_consent_required`: an OAuth token whose person has not yet chosen the workspace and the permissions (see `consent_url`). `mfa_required`: a portal session that must still verify or set up MFA (see `mfa_reason`). `cross_site_request`: authenticated by the session cookie, but not from the portal (another `Origin`, or not `Content-Type: application/json`). `workspace_suspended`: Taggor suspended the workspace; every credential acting in it is refused until it is lifted. | `application/problem+json` |
| `404` | `not_found`: no client with this id in the caller's workspace (also another workspace's). | `application/problem+json` |
| `405` | `method_not_allowed`: the path exists, but not for this method; `Allow` lists the methods it answers. | `application/problem+json` |
| `413` | `payload_too_large`: the request body is over the limit of the route (256 KiB for JSON). | `application/problem+json` |
| `415` | `unsupported_media_type`: the body was sent with a `Content-Type` other than `application/json`. Send the body as JSON with `Content-Type: application/json`. | `application/problem+json` |
| `429` | `rate_limited`: the limit of the route class (`rate_limit.limit_class`: read, write, publish, heavy, approval, diff, metrics, destructive or ip) was reached. Wait `Retry-After` seconds. `rate_limiter_unavailable` (503) is answered for `heavy` routes and destructive calls when the limiter itself fails, and for a valid OAuth token with no grant when the consent-link limiter fails (never a 401, so an MCP client does not log in again). | `application/problem+json` |
| `500` | `internal_error` (nothing about the failure; quote `request_id`) or `configuration_error`. | `application/problem+json` |
| `503` | `database_unavailable`: the API could not reach its database (timeout, dropped connection). Wait `Retry-After` seconds and send the same request again: repeating is safe with the same `Idempotency-Key`; without it a POST may already have been applied. | `application/problem+json` |

```sh title="curl"
curl -X PATCH "https://api.taggor.dev/v1/clients/cl_0123456789abcdefghjkmnpqrs" \
  -H "Authorization: Bearer $TAGGOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Padaria Sol",
  "contact": "Ana, ana@cliente.example",
  "notes": "Renova em março"
}'
```

```ts title="TypeScript"
const response = await fetch("https://api.taggor.dev/v1/clients/cl_0123456789abcdefghjkmnpqrs", {
  method: "PATCH",
  headers: { authorization: `Bearer ${process.env.TAGGOR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({
    "name": "Padaria Sol",
    "contact": "Ana, ana@cliente.example",
    "notes": "Renova em março"
  }),
});
if (!response.ok) throw new Error(await response.text());
const result: unknown = await response.json();
console.log(result);
```

```json title="Example response"
{
  "id": "cl_0123456789abcdefghjkmnpqrs",
  "name": "Padaria Sol",
  "contact": "Ana, ana@cliente.example",
  "notes": "Renova em março",
  "created_at": "2026-11-03T12:00:00.000Z",
  "updated_at": "2026-11-03T12:00:00.000Z"
}
```

## `DELETE /v1/clients/{client_id}`

Delete a client that has no sites

Refused with 409 `client_has_sites` while a site that is not deleted is linked to the client: move those sites to another client or unlink them with `PATCH /v1/sites/{site_id}` first.

Operation `deleteClient`. Scopes: `sites:write`.

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `client_id` | path | string | yes | Public client id. |

**Responses**

| Status | Meaning | Content type |
| --- | --- | --- |
| `200` | The client as it was deleted; later reads of it are 404. | `application/json` |
| `400` | `validation_failed`: a bad path parameter or body field. | `application/problem+json` |
| `401` | `unauthenticated`: no credentials, or credentials that prove nothing. | `application/problem+json` |
| `402` | `workspace_payment_required`: the workspace needs a paid plan and has none, so it accepts no change; reading and exporting still work. A person pays in the portal, under Settings, Plan and billing. | `application/problem+json` |
| `403` | `insufficient_scope`: the credential lacks a scope this route needs (see `missing_scopes`). `permission_denied`: the current workspace role does not allow the action. `oauth_consent_required`: an OAuth token whose person has not yet chosen the workspace and the permissions (see `consent_url`). `mfa_required`: a portal session that must still verify or set up MFA (see `mfa_reason`). `cross_site_request`: authenticated by the session cookie, but not from the portal (another `Origin`, or not `Content-Type: application/json`). `workspace_suspended`: Taggor suspended the workspace; every credential acting in it is refused until it is lifted. | `application/problem+json` |
| `404` | `not_found`: no client with this id in the caller's workspace (also another workspace's). | `application/problem+json` |
| `405` | `method_not_allowed`: the path exists, but not for this method; `Allow` lists the methods it answers. | `application/problem+json` |
| `409` | `client_has_sites`: sites are still linked to the client; nothing was deleted. | `application/problem+json` |
| `429` | `rate_limited`: the limit of the route class (`rate_limit.limit_class`: read, write, publish, heavy, approval, diff, metrics, destructive or ip) was reached. Wait `Retry-After` seconds. `rate_limiter_unavailable` (503) is answered for `heavy` routes and destructive calls when the limiter itself fails, and for a valid OAuth token with no grant when the consent-link limiter fails (never a 401, so an MCP client does not log in again). | `application/problem+json` |
| `500` | `internal_error` (nothing about the failure; quote `request_id`) or `configuration_error`. | `application/problem+json` |
| `503` | `database_unavailable`: the API could not reach its database (timeout, dropped connection). Wait `Retry-After` seconds and send the same request again: repeating is safe with the same `Idempotency-Key`; without it a POST may already have been applied. | `application/problem+json` |

```sh title="curl"
curl -X DELETE "https://api.taggor.dev/v1/clients/cl_0123456789abcdefghjkmnpqrs" \
  -H "Authorization: Bearer $TAGGOR_API_KEY"
```

```ts title="TypeScript"
const response = await fetch("https://api.taggor.dev/v1/clients/cl_0123456789abcdefghjkmnpqrs", {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.TAGGOR_API_KEY}` },
});
if (!response.ok) throw new Error(await response.text());
const result: unknown = await response.json();
console.log(result);
```

```json title="Example response"
{
  "id": "cl_0123456789abcdefghjkmnpqrs",
  "name": "Padaria Sol",
  "contact": "Ana, ana@cliente.example",
  "notes": null,
  "created_at": "2026-11-03T12:00:00.000Z",
  "updated_at": "2026-11-03T12:00:00.000Z"
}
```
