How to beginner · 3 min read

Claude Enterprise zero data retention

Quick answer
Use Claude Enterprise with the zero data retention option by enabling the dataRetention flag in your API request or account settings. This ensures that Anthropic does not store or use your data for model training or improvement, providing strict data privacy compliance.

PREREQUISITES

  • Python 3.8+
  • Anthropic API key with Enterprise access
  • pip install anthropic>=0.20

Setup

Install the official anthropic Python SDK and set your environment variable for the API key. Ensure you have Enterprise access enabled for zero data retention features.

bash
pip install anthropic>=0.20
output
Collecting anthropic
  Downloading anthropic-0.20.0-py3-none-any.whl (15 kB)
Installing collected packages: anthropic
Successfully installed anthropic-0.20.0

Step by step

Use the anthropic.Anthropic client with your Enterprise API key and specify dataRetention="none" in the request to enforce zero data retention. This disables logging and training on your inputs.

python
import os
import anthropic

client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])

response = client.messages.create(
    model="claude-3-5-sonnet-20241022",
    max_tokens=500,
    system="You are a helpful assistant.",
    messages=[{"role": "user", "content": "Explain zero data retention."}],
    data_retention="none"  # Enforce zero data retention
)

print(response.content[0].text)
output
Zero data retention means that your inputs and outputs are not stored or used for training by Anthropic, ensuring full privacy and compliance with enterprise data policies.

Common variations

You can also set zero data retention at the account level via Anthropic Enterprise dashboard settings, which applies to all API calls automatically. For async usage, the dataRetention parameter is supported similarly.

python
import asyncio
import os
import anthropic

async def main():
    client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
    response = await client.messages.acreate(
        model="claude-3-5-sonnet-20241022",
        max_tokens=500,
        system="You are a helpful assistant.",
        messages=[{"role": "user", "content": "What is zero data retention?"}],
        data_retention="none"
    )
    print(response.content[0].text)

asyncio.run(main())
output
Zero data retention ensures that your data is not stored or used for model training, providing enhanced privacy for enterprise users.

Troubleshooting

  • If you receive an error about dataRetention being unrecognized, verify your API key has Enterprise privileges.
  • Check that you are using the latest anthropic SDK version 0.20 or higher.
  • Ensure the dataRetention parameter is spelled correctly and passed as a string "none".

Key Takeaways

  • Use the dataRetention="none" parameter in Anthropic Enterprise API calls to enforce zero data retention.
  • Zero data retention disables data logging and training on your inputs, ensuring strict privacy compliance.
  • Set zero data retention globally via the Anthropic Enterprise dashboard for convenience.
  • Always use the latest anthropic SDK and verify your Enterprise API key for this feature.
Verified 2026-04 · claude-3-5-sonnet-20241022
Verify ↗