> ## Documentation Index
> Fetch the complete documentation index at: https://www.krea.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Zero Data Retention

> 在 Krea API 上启用零数据保留（Zero Data Retention），让提示词和参考图像不会被存储。

## 概述

Krea 允许企业启用零数据保留（Zero Data Retention）。目前 API 支持 Krea 2 Medium、Krea 2 Large 和 Krea 2 Medium Turbo。请联系 [sales@krea.ai ↗](mailto:sales@krea.ai) 以在你的工作区中启用此功能。启用支持后，按如下方式发起请求：

```bash theme={null}
curl -X POST https://api.krea.ai/generate/image/krea/krea-2/medium \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -H "X-Api-Zero-Data-Retention: 1" \
  -d '{
    "prompt": "a serene mountain landscape at sunset",
    "aspect_ratio": "1:1",
    "resolution": "1K"
  }'
```

<Note>
  所提供的任何 URL（例如风格参考图像）都必须是 base64 编码的 data URI。使用外部 URL 将会返回 `422` — `Zero data retention requires external asset inputs to be data URIs.`
</Note>

```bash theme={null}
STYLE_REF_DATA_URI="data:image/png;base64,$(base64 < ./style-reference.png | tr -d '\n')"

curl -X POST https://api.krea.ai/generate/image/krea/krea-2/medium \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -H "X-Api-Zero-Data-Retention: 1" \
  -d '{
    "prompt": "a serene mountain landscape at sunset",
    "aspect_ratio": "1:1",
    "resolution": "1K",
    "image_style_references": [
      {
        "url": "'"$STYLE_REF_DATA_URI"'",
        "strength": 0.6
      }
    ]
  }'
```
