> ## Documentation Index
> Fetch the complete documentation index at: https://graine.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Force Dispatch Batch

> Manually re-trigger call dispatching for a batch

## Endpoint

**POST** `https://api.graine.ai/api/v1/batches/{batch_id}/dispatch`

Forces a re-run of `execute_batch`. This re-publishes every `PENDING` contact in the batch to the `apollo.batch.dispatch` Kafka topic.

## When to Use This

Use `/dispatch` when:

* The worker container was **down** at the time the batch was created — calls never went out because nobody was consuming Kafka
* A batch shows `PENDING` contacts with stale timestamps and the [debug endpoint](/api-reference/batches/debug) confirms the worker is stuck
* You want to manually re-trigger dispatch after a worker restart

<Note>
  This endpoint only re-publishes `PENDING` contacts. Contacts already `dispatched`, `completed`, `failed`, etc. are not affected.
</Note>

## Path Parameters

| Parameter  | Type   | Required | Description          |
| ---------- | ------ | -------- | -------------------- |
| `batch_id` | string | Yes      | Batch to re-dispatch |

## Headers

| Header          | Required | Description          |
| --------------- | -------- | -------------------- |
| `Authorization` | Yes      | `Bearer gat_<token>` |

## Example Request

```bash theme={null}
curl -X POST "https://api.graine.ai/api/v1/batches/btc_xyz001/dispatch" \
  -H "Authorization: Bearer gat_your_token"
```

## Response

### 200 OK

```json theme={null}
{
  "batch_id": "btc_xyz001",
  "status": "in_progress",
  "dispatched_count": 22,
  "message": "Batch dispatch re-triggered successfully"
}
```

## Typical Recovery Flow

If a batch created successfully but calls never went out:

<Steps>
  <Step title="Check Debug Endpoint">
    `GET /batches/{id}/debug` — look for `diagnostics.stuck_pending: true`
  </Step>

  <Step title="Restart Worker">
    Restart the Apollo worker container so it reconnects to Kafka
  </Step>

  <Step title="Force Dispatch">
    `POST /batches/{id}/dispatch` to re-publish pending contacts
  </Step>

  <Step title="Monitor">
    Poll `GET /batches/{id}` and watch `counters.dispatched` increase
  </Step>
</Steps>

## Next Steps

<CardGroup cols={2}>
  <Card title="Debug Batch" icon="bug" href="/api-reference/batches/debug">
    Diagnose why calls aren't going out
  </Card>

  <Card title="Monitor Contacts" icon="users" href="/api-reference/batches/contacts">
    Track per-contact status
  </Card>
</CardGroup>
