> 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/hi/apis/annotations-and-workflow-api.md).

# एनोटेशन और वर्कफ़्लो API

Unitlab HTTP API से वर्कफ़्लो स्टेज और टास्क पढ़ें, टास्क एक्शन चलाएँ, एनोटेशन पढ़ें और सहेजें, लेबल फ़ाइलें इम्पोर्ट करें और बेंचमार्क मार्क करें।

सभी रूट `https://api.unitlab.ai/api/sdk/` के अंतर्गत हैं।

## स्टेज और टास्क <a href="#stages-and-tasks" id="stages-and-tasks"></a>

| Method और रूट                                      | बॉडी                                                             | अनुमति                                 |
| -------------------------------------------------- | ---------------------------------------------------------------- | -------------------------------------- |
| `GET projects/{id}/workflow/stages/`               |                                                                  | Assign project members या Manage data  |
| `GET projects/{id}/workflow/stages/{stage}/tasks/` | Query: `include_unavailable=1`, `limit`, `offset`                | वही                                    |
| `GET workflow-tasks/{task}/`                       |                                                                  | View labeling interface                |
| `POST workflow-tasks/{task}/claim/`                |                                                                  | View labeling interface, Create labels |
| `POST workflow-tasks/{task}/assign/`               | `{"user_id"}`                                                    | Assign project members या Manage data  |
| `POST workflow-tasks/{task}/release/`              |                                                                  | वही                                    |
| `POST workflow-tasks/{task}/priority/`             | `{"priority": 5}`                                                | वही                                    |
| `POST workflow-tasks/{task}/move/`                 | `{"stage_id", "reason", "expected_stage_id", "idempotency_key"}` | वही                                    |
| `POST workflow-tasks/{task}/actions/`              | नीचे देखें                                                       | Create labels, Manage data             |
| `GET workflow-tasks/{task}/timeline/`              |                                                                  | View labeling interface, Manage data   |
| `POST projects/{id}/workflow/tasks/assign/`        | `{"task_ids", "user_id"}`, अधिकतम 500                            | Assign project members या Manage data  |
| `POST projects/{id}/workflow/tasks/move/`          | `{"task_ids", "stage_id", "reason", "dry_run"}`, अधिकतम 500      | वही                                    |

`{stage}` स्टेज सूची से मिली स्टेज ID है, जैसे `annotate`।

### टास्क एक्शन <a href="#task-actions" id="task-actions"></a>

```bash
curl -s -X POST "https://api.unitlab.ai/api/sdk/workflow-tasks/$TASK_ID/actions/" \
  -H "Authorization: Api-Key $UNITLAB_API_KEY" -H "Content-Type: application/json" \
  -d '{"action": "reject", "rejection_reason": "Box misses the gripper", "comment": "Frames 40 to 55",
       "expected_stage_id": "review", "idempotency_key": "7b0c6f1e-2f4e-4a51-9e0b-1f3d2c9a8e77"}'
```

| `action`   | असर                          |
| ---------- | ---------------------------- |
| `complete` | आगे वाले edge से submit करें |
| `approve`  | Review टास्क approve करें    |
| `reject`   | rejection edge से वापस भेजें |
| `skip`     | skip edge से भेजें           |

अगर आपके पढ़ने के बाद टास्क आगे बढ़ चुका है, तो `expected_stage_id` एक्शन को ठुकरा देता है। दोहराया गया `idempotency_key` दो बार नहीं चलता। हर इच्छित एक्शन के लिए नया UUID इस्तेमाल करें, और उसे सिर्फ़ उसी एक्शन को दोबारा आज़माने के लिए दोबारा इस्तेमाल करें।

## टास्क एनोटेशन <a href="#task-annotations" id="task-annotations"></a>

