API / retrieve-a-stored-response

API

Retrieve a stored response

Retrieve a stored response

GET https://api.x.ai/v1/responses/{response_id} loads a prior Responses turn by id. OpenAI SDK: client.responses.retrieve. xAI SDK: client.chat.get_stored_completion. The response must have been stored (default store: true) and still sit inside the 30-day retention window.

OpenAI SDK

response = client.responses.retrieve("<The previous response's id>")
print(response)

xAI SDK

response = client.chat.get_stored_completion("<The previous response's id>")
print(response)

curl

curl https://api.x.ai/v1/responses/{response_id} \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -m 3600

Vercel AI SDK has no retrieve helper; use the OpenAI SDK against https://api.x.ai/v1.

Pitfalls

  • Retrieve needs a stored response within 30 days. Creates with store: false, manual DELETE, past expiry, or ZDR (no persisted history) will not return a stored turn.
  • Keep the response.id from create if you plan to fetch it later.
  • Console API credits are separate from SuperGrok's weekly pool on grok.com.