Skip to content

Create Batch

POST/api/v2/batches

Create a batch over a source directory and start processing asynchronously.

Query ParametersExpand Collapse
organization_id: optional string
project_id: optional string
Cookie ParametersExpand Collapse
session: optional string
Body ParametersJSONExpand Collapse
config: object { job }

Batch configuration snapshot to apply to this source directory.

job: object { configuration_id, type }

Job to create for each file in the source directory.

configuration_id: string

Saved product configuration ID matching the job type.

type: "parse_v2" or "extract_v2"

Product job type to run for each source directory file.

One of the following:
"parse_v2"
"extract_v2"
source_directory_id: string

Directory whose files should be processed.

ReturnsExpand Collapse
id: string

Unique identifier

config: object { job }

Batch configuration snapshot.

job: object { configuration_id, type }

Job to create for each file in the source directory.

configuration_id: string

Saved product configuration ID matching the job type.

type: "parse_v2" or "extract_v2"

Product job type to run for each source directory file.

One of the following:
"parse_v2"
"extract_v2"
project_id: string

Project this batch belongs to.

source_directory_id: string

Directory being processed.

status: "PENDING" or "THROTTLED" or "RUNNING" or 3 more

Current batch status.

One of the following:
"PENDING"
"THROTTLED"
"RUNNING"
"COMPLETED"
"FAILED"
"CANCELLED"
created_at: optional string

Creation datetime

formatdate-time
results: optional array of object { source_directory_file_id, error_message, job_reference }

Expanded per-file result mappings. Null unless requested with expand=results, or until result mappings are available.

source_directory_file_id: string

Source directory file processed by this batch.

error_message: optional string

Batch-level mapping error if the system could not create or associate a job for this source file.

job_reference: optional object { id, type }

Reference to a job produced by a batch.

Example: { “type”: “parse_v2”, “id”: “pjb-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee” }

id: string

Job ID, such as a parse job ID.

type: "parse_v2" or "extract_v2"

Type of job produced for the file.

One of the following:
"parse_v2"
"extract_v2"
updated_at: optional string

Update datetime

formatdate-time

Create Batch

curl https://api.cloud.llamaindex.ai/api/v2/batches \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
    -d '{
          "config": {
            "job": {
              "configuration_id": "cfg-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
              "type": "parse_v2"
            }
          },
          "source_directory_id": "dir-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
        }'
{
  "id": "id",
  "config": {
    "job": {
      "configuration_id": "cfg-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
      "type": "parse_v2"
    }
  },
  "project_id": "project_id",
  "source_directory_id": "source_directory_id",
  "status": "PENDING",
  "created_at": "2019-12-27T18:11:19.117Z",
  "results": [
    {
      "source_directory_file_id": "dfl-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
      "error_message": "error_message",
      "job_reference": {
        "id": "pjb-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
        "type": "parse_v2"
      }
    }
  ],
  "updated_at": "2019-12-27T18:11:19.117Z"
}
Returns Examples
{
  "id": "id",
  "config": {
    "job": {
      "configuration_id": "cfg-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
      "type": "parse_v2"
    }
  },
  "project_id": "project_id",
  "source_directory_id": "source_directory_id",
  "status": "PENDING",
  "created_at": "2019-12-27T18:11:19.117Z",
  "results": [
    {
      "source_directory_file_id": "dfl-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
      "error_message": "error_message",
      "job_reference": {
        "id": "pjb-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
        "type": "parse_v2"
      }
    }
  ],
  "updated_at": "2019-12-27T18:11:19.117Z"
}