# Tasks

Task and annotation management

## Get Project Tasks

> Retrieves all tasks for a specific project with optional filtering

```json
{"openapi":"3.0.3","info":{"title":"Ango Hub API v2","version":"2.0.0"},"tags":[{"name":"Tasks","description":"Task and annotation management"}],"servers":[{"url":"https://imeritapi.ango.ai/v2","description":"EU Production Server"},{"url":"https://us-api.ango.ai/v2","description":"US Production Server"},{"url":"https://in-api.ango.ai/v2","description":"India Production Server"},{"url":"https://testapi.ango.ai/v2","description":"Test Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"apikey","description":"API key for authentication. Format - apikey YOUR_API_KEY"}},"parameters":{"ProjectIdParam":{"name":"projectId","in":"path","required":true,"schema":{"type":"string"},"description":"Project ID"},"PageParam":{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1},"description":"Page number (1-indexed)"},"LimitParam":{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"description":"Items per page (max 100)"}},"schemas":{"TaskListResponse":{"type":"object","properties":{"status":{"type":"string"},"data":{"type":"object","properties":{"tasks":{"type":"array","items":{"$ref":"#/components/schemas/LabelTask"}},"total":{"type":"integer"}}}}},"LabelTask":{"type":"object","properties":{"_id":{"type":"string"},"project":{"type":"string"},"asset":{"type":"string"},"stage":{"type":"string"},"status":{"type":"string"},"assignee":{"type":"string"},"externalId":{"type":"string"},"batches":{"type":"array","items":{"type":"string"}},"priority":{"type":"number"},"answer":{"type":"object"},"createdAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time"},"duration":{"type":"number","description":"Duration in seconds"}}}}},"paths":{"/project/{projectId}/tasks":{"get":{"tags":["Tasks"],"summary":"Get Project Tasks","description":"Retrieves all tasks for a specific project with optional filtering","operationId":"getProjectTasks","parameters":[{"$ref":"#/components/parameters/ProjectIdParam"},{"$ref":"#/components/parameters/PageParam"},{"$ref":"#/components/parameters/LimitParam"},{"name":"filters","in":"query","schema":{"type":"string"},"description":"JSON stringified filter object"},{"name":"status","in":"query","schema":{"type":"string"},"description":"Filter by task status"},{"name":"stage","in":"query","schema":{"type":"string"},"description":"Filter by stage ID"},{"name":"assignee","in":"query","schema":{"type":"string"},"description":"Filter by assignee email"},{"name":"batches","in":"query","schema":{"type":"string"},"description":"Filter by batch names (comma-separated)"}],"responses":{"200":{"description":"Tasks retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskListResponse"}}}}}}}}}
```

## Requeue Tasks

> Move tasks from one stage to another based on filter criteria

```json
{"openapi":"3.0.3","info":{"title":"Ango Hub API v2","version":"2.0.0"},"tags":[{"name":"Tasks","description":"Task and annotation management"}],"servers":[{"url":"https://imeritapi.ango.ai/v2","description":"EU Production Server"},{"url":"https://us-api.ango.ai/v2","description":"US Production Server"},{"url":"https://in-api.ango.ai/v2","description":"India Production Server"},{"url":"https://testapi.ango.ai/v2","description":"Test Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"apikey","description":"API key for authentication. Format - apikey YOUR_API_KEY"}},"parameters":{"ProjectIdParam":{"name":"projectId","in":"path","required":true,"schema":{"type":"string"},"description":"Project ID"}},"schemas":{"RequeueTasksRequest":{"type":"object","required":["toStageId","filters"],"properties":{"toStageId":{"type":"string","description":"Destination stage ID"},"filters":{"$ref":"#/components/schemas/TaskFilters"},"options":{"type":"object","description":"Options for task requeue operation","properties":{"removeAnnotations":{"type":"boolean","description":"Remove existing annotations when requeuing","default":false},"removeAssignee":{"type":"boolean","description":"Remove task assignee when requeuing","default":false},"removeStageHistory":{"type":"boolean","description":"Remove stage history when requeuing","default":false}}}}},"TaskFilters":{"type":"object","description":"Filter criteria for task operations","properties":{"taskIds":{"type":"array","items":{"type":"string"},"description":"Array of task IDs"},"externalIds":{"type":"array","items":{"type":"string"},"description":"Array of external IDs"},"assetIds":{"type":"array","items":{"type":"string"},"description":"Array of asset IDs"},"fromStageIds":{"type":"array","items":{"type":"string"},"description":"Array of source stage IDs"},"batches":{"type":"array","items":{"type":"string"},"description":"Array of batch IDs"}}},"RequeueResponse":{"type":"object","properties":{"status":{"type":"string"},"data":{"type":"object","properties":{"modifiedCount":{"type":"object","properties":{"modified":{"type":"integer"},"toStageId":{"type":"string"}}}}}}},"ErrorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["fail","error"]},"message":{"type":"string"}}}},"responses":{"BadRequestError":{"description":"Bad request - validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/project/{projectId}/requeueTasks":{"post":{"tags":["Tasks"],"summary":"Requeue Tasks","description":"Move tasks from one stage to another based on filter criteria","operationId":"requeueTasks","parameters":[{"$ref":"#/components/parameters/ProjectIdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequeueTasksRequest"}}}},"responses":{"200":{"description":"Tasks requeued successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequeueResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"}}}}}}
```

