> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/reference/ko/platform/rest-api/async-tasks.md).

# 비동기 작업

일부 REST API 엔드포인트는 장시간 실행되는 작업을 시작하고, 작업이 끝날 때까지 기다리는 대신 비동기 작업을 반환합니다. 이러한 엔드포인트는 다음을 반환합니다 `taskId` 와 폴링 `url`:

```json
{
    "taskId": "abc123",
    "url": "https://api.roboflow.com/my-workspace/asynctasks/abc123"
}
```

폴링 URL을 사용하여 작업이 아직 실행 중인지, 완료되었는지, 실패했는지 확인하세요.

## 작업 상태 가져오기

다음을 전송하세요 `GET` 요청을 `/:workspace/asynctasks/:id`. 다음으로 바꾸세요 `:workspace` 작업을 소유한 Workspace로 바꾸고 `:id` 반환된 `taskId`.

```bash
$ curl --location "https://api.roboflow.com/my-workspace/asynctasks/abc123?api_key=$ROBOFLOW_API_KEY"
```

API 키는 요청 경로에서 사용된 동일한 Workspace에 접근할 수 있어야 합니다. 다른 Workspace의 작업은 `404`.

## 응답 필드

```
- taskId (string) - 비동기 작업 ID입니다.
- status (string) - 현재 작업 상태입니다. 일반적인 상태로는 created, running, completed, failed가 있습니다. 종료 상태는 completed와 failed입니다.
- progress (object or null) - 사용 가능한 경우의 작업 진행률이며, 형식은 `{ "current": <number>, "total": <number> }`입니다.
- result (object) - 작업이 성공적으로 완료되면 표시됩니다.
- error (string) - 작업이 실패하면 표시됩니다.
```

## 실행 중인 작업

```json
{
    "taskId": "abc123",
    "status": "running",
    "progress": {
        "current": 42,
        "total": 100
    }
}
```

## 완료된 작업

해당 `result` 객체는 작업을 생성한 엔드포인트에 따라 달라집니다. 예를 들어, 완료된 Universe Project fork는 포크된 Project 세부 정보를 반환합니다:

```json
{
    "taskId": "abc123",
    "status": "completed",
    "progress": {
        "current": 100,
        "total": 100
    },
    "result": {
        "forked": true,
        "datasetUrl": "football-players-detection-3zvbc-a1b2c",
        "id": "my-workspace/football-players-detection-3zvbc-a1b2c",
        "name": "Football Players Detection",
        "url": "https://app.roboflow.com/my-workspace/football-players-detection-3zvbc-a1b2c"
    }
}
```

## 실패한 작업

```json
{
    "taskId": "abc123",
    "status": "failed",
    "progress": {
        "current": 64,
        "total": 100
    },
    "error": "Task failed"
}
```

## 오류

```
- 404 - 비동기 작업이 존재하지 않거나 다른 Workspace에 속합니다.
```
