> 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/hi/platform/rest-api/async-tasks.md).

# Async Tasks

लंबे समय तक चलने वाले REST API operations को poll कैसे करें जो task ID लौटाते हैं, और running, completed, या failed statuses पढ़ें।

कुछ 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 key के पास अनुरोध पथ में उपयोग किए गए उसी Workspace तक पहुंच होनी चाहिए। अन्य Workspaces के टास्क लौटाते हैं `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` object उस endpoint पर निर्भर करता है जिसने टास्क बनाया है। उदाहरण के लिए, एक पूर्ण Universe Project fork निम्न 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 से संबंधित है।
```
