> For the complete documentation index, see [llms.txt](https://docs.ggwp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ggwp.com/chinese-simplified/api-wen-dang-yin-si/yong-hu-shu-ju-bao-liu.md).

# 用户数据保留

\[ 基础 URL: `api.ggwp.com`]

`PUT` /privacy/v1/data-retention

## **描述**

用于在 GGWP 平台中定义用户数据保留策略的 API 端点。所有用户的默认保留期限为 6 个月。

## **参数**

`请求体`：包含以下字段的字典：

* **user\_id**：将更新其保留策略的用户的唯一标识符。
* **retention\_period**：对应于 *user\_id* 的数据应保留的天数。

示例调用：

```bash
curl --request PUT 'https://api.ggwp.com/privacy/v1/data-retention' \
--header 'x-api-key: api_key' \
--header 'Content-Type: application/json' \
--data-raw '{
  "user_id": "<id1>",
  "retention_period": 90	
}'
```

## **输出**

* 200 - 操作成功

  ```json
  {
    "status": "成功"
  }
  ```
* 400
  * 无效输入（例如：缺少 *user\_id* 或 *retention\_period*，或类型不正确）
* 403
  * 无效或缺失的 API 密钥
* 500
  * 错误响应
