Skip to main content

GET /api/tasks

Returns a paginated list of tasks. Admin users see all tasks across all users; regular users see only their own tasks.

Authentication

Include a valid access token in the Authorization header:
Authorization: Bearer <access_token>

Query Parameters

page
integer
default:"1"
Page number to retrieve.
per_page
integer
default:"10"
Number of tasks per page. Maximum value is 100.
sort_by
string
default:"created_at"
Field to sort results by. Allowed values: id, title, status, priority, due_date, created_at, updated_at.
sort_order
string
default:"desc"
Sort direction. Allowed values: asc, desc.
status
string
Filter tasks by status. Allowed values: pending, in_progress, completed, cancelled.
priority
string
Filter tasks by priority. Allowed values: low, medium, high, urgent.
tag_id
integer
Filter tasks associated with a specific tag ID.
tag_name
string
Filter tasks by tag name. Performs a case-insensitive partial match.
Search for tasks by keyword. Matches against the task title and description fields.
overdue
boolean
When true, returns only tasks whose due_date is in the past and whose status is not completed.
due_date_from
string
Return tasks with a due_date on or after this datetime. ISO 8601 format, e.g. 2024-01-01T00:00:00.
due_date_to
string
Return tasks with a due_date on or before this datetime. ISO 8601 format, e.g. 2024-12-31T23:59:59.

Response

200 OK — Returns an object with a tasks array and a pagination metadata object.
success
boolean
Always true for successful responses.
data
object

Examples

Basic request — first page of tasks:
curl -X GET "https://task-forge-gbd6h8gtg8hchve9.chilecentral-01.azurewebsites.net/api/tasks" \
  -H "Authorization: Bearer <access_token>"
Filtered request — high-priority in-progress tasks due before end of year, sorted by due date:
curl -X GET "https://task-forge-gbd6h8gtg8hchve9.chilecentral-01.azurewebsites.net/api/tasks?status=in_progress&priority=high&sort_by=due_date&sort_order=asc&due_date_to=2024-12-31T23:59:59&per_page=25" \
  -H "Authorization: Bearer <access_token>"
Example response:
{
  "success": true,
  "data": {
    "tasks": [
      {
        "id": 42,
        "title": "Write API documentation",
        "description": "Cover all endpoints with examples",
        "status": "in_progress",
        "priority": "high",
        "due_date": "2024-11-30T23:59:59",
        "completed_at": null,
        "is_overdue": false,
        "is_completed": false,
        "created_at": "2024-10-01T09:00:00",
        "updated_at": "2024-10-15T14:22:00",
        "user_id": 7,
        "tags": [
          {
            "id": 3,
            "name": "docs",
            "color": "#2c0444",
            "description": null,
            "task_count": 8,
            "created_at": "2024-01-01T00:00:00",
            "updated_at": "2024-01-01T00:00:00"
          }
        ]
      }
    ],
    "pagination": {
      "page": 1,
      "per_page": 25,
      "total": 1,
      "total_pages": 1,
      "has_next": false,
      "has_prev": false
    }
  }
}

Build docs developers (and LLMs) love