This document describes the TaskMan API endpoints for managing tasks. All endpoints require authentication using Laravel Sanctum.
All API requests require a valid Sanctum token in the Authorization header:
Authorization: Bearer {your-token}
You can obtain a token by using Laravel's authentication system or by implementing a custom token issuance endpoint.
Retrieves a paginated list of tasks that belong to the authenticated user, with optional filtering.
URL: GET /api/v1/tasks
Query Parameters:
| Parameter | Description | Example |
|---|---|---|
| search | Search term for title and description | ?search=important |
| status | Filter by task status | ?status=completed |
| priority | Filter by priority level | ?priority=HIGH |
| sort_by | Field to sort by | ?sort_by=due |
| sort_direction | Sort direction (asc or desc) | ?sort_direction=desc |
| per_page | Number of items per page | ?per_page=20 |
Status Options:
completed- All completed tasksuncompleted- All uncompleted tasksoverdue- Tasks past their due datetoday- Tasks due todaythis_week- Tasks due this weekthis_month- Tasks due this monththis_year- Tasks due this yearnext_7_days- Tasks due in the next 7 daysnext_30_days- Tasks due in the next 30 daysnext_90_days- Tasks due in the next 90 days
Example Response:
{
"tasks": {
"current_page": 1,
"data": [
{
"id": 1,
"title": "Complete API Documentation",
"desc": "Write comprehensive documentation for the Task API",
"due": "2025-03-25T12:00:00.000000Z",
"priority": "HIGH",
"completed": false,
"user_id": 1,
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"slug": "complete-api-documentation",
"created_at": "2025-03-21T12:00:00.000000Z",
"updated_at": "2025-03-21T12:00:00.000000Z"
},
// More tasks...
],
"first_page_url": "http://example.com/api/v1/tasks?page=1",
"from": 1,
"last_page": 3,
"last_page_url": "http://example.com/api/v1/tasks?page=3",
"links": [
// Pagination links...
],
"next_page_url": "http://example.com/api/v1/tasks?page=2",
"path": "http://example.com/api/v1/tasks",
"per_page": 10,
"prev_page_url": null,
"to": 10,
"total": 25
}
}Retrieves a specific task by ID.
URL: GET /api/v1/tasks/{id}
Path Parameters:
| Parameter | Description | Example |
|---|---|---|
| id | Task ID | /api/v1/tasks/1 |
Example Response:
{
"task": {
"id": 1,
"title": "Complete API Documentation",
"desc": "Write comprehensive documentation for the Task API",
"due": "2025-03-25T12:00:00.000000Z",
"priority": "HIGH",
"completed": false,
"user_id": 1,
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"slug": "complete-api-documentation",
"created_at": "2025-03-21T12:00:00.000000Z",
"updated_at": "2025-03-21T12:00:00.000000Z"
}
}Creates a new task for the authenticated user.
URL: POST /api/v1/tasks
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
| title | string | Yes | Task title (5-250 chars) |
| desc | string | Yes | Task description |
| priority | enum (PriorityLevel) | Yes | Task priority |
| due | datetime | No | Due date and time |
Priority Level Options:
CRITICALHIGHMEDIUMLOWNONE
Example Request:
{
"title": "Review Project Proposal",
"desc": "Review the new project proposal document and provide feedback",
"priority": "HIGH",
"due": "2025-03-28T15:00:00"
}Example Response:
{
"message": "Task created successfully",
"task": {
"id": 10,
"title": "Review Project Proposal",
"desc": "Review the new project proposal document and provide feedback",
"due": "2025-03-28T15:00:00.000000Z",
"priority": "HIGH",
"completed": false,
"user_id": 1,
"uuid": "7f1bfd09-2d48-4c3a-a874-2c55eac1d695",
"slug": "review-project-proposal",
"created_at": "2025-03-21T12:35:42.000000Z",
"updated_at": "2025-03-21T12:35:42.000000Z"
}
}Updates an existing task.
URL: PUT /api/v1/tasks/{id}
Path Parameters:
| Parameter | Description | Example |
|---|---|---|
| id | Task ID | /api/v1/tasks/10 |
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
| title | string | No | Task title (5-250 chars) |
| desc | string | No | Task description |
| priority | enum (PriorityLevel) | No | Task priority |
| due | datetime | No | Due date and time |
| completed | boolean | No | Completion status |
Example Request:
{
"title": "Review Project Proposal - Urgent",
"priority": "CRITICAL"
}Example Response:
{
"message": "Task updated successfully",
"task": {
"id": 10,
"title": "Review Project Proposal - Urgent",
"desc": "Review the new project proposal document and provide feedback",
"due": "2025-03-28T15:00:00.000000Z",
"priority": "CRITICAL",
"completed": false,
"user_id": 1,
"uuid": "7f1bfd09-2d48-4c3a-a874-2c55eac1d695",
"slug": "review-project-proposal-urgent",
"created_at": "2025-03-21T12:35:42.000000Z",
"updated_at": "2025-03-21T12:40:15.000000Z"
}
}Deletes a specific task.
URL: DELETE /api/v1/tasks/{id}
Path Parameters:
| Parameter | Description | Example |
|---|---|---|
| id | Task ID | /api/v1/tasks/10 |
Example Response:
{
"message": "Task deleted successfully"
}Toggles the completion status of a task.
URL: PATCH /api/v1/tasks/{id}/toggle-completion
Path Parameters:
| Parameter | Description | Example |
|---|---|---|
| id | Task ID | /api/v1/tasks/5/toggle-completion |
Example Response:
{
"message": "Task completion toggled successfully",
"task": {
"id": 5,
"title": "Team Meeting",
"desc": "Weekly team sync",
"due": "2025-03-22T10:00:00.000000Z",
"priority": "MEDIUM",
"completed": true,
"completed_at": "2025-03-21T12:45:22.000000Z",
"user_id": 1,
"uuid": "a1b2c3d4-e5f6-4a5b-8c7d-9e8f7a6b5c4d",
"slug": "team-meeting",
"created_at": "2025-03-20T09:30:00.000000Z",
"updated_at": "2025-03-21T12:45:22.000000Z"
}
}Exports all tasks for the authenticated user.
URL: GET /api/v1/tasks/export
Example Response:
{
"metadata": {
"version": "1.0",
"created_at": "2025-03-21T13:00:00.000000Z",
"user_id": 1,
"user_email": "user@example.com",
"task_count": 25
},
"tasks": [
{
"id": 1,
"title": "Complete API Documentation",
"desc": "Write comprehensive documentation for the Task API",
"due": "2025-03-25T12:00:00.000000Z",
"priority": "HIGH",
"completed": false,
"user_id": 1,
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"slug": "complete-api-documentation",
"created_at": "2025-03-21T12:00:00.000000Z",
"updated_at": "2025-03-21T12:00:00.000000Z"
},
// More tasks...
]
}Imports tasks from a backup.
URL: POST /api/v1/tasks/import
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
| data | object | Yes | Task backup data |
| data.metadata | object | Yes | Backup metadata |
| data.tasks | array | Yes | Array of task objects |
| duplicate_action | string | Yes | How to handle duplicates |
Duplicate Action Options:
skip- Skip tasks with duplicate UUIDsoverwrite- Overwrite tasks with duplicate UUIDskeep_both- Keep both by generating new UUIDs for imported tasks
Example Request:
{
"data": {
"metadata": {
"version": "1.0",
"created_at": "2025-03-20T13:00:00.000000Z",
"user_id": 1,
"user_email": "user@example.com",
"task_count": 3
},
"tasks": [
{
"title": "Imported Task 1",
"desc": "This is an imported task",
"due": "2025-04-01T09:00:00.000000Z",
"priority": "MEDIUM",
"completed": false,
"uuid": "b3c4d5e6-f7g8-5h6i-9j0k-1l2m3n4o5p6q"
},
// More tasks...
]
},
"duplicate_action": "skip"
}Example Response:
{
"message": "Tasks imported successfully",
"stats": {
"imported": 2,
"updated": 0,
"skipped": 1
}
}The API uses standard HTTP status codes to indicate the success or failure of requests.
200 OK- The request was successful201 Created- A resource was successfully created401 Unauthorized- Authentication is required403 Forbidden- The authenticated user doesn't have permission404 Not Found- The requested resource was not found422 Unprocessable Entity- Validation errors
{
"message": "The given data was invalid.",
"errors": {
"title": [
"The title field is required.",
"The title must be at least 5 characters."
],
"priority": [
"The selected priority is invalid."
]
}
}API requests are subject to rate limiting. If you exceed the limit, you'll receive a 429 Too Many Requests response.