# Delete Agency Client

> Permanently delete a client workspace and its data.

Requires an API key with the `write` scope.

Only API keys of an Agency workspace can call this endpoint (`403 agency_required` otherwise). The call always runs in the key's own workspace; `X-Workspace-Id` is ignored. Writes also need a key created by the agency workspace owner (`403 agency_owner_required` otherwise).

**This cannot be undone.** The workspace is removed with its leads, campaigns, email accounts and every other record. A key cannot delete the workspace it belongs to (`400 cannot_delete_own_workspace`), and personal workspaces cannot be deleted.

## Path Parameters

<ParamField path="client_id" type="string" required>The client workspace id.</ParamField>

## Response

<ResponseField name="data" type="object">
  <Expandable title="data">
    <ResponseField name="id" type="string">The deleted workspace id.</ResponseField>
    <ResponseField name="deleted" type="boolean">Always `true`.</ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
```bash cURL
curl -X DELETE "https://api.foxreach.io/api/v1/agency/clients/ws_abc123" \
  -H "X-API-Key: otr_your_key"
```

```python Python SDK
from foxreach import FoxReach

client = FoxReach(api_key="otr_your_key")
client.agency.delete_client("ws_abc123")
```

```typescript TypeScript SDK
import { FoxReach } from "foxreach";

const client = new FoxReach({ apiKey: "otr_your_key" });
await client.agency.deleteClient("ws_abc123");
```
</RequestExample>

<ResponseExample>
```json
{
  "data": {"id": "ws_abc123", "deleted": true}
}
```
</ResponseExample>

Each delete is recorded as an `audit.agency_client.deleted` event on the agency workspace before the data is removed.

## Errors

| Status | Description |
|--------|-------------|
| `401` | Missing, invalid, revoked or expired API key |
| `403` | API key does not have the required scope: `write` |
| `400` | `cannot_delete_own_workspace`, or the workspace is personal |
| `403` | `agency_required` or `agency_owner_required` |
| `404` | The workspace is not owned by the agency owner |

## Rate Limit

- **120 requests per minute, shared by every `write` call in your workspace.** Fixed 60-second window.
- Every response includes `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` (unix epoch seconds) and `X-RateLimit-Bucket` (`write`).
- A `429` response includes a `Retry-After` header (seconds until the bucket resets).

For client-side patterns, see [Rate Limiting](/rate-limiting).
