Batch

interface Batch

Create large batches of API requests for asynchronous processing. The Batch API returns completions within 24 hours for a 50% discount.

Functions

Link copied to clipboard
abstract suspend fun batch(id: BatchId, requestOptions: RequestOptions? = null): Batch?

Retrieves a batch.

abstract suspend fun batch(request: BatchRequest, requestOptions: RequestOptions? = null): Batch

Creates and executes a batch from an uploaded file of requests.

Link copied to clipboard
abstract suspend fun batches(after: BatchId? = null, limit: Int? = null, requestOptions: RequestOptions? = null): List<Batch>

List your organization's batches.

Link copied to clipboard
abstract suspend fun cancel(id: BatchId, requestOptions: RequestOptions? = null): Batch?

Cancels an in-progress batch.