Creating and Managing Tasks via API
The Loomstack API allows you to programmatically manage tasks. This guide covers the most common operations.
Create a Task
Endpoint
POST /v1/projects/{projectId}/tasks
Request
curl -X POST https://api.loomstack.com/v1/projects/proj_123/tasks \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Fix login bug",
"description": "Users report 401 errors on login",
"assignee_id": "user_456",
"due_date": "2024-02-15",
"priority": "high",
"state": "to_do"
}'
Response
{
"success": true,
"data": {
"id": "task_789",
"project_id": "proj_123",
"title": "Fix login bug",
"state": "to_do",
"priority": "high",
"assignee": {
"id": "user_456",
"name": "John Doe"
},
"due_date": "2024-02-15",
"created_at": "2024-02-08T10:30:00Z"
}
}
List Tasks
Endpoint
GET /v1/projects/{projectId}/tasks
Query Parameters
state- Filter by state (to_do, in_progress, done)assignee- Filter by assignee IDpriority- Filter by priority (low, medium, high)due_before- Filter by due date (YYYY-MM-DD)limit- Results per page (default: 50, max: 100)offset- Pagination offset
Example
curl "https://api.loomstack.com/v1/projects/proj_123/tasks?state=in_progress&limit=25" \
-H "Authorization: Bearer YOUR_API_KEY"
Update a Task
Endpoint
PUT /v1/projects/{projectId}/tasks/{taskId}
Request
curl -X PUT https://api.loomstack.com/v1/projects/proj_123/tasks/task_789 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"state": "in_progress",
"priority": "medium"
}'
Update Task Status
Quick status updates:
curl -X PATCH https://api.loomstack.com/v1/projects/proj_123/tasks/task_789 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"state": "done"}'
Delete a Task
Endpoint
DELETE /v1/projects/{projectId}/tasks/{taskId}
Add Comments
Endpoint
POST /v1/projects/{projectId}/tasks/{taskId}/comments
Request
curl -X POST https://api.loomstack.com/v1/projects/proj_123/tasks/task_789/comments \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Started work on this, should be done by EOD"
}'
Get Task Details
Endpoint
GET /v1/projects/{projectId}/tasks/{taskId}
Returns full task data including comments, attachments, and history.
Bulk Operations
For bulk task creation, use batch endpoint:
POST /v1/projects/{projectId}/tasks/batch
Request:
{
"tasks": [
{"title": "Task 1", "state": "to_do"},
{"title": "Task 2", "state": "to_do"},
{"title": "Task 3", "state": "to_do"}
]
}
Processes up to 100 tasks per request.
Rate Limiting
- Task creation: Limited to 100 per minute
- Task updates: Limited to 500 per minute
- Bulk operations: Count as 1 request
Best Practices
- Use batch endpoints for bulk operations
- Cache project/user IDs to reduce API calls
- Implement exponential backoff for retries
- Use state filters to reduce response size
- Archive old tasks before large imports
Webhooks
Receive real-time notifications when tasks change:
POST /v1/webhooks
Setup webhooks for:
task.createdtask.updatedtask.deletedtask.status_changed
See webhook documentation for details.