TsgcHTTP_API_OpenAIMethods › RetrieveFile

RetrieveFile Method

Retrieves metadata for a single file previously uploaded to OpenAI

Syntax

function RetrieveFile(const aFileId: string): TsgcOpenAIClass_Response_File;

Parameters

NameTypeDescription
aFileIdconst stringIdentifier of the file, typically starting with "file-"

Return Value

File metadata record with id, filename, size, purpose and timestamps (TsgcOpenAIClass_Response_File)

Remarks

Calls the GET /v1/files/{file_id} endpoint. Returns descriptive information about a file but not its binary content; use RetrieveFileContent to download the bytes. Common use cases include verifying that an upload succeeded and inspecting a file's purpose before referencing it.

Example

oResponse := oAPI.RetrieveFile('file-abc123');
ShowMessage(Format('%s (%d bytes, purpose=%s)',
  [oResponse.Filename, oResponse.Bytes, oResponse.Purpose]));

Back to Methods