Unlike Chat completions, the Responses API has a 30 day retention period by default, or when the store
parameter is set to true
. Response data will be stored for at least 30 days in this case.
They do not state “at most”, they state “at least”.
I do not see any evidence of data going away. Logs are there since the date of introduction of the Responses endpoint, not prevented by disabling “API endpoint logging”:
I suppose that is a benefit if you are building a stateful chatbot using previous response IDs. However, "store":true
as endpoint default is a big “heck no, what were you thinking”.
You are essentially powerless to stop the presentation of this data or its persistence, it seems, for there is no “list” method beyond hacking into the platform site API for easy pruning.
Deleting the response ID will clear the log, gone after the refresh of the page that was previously showing the response ID in the URL:
I also discover non-clever use of a reserved keyword in the SDK, preventing proper function:
from openai import OpenAI
client = OpenAI()
response = client.responses.del("resp_123")
print(response)
So your deleting function for Python:
import os
import httpx
def delete_openai_response(response_id: str) -> dict:
"""
Sends a DELETE request to the OpenAI API to delete a response object.
Returns the parsed JSON response which includes the deletion confirmation.
Raises 404 for bad ID or already deleted
"""
api_key = os.environ.get("OPENAI_API_KEY")
if not api_key:
raise EnvironmentError("OPENAI_API_KEY environment variable is not set")
url = f"https://api.openai.com/v1/responses/{response_id}"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
}
with httpx.Client(timeout=30.0) as client:
response = client.delete(url, headers=headers)
response.raise_for_status()
return response.json()
# Usage
id = "resp_1234123412341234"
response = delete_openai_response(id)
print(response)
print(f"True if deleted: {response["deleted"]}")
(yes, I am able to get the platform site’s listing by “special” techniques if I wanted to automate this, but that’s not what OpenAI wants, as evidenced by mitigations.)