# Create Agency Client

> Create a client workspace.

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).

Creating a client counts toward the plan's workspace limit. The new workspace starts on the free plan and the agency owner is its owner.

## Body Parameters

<ParamField body="name" type="string" required>Client name, 1 to 100 characters.</ParamField>

## Response

Returns the client with a `201` status code.

<ResponseField name="data" type="object">
  <Expandable title="data">
    <ResponseField name="id" type="string">Workspace id.</ResponseField>
    <ResponseField name="name" type="string">Workspace name.</ResponseField>
    <ResponseField name="slug" type="string">URL slug.</ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
```bash cURL
curl -X POST "https://api.foxreach.io/api/v1/agency/clients" \
  -H "X-API-Key: otr_your_key" \
  -H "Content-Type: application/json" \
  -d '{"name": "Acme Co"}'
```

```python Python SDK
from foxreach import FoxReach

client = FoxReach(api_key="otr_your_key")
acme = client.agency.create_client("Acme Co")
```

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

const client = new FoxReach({ apiKey: "otr_your_key" });
const acme = await client.agency.createClient({ name: "Acme Co" });
```
</RequestExample>

<ResponseExample>
```json
{
  "data": {"id": "ws_abc123", "name": "Acme Co", "slug": "acme-co"}
}
```
</ResponseExample>

Each create is recorded as an `audit.agency_client.created` event with the key as the actor, readable through the [audit log](/api-reference/audit-log/list-audit-log).

## Errors

| Status | Description |
|--------|-------------|
| `401` | Missing, invalid, revoked or expired API key |
| `403` | API key does not have the required scope: `write` |
| `403` | `agency_required`, `agency_owner_required`, or `upgrade_required` when the workspace limit is reached |
| `422` | `name` is missing or longer than 100 characters |

## 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).
