Skip to main content

Discard Task

Mark a task as discarded, removing it from the processing pipeline without completing it. This action can only be performed on tasks that are currently in the REVIEWING state.

Endpoint

POST /v2/{team_id}/project/{project_id}/task/{task_id}/discard

Authentication

This endpoint requires an API key with the task.edit scope.

Request Parameters

ParameterTypeRequiredDescription
team_idStringYesThe ID of the team
project_idStringYesThe ID of the project
task_idStringYesThe ID of the task to discard

Example Request

curl -X POST \
'https://api.send.ai/v2/team_123456/project/proj_123456/task/task_abcdef123456/discard' \
-H 'Authorization: Bearer YOUR_API_KEY'

Response

Returns the updated task (full public task object):

{
"payload": {
"id": "task_abcdef123456",
"name": "Document Analysis Task",
"created_at": "2024-01-15T10:30:00Z",
"meta": [{ "name": "category", "value": "invoice" }],
"status": "DISCARDED",
"step_type": "EXTRACT",
"upload_id": "upl_123456789",
"project_id": "proj_123456",
"approved": false,
"exported_at": null,
"export_failed_at": null,
"last_opened_at": "2024-01-15T12:30:00Z",
"pages": [
{
"id": "page_1",
"width": 2480,
"height": 3508,
"annotations": [
{
"id": "ann_1",
"entity_id": "total_amount",
"confidence": 0.98,
"content": "$1,234.56",
"top": 120.5,
"left_of_line": 340.0
}
],
"checkboxes": [
{
"id": "cb_1",
"confidence": 0.92,
"checked": true,
"coordinates": [
[100, 100],
[120, 100],
[120, 120],
[100, 120]
]
}
],
"segments": [
{
"id": "seg_1",
"confidence": 0.87,
"coordinates": [
[50, 50],
[400, 50],
[400, 200],
[50, 200]
]
}
],
"signatures": [
{
"id": "sig_1",
"confidence": 0.83,
"coordinates": [
[800, 600],
[1100, 600],
[1100, 750],
[800, 750]
]
}
]
}
]
}
}

Important Notes

  • Only tasks in REVIEWING state can be discarded - Tasks in other states (PROCESSING, COMPLETED, FAILED, DISCARDED, FILTERED) will be ignored
  • Tasks must be actively available for review to be discarded
  • Discarding a task removes it from the processing pipeline permanently
  • The task status will change to DISCARDED
  • Discarded tasks will not proceed to subsequent pipeline steps
  • This action cannot be undone once performed

Use Cases

  • Remove tasks with poor quality documents
  • Skip tasks that are not relevant to the project
  • Handle tasks that cannot be processed due to data issues
  • Clean up test or duplicate tasks

Error Responses

  • 400 Bad Request - Task cannot be discarded (e.g., not in REVIEWING state, already processed)
  • 404 Not Found - Task not found or API key doesn't have access
  • 401 Unauthorized - Invalid or missing API key