Skip to content

List Batches

client.Batches.List(ctx, query) (*PaginatedCursor[BatchListResponse], error)
GET/api/v2/batches

List batches for the current project.

ParametersExpand Collapse
query BatchListParams
CreatedAtOnOrAfter param.Field[Time]optional
CreatedAtOnOrBefore param.Field[Time]optional
OrganizationID param.Field[string]optional
PageSize param.Field[int64]optional
PageToken param.Field[string]optional
ProjectID param.Field[string]optional
SourceDirectoryID param.Field[string]optional
Status param.Field[BatchListParamsStatus]optional
const BatchListParamsStatusPending BatchListParamsStatus = "PENDING"
const BatchListParamsStatusThrottled BatchListParamsStatus = "THROTTLED"
const BatchListParamsStatusRunning BatchListParamsStatus = "RUNNING"
const BatchListParamsStatusCompleted BatchListParamsStatus = "COMPLETED"
const BatchListParamsStatusFailed BatchListParamsStatus = "FAILED"
const BatchListParamsStatusCancelled BatchListParamsStatus = "CANCELLED"
ReturnsExpand Collapse
type BatchListResponse struct{…}

A top-level batch.

Example: { “id”: “bat-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee”, “project_id”: “prj-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee”, “source_directory_id”: “dir-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee”, “config”: { “job”: { “type”: “parse_v2”, “configuration_id”: “cfg-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee” } }, “status”: “COMPLETED”, “results”: [ { “source_directory_file_id”: “dfl-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee”, “job_reference”: { “type”: “parse_v2”, “id”: “pjb-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee” }, “error_message”: null } ] }

Batch-level FAILED means the orchestration failed and cannot provide a reliable per-file result set. results is only populated when explicitly requested with expand=results and may be null while a batch is still running or before result mappings are available.

ID string

Unique identifier

Config BatchListResponseConfig

Batch configuration snapshot.

Job BatchListResponseConfigJob

Job to create for each file in the source directory.

ConfigurationID string

Saved product configuration ID matching the job type.

Type BatchListResponseConfigJobType

Product job type to run for each source directory file.

One of the following:
const BatchListResponseConfigJobTypeParseV2 BatchListResponseConfigJobType = "parse_v2"
const BatchListResponseConfigJobTypeExtractV2 BatchListResponseConfigJobType = "extract_v2"
ProjectID string

Project this batch belongs to.

SourceDirectoryID string

Directory being processed.

Status BatchListResponseStatus

Current batch status.

One of the following:
const BatchListResponseStatusPending BatchListResponseStatus = "PENDING"
const BatchListResponseStatusThrottled BatchListResponseStatus = "THROTTLED"
const BatchListResponseStatusRunning BatchListResponseStatus = "RUNNING"
const BatchListResponseStatusCompleted BatchListResponseStatus = "COMPLETED"
const BatchListResponseStatusFailed BatchListResponseStatus = "FAILED"
const BatchListResponseStatusCancelled BatchListResponseStatus = "CANCELLED"
CreatedAt Timeoptional

Creation datetime

formatdate-time
Results []BatchListResponseResultoptional

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

SourceDirectoryFileID string

Source directory file processed by this batch.

ErrorMessage stringoptional

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

JobReference BatchListResponseResultJobReferenceoptional

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 BatchListResponseResultJobReferenceType

Type of job produced for the file.

One of the following:
const BatchListResponseResultJobReferenceTypeParseV2 BatchListResponseResultJobReferenceType = "parse_v2"
const BatchListResponseResultJobReferenceTypeExtractV2 BatchListResponseResultJobReferenceType = "extract_v2"
UpdatedAt Timeoptional

Update datetime

formatdate-time

List Batches

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/llamacloud-prod-go"
  "github.com/stainless-sdks/llamacloud-prod-go/option"
)

func main() {
  client := llamacloudprod.NewClient(
    option.WithAPIKey("My API Key"),
  )
  page, err := client.Batches.List(context.TODO(), llamacloudprod.BatchListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "items": [
    {
      "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"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
Returns Examples
{
  "items": [
    {
      "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"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}