Last Updated: 2026-02-11
This manual provides complete API reference for AI assistants and bot developers to interact with TaskPulse.
- Getting Started
- CLI Usage
- REST API
- Authentication
- Projects API
- Tasks API
- Subtasks API
- Bots API
- Activity API
- Error Handling
- Testing Examples
TaskPulse provides two ways for AI assistants to interact:
- CLI (Command-Line Interface) - Direct script execution with JSON output
- REST API - Full HTTP API for remote or complex operations
Choose the approach that best fits your use case:
- Use CLI for local, simple operations
- Use REST API for remote access, web applications, or advanced features
- API:
http://localhost:3000 - Web UI:
http://localhost:3050 - Health Check:
http://localhost:3000/health
Full API reference available at: http://localhost:3000/api
TaskPulse uses hybrid authentication:
- Session-based: For human users (cookie-based)
- Token-based: For bots (API token in headers)
When TaskPulse is hosted online (production environment), administrators can configure IP-based access control:
For Bots:
- API access can be restricted to whitelisted IP addresses only
- Only known, trusted bots can connect to the API
- Bot IP addresses must be pre-approved in the server configuration
For Humans:
- Web UI access remains available from any location
- Team members can work from anywhere in the world
- Authentication is handled via secure sessions
Benefits:
- Secure Integration - Prevents unauthorized bot access to your API
- Flexibility - Human users aren't restricted by IP whitelists
- Fine-Grained Control - Different security policies for bots vs humans
- Compliance - Meets security requirements for automated systems
To configure IP whitelisting for bots, administrators should:
- Obtain the static IP address of each bot/service
- Configure the reverse proxy (e.g., Nginx) or firewall rules
- Allow API endpoints only from whitelisted IPs for bot tokens
- Ensure web UI remains accessible to authenticated users from anywhere
See ADMIN_GUIDE.md for detailed deployment and security configuration.
The CLI (server/cli.js) provides direct script execution with JSON output for easy parsing.
cd server
./cli.js status
# Find high-priority tasks
./cli.js tasks --priority high
# Find pending tasks
./cli.js tasks --status pending# List all projects
./cli.js projects
# See tasks for specific project
./cli.js tasks --project 1
# Get full details of a task including subtasks
./cli.js task full 5# Add a new task
./cli.js task add 1 "Implement user authentication" --priority high
# Add subtasks to break down work
./cli.js subtask add 5 "Which auth method?" --options "JWT,OAuth,Sessions"# Start working on a task
./cli.js task start 5
# Complete a task
./cli.js task complete 5
# Answer a decision
./cli.js subtask answer 3 "JWT"# All in-progress tasks
./cli.js tasks --status in-progress
# Tasks for specific project that are pending
./cli.js tasks --project 1 --status pending
# High priority tasks across all projects
./cli.js tasks --priority highAll CLI responses are JSON. Parse them to extract data:
{
"success": true,
"message": "Task created",
"task": { ... }
}[
{ "id": 1, "title": "Task 1", ... },
{ "id": 2, "title": "Task 2", ... }
]{
"error": "Task ID is required"
}- Always check status first - Get context before making changes
- Use full commands - Get complete task details with
task full <id> - Parse JSON carefully - Extract IDs and data from responses
- Provide context - When suggesting tasks, explain reasoning
- Confirm destructive actions - Before deleting, verify with user
User: "What do I need to work on today?"
AI Actions:
cd server
./cli.js status
./cli.js tasks --status pending --priority highAI Response: "You have 3 high-priority pending tasks:
- Implement user auth (Task #5)
- Design database schema (Task #3)
- Write API docs (Task #7)
Would you like me to start any of these?"
User: "Start the auth task"
AI Actions:
./cli.js task start 5
./cli.js task full 5AI Response: "Started Task #5: Implement user authentication. This task has a subtask asking which auth method to use. The options are JWT, OAuth, or Sessions. Which would you prefer?"
User: "JWT"
AI Actions:
./cli.js subtask answer 3 "JWT"AI Response: "Great! I've recorded JWT as your choice. The task is now in progress."
./cli.js projects # List all
./cli.js project add "Name" # Create
./cli.js project get <id> # Get one
./cli.js project full <id> # Get with tasks
./cli.js project delete <id> # Delete./cli.js tasks # List all
./cli.js tasks --project <id> # Filter by project
./cli.js tasks --status pending # Filter by status
./cli.js tasks --priority high # Filter by priority
./cli.js task add <project-id> "Title" # Create
./cli.js task start <id> # Start
./cli.js task complete <id> # Complete
./cli.js task reopen <id> # Reopen
./cli.js task delete <id> # Delete./cli.js subtasks <task-id> # List for task
./cli.js subtask add <task-id> "Question" # Create
./cli.js subtask answer <id> "Option" # Answer
./cli.js subtask delete <id> # Delete./cli.js status # Overview of everythingcli.js projects [--status <status>]- List projectscli.js project add <name> [--description "text"]- Create projectcli.js project get <id>- Get project detailscli.js project full <id>- Get project with all taskscli.js project update <id> [--name "text"]- Update projectcli.js project archive <id>- Archive projectcli.js project delete <id>- Delete project
cli.js tasks [--project <id>] [--status <status>] [--priority <priority>]- List taskscli.js task add <project-id> <title> [--description "text"] [--priority <priority>]- Create taskcli.js task get <id>- Get task detailscli.js task full <id>- Get task with subtaskscli.js task update <id> [--title "text"]- Update taskcli.js task start <id>- Start taskcli.js task complete <id>- Complete taskcli.js task reopen <id>- Reopen taskcli.js task delete <id>- Delete task
cli.js subtasks <task-id>- List subtasks for taskcli.js subtask add <task-id> <question> [--options "opt1,opt2,opt3"]- Create subtaskcli.js subtask get <id>- Get subtask detailscli.js subtask answer <id> <option>- Answer subtaskcli.js subtask update <id> [--question "text"]- Update subtaskcli.js subtask delete <id>- Delete subtask
cli.js status- Overview of all projects and tasks
Full help available:
cd server
./cli.js helpPOST /api/auth/register
Content-Type: application/json
{
"username": "alice",
"password": "secure_password_123",
"fullName": "Alice Johnson"
}Response (201):
{
"success": true,
"user": {
"id": 1,
"username": "alice",
"fullName": "Alice Johnson",
"userType": "human"
}
}POST /api/auth/login
Content-Type: application/json
{
"username": "alice",
"password": "secure_password_123"
}Response (200):
{
"success": true,
"user": {
"id": 1,
"username": "alice",
"fullName": "Alice Johnson",
"userType": "human",
"teamId": 1,
"lastVisit": "2026-02-11T09:00:00.000Z"
},
"lastVisit": "2026-02-11T09:00:00.000Z"
}POST /api/auth/logout
Cookie: sessionId=<session_id>GET /api/auth/me
Cookie: sessionId=<session_id>Response (200):
{
"user": {
"id": 1,
"username": "alice",
"fullName": "Alice Johnson",
"userType": "human",
"teamId": 1
}
}POST /api/bots
Cookie: sessionId=<session_id>
Content-Type: application/json
{
"name": "Task Assistant",
"description": "Helps manage tasks"
}Response (201):
{
"success": true,
"bot": {
"id": 1,
"name": "Task Assistant",
"description": "Helps manage tasks",
"apiToken": "bot_token_xxxxxxxxxxxxxxxx",
"ownerId": 1,
"isActive": true
}
}GET /api/bots
Cookie: sessionId=<session_id>GET /api/bots/:id
Cookie: sessionId=<session_id>PUT /api/bots/:id
Cookie: sessionId=<session_id>
Content-Type: application/json
{
"name": "Updated Bot Name",
"description": "Updated description"
}POST /api/bots/:id/regenerate-token
Cookie: sessionId=<session_id>Response (200):
{
"success": true,
"apiToken": "new_bot_token_yyyyyyyyyyyyyyyy"
}POST /api/bots/:id/deactivate
Cookie: sessionId=<session_id>DELETE /api/bots/:id
Cookie: sessionId=<session_id>GET /api/projects
Cookie: sessionId=<session_id>Query Parameters:
status(optional): Filter by status (active,archived)
GET /api/projects/:id
Cookie: sessionId=<session_id>GET /api/projects/:id/full
Cookie: sessionId=<session_id>POST /api/projects
Cookie: sessionId=<session_id>
Content-Type: application/json
{
"name": "Website Redesign",
"description": "Redesign the company website",
"dueDate": "2026-03-01T00:00:00.000Z"
}Response (201):
{
"id": 1,
"name": "Website Redesign",
"description": "Redesign the company website",
"status": "active",
"dueDate": "2026-03-01T00:00:00.000Z",
"ownerId": 1,
"createdBy": 1,
"teamId": 1,
"createdAt": "2026-02-11T09:00:00.000Z"
}PUT /api/projects/:id
Cookie: sessionId=<session_id>
Content-Type: application/json
{
"name": "Updated Project Name",
"description": "Updated description"
}POST /api/projects/:id/archive
Cookie: sessionId=<session_id>DELETE /api/projects/:id
Cookie: sessionId=<session_id>GET /api/projects/overdue
Cookie: sessionId=<session_id>GET /api/projects/due-soon?days=7
Cookie: sessionId=<session_id>GET /api/tasks
Cookie: sessionId=<session_id>Query Parameters:
projectId(optional): Filter by projectstatus(optional): Filter by status (pending,in-progress,done)priority(optional): Filter by priority (low,medium,high)assignedTo(optional): Filter by assignee (usemefor current user)dueBefore(optional): ISO date stringdueAfter(optional): ISO date stringstartDateBefore(optional): ISO date stringstartDateAfter(optional): ISO date stringsearch(optional): Search in title and descriptioncompletedAfter(optional): ISO date stringcompletedBefore(optional): ISO date stringcompletedToday(optional):trueorfalse
Examples:
# Get all high-priority tasks
GET /api/tasks?priority=high
# Get pending tasks for project 1
GET /api/tasks?projectId=1&status=pending
# Get tasks assigned to current user
GET /api/tasks?assignedTo=me
# Get tasks due in the next week
GET /api/tasks?dueAfter=2026-02-11T00:00:00.000Z&dueBefore=2026-02-18T00:00:00.000ZGET /api/tasks/:id
Cookie: sessionId=<session_id>GET /api/tasks/:id/full
Cookie: sessionId=<session_id>Response (200):
{
"id": 1,
"title": "Implement user authentication",
"description": "Add login and registration functionality",
"status": "pending",
"priority": "high",
"projectId": 1,
"assignedTo": 1,
"dueDate": "2026-02-15T00:00:00.000Z",
"startDate": "2026-02-11T00:00:00.000Z",
"ownerId": 1,
"teamId": 1,
"createdAt": "2026-02-11T09:00:00.000Z",
"completedAt": null,
"subtasks": [
{
"id": 1,
"question": "Which auth method?",
"options": ["JWT", "OAuth", "Sessions"],
"answered": false,
"selectedOption": null
}
]
}POST /api/tasks
Cookie: sessionId=<session_id>
Content-Type: application/json
{
"projectId": 1,
"title": "Implement user authentication",
"description": "Add login and registration functionality",
"priority": "high",
"assignedTo": 1,
"dueDate": "2026-02-15T00:00:00.000Z",
"startDate": "2026-02-11T00:00:00.000Z",
"provided_file": "no_file",
"file_reference": null
}Response (201):
{
"id": 1,
"title": "Implement user authentication",
"description": "Add login and registration functionality",
"status": "pending",
"priority": "high",
"projectId": 1,
"assignedTo": 1,
"dueDate": "2026-02-15T00:00:00.000Z",
"startDate": "2026-02-11T00:00:00.000Z",
"ownerId": 1,
"teamId": 1,
"createdAt": "2026-02-11T09:00:00.000Z"
}PUT /api/tasks/:id
Cookie: sessionId=<session_id>
Content-Type: application/json
{
"title": "Updated task title",
"description": "Updated description",
"priority": "medium",
"dueDate": "2026-02-20T00:00:00.000Z"
}POST /api/tasks/:id/start
Cookie: sessionId=<session_id>POST /api/tasks/:id/complete
Cookie: sessionId=<session_id>POST /api/tasks/:id/reopen
Cookie: sessionId=<session_id>POST /api/tasks/:id/assign
Cookie: sessionId=<session_id>
Content-Type: application/json
{
"assignedTo": 2
}DELETE /api/tasks/:id
Cookie: sessionId=<session_id>GET /api/tasks/overdue
Cookie: sessionId=<session_id>GET /api/tasks/due-soon?days=7
Cookie: sessionId=<session_id>GET /api/tasks/due-today
Cookie: sessionId=<session_id>GET /api/tasks/completed-today
Cookie: sessionId=<session_id>GET /api/tasks/completed-recent?days=7
Cookie: sessionId=<session_id>GET /api/tasks/:taskId/subtasks
Cookie: sessionId=<session_id>Response (200):
[
{
"id": 1,
"taskId": 1,
"question": "Which auth method?",
"options": ["JWT", "OAuth", "Sessions"],
"assignedTo": null,
"assignedToUsername": null,
"assignedToName": null,
"answered": false,
"selectedOption": null,
"type": "multiple_choice",
"providedFile": "no_file",
"fileReference": null,
"createdAt": "2026-02-11T09:00:00.000Z"
}
]POST /api/tasks/:taskId/subtasks
Cookie: sessionId=<session_id>
Content-Type: application/json
{
"question": "Which framework should we use?",
"type": "multiple_choice",
"options": ["React", "Vue", "Angular"],
"assignedTo": 2,
"provided_file": "no_file",
"file_reference": null
}Required Fields:
question(string): The subtask questiontype(string): Eithermultiple_choiceoropen_answeroptions(array): Required formultiple_choicetype - array of option strings
Optional Fields:
assignedTo(number): User ID to assign the subtask toprovided_file(string): One ofno_file,emailed,on_diskfile_reference(string): Reference to file (required whenprovided_fileisemailedoron_disk)
Response (201):
{
"id": 1,
"taskId": 1,
"question": "Which framework should we use?",
"options": ["React", "Vue", "Angular"],
"assignedTo": 2,
"assignedToUsername": "bob",
"assignedToName": "Bob Smith",
"answered": false,
"selectedOption": null,
"type": "multiple_choice",
"providedFile": "no_file",
"fileReference": null,
"createdAt": "2026-02-11T09:00:00.000Z"
}POST /api/subtasks
Cookie: sessionId=<session_id>
Content-Type: application/json
{
"taskId": 1,
"question": "What's the deadline for this?",
"type": "open_answer",
"assignedTo": 1,
"provided_file": "no_file",
"file_reference": null
}Required Fields:
taskId(number): The parent task IDquestion(string): The subtask questiontype(string): Eithermultiple_choiceoropen_answeroptions(array): Required formultiple_choicetype - array of option strings
Optional Fields:
assignedTo(number): User ID to assign the subtask toprovided_file(string): One ofno_file,emailed,on_diskfile_reference(string): Reference to file (required whenprovided_fileisemailedoron_disk)
GET /api/subtasks/:id
Cookie: sessionId=<session_id>POST /api/subtasks/:id/answer
Cookie: sessionId=<session_id>
Content-Type: application/json
{
"selectedOption": "JWT"
}Response (200):
{
"id": 1,
"taskId": 1,
"question": "Which auth method?",
"options": ["JWT", "OAuth", "Sessions"],
"answered": true,
"selectedOption": "JWT",
"type": "multiple_choice",
"providedFile": "no_file",
"fileReference": null,
"createdAt": "2026-02-11T09:00:00.000Z"
}PUT /api/subtasks/:id
Cookie: sessionId=<session_id>
Content-Type: application/json
{
"question": "Updated question?",
"options": ["Option A", "Option B", "Option C"],
"assignedTo": 2,
"type": "multiple_choice",
"provided_file": "emailed",
"file_reference": "path/to/file.pdf"
}DELETE /api/subtasks/:id
Cookie: sessionId=<session_id>GET /api/activity?limit=50
Cookie: sessionId=<session_id>Response (200):
[
{
"id": 1,
"actorId": 1,
"actorType": "human",
"actionType": "task_created",
"entityType": "task",
"entityId": 1,
"entityName": "Implement user authentication",
"details": {},
"createdAt": "2026-02-11T09:00:00.000Z",
"message": "Alice Johnson created task 'Implement user authentication'"
}
]GET /api/activity/whats-new?since=2026-02-10T09:00:00.000Z
Cookie: sessionId=<session_id>Response (200):
{
"totalChanges": 5,
"recentActivities": [
{
"id": 1,
"actorId": 2,
"actorType": "human",
"actionType": "task_assigned",
"entityType": "task",
"entityId": 1,
"entityName": "Implement user authentication",
"details": {},
"createdAt": "2026-02-11T09:00:00.000Z",
"message": "Bob Smith assigned task 'Implement user authentication' to you"
}
]
}GET /api/users
Cookie: sessionId=<session_id>Response (200):
[
{
"id": 1,
"username": "alice",
"fullName": "Alice Johnson"
},
{
"id": 2,
"username": "bob",
"fullName": "Bob Smith"
}
]All errors follow this format:
{
"error": "Error message here",
"path": "/api/tasks/999"
}200 OK- Successful GET, PUT, POST201 Created- Successful resource creation400 Bad Request- Validation errors, missing required fields403 Forbidden- Permission denied404 Not Found- Resource not found500 Internal Server Error- Server error
Authentication Errors:
- "Authentication required"
- "Invalid username or password"
- "Session expired"
Validation Errors:
- "Subtask question is required"
- "Task ID is required"
- "Type must be multiple_choice or open_answer"
- "Multiple choice subtasks must have at least one option"
- "Provided file must be no_file, emailed, or on_disk"
- "File reference is required when provided_file is emailed or on_disk"
Permission Errors:
- "You must be a member of a team to view projects"
- "You do not have permission to view this task"
- "You do not have permission to create subtasks for this task"
Not Found Errors:
- "Task 999 not found"
- "Subtask 999 not found"
- "Project 999 not found"
Login:
curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"alice","password":"password"}' \
-c cookies.txtCreate Task:
curl -X POST http://localhost:3000/api/tasks \
-H "Content-Type: application/json" \
-b cookies.txt \
-d '{
"projectId": 1,
"title": "Test task",
"priority": "high"
}'Create Subtask (URL-based):
curl -X POST http://localhost:3000/api/tasks/1/subtasks \
-H "Content-Type: application/json" \
-b cookies.txt \
-d '{
"question": "What is your preference?",
"type": "multiple_choice",
"options": ["Option A", "Option B"]
}'// Create a task
async function createTask(sessionId, taskData) {
const response = await fetch('http://localhost:3000/api/tasks', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Cookie': `sessionId=${sessionId}`
},
body: JSON.stringify(taskData)
});
return response.json();
}
// Create a subtask (URL-based)
async function createSubtask(sessionId, taskId, subtaskData) {
const response = await fetch(`http://localhost:3000/api/tasks/${taskId}/subtasks`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Cookie': `sessionId=${sessionId}`
},
body: JSON.stringify(subtaskData)
});
return response.json();
}import requests
# Create a task
def create_task(session_id, task_data):
response = requests.post(
'http://localhost:3000/api/tasks',
json=task_data,
cookies={'sessionId': session_id}
)
return response.json()
# Create a subtask (URL-based)
def create_subtask(session_id, task_id, subtask_data):
response = requests.post(
f'http://localhost:3000/api/tasks/{task_id}/subtasks',
json=subtask_data,
cookies={'sessionId': session_id}
)
return response.json()- Always check API documentation first - The
/apiendpoint provides the most up-to-date information - Parse error messages carefully - They provide specific feedback on what went wrong
- Use appropriate subtask types:
multiple_choicefor decisions with predefined optionsopen_answerfor questions requiring text responses
- Validate required fields before sending:
- For
multiple_choicesubtasks:question,type,options - For
open_answersubtasks:question,type
- For
- Handle file references properly:
- Use
no_filewhen no file is attached - Use
emailedoron_diskwhen a file is referenced - Always provide
file_referencewhen not usingno_file
- Use
- Check permissions - Ensure the user is a member of a team before creating projects/tasks
- Use RESTful patterns - Prefer
/api/tasks/:taskId/subtasksover/api/subtasksfor creating subtasks - Handle errors gracefully - Catch and report errors to users with helpful messages
| Endpoint | Method | Description |
|---|---|---|
/api/auth/register |
POST | Register new user |
/api/auth/login |
POST | Login user |
/api/auth/me |
GET | Get current user |
/api/projects |
GET | List projects |
/api/projects |
POST | Create project |
/api/projects/:id |
GET | Get project |
/api/projects/:id/full |
GET | Get project with tasks |
/api/projects/:id |
PUT | Update project |
/api/projects/:id/archive |
POST | Archive project |
/api/projects/:id |
DELETE | Delete project |
/api/tasks |
GET | List tasks |
/api/tasks |
POST | Create task |
/api/tasks/:id |
GET | Get task |
/api/tasks/:id/full |
GET | Get task with subtasks |
/api/tasks/:id |
PUT | Update task |
/api/tasks/:id/start |
POST | Start task |
/api/tasks/:id/complete |
POST | Complete task |
/api/tasks/:id/reopen |
POST | Reopen task |
/api/tasks/:id/assign |
POST | Assign task |
/api/tasks/:id |
DELETE | Delete task |
/api/tasks/:taskId/subtasks |
GET | List subtasks |
/api/tasks/:taskId/subtasks |
POST | Create subtask (taskId in URL) |
/api/subtasks |
POST | Create subtask (taskId in body) |
/api/subtasks/:id |
GET | Get subtask |
/api/subtasks/:id/answer |
POST | Answer subtask |
/api/subtasks/:id |
PUT | Update subtask |
/api/subtasks/:id |
DELETE | Delete subtask |
/api/activity |
GET | Get recent activity |
/api/activity/whats-new |
GET | Get changes since last visit |
/api/users |
GET | List users |
TaskPulse API Version: v1.2.0
Last Updated: 2026-02-13