| Method और रूट                                                | बॉडी                                                                                                                                             |
| ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `GET workflow-tasks/{task}/annotations/?only_keyframes=true` | `document` (UUEF) वाली पंक्तियाँ, या बड़े डॉक्यूमेंट के लिए `document_url`                                                                       |
| `PUT workflow-tasks/{task}/annotations/`                     | `{"datasource_id", "format": "uuef" \| "geojson" \| "model", "document"}`                                                                        |
| `POST workflow-tasks/{task}/annotations/uploads/`            | 64 MiB से बड़े डॉक्यूमेंट के लिए `{"datasource_id", "format", "size"}`; JSON को `upload_url` पर PUT करें, फिर `document_upload_id` के साथ सहेजें |
| `POST workflow-tasks/{task}/agent-result/`                   | `{"run_id", "status": "complete"}` या `{"run_id", "status": "failed", "error"}`                                                                  |
| `POST workflow-tasks/{task}/model-result/`                   | `{"run_id", "status", "result" or "results", "model_version"}`                                                                                   |

सहेजने पर पूरा आइटम बदल जाता है, और यह सिर्फ़ तब चलता है जब टास्क Agent स्टेज में हो। नियम और lidar वेरिएंट: [टास्क एनोटेशन और Agent webhooks](https://docs.unitlab.ai/api-sdk-cli/hi/sdks/task-annotations-and-agent-webhooks.md)। डॉक्यूमेंट की बनावट: [एनोटेशन JSON संदर्भ](https://docs.unitlab.ai/api-sdk-cli/hi/apis/annotation-json-reference.md)।

## एनोटेशन इम्पोर्ट <a href="#annotation-imports" id="annotation-imports"></a>

| Method और रूट                                            | काम                                               |
| -------------------------------------------------------- | ------------------------------------------------- |
| `POST projects/{id}/annotation-imports/`                 | लेबल फ़ाइल अपलोड करें और preview पाएँ             |
| `POST projects/{id}/annotation-imports/{batch}/preview/` | नए विकल्पों के साथ फिर से preview                 |
| `POST projects/{id}/annotation-imports/{batch}/commit/`  | सहेजें: `{"token", "decisions", "allow_partial"}` |
| `GET projects/{id}/annotation-imports/sources/`          | सहेजे गए लेबल सोर्स                               |
| `GET projects/{id}/annotation-imports/media/?search=`    | mapping के लिए मीडिया उम्मीदवार                   |

```bash
curl -s -X POST "https://api.unitlab.ai/api/sdk/projects/$PROJECT_ID/annotation-imports/" \
  -H "Authorization: Api-Key $UNITLAB_API_KEY" \
  -F "annotation_file=@detector-v3.json;type=application/json" \
  --form-string "source_name=detector-v3" \
  --form-string "track_profile=none" \
  --form-string 'options={}'
```

जवाब preview है, जिसमें `batch_id`, `counts`, `issues`, `annotations` और एक `token` होता है। उसी token से commit करें। commit दोहराने पर लेबल डुप्लिकेट किए बिना सहेजी गई रिपोर्ट लौटती है। इसके लिए **Manage data** और **Create labels** चाहिए, और किसी वर्कस्पेस सदस्य की बनाई कुंजी। फ़ॉर्मैट और विकल्प: [एनोटेशन इम्पोर्ट](https://docs.unitlab.ai/api-sdk-cli/hi/sdks/annotation-imports.md)।

## बेंचमार्क <a href="#benchmarks" id="benchmarks"></a>

```bash
curl -s -X POST "https://api.unitlab.ai/api/sdk/projects/$PROJECT_ID/benchmarks/" \
  -H "Authorization: Api-Key $UNITLAB_API_KEY" -H "Content-Type: application/json" \
  -d '{"datasource_ids": ["DATASOURCE_ID"], "when_ready": true}'
```

एक अनुरोध में अधिकतम 100 ID भेजें। जवाब में `created`, `existing`, `deferred` और `skipped_by_reason` की गिनती होती है। देखें [बेंचमार्क](https://docs.unitlab.ai/api-sdk-cli/hi/sdks/benchmarks.md)।

## संबंधित <a href="#related" id="related"></a>

[SDK: वर्कफ़्लो स्टेज और टास्क](https://docs.unitlab.ai/api-sdk-cli/hi/sdks/workflow-stages-and-tasks.md) · [एरर, रेट लिमिट और pagination](https://docs.unitlab.ai/api-sdk-cli/hi/apis/errors-rate-limits-and-pagination.md)
