TsgcHTTP_API_AnthropicMethods › ListBatches

ListBatches Method

Lists all Message Batches in the Anthropic workspace, with optional pagination

Syntax

function ListBatches(const aLimit: Integer = 20; const aAfterId: string = ''; const aBeforeId: string = '') : TsgcAnthropicClass_Response_List_Batches;

Parameters

NameTypeDescription
aLimitconst IntegerMaximum number of batches to return per page. Defaults to 20.
aAfterIdconst stringCursor: return batches created after the batch with this id. Empty for the first page.
aBeforeIdconst stringCursor: return batches created before the batch with this id. Empty to ignore.

Return Value

Response with a Data array of batch descriptors plus paging cursors (TsgcAnthropicClass_Response_List_Batches)

Remarks

Performs a GET /v1/messages/batches request against the Anthropic Message Batches API, returning every batch submitted by the current workspace with its current processing status (in_progress, ended, canceled, etc.). Use aAfterId to walk past the first page. The anthropic-version header from AnthropicOptions is included automatically. The returned object must be freed by the caller.

Example

oResponse := oAPI.ListBatches(20);
try
  for i := 0 to oResponse.Data.Count - 1 do
    Memo1.Lines.Add(oResponse.Data[i].Id + ' = ' + oResponse.Data[i].ProcessingStatus);
finally
  oResponse.Free;
end;

Back to Methods