TsgcHTTP_API_OpenAIMethods › DeleteResponse

DeleteResponse Method

Deletes a stored response from the OpenAI Responses API

Syntax

function DeleteResponse(const aResponseId: string) : TsgcOpenAIClass_Response_Delete_Status;

Parameters

NameTypeDescription
aResponseIdconst stringUnique identifier of the response to remove from OpenAI storage.

Return Value

Status object that reports whether the response was deleted and echoes back the id and object type. (TsgcOpenAIClass_Response_Delete_Status)

Remarks

Issues a DELETE against /v1/responses/{response_id}, permanently removing the stored response and its associated input items from OpenAI servers. Call this when a conversation has ended and you want to comply with a retention or privacy policy. Deleting a response also invalidates any subsequent attempt to chain new requests with that PreviousResponseId.

Example

oStatus := oAPI.DeleteResponse('resp_abc123');
if oStatus.Deleted then
  ShowMessage('Response ' + oStatus.Id + ' deleted');

Back to Methods