## Update Task Priority

> Update priority for multiple tasks based on filter criteria

```json
{"openapi":"3.0.3","info":{"title":"Ango Hub API v2","version":"2.0.0"},"tags":[{"name":"Tasks","description":"Task and annotation management"}],"servers":[{"url":"https://imeritapi.ango.ai/v2","description":"EU Production Server"},{"url":"https://us-api.ango.ai/v2","description":"US Production Server"},{"url":"https://in-api.ango.ai/v2","description":"India Production Server"},{"url":"https://testapi.ango.ai/v2","description":"Test Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"apikey","description":"API key for authentication. Format - apikey YOUR_API_KEY"}},"parameters":{"ProjectIdParam":{"name":"projectId","in":"path","required":true,"schema":{"type":"string"},"description":"Project ID"}},"schemas":{"UpdatePriorityRequest":{"type":"object","required":["priority","filters"],"properties":{"priority":{"type":"number","minimum":-1000,"maximum":1000,"description":"Priority value (-1000 to 1000)"},"filters":{"$ref":"#/components/schemas/TaskFilters"},"options":{"type":"object"}}},"TaskFilters":{"type":"object","description":"Filter criteria for task operations","properties":{"taskIds":{"type":"array","items":{"type":"string"},"description":"Array of task IDs"},"externalIds":{"type":"array","items":{"type":"string"},"description":"Array of external IDs"},"assetIds":{"type":"array","items":{"type":"string"},"description":"Array of asset IDs"},"fromStageIds":{"type":"array","items":{"type":"string"},"description":"Array of source stage IDs"},"batches":{"type":"array","items":{"type":"string"},"description":"Array of batch IDs"}}},"PriorityUpdateResponse":{"type":"object","properties":{"status":{"type":"string"},"data":{"type":"object","properties":{"result":{"type":"object","properties":{"modifiedCount":{"type":"integer"},"priority":{"type":"number"}}}}}}},"ErrorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["fail","error"]},"message":{"type":"string"}}}},"responses":{"BadRequestError":{"description":"Bad request - validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/project/{projectId}/updatePriority":{"post":{"tags":["Tasks"],"summary":"Update Task Priority","description":"Update priority for multiple tasks based on filter criteria","operationId":"updatePriority","parameters":[{"$ref":"#/components/parameters/ProjectIdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePriorityRequest"}}}},"responses":{"200":{"description":"Priority updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriorityUpdateResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"}}}}}}
```

## Get Task Details

> Retrieves detailed information about a specific task

```json
{"openapi":"3.0.3","info":{"title":"Ango Hub API v2","version":"2.0.0"},"tags":[{"name":"Tasks","description":"Task and annotation management"}],"servers":[{"url":"https://imeritapi.ango.ai/v2","description":"EU Production Server"},{"url":"https://us-api.ango.ai/v2","description":"US Production Server"},{"url":"https://in-api.ango.ai/v2","description":"India Production Server"},{"url":"https://testapi.ango.ai/v2","description":"Test Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"apikey","description":"API key for authentication. Format - apikey YOUR_API_KEY"}},"schemas":{"TaskResponse":{"type":"object","properties":{"status":{"type":"string"},"data":{"type":"object","properties":{"task":{"$ref":"#/components/schemas/LabelTask"}}}}},"LabelTask":{"type":"object","properties":{"_id":{"type":"string"},"project":{"type":"string"},"asset":{"type":"string"},"stage":{"type":"string"},"status":{"type":"string"},"assignee":{"type":"string"},"externalId":{"type":"string"},"batches":{"type":"array","items":{"type":"string"}},"priority":{"type":"number"},"answer":{"type":"object"},"createdAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time"},"duration":{"type":"number","description":"Duration in seconds"}}},"ErrorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["fail","error"]},"message":{"type":"string"}}}},"responses":{"NotFoundError":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/task/{taskId}":{"get":{"tags":["Tasks"],"summary":"Get Task Details","description":"Retrieves detailed information about a specific task","operationId":"getTask","parameters":[{"name":"taskId","in":"path","required":true,"schema":{"type":"string"},"description":"Task ID"}],"responses":{"200":{"description":"Task retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskResponse"}}}},"404":{"$ref":"#/components/responses/NotFoundError"}}}}}}
```

