TsgcHTTP_API_OpenAIMethods › RetrieveResponse

RetrieveResponse Method

Retrieves a previously created response from the OpenAI Responses API by its identifier

Syntax

function RetrieveResponse(const aResponseId: string) : TsgcOpenAIClass_Response_Response;

Parameters

NameTypeDescription
aResponseIdconst stringUnique identifier of the response to load (the id value returned by a previous CreateResponse call).

Return Value

Parsed response object with the current status, output items and token usage for the requested response id. (TsgcOpenAIClass_Response_Response)

Remarks

Issues a GET to /v1/responses/{response_id} and returns the stored object. Useful for resuming a conversation thread across sessions, polling a long running response that was created in background mode, or inspecting tool call outputs after the fact. Responses are retained by OpenAI for a limited time; once expired the endpoint returns an error which is surfaced as an exception.

Example

oResponse := oAPI.RetrieveResponse('resp_abc123');
ShowMessage('Status: ' + oResponse.Status + sLineBreak +
  'Output: ' + oResponse.OutputText);

Back to Methods