[POST] status-logs

POST /api/v1/tasks/{task_id}/status-logs

A status log records a transition of a task between workflow statuses. It allows tracking of a task’s lifecycle and performance over time.

This endpoint inserts status change logs for a specific task. The task and its statuses must already exist.

URL Parameter:

  • task_id (string): ID of the task in Leanmote (not the external tool ID)

Required Body Parameters:

  • status_logs (array): list of status log objects, each containing:
    • task_app_id (string): unique identifier of the task in the external tool
    • status_index (string): current status ID from the external tool
    • status_name (string): current status name
    • log_date (string): UTC timestamp of when the status change occurred

Optional Parameters:

  • previous_status_index (string): ID of the previous status (if applicable)
  • previous_status_name (string): name of the previous status

If optional parameters are not provided, the system assumes it’s the first status log for that task.

Example Request:

{
  "status_logs": [
    {
      "task_app_id": "TASK-001",
      "status_index": "1abc",
      "status_name": "Backlog",
      "log_date": "2024-01-20 09:00:00"
    },
    {
      "task_app_id": "TASK-002",
      "status_index": "2abc",
      "status_name": "In Progress",
      "previous_status_index": "1abc",
      "previous_status_name": "Backlog",
      "log_date": "2024-01-25 14:30:00"
    },
    {
      "task_app_id": "TASK-002",
      "status_index": "4abc",
      "status_name": "Done",
      "previous_status_index": "3abc",
      "previous_status_name": "Paused",
      "log_date": "2024-01-30 14:30:00"
    }
  ]
}

Example Response:

{
  "status": "success",
  "message": "Status logs processed successfully",
  "data": {
    "processed_logs": [
      {
        "task_app_id": "TASK-001",
        "status_index": "1abc",
        "log_date": "2024-01-20 09:00:00",
        "action": "created",
        "log_id": 201
      },
      {
        "task_app_id": "TASK-002",
        "status_index": "2abc",
        "log_date": "2024-01-25 14:30:00",
        "action": "skipped (duplicate)"
      }
    ]
  }
}

Validations:

  • ✅ Task must exist
  • ✅ Task must belong to an organization within token scope
  • ✅ Status must exist in the project
  • ✅ Date format must be valid (UTC)
  • ✅ Duplicates are automatically detected and skipped
  • ✅ All required fields must be present

Error Codes:

  • 400: Invalid input data
  • 401: Invalid or missing token
  • 403: Organization out of token scope
  • 404: Task or status not found
  • 500: Internal server error