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

# HappyHorse Tasks API의 연동 및 사용

> HappyHorse Video API guide - Ace Data Cloud

HappyHorse Tasks API는 HappyHorse Videos API에서 생성된 비디오 생성 또는 편집 작업을 조회하는 데 사용됩니다.

## 신청 절차

HappyHorse Videos API를 사용하려면 먼저 [Ace Data Cloud 콘솔](https://platform.acedata.cloud/console/applications)에서 API Token을 받아야 하며, 이를 보관해 두십시오.

![](https://cdn.acedata.cloud/dvc3cg.jpg)

로그인 또는 등록이 되어 있지 않은 경우, 자동으로 로그인 페이지로 리디렉션되어 등록 및 로그인을 요청합니다. 완료 후 현재 페이지로 자동으로 돌아옵니다.

**하나의 API Token으로 플랫폼의 모든 서비스를 호출할 수 있으며, 각 서비스마다 별도로 신청할 필요가 없습니다.** 최초 신청 시 무료 할당량이 제공되어 무료로 체험할 수 있으며, 할당량이 부족할 경우 [콘솔](https://platform.acedata.cloud/console/coin)에서 일반 잔액을 충전할 수 있습니다.

> 📘 전체 문서: [HappyHorse Videos API →](https://platform.acedata.cloud/documents/happyhorse-videos)

## 요청 예시

HappyHorse Tasks API는 HappyHorse Videos API의 결과를 조회하는 데 사용할 수 있습니다.

### 요청 헤더 및 요청 본문 설정

**Request Headers**에는 다음이 포함됩니다:

* `accept`：JSON 형식의 응답 결과를 수신하도록 지정하며, 여기에는 `application/json`을 입력합니다.
* `authorization`：API 호출에 필요한 키로, 신청 후 직접 드롭다운에서 선택할 수 있습니다.

**Request Body**에는 다음이 포함됩니다:

* `id`：조회할 작업 ID입니다.
* `action`：작업의 조작 방식으로, 단일 조회 시 `retrieve`를 입력합니다.

### CURL 코드 예시

```bash theme={null}
curl -X POST 'https://api.acedata.cloud/happyhorse/tasks' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "id": "b8976e18-32dc-4718-9ed8-1ea090fcb6ea",
  "action": "retrieve"
}'
```

### 응답 예시

요청이 성공하면 API는 해당 작업의 세부 정보를 반환합니다. 여기서 `request` 필드는 작업 생성 시의 요청 본문이며, `response` 필드는 작업 완료 후 반환된 응답 본문입니다. 예를 들어:

```json theme={null}
{
  "id": "b8976e18-32dc-4718-9ed8-1ea090fcb6ea",
  "started_at": 1769262721.823,
  "finished_at": 1769262774.423,
  "elapsed": 52.6,
  "request": {
    "action": "generate",
    "model": "happyhorse-1.1-t2v",
    "prompt": "A cinematic shot of a white horse running across a moonlit beach",
    "resolution": "720P",
    "duration": 5
  },
  "type": "videos",
  "response": {
    "success": true,
    "task_id": "b8976e18-32dc-4718-9ed8-1ea090fcb6ea",
    "trace_id": "fb751e1e-4705-49ea-9fd4-5024b7865ea2",
    "data": [
      {
        "id": "1469cfc3-3004-4d9e-ab10-xxxxxx",
        "video_url": "https://cdn.acedata.cloud/happyhorse/c8cbf53aa0.mp4",
        "state": "succeeded",
        "duration": 5,
        "resolution": "720P",
        "ratio": "16:9"
      }
    ]
  }
}
```

필드 설명은 다음과 같습니다:

* `id`：생성 작업의 ID로, 이번 생성 작업을 고유하게 식별하는 데 사용됩니다.
* `request`：작업 생성 시의 요청 정보입니다.
* `response`：작업의 현재 또는 최종 반환 정보입니다.
* `created_at`：작업 생성 시간, Unix 타임스탬프(초, 부동 소수점).
* `started_at`：작업 시작 실행 시간, Unix 타임스탬프(초, 부동 소수점).
* `finished_at`：작업 완료 시간, Unix 타임스탬프(초, 부동 소수점). 작업이 완료되지 않은 경우 이 필드는 반환되지 않습니다.
* `elapsed`：작업 실행 소요 시간, 단위는 초(부동 소수점, 소수점 3자리). 작업이 완료되지 않은 경우 이 필드는 반환되지 않습니다.

## 배치 조회 작업

여러 작업 ID에 대한 작업 세부 정보를 조회할 때는 `action`을 `retrieve_batch`로 설정하고 `ids`를 통해 작업 ID 배열을 전달합니다:

```bash theme={null}
curl -X POST 'https://api.acedata.cloud/happyhorse/tasks' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "ids": ["b8976e18-32dc-4718-9ed8-1ea090fcb6ea"],
  "action": "retrieve_batch"
}'
```

반환 결과에는 `items`와 `count` 필드가 포함되며, `items`는 작업 세부 정보 배열이고, `count`는 이번에 일치한 작업 수입니다.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.