Skip to main content

GET /api/tasks/export

Exports the authenticated user’s tasks as a downloadable file. Supports CSV and JSON formats. The same status, priority, tag, and overdue filters available on List Tasks are supported here.
Returns 404 Not Found if no tasks match the applied filters. Ensure your filters are not too restrictive before exporting.

Authentication

Authorization: Bearer <access_token>

Query Parameters

format
string
default:"csv"
Export file format. Allowed values: csv, json.
status
string
Filter exported tasks by status. Allowed values: pending, in_progress, completed, cancelled.
priority
string
Filter exported tasks by priority. Allowed values: low, medium, high, urgent.
tag_id
integer
Filter exported tasks to those associated with a specific tag ID.
overdue
boolean
When true, exports only tasks whose due_date is in the past and whose status is not completed.

Response

The response is a file download, not a JSON object.
FormatContent-TypeContent-Disposition
csvtext/csvattachment; filename=tasks.csv
jsonapplication/jsonattachment; filename=tasks.json

CSV Columns

The CSV file contains the following columns, derived from the prepare_tasks_for_export function:
ColumnDescription
idTask ID
titleTask title
descriptionTask description
statusTask status
priorityTask priority
due_dateISO 8601 due date, or empty
completed_atISO 8601 completion timestamp, or empty
is_overdueTrue or False
is_completedTrue or False
created_atISO 8601 creation timestamp
updated_atISO 8601 last-updated timestamp
user_idID of the task owner
user_usernameUsername of the task owner
user_emailEmail of the task owner
tagsComma-separated list of tag names, e.g. docs, api

Examples

Export all tasks to CSV:
curl -X GET "https://task-forge-gbd6h8gtg8hchve9.chilecentral-01.azurewebsites.net/api/tasks/export" \
  -H "Authorization: Bearer <access_token>" \
  -o tasks.csv
Export completed tasks to JSON:
curl -X GET "https://task-forge-gbd6h8gtg8hchve9.chilecentral-01.azurewebsites.net/api/tasks/export?format=json&status=completed" \
  -H "Authorization: Bearer <access_token>" \
  -o tasks.json
Example CSV output:
id,title,description,status,priority,due_date,completed_at,is_overdue,is_completed,created_at,updated_at,user_id,user_username,user_email,tags
42,Write API documentation,Cover all endpoints with examples,completed,high,2024-11-30T23:59:59,2024-11-28T16:45:00,False,True,2024-10-01T09:00:00,2024-11-28T16:45:00,7,jsmith,[email protected],"docs, api"
Example JSON output:
[
  {
    "id": 42,
    "title": "Write API documentation",
    "description": "Cover all endpoints with examples",
    "status": "completed",
    "priority": "high",
    "due_date": "2024-11-30T23:59:59",
    "completed_at": "2024-11-28T16:45:00",
    "is_overdue": false,
    "is_completed": true,
    "created_at": "2024-10-01T09:00:00",
    "updated_at": "2024-11-28T16:45:00",
    "user_id": 7,
    "user_username": "jsmith",
    "user_email": "[email protected]",
    "tags": "docs, api"
  }
]

Build docs developers (and LLMs) love