How to Set a Data Retention Policy for Gemini API Logs
Your newest Gemini project may be keeping a copy of every prompt and response, and nobody wrote down for how long. Since October 26, 2026, new paid-tier projects that call the Generate Content API store requests by default (store=true), matching the Interactions API, according to the AI Studio changelog. By the end of this guide you'll have a written Gemini API logs retention policy: which projects log, how long logs live, and which requests opt out.
1. Audit which Gemini projects store requests
Start with the rules in the Logs and Datasets docs:
- Logs exist only for projects on the paid tier.
- Generate Content: projects created on or after October 26, 2026 store requests by default. Older projects don't (
store=false) unless someone enabled logging in AI Studio. - Interactions API: stores by default.
- Covered calls:
GenerateContent,BatchGenerateContent,StreamGenerateContent, Interactions (except Managed Agents), and calls through the OpenAI compatibility endpoints.
Open the Logs page in AI Studio and pick each project from the drop-down. A project needs at least one active API key for logs to display, so an empty list on a project with no active key proves nothing.
Write the result down. This file is our own template, not a Google config format:
# gemini-logging-policy.yaml (internal record, not a Google file)
- project: <project-id>
tier: paid # logs exist only on the paid tier
created: <yyyy-mm-dd> # on or after 2026-10-26 means Generate Content stores by default
generate_content_logging: on # on | off
interactions_logging: on # on | off, toggled separately
retention_days: 14 # 7 | 14 | 28 | 55
per_request_opt_out: customer-PII workflows use store=False
dataset_creators: [<owner-name>]
2. Choose a Gemini API logs retention window
The default is 55 days, and 55 is the maximum. You can set 7, 14, 28 or 55. When the window ends, logs expire and are marked for deletion.
My rule of thumb: pick the shortest window that still covers how long your team takes to notice and investigate a bad output. Review incidents weekly? 14 days is plenty. Handling regulated or customer data? Go to 7, or switch logging off for that project.
3. Set the project-level switch and window in AI Studio
In the Settings panel of the Logs and Datasets dashboard, you can turn logging on or off for the Generate Content API and the Interactions API independently. The data logging policy says the retention window for a project can be updated in AI Studio. The docs don't name the exact control, so look beside the logging toggles and confirm the 7, 14, 28 and 55 options appear.
One warning from the docs: turning Interactions logging off stops the API from automatically storing and retrieving conversation history, unless you override it per request.
4. Opt out of Gemini API logging per request with store=False
The request-level store property takes precedence over the project setting, so one sensitive call can opt out while the rest of the project logs. For Generate Content it needs a recent SDK: google-genai 2.33.0+ (Python), @google/genai 2.31.0+ (JavaScript), google-genai 1.79.0+ (Java) or google.golang.org/genai 1.76.0+ (Go).
pip install --upgrade "google-genai>=2.33.0"
Pin that version in your lockfile, or a stale environment is where the opt-out stops working.
from google import genai
client = genai.Client() # reads GEMINI_API_KEY from the environment
response = client.models.generate_content(
model='<your-model-id>',
contents='Summarize this support ticket: <ticket text>',
config={'store': False}, # this request is not logged
)
print(response.text)
On the Interactions API, store is a top-level parameter instead of living in config.
5. Control datasets, where logs outlive the window
Logs saved to a dataset don't expire. Anyone who can filter logs, tick the checkboxes and click Create dataset can keep data past your 14-day policy, and export it as CSV, JSONL or Google Sheets.
So name who may create datasets. Sharing a dataset with Google is optional and offered at creation time, so make that choice on purpose. The policy says logs aren't used for product improvement or development by default, says shared data may be, and advises against contributing personal, sensitive or confidential data.
6. List what the logs don't cover
These aren't logged: Imagen and Veo models, Gemini embedding models, the Gemini Robotics model, inputs containing videos, GIFs or PDFs, and Public Preview Agents. Your policy should say where the audit trail for those calls comes from, probably your own application logs.
Gotchas
- The docs page says both APIs store by default, then limits Generate Content to projects created on or after October 26. Trust the dated rule and check each project.
- Existing projects keep their current setting, so the change affects your newest projects first.
- The docs say logs are marked for deletion, not when erasure completes, and describe no manual delete.
- They also don't say whether shortening the window applies to logs already written. Test on a non-production project before you promise anything to legal.
- Logs are paid-tier only, so a free-tier prototype won't show up in your audit.
Write the policy while it's a short YAML file, because after your next five projects it becomes an archaeology project.
If you're deploying Gemini in production, this is how you answer "what do you store and for how long?" with a file instead of a guess.