TsgcHTTP_API_Anthropic › Methods › ListFiles
Lists files previously uploaded to the Anthropic Files API, with optional pagination
function ListFiles(const aLimit: Integer = 20; const aAfterId: string = ''; const aBeforeId: string = ''): TsgcAnthropicClass_Response_List_Files;
| Name | Type | Description |
|---|---|---|
aLimit | const Integer | Maximum number of files to return per page. Defaults to 20. |
aAfterId | const string | Cursor: return results created after the file with this id. Empty for the first page. |
aBeforeId | const string | Cursor: return results created before the file with this id. Empty to ignore. |
Response with the Data array of file descriptors and HasMore/FirstId/LastId paging cursors (TsgcAnthropicClass_Response_List_Files)
Sends a GET /v1/files request to the Anthropic Files API and returns the page of file metadata. Use aAfterId together with the LastId of the previous response to walk through all pages. The anthropic-version header from AnthropicOptions is included automatically. The returned object must be freed by the caller.
oResponse := oAPI.ListFiles(50);
try
for i := 0 to oResponse.Data.Count - 1 do
Memo1.Lines.Add(oResponse.Data[i].Id + ' - ' + oResponse.Data[i].Filename);
finally
oResponse.Free;
end;