Mjara Docs
API Reference

Tasks Endpoints

Background task monitoring and management

Tasks Endpoints

Base path: /api/v1/tasks

Background tasks are created by async scrape/upload operations.

GET /api/v1/tasks

List all background tasks.

Query Parameters:

ParameterTypeDefaultDescription
statusstringnullFilter by status
limitint50Maximum tasks to return (1-200)

Task Status Values:

StatusDescription
pendingTask created, waiting to start
runningTask is executing
completedTask finished successfully
failedTask failed with error
cancelledTask was cancelled

Response:

{
  "tasks": [
    {
      "task_id": "550e8400-e29b-41d4-a716-446655440000",
      "status": "completed",
      "progress": 1.0,
      "result": {
        "urls_processed": 3,
        "successful": 3,
        "failed": 0,
        "total_chunks_added": 45
      },
      "error": null,
      "created_at": "2025-01-15T10:30:00.000000",
      "started_at": "2025-01-15T10:30:01.000000",
      "completed_at": "2025-01-15T10:30:15.000000"
    }
  ],
  "total": 1
}

GET /api/v1/tasks/{task_id}

Get the status of a specific task.

Response:

{
  "task_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "running",
  "progress": 0.66,
  "result": null,
  "error": null,
  "created_at": "2025-01-15T10:30:00.000000",
  "started_at": "2025-01-15T10:30:01.000000",
  "completed_at": null
}

DELETE /api/v1/tasks/{task_id}

Cancel a pending or running task.

Response:

{
  "task_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "cancelled",
  "message": "Task cancelled successfully"
}

On this page