> ## 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.

# Build 생성

> 현재 드래프트를 디버그 실행·게시에 쓰는 불변 스냅샷으로 고정.

**`POST`** `https://api-datahub.octoparse.com/v1/data-apps/{app_id}/builds`

인증: API 키 필요(`Authorization: Bearer <API Key>`). App 작성자만. 그 외 `404`.

현재 워크스페이스를 불변 스냅샷으로 고정 — 디버그 실행과 게시가 참조하는 객체.

전제: 워크스페이스 존재·내용 유효(아니면 `422`+`issues`). body에 `expected_revision` 가능(저장\~고정 사이 드래프트 변경 시 `409`). 같은 `content_hash` ready 스냅샷이 있으면 재사용·중복 행 없음. api 형은 즉시 ready, code 형은 `202`로 이미지 Build 큐 — 같은 App 진행 중 재제출은 `409`. 비권장 App도 Build 가능. 거부되는 것은 신규 Release뿐.

## 요청

### 경로 파라미터

<ParamField path="app_id" type="string" required>
  App 참조.
</ParamField>

### 요청 body

<ParamField body="expected_revision" type="integer">
  기대하는 현재 드래프트 리비전. 불일치는 `409`.
</ParamField>

### 요청 예시

```bash theme={null}
curl -X POST \
  -H "Authorization: Bearer $OCTOPARSE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"expected_revision": 3}' \
  "https://api-datahub.octoparse.com/v1/data-apps/carol/reviews-query/builds"
```

## 응답

### 200 성공

```json theme={null}
{
  "data": {
    "build_id": "string",
    "build_status": "string",
    "content_hash": "string",
    "source_revision": 0,
    "reused": false,
    "created_at": "string"
  }
}
```

페이로드는 `data`로 감쌉니다. 필드:

<ResponseField name="build_id" type="string" required>
  Build ID.
</ResponseField>

<ResponseField name="build_status" type="string" required>
  `ready`, `building`(code 유형) 또는 `failed`.
</ResponseField>

<ResponseField name="content_hash" type="string" required>
  콘텐츠 해시.
</ResponseField>

<ResponseField name="source_revision" type="integer" required>
  고정 시점 드래프트 리비전.
</ResponseField>

<ResponseField name="reused" type="boolean">
  동일 내용 기존 스냅샷 재사용 여부.
</ResponseField>

<ResponseField name="created_at" type="string">
  생성 시각.
</ResponseField>

### 오류

| HTTP | `code`                | `category`      | 설명                                             |
| ---- | --------------------- | --------------- | ---------------------------------------------- |
| 401  | `unauthorized`        | `forbidden`     | API 키 누락 또는 무효.                                |
| 404  | `workspace-not-found` | `not_found`     | 진행 중 드래프트 없음. 정상 주경로 상태이며 오류가 아님.              |
| 422  | `build-failed`        | `invalid_input` | 워크스페이스 내용 검증 실패. `issues[]`에 문제 목록.            |
| 409  | `revision-conflict`   | `invalid_input` | `expected_revision`이 현재 드래프트 리비전과 불일치 — 동시 편집. |

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

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

Python / JavaScript SDK는 아직 이 엔드포인트를 감싸지 않습니다. REST를 직접 호출하세요.
