TLDR; Codex and ChatGPT data retention depends on the login. On a personal ChatGPT plan, OpenAI trains on your conversations unless you turn off ChatGPT’s training setting, and Codex adds a second switch for the code environments it works in. OpenAI doesn’t train on Business, Enterprise, Edu or API data by default, but zero data retention covers only the API, not Codex cloud. Before Codex reads client code, I switch off its metrics, analytics and prompt history, and stop it passing secret-looking variables to the commands it runs.
I run Codex, OpenAI’s coding agent, as a second reviewer inside my Claude Code workflow, so client code reaches OpenAI as well as Anthropic. My Claude Code data privacy guide covers Anthropic’s side. This is OpenAI’s. I checked the table on 21 October 2026; read the linked pages before you rely on any row.
Codex and ChatGPT data retention, by plan
| Plan | Training | Retention | Zero data retention | Region |
|---|---|---|---|---|
| Free, Plus, Pro (and Codex signed in with them) | Yes, unless you opt out; Codex adds a second switch | Deleted chats normally purged within 30 days; Temporary Chat up to 30 days | No | No choice of region |
| Business, Enterprise, Edu | No by default | Set by the admin; deleted chats normally removed within 30 days | No: API zero retention does not cover ChatGPT Work | Enterprise and Edu: storage in Australia, Japan or the UK for new workspaces; inference pinnable only to the US, EU or UAE |
| API | No, since 1 March 2023 | Abuse monitoring up to 30 days; Responses API state 30 days | By prior approval through sales | Storage in Australia, Japan or the UK with approval; inference pinnable only to the US, EU or UAE |
Codex takes its terms from the sign-in: a ChatGPT login follows the workspace’s retention, and an API key follows the API organisation’s. Codex cloud needs a ChatGPT login.
Does Codex train on your code? Two switches and the thumbs rating
On a personal plan, turn training off. On ChatGPT that is “Improve the model for everyone” under Settings, Data controls. Codex adds a second switch, “Include environments”, for the code environments it works in. Turn off both.
Don’t rate responses. On ChatGPT’s consumer plans, a thumbs rating lets OpenAI train on that conversation even after you opt out.
What zero data retention leaves out
ChatGPT Work covers the agent features that a ChatGPT workspace runs in OpenAI’s cloud. Its security page says API zero data retention “is an API-specific control and doesn’t define retention for ChatGPT Work”. As I read it, zero retention does not cover Codex cloud. The Codex CLI (the version that runs in your terminal) on an API key is different: Codex’s sign-in docs say it follows the API organisation’s retention and data-sharing settings.
On the API itself, OpenAI’s guide to your data lists Assistants, vector stores, files, fine-tuning and batches as kept until you delete them. If OpenAI approves zero retention for your organisation, check each feature your code calls against that list.
A court order overrode OpenAI’s 30-day deletion
In 2025, in the New York Times case against OpenAI, a court ordered OpenAI to preserve consumer ChatGPT and API content indefinitely. It covered Free, Plus, Pro, Team and API customers without zero retention, and ended on 26 September 2025. OpenAI still holds a limited set of data collected between April and September 2025.
Data in Australia, Japan or the UK
OpenAI stores data at rest in Australia, Japan and the UK for new Enterprise and Edu workspaces, and for API customers with approval (au.api.openai.com, jp.api.openai.com, gb.api.openai.com). Inference can be pinned only to the US, the EU or the UAE. Not every product is covered, so check Codex on the residency page before you rely on it. For Claude, only Amazon Bedrock keeps processing in Australia, Japan and the UK; the privacy guide lists the models.
Lock down the Codex CLI
Codex sends out more than OpenAI’s docs say. In release rust-v0.163.0 (its source on GitHub), it sends metrics to ab.chatgpt.com by default, and sessions signed in with ChatGPT also send product analytics. Its ignore_default_excludes defaults to true, so environment variables with secret-looking names reach every command the agent runs. Local Codex runs commands with the network off by default (workspace-write). That blocks a direct route out, but a command’s output still reaches OpenAI’s model.
These lines in Codex’s config.toml stop the metrics, analytics, feedback, prompt history and secret variables:
[analytics]
enabled = false
[otel]
metrics_exporter = "none"
[feedback]
enabled = false
[history]
persistence = "none"
[shell_environment_policy]
inherit = "core"
ignore_default_excludes = false
Codex still keeps its state, including each session’s transcript, in ~/.codex (the folder its CODEX_HOME setting points to). Protect the whole folder as you would ~/.claude: disk encryption, encrypted backups and no cloud sync. For a non-interactive run, codex exec --ephemeral saves no session files.
To check that secret-looking variables stay out, start Codex with a dummy one, TEST_API_KEY=canary codex, and ask it to run this command, which prints only PASS or FAIL:
python3 -c 'import os; print("FAIL" if "TEST_API_KEY" in os.environ else "PASS")'
It prints PASS.
Treat a personal ChatGPT share link as public
A chat shared from a personal account is a public web page with an unguessable address. In July 2025 a ChatGPT checkbox, “Make this chat discoverable”, let Google index shared chats about addiction, abuse and mental health. OpenAI removed the option. If a link held anything private, go to Settings, Data controls, Shared links, Manage (OpenAI’s FAQ), delete it, and rotate every credential that appeared in it. Deleting the link does not remove copies people have already saved.
How I run it
Codex reads the same client repositories Claude Code does, through OpenAI’s plugin for Claude Code, signed in with ChatGPT Pro. That is a personal plan, the table’s first row, so I keep both training switches off. Zero retention is not on offer, so I use Codex for plans, code reviews and images, never on client records or personal data. My config.toml carries the lines above. My tools that fetch personal data strip the fields I have blocked before Claude sees them, which matters more than any vendor’s terms: the privacy guide shows how. Where the law in a client’s country adds duties, Claude Code and privacy law in Australia, Japan and the UK covers them, and they apply to OpenAI the same way.
Related reading
- Claude Code data privacy: what Claude keeps, Anthropic’s terms by plan and the steps that gate client data
- Codex reviews my Claude Code work, how I run Codex as a second reviewer
- Claude Code and privacy law in Australia, Japan and the UK, the duties when client personal data reaches a prompt
Sources
- Data controls FAQ, OpenAI Help Center, the consumer opt-out and Codex’s Include environments switch. Documentation
- Data residency, OpenAI Help Center, Australian storage for Enterprise and Edu. Documentation
- Your data, OpenAI API docs, API training, abuse-monitoring retention and zero-retention eligibility. Documentation
- Authentication, ChatGPT Work cloud security and Advanced configuration, Codex docs. Sign-in and retention, zero retention’s scope, environment-variable defaults. Documentation
- openai/codex on GitHub, telemetry defaults, session files and
--ephemeralin releaserust-v0.163.0. Repository - How we’re responding to The New York Times’ data demands, OpenAI, the preservation order’s scope and end. Company statement
- ChatGPT shared links FAQ, OpenAI Help Center, viewing and deleting shared links. Documentation
- Your public ChatGPT queries are getting indexed by Google, TechCrunch, July 2025. News
Common questions
Is Codex safe to use on client code?
With the right login and limits, it can be. Use a Business, Enterprise or Edu workspace, or an API key, so OpenAI does not train on your code by default. Zero data retention covers only the API, not Codex cloud. Before Codex reads client code, switch off its metrics, analytics and prompt history, and stop it passing secret-looking environment variables to the commands it runs. Keep personal data out of what its tools can fetch.
Does Codex use my code for training?
On a personal ChatGPT plan (Free, Plus or Pro) OpenAI trains on your conversations and Codex tasks unless you turn off ChatGPT’s training setting. Codex has a second switch, Include environments, for the code environments it works in; turn that off as well. By default, OpenAI does not train on Business, Enterprise and Edu workspaces or the API platform.
How long does Codex keep my data?
Codex follows its login. On a personal ChatGPT plan, deleted chats are normally purged within 30 days. On Business, Enterprise and Edu the admin sets retention, and deleted chats normally go within 30 days. OpenAI can keep data longer for security or legal reasons. On the API, OpenAI keeps inputs up to 30 days for abuse monitoring unless your organisation has approved zero data retention. Files, vector stores and batches stay until you delete them.
Does zero data retention cover Codex?
Not Codex cloud. OpenAI says API zero data retention is an API-specific control and does not define retention for ChatGPT Work. ChatGPT Work is the set of agent features a workspace runs in OpenAI’s cloud. On an API key, Codex follows the API organisation’s retention settings. If OpenAI has approved zero retention for that organisation, it covers Codex too, except for the API features that keep data until you delete them.
Can I keep ChatGPT or Codex data in Australia, Japan or the UK?
OpenAI stores data in all three countries for new Enterprise and Edu workspaces and, with approval, for the API. Inference can be pinned only to the US, the EU or the UAE. Not every product is covered, so check Codex on OpenAI’s data residency page first.