For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DASHBOARDPLAYGROUNDDOCSCOMMUNITYLOG IN
Guides and conceptsAPI ReferenceRelease NotesLLMUCookbooks
Guides and conceptsAPI ReferenceRelease NotesLLMUCookbooks
  • Cohere API
    • About
    • Teams and Roles
    • Errors
    • Migrating From API v1 to API v2
    • Using the OpenAI SDK
  • Endpoints
      • POSTCreate a batch
      • GETList batches
      • GETRetrieve a batch
      • POSTCancel a batch
  • Deprecated
LogoLogodocs
DASHBOARDPLAYGROUNDDOCSCOMMUNITYLOG IN
Endpointsv2/batches

Create a batch

POST
https://api.cohere.com/v2/batches
POST
/v2/batches
1import cohere
2
3co = cohere.ClientV2()
4
5batch_job = co.batches.create(
6 name="<batch_job_name>",
7 input_dataset_id="<input_dataset_id>",
8 model="<model_name>",
9)
1{
2 "batch": {
3 "name": "string",
4 "input_dataset_id": "string",
5 "model": "string",
6 "id": "string",
7 "creator_id": "string",
8 "org_id": "string",
9 "status": "BATCH_STATUS_UNSPECIFIED",
10 "created_at": "2024-01-15T09:30:00Z",
11 "updated_at": "2024-01-15T09:30:00Z",
12 "output_dataset_id": "string",
13 "input_tokens": "string",
14 "output_tokens": "string",
15 "num_records": 1,
16 "num_successful_records": 1,
17 "num_failed_records": 1,
18 "status_reason": "string"
19 }
20}
Creates and executes a batch from an uploaded dataset of requests
Was this page helpful?
Previous

List batches

Next
Built with

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Headers

X-Client-NamestringOptional
The name of the project that is making the request.

Request

Information about the batch. Must contain name, input_dataset_id, and model. Output-only fields are ignored.

namestringRequired

Batch name (e.g. foobar).

input_dataset_idstringRequired
ID of the dataset the batch reads inputs from.
modelstringRequired
The name of the model the batch uses.

Response

A successful response.
batchobject
Information about the batch.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
500
Internal Server Error
503
Service Unavailable Error