Skip to content

API Reference

The TechDocsHub API allows developers to interact with tasks programmatically. All requests must be authenticated using an API token.

🔐 Authentication

All endpoints require authentication.

Pass your API token in the request header as follows:

Authorization: Bearer YOUR_TOKEN_HERE

Note: Replace YOUR_TOKEN_HERE with your actual access token.

If the token is missing or invalid, the server will respond with:

  • 401 Unauthorized – Missing or incorrect token
  • 403 Forbidden – Token is valid but does not have permission to access the resource

📥 Get All Tasks

Endpoint: GET /api/tasks

Headers:

Content-Type: application/json
Authorization: Bearer YOUR_TOKEN_HERE

Description:
Returns a list of all tasks in the authenticated user's workspace.

Query Parameters (optional):

  • status – Filter tasks by status. Values: To Do, In Progress, Done
  • priority – Filter tasks by priority. Values: Low, Medium, High
  • limit – Number of tasks to return (e.g., 10)
  • offset – Pagination offset (e.g., 20)

Example Request:

GET /api/tasks?status=In%20Progress&priority=High&limit=5
Authorization: Bearer YOUR_TOKEN_HERE

Success Response:

[
  {
    "id": "task-001",
    "title": "Design homepage",
    "description": "Create responsive homepage layout",
    "status": "To Do",
    "priority": "High",
    "due_date": "2025-07-10T00:00:00Z",
    "created_at": "2025-06-30T14:22:13Z",
    "updated_at": "2025-07-01T09:47:01Z"
  },
  {
    "id": "task-002",
    "title": "Fix login bug",
    "description": "Resolve token refresh issue",
    "status": "In Progress",
    "priority": "Medium",
    "due_date": null,
    "created_at": "2025-06-29T08:10:45Z",
    "updated_at": "2025-07-02T10:15:00Z"
  }
]

Status Code: 200 OK

Error Responses:

  • 401 Unauthorized – Missing or invalid access token
  • 403 Forbidden – Access denied to resource
  • 500 Internal Server Error – Server encountered an unexpected condition

📝 Create a New Task

Endpoint: POST /api/tasks

Headers:

Content-Type: application/json
Authorization: Bearer YOUR_TOKEN_HERE

Description:
Creates a new task in the authenticated user's workspace. Requires a valid JSON payload with task details.

Request Body:

{
  "title": "Write release notes",
  "description": "Cover all new features",
  "due_date": "2025-07-01",
  "priority": "High"
}

Field Descriptions:

  • title (string, required) – The title of the task.
  • description (string, optional) – Additional information about the task.
  • due_date (string, optional) – Deadline in YYYY-MM-DD format.
  • priority (string, optional) – Task priority. Accepted values: Low, Medium, High.

Success Response:

{
  "id": "task-003",
  "message": "Task created successfully."
}

Status Code: 201 Created

Error Responses:

  • 400 Bad Request – Invalid or missing fields in request body
  • 401 Unauthorized – Missing or invalid access token
  • 500 Internal Server Error – Server error during task creation

🔧 Update a Task

Endpoint: PATCH /api/tasks/{id}

Headers:

Content-Type: application/json
Authorization: Bearer YOUR_TOKEN_HERE

Description:
Updates one or more fields of the task with the specified ID. Fields not included in the request remain unchanged.

Path Parameters:

  • {id} (string, required) – The unique identifier of the task to update (e.g., task-002).

Request Body: (at least one field is required)

{
  "title": "Fix login bug ASAP",
  "description": "Update handling of expired tokens",
  "status": "Done",
  "priority": "High",
  "due_date": "2025-07-10"
}

Success Response:

{
  "id": "task-002",
  "message": "Task updated successfully."
}

Status Code: 200 OK

Error Responses:

  • 400 Bad Request – No valid fields provided or invalid data format
  • 401 Unauthorized – Missing or invalid access token
  • 404 Not Found – Task with the specified ID does not exist
  • 500 Internal Server Error – Unexpected error while updating the task

🗑️ Delete a Task

Endpoint: DELETE /api/tasks/{id}

Headers:

Authorization: Bearer YOUR_TOKEN_HERE

Description:
Permanently deletes the task with the specified ID from the authenticated user's workspace.

Path Parameters:

  • {id} (string, required) – The unique identifier of the task to delete (e.g., task-003).

Example Request:

DELETE /api/tasks/task-003
Authorization: Bearer YOUR_TOKEN_HERE

Success Response:

{
  "message": "Task deleted successfully."
}

Status Code: 200 OK

Error Responses:

  • 401 Unauthorized – Missing or invalid access token
  • 404 Not Found – Task with the specified ID does not exist
  • 500 Internal Server Error – Server error during task deletion

Note:
Deleting a task is permanent and cannot be undone.