## Cancel Batch Job

`BatchCancelResponse beta().batch().cancel(BatchCancelParamsparams = BatchCancelParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

**post** `/api/v1/beta/batch-processing/{job_id}/cancel`

Cancel a running batch processing job.

Stops processing and marks pending items as cancelled.
Items currently being processed may still complete.

### Parameters

- `BatchCancelParams params`

  - `Optional<String> jobId`

  - `Optional<String> organizationId`

  - `Optional<String> projectId`

  - `Optional<String> temporalNamespace`

  - `Optional<String> reason`

    Optional reason for cancelling the job

### Returns

- `class BatchCancelResponse:`

  Response after cancelling a batch job.

  - `String jobId`

    ID of the cancelled job

  - `String message`

    Confirmation message

  - `long processedItems`

    Number of items processed before cancellation

  - `Status status`

    New status (should be 'cancelled')

    - `PENDING("pending")`

    - `RUNNING("running")`

    - `DISPATCHED("dispatched")`

    - `COMPLETED("completed")`

    - `FAILED("failed")`

    - `CANCELLED("cancelled")`

### Example

```java
package com.llamacloud_prod.api.example;

import com.llamacloud_prod.api.client.LlamaCloudClient;
import com.llamacloud_prod.api.client.okhttp.LlamaCloudOkHttpClient;
import com.llamacloud_prod.api.models.beta.batch.BatchCancelParams;
import com.llamacloud_prod.api.models.beta.batch.BatchCancelResponse;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        LlamaCloudClient client = LlamaCloudOkHttpClient.fromEnv();

        BatchCancelResponse response = client.beta().batch().cancel("job_id");
    }
}
```

#### Response

```json
{
  "job_id": "job_id",
  "message": "message",
  "processed_items": 0,
  "status": "pending"
}
```