## Get Task History

> Retrieves the complete history of changes for a task

```json
{"openapi":"3.0.3","info":{"title":"Ango Hub API v2","version":"2.0.0"},"tags":[{"name":"Tasks","description":"Task and annotation management"}],"servers":[{"url":"https://imeritapi.ango.ai/v2","description":"EU Production Server"},{"url":"https://us-api.ango.ai/v2","description":"US Production Server"},{"url":"https://in-api.ango.ai/v2","description":"India Production Server"},{"url":"https://testapi.ango.ai/v2","description":"Test Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"apikey","description":"API key for authentication. Format - apikey YOUR_API_KEY"}},"parameters":{"PageParam":{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1},"description":"Page number (1-indexed)"},"LimitParam":{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"description":"Items per page (max 100)"}},"schemas":{"TaskHistoryListResponse":{"type":"object","properties":{"status":{"type":"string"},"data":{"type":"object","properties":{"taskHistory":{"type":"array","items":{"$ref":"#/components/schemas/TaskHistory"}}}}}},"TaskHistory":{"type":"object","properties":{"_id":{"type":"string"},"task":{"type":"string"},"user":{"type":"string"},"action":{"type":"string"},"answer":{"type":"object"},"createdAt":{"type":"string","format":"date-time"}}}}},"paths":{"/task/{taskId}/history":{"get":{"tags":["Tasks"],"summary":"Get Task History","description":"Retrieves the complete history of changes for a task","operationId":"getTaskHistory","parameters":[{"name":"taskId","in":"path","required":true,"schema":{"type":"string"},"description":"Task ID"},{"$ref":"#/components/parameters/PageParam"},{"$ref":"#/components/parameters/LimitParam"}],"responses":{"200":{"description":"Task history retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskHistoryListResponse"}}}}}}}}}
```

## Get Task History Entry

> Retrieves a specific task history entry by ID

```json
{"openapi":"3.0.3","info":{"title":"Ango Hub API v2","version":"2.0.0"},"tags":[{"name":"Tasks","description":"Task and annotation management"}],"servers":[{"url":"https://imeritapi.ango.ai/v2","description":"EU Production Server"},{"url":"https://us-api.ango.ai/v2","description":"US Production Server"},{"url":"https://in-api.ango.ai/v2","description":"India Production Server"},{"url":"https://testapi.ango.ai/v2","description":"Test Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"apikey","description":"API key for authentication. Format - apikey YOUR_API_KEY"}},"schemas":{"TaskHistoryResponse":{"type":"object","properties":{"status":{"type":"string"},"data":{"type":"object","properties":{"taskHistory":{"$ref":"#/components/schemas/TaskHistory"}}}}},"TaskHistory":{"type":"object","properties":{"_id":{"type":"string"},"task":{"type":"string"},"user":{"type":"string"},"action":{"type":"string"},"answer":{"type":"object"},"createdAt":{"type":"string","format":"date-time"}}}}},"paths":{"/taskHistory/{taskHistoryId}":{"get":{"tags":["Tasks"],"summary":"Get Task History Entry","description":"Retrieves a specific task history entry by ID","operationId":"getTaskHistoryEntry","parameters":[{"name":"taskHistoryId","in":"path","required":true,"schema":{"type":"string"},"description":"Task history entry ID"}],"responses":{"200":{"description":"Task history entry retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskHistoryResponse"}}}}}}}}}
```

## Assign Tasks to User

> Assigns one or more tasks to a specific user at a specific stage

