# Bulk Assign Leads Beta

> Assign many leads to a workspace member, or unassign them.

> Documentation index: https://www.foxreach.io/docs/llms.txt lists every page of these docs. Each page is also served as Markdown: add `.md` to its URL.

`POST` https://api.foxreach.io/api/v1/leads/bulk/assign

> **Note:** **Beta.** This endpoint is new and may change.

Requires an API key with the `write` scope.

Sets the owner (assignee) of the selected leads. The owner is a different thing from the user who created the lead: `ownerUserId` on a lead starts as `null` (unassigned) and only changes through this endpoint. Read it back with `GET /leads` (the `ownerUserId` filter) or on the lead object.

The owner must be a member of the workspace; any other user id is a `422` and nothing changes. A member who is removed later can remain the owner of the leads until you reassign them.

Up to 1,000 selected leads run inside the request and the job comes back `completed` (`200`). More than that is queued: the response is `202` with a `pending` job; poll [Get Job](https://www.foxreach.io/docs/api-reference/jobs/get-job) until it is `completed`. The job keeps the actor and the owner as its record.

## Body Parameters

- `ownerUserId` string | null body required: The workspace member to assign the leads to. Send `null` to unassign them. The field is required: leaving it out is a `422`.
- `leadIds` string[] body: Lead IDs, up to 50,000. Send this or `filter`, not both.
- `filter` object body: Select leads by filter instead. Keys: `search`, `status`, `tags` (comma separated; a lead must carry all of them), `tagMatch` (`any` to match leads with at least one of the tags), `provider`, `interestStatus`, `labelId`, `ownerUserId`. Matches at most 50,000 leads, newest first.

## Response

- `data` object

  The job. See [Get Job](https://www.foxreach.io/docs/api-reference/jobs/get-job) for every field.

  Job object:

  - `id` string: Job identifier.
  - `type` string: `lead_bulk`.
  - `status` string: `completed` when the call finished the work (200), `pending` when it was queued (202).
  - `totalItems` integer: Leads selected.
  - `result` object: `{ "updated": 120 }`: how many of the selected leads in your workspace were updated. Ids from another workspace or deleted leads are skipped.

**Request example**

```bash cURL
curl -X POST "https://api.foxreach.io/api/v1/leads/bulk/assign" \
  -H "X-API-Key: otr_your_key" \
  -H "Content-Type: application/json" \
  -d '{"leadIds": ["cmlead1"], "ownerUserId": "cmuser1"}'
```

```python Python SDK (beta)
from foxreach import FoxReach

client = FoxReach(api_key="otr_your_key")
job = client.leads.bulk_assign("cmuser1", lead_ids=["cmlead1"])
```

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

const client = new FoxReach({ apiKey: "otr_your_key" });
const job = await client.leads.bulkAssign({ leadIds: ["cmlead1"], ownerUserId: "cmuser1" });
```

**Response example**

```json
{
  "data": {
    "id": "cmjob903",
    "type": "lead_bulk",
    "status": "completed",
    "progress": 100,
    "totalItems": 1,
    "completedItems": 1,
    "result": { "updated": 1 },
    "error": null,
    "startedAt": "2026-12-04T09:00:00",
    "completedAt": "2026-12-04T09:00:00",
    "createdAt": "2026-12-04T09:00:00"
  }
}
```

## Errors

| Status | Description |
|--------|-------------|
| `401` | Missing, invalid, revoked or expired API key |
| `403` | API key does not have the required scope: `write` |
| `422` | Neither or both of `leadIds` and `filter` were sent, `ownerUserId` is missing, or `ownerUserId` is not a member of this workspace |

## Rate Limit

- **100 requests per minute, shared by every `bulk` 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` (`bulk`).
- A `429` response includes a `Retry-After` header (seconds until the bucket resets).

For client-side patterns (`Retry-After`, exponential backoff, monitoring `X-RateLimit-Remaining`), see [Rate Limiting](https://www.foxreach.io/docs/rate-limiting).
