Manage tasks, projects, and labels via the Todoist REST API.
Use Cases
- The user says "Help me add a task in Todoist" or "Check my to-dos"
- The user says "What tasks are in Todoist today" or "Mark this task as complete"
Prerequisites
You need to set the environment variable TODOIST_API_TOKEN:
- Visit https://todoist.com/app/settings/integrations/developer → Copy the API Token
- Set:
export TODOIST_API_TOKEN="your-token"
Execution Method
Get Tasks
curl -s "https://api.todoist.com/rest/v2/tasks" \
-H "Authorization: Bearer $TODOIST_API_TOKEN" | python3 -m json.tool
Filter today's tasks:
curl -s "https://api.todoist.com/rest/v2/tasks?filter=today" \
-H "Authorization: Bearer $TODOIST_API_TOKEN"
Create Task
curl -s -X POST "https://api.todoist.com/rest/v2/tasks" \
-H "Authorization: Bearer $TODOIST_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"content":"任务内容","due_string":"tomorrow","priority":3}'
priority: 1 (normal) → 4 (urgent).due_string Supports natural language ("tomorrow", "next monday", "every day").
Complete Task
curl -s -X POST "https://api.todoist.com/rest/v2/tasks/{task_id}/close" \
-H "Authorization: Bearer $TODOIST_API_TOKEN"
Get Projects
curl -s "https://api.todoist.com/rest/v2/projects" \
-H "Authorization: Bearer $TODOIST_API_TOKEN"
Output Specifications
- Task list sorted by due date and priority
- Show project affiliation and labels
- After creating a task, confirm and show the due date