TsgcHTTP_API_OpenAIMethods › ListFiles

ListFiles Method

Lists all files previously uploaded to the authenticated OpenAI organization

Syntax

function ListFiles: TsgcOpenAIClass_Response_Files;

Return Value

Collection of file metadata records with id, size, purpose and creation timestamp (TsgcOpenAIClass_Response_Files)

Remarks

Calls the GET /v1/files endpoint and returns every file available to the current API key. Each entry exposes the file id used by the assistants, batch, fine-tuning and vision endpoints. Use this method to locate existing uploads before referencing them in downstream requests.

Example

oResponse := oAPI.ListFiles;
for i := 0 to oResponse.Data.Count - 1 do
  Memo1.Lines.Add(oResponse.Data[i].Id + ' - ' + oResponse.Data[i].Filename);

Back to Methods