> For the complete documentation index, see [llms.txt](https://docs.unitlab.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unitlab.ai/api-sdk-cli/ko/apis/releases-api.md).

# 릴리스 API

Unitlab Releases API로 HTTP 요청을 보내 COCO, YOLO, UUEF 등 형식의 릴리스를 만들고, 준비 상황을 추적하고, 분할과 원본 파일을 다운로드하는 방법입니다.

모든 라우트에는 **Manage releases** 권한이 필요합니다.

| 메서드와 라우트                                | 하는 일                 |
| --------------------------------------- | -------------------- |
| `POST /api/sdk/projects/{id}/releases/` | 릴리스 시작               |
| `GET /api/sdk/releases/`                | 준비된 릴리스 목록(단순 배열)    |
| `GET /api/sdk/releases/{id}/`           | 릴리스 하나 조회(준비 중에도 가능) |
| `GET /api/sdk/releases/{id}/status/`    | 준비 진행 상황             |
| `POST /api/sdk/releases/{id}/`          | 다운로드 링크 받기           |

## 생성 <a href="#create" id="create"></a>

```bash
curl -s -X POST "https://api.unitlab.ai/api/sdk/projects/$PROJECT_ID/releases/" \
  -H "Authorization: Api-Key $UNITLAB_API_KEY" -H "Content-Type: application/json" \
  -d '{"export_type": "COCO", "split_ratios": {"train": 80, "test": 20}, "completed_only": true}'
```

| 필드                        | 용도                                                                             |
| ------------------------- | ------------------------------------------------------------------------------ |
| `export_type`             | `COCO`, `YOLOv8`, `YOLOv5`, `Audio JSON`, `RTTM`, `JSONL`, `GeoJSON` 또는 `UUEF` |
| `split_ratios`            | `train`, `validation`, `test`의 비율(%). 기본값 `{"train": 100}`                     |
| `completed_only`          | Complete 단계에 있는 항목만 포함                                                         |
| `upload_sessions`         | 지정한 Batch Queue ID만 포함                                                         |
| `generic_types`           | `["img", "video"]`처럼 지정한 유형만 포함                                                |
| `bundle_formats`          | 혼합 프로젝트에서 유형별 형식: `{"img": "COCO", "audio": "Audio JSON"}`                     |
| `include_download_tokens` | 항목마다 영구 다운로드 링크 추가                                                             |
| `license`                 | 데이터셋 라이선스 ID. 활성 구독이 없으면 필수                                                    |

응답은 `status`가 `pending`인 릴리스입니다. 릴리스가 준비되는 동안 같은 프로젝트의 두 번째 릴리스를 요청하면 코드 `release_in_progress`와 함께 409로 응답합니다.

## 준비 상황 추적 <a href="#follow-preparation" id="follow-preparation"></a>

```bash
curl -s "https://api.unitlab.ai/api/sdk/releases/$RELEASE_ID/status/" -H "Authorization: Api-Key $UNITLAB_API_KEY"
```

```json
{"status": "completed", "total": 100, "completed": 100, "processing": 0, "failed": 0, "release_status": "ready", "status_error": ""}
```

`release_status`는 `pending`에서 `exporting`을 거쳐 `ready` 또는 `failed`로 바뀝니다. `completed`는 진행률(%)입니다.

## 다운로드 <a href="#download" id="download"></a>

```bash
URL=$(curl -s -X POST "https://api.unitlab.ai/api/sdk/releases/$RELEASE_ID/" \
  -H "Authorization: Api-Key $UNITLAB_API_KEY" -H "Content-Type: application/json" \
  -d '{"download_type": "annotation", "split_type": "train"}' | jq -r .file)
curl -s -o train.json "$URL"
```

| 본문                                                       | 응답                                                                      |
| -------------------------------------------------------- | ----------------------------------------------------------------------- |
| `{"download_type": "annotation", "split_type": "train"}` | 분할 하나에 대한 `{"file": "<signed link>"}`. 전체 릴리스는 `split_type`을 생략합니다.     |
| `{"download_type": "files"}`                             | `{"file_name", "source"}` 미디어 링크 목록. 텍스트 항목은 `{"file_name", "content"}` |

서명된 링크는 `Authorization` 헤더 없이 가져옵니다. 릴리스가 준비되기 전에 다운로드하면 코드 `release_not_ready`와 함께 409로, 비어 있는 분할은 400으로 응답합니다.

## 릴리스 필드 <a href="#release-fields" id="release-fields"></a>

`pk`, `name`, `version`, `generic_type`, `number_of_data`, `is_public`, `status`, `progress`, `status_error`, `completed_only`.

## 관련 문서 <a href="#related" id="related"></a>

[SDK: 릴리스 생성과 다운로드](https://docs.unitlab.ai/api-sdk-cli/ko/sdks/create-and-download-releases.md) · [내보내기 형식](https://docs.unitlab.ai/documentation/ko/releases/export-formats-and-source-inclusion)