```json
{"openapi":"3.0.3","info":{"title":"Ango Hub API v2","version":"2.0.0"},"tags":[{"name":"Tasks","description":"Task and annotation management"}],"servers":[{"url":"https://imeritapi.ango.ai/v2","description":"EU Production Server"},{"url":"https://us-api.ango.ai/v2","description":"US Production Server"},{"url":"https://in-api.ango.ai/v2","description":"India Production Server"},{"url":"https://testapi.ango.ai/v2","description":"Test Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"apikey","description":"API key for authentication. Format - apikey YOUR_API_KEY"}},"schemas":{"TaskAssignRequest":{"type":"object","required":["user","project","tasks","stage"],"properties":{"user":{"type":"string","description":"User email to assign to"},"project":{"type":"string","description":"Project ID"},"tasks":{"type":"array","items":{"type":"string"},"description":"Array of task IDs"},"stage":{"type":"string","description":"Stage ID"}}},"TaskAssignResponse":{"type":"object","properties":{"status":{"type":"string"},"data":{"type":"object","properties":{"task":{"type":"object","properties":{"updatedCount":{"type":"integer"},"assignedTasks":{"type":"object","properties":{"count":{"type":"integer"}}},"message":{"type":"string"}}}}}}},"ErrorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["fail","error"]},"message":{"type":"string"}}}},"responses":{"BadRequestError":{"description":"Bad request - validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/task/assign":{"post":{"tags":["Tasks"],"summary":"Assign Tasks to User","description":"Assigns one or more tasks to a specific user at a specific stage","operationId":"assignTask","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskAssignRequest"}}}},"responses":{"200":{"description":"Tasks assigned successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskAssignResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"}}}}}}
```

## Submit Review Decision

> Submits a review decision (accept/reject) for a task in a Review stage.\
> \
> This endpoint is used to submit review decisions for tasks that are currently in a Review stage\
> of the workflow. When a review decision is submitted, the task automatically advances to the\
> next stage in the workflow.\
> \
> \*\*Important\*\*: The task must be in a Review stage. Use \`/annotate/{taskId}\` for Label stages.<br>

```json
{"openapi":"3.0.3","info":{"title":"Ango Hub API v2","version":"2.0.0"},"tags":[{"name":"Tasks","description":"Task and annotation management"}],"servers":[{"url":"https://imeritapi.ango.ai/v2","description":"EU Production Server"},{"url":"https://us-api.ango.ai/v2","description":"US Production Server"},{"url":"https://in-api.ango.ai/v2","description":"India Production Server"},{"url":"https://testapi.ango.ai/v2","description":"Test Server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"apikey","description":"API key for authentication. Format - apikey YOUR_API_KEY"}},"schemas":{"ReviewRequest":{"type":"object","required":["reviewStatus"],"properties":{"reviewStatus":{"type":"string","enum":["Accepted","Rejected"],"description":"Review decision for the task.\n- `Accepted`: Approve the task and move it to the next stage\n- `Rejected`: Reject the task (typically sends it back for correction)\n"},"answer":{"type":"object","description":"Optional annotation modifications (structure depends on project categorySchema)"},"duration":{"type":"number","description":"Time spent reviewing in seconds"},"idleDuration":{"type":"number","description":"Idle time during review in seconds"},"blurDuration":{"type":"number","description":"Time window was blurred/unfocused in seconds"}}},"LabelResponse":{"type":"object","properties":{"status":{"type":"string"},"data":{"type":"object","properties":{"label":{"$ref":"#/components/schemas/LabelTask"}}}}},"LabelTask":{"type":"object","properties":{"_id":{"type":"string"},"project":{"type":"string"},"asset":{"type":"string"},"stage":{"type":"string"},"status":{"type":"string"},"assignee":{"type":"string"},"externalId":{"type":"string"},"batches":{"type":"array","items":{"type":"string"}},"priority":{"type":"number"},"answer":{"type":"object"},"createdAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time"},"duration":{"type":"number","description":"Duration in seconds"}}},"ErrorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["fail","error"]},"message":{"type":"string"}}}}},"paths":{"/review/{taskId}":{"post":{"tags":["Tasks"],"summary":"Submit Review Decision","description":"Submits a review decision (accept/reject) for a task in a Review stage.\n\nThis endpoint is used to submit review decisions for tasks that are currently in a Review stage\nof the workflow. When a review decision is submitted, the task automatically advances to the\nnext stage in the workflow.\n\n**Important**: The task must be in a Review stage. Use `/annotate/{taskId}` for Label stages.\n","operationId":"reviewTask","parameters":[{"name":"taskId","in":"path","required":true,"schema":{"type":"string"},"description":"Task ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewRequest"}}}},"responses":{"200":{"description":"Review submitted successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LabelResponse"}}}},"400":{"description":"Bad request - task not in Review stage or invalid reviewStatus","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Task or stage not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```
