API / disable-store-on-responses

API

Disable store on Responses requests

Disable store on Responses requests

Pass store: false on a Responses request so the server skips saving that turn for later retrieval. On the xAI SDK the matching flag is store_messages=False. Default is store-on (store: true / store messages enabled). When a response is stored, retention is 30 days, then the server permanently removes it.

Zero Data Retention is a separate Console team setting; the response header x-zero-data-retention reports "true" or "false". ZDR needs no per-request code change once enabled. Under ZDR, features that depend on storage (store_messages, previous_response_id) are unavailable, so keep history on the client (docs recommend use_encrypted_content for agentic tool-calling state).

OpenAI SDK

response = client.responses.create(
    model="grok-4.6",
    input=[
        {"role": "system", "content": "You are Grok, an AI agent built to answer helpful questions."},
        {"role": "user", "content": "How big is the universe?"},
    ],
    store=False
)
print(response)

xAI SDK

chat = client.chat.create(model="grok-4.6", store_messages=False)
chat.append(system("You are Grok, an AI agent built to answer helpful questions."))
chat.append(user("How big is the universe?"))
response = chat.sample()
print(response)

curl

curl https://api.x.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -m 3600 \
  -d '{
    "model": "grok-4.6",
    "input": [
        {
            "role": "system",
            "content": "You are Grok, an AI agent built to answer helpful questions."
        },
        {
            "role": "user",
            "content": "How big is the universe?"
        }
    ],
    "store": false
}'

With store: false, retrieve and HTTP previous_response_id rehydration need local history (and encrypted thinking when you want reasoning continuity). Vercel AI SDK auto-includes encrypted reasoning unless store: false is set.

Pitfalls

  • With store: false (or under ZDR), missing server-side history can fail continuation with previous_response_not_found. Keep the transcript locally.
  • ZDR also disables Batch, Files uploads, Collections, Deferred completions, and stored image/video outputs (Security FAQ). Docs prefer the default 30-day retention for most teams.
  • REST and OpenAI-compatible bodies use store. The xAI SDK uses store_messages.
  • Console API credits are separate from SuperGrok's weekly pool on grok.com.