Skip to main content

Overview

The Tasks API allows you to manage individual tasks within work orders. Tasks represent specific work items that need to be completed as part of a work order.

Endpoints

List Tasks

Retrieve tasks for a work order.
GET /api/v1/work-orders/{work_order_id}/tasks
Query Parameters:
ParameterTypeDescription
statusstringFilter by status
technician_idstringFilter by assigned technician
Example Request:
curl -X GET "https://api.fentu.io/v1/work-orders/wo-12345/tasks" \
  -H "Authorization: Bearer YOUR_API_KEY"
Example Response:
{
  "data": [
    {
      "id": "task-001",
      "name": "Inspect HVAC filters",
      "description": "Check and document filter condition",
      "status": "completed",
      "technician": {
        "id": "tech-001",
        "name": "Jane Doe"
      },
      "started_at": "2024-01-27T09:30:00Z",
      "completed_at": "2024-01-27T09:45:00Z",
      "duration": 15
    },
    {
      "id": "task-002",
      "name": "Replace filters",
      "status": "pending",
      "parts_required": [
        {
          "part_id": "part-001",
          "name": "Air Filter 20x25",
          "quantity": 2
        }
      ]
    }
  ]
}

Get Task

Retrieve a single task.
GET /api/v1/tasks/{id}
Example Response:
{
  "data": {
    "id": "task-001",
    "work_order_id": "wo-12345",
    "name": "Inspect HVAC filters",
    "description": "Check and document filter condition",
    "status": "completed",
    "sequence": 1,
    "estimated_duration": 15,
    "actual_duration": 15,
    "technician": {
      "id": "tech-001",
      "name": "Jane Doe"
    },
    "checklist": {
      "id": "checklist-001",
      "name": "Filter Inspection"
    },
    "parts_used": [
      {
        "part_id": "part-001",
        "name": "Air Filter 20x25",
        "quantity": 1
      }
    ],
    "notes": "Filter was heavily clogged",
    "photos": [
      {
        "id": "photo-001",
        "url": "https://..."
      }
    ],
    "started_at": "2024-01-27T09:30:00Z",
    "completed_at": "2024-01-27T09:45:00Z"
  }
}

Create Task

Add a task to a work order.
POST /api/v1/work-orders/{work_order_id}/tasks
Request Body:
{
  "name": "Install new thermostat",
  "description": "Remove old thermostat and install new smart thermostat",
  "estimated_duration": 45,
  "technician_id": "tech-001",
  "checklist_id": "checklist-002",
  "parts": [
    {
      "part_id": "part-002",
      "quantity": 1
    }
  ]
}
Example Request:
curl -X POST "https://api.fentu.io/v1/work-orders/wo-12345/tasks" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Install new thermostat",
    "estimated_duration": 45
  }'

Update Task

Update a task.
PUT /api/v1/tasks/{id}
Request Body:
{
  "status": "completed",
  "actual_duration": 40,
  "notes": "Installation completed successfully",
  "parts_used": [
    {
      "part_id": "part-002",
      "quantity": 1
    }
  ]
}

Delete Task

Remove a task from a work order.
DELETE /api/v1/tasks/{id}

Complete Task

Mark a task as completed.
POST /api/v1/tasks/{id}/complete
Request Body:
{
  "notes": "Task completed successfully",
  "photos": ["photo-base64-data"],
  "parts_used": [
    {
      "part_id": "part-001",
      "quantity": 2
    }
  ],
  "checklist_responses": [
    {
      "item_id": "item-001",
      "response": true
    }
  ]
}

Task Statuses

StatusDescription
pendingNot yet started
in_progressCurrently being worked on
completedSuccessfully finished
skippedNot performed (with reason)
blockedCannot proceed (waiting on something)

Task Line Items

Tasks can have associated line items for billing:

List Line Items

GET /api/v1/tasks/{task_id}/line-items

Add Line Item

POST /api/v1/tasks/{task_id}/line-items
Request Body:
{
  "type": "labor",
  "description": "Installation labor",
  "quantity": 1,
  "unit_price": 75.00,
  "tax_rate": 0.08
}

Error Responses

CodeDescription
400Bad request - invalid parameters
401Unauthorized
403Forbidden - insufficient permissions
404Task or work order not found
422Validation error

Work Orders API

Work order endpoints

Tasks

Task user guide

Authentication

API authentication

Parts API

Parts management