> This page is for version v1 API.
> For other versions, use one of these documentation indexes:
> - v2 API (default): https://docs.cohere.com/v2/llms.txt
> - v1 API: https://docs.cohere.com/v1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.cohere.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.cohere.com/_mcp/server.

# Retrieve a batch

GET https://api.cohere.com/v2/batches/{id}

Retrieves a batch

Reference: https://docs.cohere.com/reference/get-batch

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `id` (string, required) — The batch ID.

### Headers

- `X-Client-Name` (string, optional) — The name of the project that is making the request.

## Response

### 200

A successful response.

- `batch` (Batch, required) — Information about the batch.

## Errors

### 400 Bad Request Error

Bad Request

- `message` (string, optional) — A developer-facing error message.

### 401 Unauthorized Error

Unauthorized

- `message` (string, optional) — A developer-facing error message.

### 403 Forbidden Error

Forbidden

- `message` (string, optional) — A developer-facing error message.

### 404 Not Found Error

Not Found

- `message` (string, optional) — A developer-facing error message.

### 500 Internal Server Error

Internal Server Error

- `message` (string, optional) — A developer-facing error message.

### 503 Service Unavailable Error

Status Service Unavailable

- `message` (string, optional) — A developer-facing error message.

## Types

### Batch

This resource represents a batch job.

- `name` (string, required) — Batch name (e.g. `foobar`).
- `input_dataset_id` (string, required) — ID of the dataset the batch reads inputs from.
- `model` (string, required) — The name of the model the batch uses.
- `id` (string, optional) — read-only. Batch ID.
- `creator_id` (string, optional) — read-only. User ID of the creator.
- `org_id` (string, optional) — read-only. Organization ID.
- `status` (enum, optional, default: BATCH_STATUS_UNSPECIFIED) — read-only. Current stage in the life-cycle of the batch.
  - Allowed values: `BATCH_STATUS_UNSPECIFIED`, `BATCH_STATUS_QUEUED`, `BATCH_STATUS_IN_PROGRESS`, `BATCH_STATUS_CANCELING`, `BATCH_STATUS_COMPLETED`, `BATCH_STATUS_FAILED`, `BATCH_STATUS_CANCELED`
- `created_at` (string, optional) — read-only. Creation timestamp.
- `updated_at` (string, optional) — read-only. Latest update timestamp.
- `output_dataset_id` (string, optional)
- `input_tokens` (string, optional) — read-only. The total number of input tokens in the batch.
- `output_tokens` (string, optional) — read-only. The total number of output tokens in the batch.
- `num_records` (integer, optional) — read-only. The total number of records in the batch.
- `num_successful_records` (integer, optional) — read-only. The current number of successful records in the batch.
- `num_failed_records` (integer, optional) — read-only. The current number of failed records in the batch.
- `status_reason` (string, optional) — read-only. More details about the reason for the status of a batch job.

## Examples

**Response**

```json
{
  "batch": {
    "name": "my-batch",
    "input_dataset_id": "my-requests-dataset",
    "model": "batch-command",
    "id": "9439e0e3-49a4-4336-93e3-485fc420bc18",
    "creator_id": "b5e1ffb9-49a1-4653-9927-94083316309d",
    "org_id": "62603116-1750-4c04-b1b6-9d5046764bc4",
    "status": "BATCH_STATUS_IN_PROGRESS",
    "created_at": "2024-01-15T09:30:00Z",
    "updated_at": "2024-01-15T09:30:00Z",
    "output_dataset_id": "my-batch-output-c2waz1",
    "input_tokens": "0",
    "output_tokens": "0",
    "num_records": 5000,
    "num_successful_records": 8,
    "num_failed_records": 0
  }
}
```

**SDK Code**

```python Default
import cohere

co = cohere.ClientV2()

batch_job = co.batches.retrieve("<batch_job_id>")
```

```typescript Default
import { CohereClient } from 'cohere-ai';

const cohere = new CohereClient({});

(async () => {
  const batchJob = await cohere.batches.retrieve('<batch_job_id>');
  console.log(batchJob);
})();

```

```go Default
package main

import (
	"context"
	"log"
	"os"

	client "github.com/cohere-ai/cohere-go/v2/client"
)

func main() {
	co := client.NewClient(client.WithToken(os.Getenv("CO_API_KEY")))

	resp, err := co.Batches.Retrieve(context.TODO(), "<batch_job_id>")

	if err != nil {
		log.Fatal(err)
	}

	log.Printf("%+v", resp)
}

```

```java Default
import com.cohere.api.Cohere;
import com.cohere.api.resources.batches.types.GetBatchResponse;

public class BatchGetId {
  public static void main(String[] args) {
    Cohere cohere = Cohere.builder().clientName("snippet").build();

    GetBatchResponse response = cohere.batches().retrieve("<batch_job_id>");

    System.out.println(response);
  }
}
```

```ruby batches_retrieve_example
require 'uri'
require 'net/http'

url = URI("https://api.cohere.com/v2/batches/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-Client-Name"] = 'my-cool-project'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```php batches_retrieve_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.cohere.com/v2/batches/id', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'X-Client-Name' => 'my-cool-project',
  ],
]);

echo $response->getBody();
```

```csharp batches_retrieve_example
using RestSharp;

var client = new RestClient("https://api.cohere.com/v2/batches/id");
var request = new RestRequest(Method.GET);
request.AddHeader("X-Client-Name", "my-cool-project");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift batches_retrieve_example
import Foundation

let headers = [
  "X-Client-Name": "my-cool-project",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.cohere.com/v2/batches/id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```