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

# 보존 플래그 설정

> 장기 보존 플래그 설정/해제.

**`PUT`** `https://api-datahub.octoparse.com/v1/datasets/{dataset_id}/retention`

인증: API 키 필요(`Authorization: Bearer <API Key>`).

실행 결과는 생성 후 기본 90일 보관. 보존 플래그 데이터셋은 만료 정리 제외. 플래그는 명시적 사용자 선언. 읽기로 연장되지 않으며 설정/해제는 멱등.

본인 데이터셋만 표시 가능. 타인·공개 시드·없는 id는 `404`. 시드는 본인 출력이 아니고 정리 대상도 아니라 표시 무의미. 표시 게이트가 가시성보다 좁음.

## 요청

### 경로 파라미터

<ParamField path="dataset_id" type="string" required>
  데이터셋 id.
</ParamField>

### 요청 body

<ParamField body="retained" type="boolean" required>
  보존 `true`, 해제 `false`.
</ParamField>

### 요청 예시

```bash theme={null}
curl -X PUT   -H "Authorization: Bearer $OCTOPARSE_API_KEY"   -H "Content-Type: application/json"   -d '{"retained": true}'   "https://api-datahub.octoparse.com/v1/datasets/ds_0bd5345d13d0/retention"
```

## 응답

### 200 성공

```json theme={null}
{
  "data": {
    "dataset_id": "ds_0bd5345d13d0",
    "retained": true
  }
}
```

### 오류

| HTTP | `code`              | `category`  | 설명                            |
| ---- | ------------------- | ----------- | ----------------------------- |
| 401  | `unauthorized`      | `forbidden` | API 키 누락 또는 무효.               |
| 404  | `dataset-not-found` | `not_found` | 데이터셋 없음·본인 것 아님·공개 시드(표시 불가). |

오류 응답은 `{"error": {code, category, message, retryable}}`입니다. <a href="/docs/ko/datahub/api/reference/introduction#errors">오류</a> 참고.

## 클라이언트 라이브러리

<CodeGroup>
  ```python Python theme={null}
  client.set_dataset_retention("ds_0bd5345d13d0", retained=True)
  ```

  ```js JavaScript theme={null}
  await client.setDatasetRetention("ds_0bd5345d13d0", true);
  ```
</CodeGroup>
