REST API Tasks - edmozley/freeitsm GitHub Wiki

โœ… REST API: Tasks

The complete usage guide for the Tasks (kanban) module of the REST API โ€” every URL, method, parameter and response shape, including moving cards on the board. Mirrors the interactive documentation at System โ†’ API โ†’ Documentation (with its live "Try it" tester).

[!NOTE] New to the API? The basics table on REST API: Tickets covers base URL, authentication, the response envelope, error codes, rate limits and PATCH semantics โ€” identical across all modules.

What's distinctive about Tasks:

๐Ÿ“‹ It's a board Tasks live in status columns ordered by board_position. POST /tasks/{id}/move is the kanban drag as an API call โ€” target column + 0-based position, re-packed automatically.
๐Ÿช† Subtasks are tasks A subtask is just a task with parent_task_id set. Lists return top-level tasks by default (each with done/total subtask counts); pass parent_task_id=N to list a task's children.
๐Ÿ”— Links respect company scope A task can link to a ticket, change or contract. Ticket, change (5.5.0) and parent-task links are validated against the key's company scope (one outside it is "unknown", exactly like one that does not exist), and a linked ticket's details only appear in responses when the key could read that ticket directly โ€” tighter than the UI.
๐Ÿท๏ธ Tags are curated Task tags are a managed list (Tasks โ†’ Settings) โ€” the API accepts existing names or ids and returns 422 for unknown ones rather than creating tags on the fly.
๐Ÿข Company-scoped Tasks belong to a company. A key sees and changes only tasks in its companies. (This page said tasks were install-wide until #181; they have been scoped since tasks gained companies.)
๐Ÿงพ History is recorded and served Every write through the API is recorded on the task's history (#181) - who, when, what - shown in the task window and the evidence report. Since #438 the API serves it too: GET /tasks/{id}/history, with the task_history.read permission (below).
๐Ÿ”’ Read only is enforced A key whose analyst has Read only access to Tasks is refused every write (403, code read_only).

๐Ÿš€ Quick start

Create a task from a monitoring runbook and walk it across the board:

B="https://your-server/api/v1"; K="Authorization: Bearer fitsm_โ€ฆ"

# 1. Create (lands at the end of the To Do column)
TASK=$(curl -s -X POST "$B/tasks" -H "$K" -H "Content-Type: application/json" -d '{
  "title": "Renew SSL certificate for portal",
  "priority": "High", "due_date": "2026-07-20",
  "tags": ["Security"]}' | jq -r '.data.id')

# 2. Drag it to the top of In Progress
curl -s -X POST "$B/tasks/$TASK/move" -H "$K" -H "Content-Type: application/json" \
  -d '{"status": "In Progress", "position": 0}'

# 3. Done โ†’ completed_at stamped, task.completed workflow fires
curl -s -X PATCH "$B/tasks/$TASK" -H "$K" -H "Content-Type: application/json" -d '{"status": "Done"}'

โœ… Tasks

๐ŸŸข GET /tasks โ€” list / board feed ย  ๐Ÿ”‘ tasks.read

Top-level tasks in board order by default. Every task carries its tags, subtasks: {total, done} counts and board_position โ€” enough to render a board.

Parameter Description
state open | closed | all (default all)
status / status_id One board column, by name (e.g. In Progress) or id
priority / priority_id By name or id
assigned_analyst_id / assigned_team_id Assignment filters ยท unassigned=true
ticket_id ยท change_id ยท contract_id Tasks linked to a record
company_id (5.5.0) One company's tasks, as on /tickets. The Default company includes tasks stored with no company; a company outside the key's list is 403
parent_task_id List the subtasks of this task (default: top-level only)
tag Only tasks carrying this tag (exact name)
q Search title and description
due_before / due_after YYYY-MM-DD bounds
overdue true = open tasks past their due date โฐ
sort board_position (default), created_at, updated_at, due_date, completed_at, title, id โ€” prefix - for descending
page / per_page Pagination โ€” default 1 / 25, max 100

The task shape:

{ "id": 45, "title": "Renew SSL certificate for portal", "description": null,
  "company":  { "id": 1, "name": "Default" },
  "status":   { "id": 2, "name": "In Progress", "is_closed": false, "colour": "#f59e0b" },
  "priority": { "id": 3, "name": "High", "colour": "#f59e0b" },
  "assigned_analyst": { "id": 1, "name": "Administrator" }, "assigned_team": null,
  "contractor": null, "contractor_contact": null,
  "start_date": null, "due_date": "2026-07-20", "estimate_hours": 4.5,
  "parent_task_id": null, "ticket_id": null, "change_id": null, "contract_id": null,
  "board_position": 0,
  "tags": ["Security"], "subtasks": { "total": 1, "done": 0 },
  "created_by": { "id": 1, "name": "Administrator" },
  "created_at": "2026-07-03T12:40:44Z", "updated_at": "2026-07-03T12:41:12Z",
  "completed_at": null }

company (5.5.0, #371) โ€” the company the task is in. A task stored with no company is in the Default company and is shown as it; null only on an install without companies set up.

estimate_hours (3.3.0) โ€” how long the task should take, in hours (up to two decimals, above 0, at most 9999; null = not estimated). Accepted on create and update, returned on every task.

๐Ÿ”ต POST /tasks โ€” create ย  ๐Ÿ”‘ tasks.create

Only title is required. Defaults To Do / Medium; the card is appended to the end of its status column. Returns 201.

Field Description
title โœ… Task title
description Details
status / status_id ยท priority / priority_id By name or id
assigned_analyst_id / assigned_team_id Assignment (both validated)
assigned_supplier_id / assigned_contact_id (3.3.0) A contractor: a supplier from Contracts doing the work, and optionally a person there. The contact must work for that supplier; a contact alone brings its supplier; null clears. Setting or changing either needs the key's analyst to have Contracts (403 otherwise). Read back as contractor / contractor_contact ({id, name} or null)
start_date / due_date YYYY-MM-DD
parent_task_id Create as a subtask of this task. It is always in the parent's company; (5.5.0) the parent must be within the key's company scope, and a company_id that is not the parent's is 422
company_id (5.5.0) The company to create it in, as on POST /tickets and /projects (tenant_id is the older name and still works; both naming different companies is 422). An unknown company is 422, one outside the key's list 403. Without it: the company of the linked ticket, change or parent task, else the Default company - or the key's own company when the key cannot reach Default
ticket_id / change_id / contract_id Link to a record โ€” validated; ticket and (5.5.0) change links must be within the key's company scope, and a task linked to either goes in that record's company (a company_id that disagrees is 422, as is a ticket and a change in two different companies)
tags Array of existing tag names or ids (422 for unknown)

๐ŸŸข GET /tasks/{id} โ€” get one ย  ๐Ÿ”‘ tasks.read

Everything in the list shape plus parent summary, the ordered subtask_list, comments, and linked_ticket / linked_change summaries (linked-ticket details only when the key's scope allows).

๐ŸŸ  PATCH /tasks/{id} โ€” update ย  ๐Ÿ”‘ tasks.update

Everything creatable is patchable except the company; null clears. (5.5.0) company_id / tenant_id naming another company is 422 โ€” move a task between companies in the app (right-click โ†’ Move to company), which applies the subtask and link rules; naming the company it is already in is accepted. Two behaviours worth knowing:

  • Closing: moving to a closed status (Done, Cancelled) stamps completed_at (kept if already set) and fires the task.completed workflow event; moving back to an open status clears it.
  • Tags: tags replaces the tag set.

๐Ÿ”ต POST /tasks/{id}/move โ€” move on the board ย  ๐Ÿ”‘ tasks.update

The kanban drag as an API call:

{ "status": "In Progress", "position": 0 }
  • status / status_id โ€” target column (omit to reorder within the current one)
  • position โ€” 0-based slot in the column (omit = end)

The whole column is re-packed transactionally, so positions stay dense and ordered.

[!NOTE] A move is announced like any status change (#266): when /move changes the status it fires task.status_changed, and task.completed when it lands in a closed status - so the people on the task are notified and workflows run, exactly as for PATCH. A move within the same column changes no status and fires nothing. (Before #266 neither /move nor the board's drag fired any event, and this page called that a deliberate parity quirk - it was a gap in both.)

๐Ÿ”ด DELETE /tasks/{id} โ€” delete ย  ๐Ÿ”‘ tasks.delete

[!WARNING] Permanent, no trash. The whole subtask tree, comments and tag links are removed with it. The response reports subtasks_deleted.


๐Ÿ”— What hangs off a task: related (#328, 5.4.0)

GET /tasks/{id} carries a related block, the same shape as a ticket's: counts of what is on the task, so you only call the sub-endpoints that are not 0, and links to what it is linked with.

"related": {
  "counts": { "comments": 3, "forms": 1, "checklists": 0 },
  "links": [
    { "type": "ticket",   "id": 990, "reference": "TKT-0990" },
    { "type": "project",  "id": 12,  "name": "Office move" },
    { "type": "task",     "id": 40,  "name": "Plan the move", "relation": "child_of" },
    { "type": "task",     "id": 44,  "name": "Order desks",   "relation": "parent_of" },
    { "type": "task",     "id": 38,  "name": "Sign lease",    "relation": "waits_on" },
    { "type": "task",     "id": 47,  "name": "Book movers",   "relation": "blocks" }
  ]
}
  • Links: the ticket it is for (its number - never its subject, which may be confidential), its change, contract and project, and other tasks from this task's point of view: its parent (child_of), subtasks (parent_of), what it waits for (waits_on) and what waits for it (blocks).
  • A count or link appears only if the key could read it itself: a key with tasks read alone gets no counts and no ticket link.
  • On GET /tasks it is opt-in with ?include=related, so a page of 100 does not run 100 sets of counts. The task's Full record webhook carries it too.

How it is built: REST API related records - Developer Guide.

๐Ÿ’ฌ Comments

๐ŸŸข GET /tasks/{id}/comments ย  ๐Ÿ”‘ task_comments.read

Comments oldest first, with the author.

๐Ÿ”ต POST /tasks/{id}/comments ย  ๐Ÿ”‘ task_comments.create

Body: {"text": "โ€ฆ"}. Attributed to the analyst the key acts as. Comments can't be edited or deleted (parity with the UI). Returns 201.


๐Ÿ“‹ Forms a task needs (#190)

A task - typically an occurrence of a repeating check - can need forms from the Forms module (Forms on tasks). These two let an integration see them and submit one against that occurrence: no submission numbers to copy, the same validation as the Forms page, and the submission linked to the task in the same transaction.

๐ŸŸข GET /tasks/{id}/forms ย  ๐Ÿ”‘ task_forms.read

Each form the task needs: id (the requirement - use it to submit), form_id (the exact form version), title, required, requirement (block | warn | optional), submission_id, submitted_by, submitted_at, has_draft, revision.

answers ([{field_id, question, answer, exception}]) is included only where the key's analyst may read them - access to Forms, or the role permission Read the form answers on tasks you can see - exactly as in the app. Otherwise the field is absent. exception is true for an answer the form marks as counting as an exception.

๐Ÿ”ต POST /tasks/{id}/forms/{task_form_id}/submissions ย  ๐Ÿ”‘ task_forms.create

{ "data": { "812": "Warning", "813": "Job 4 retried overnight" },
  "client_reference": "backup-2026-10-18" }
  • data - the answers, keyed by form field id (the field ids of the requirement's form version).
  • client_reference (recommended) - your own id for this submit, up to 64 characters. A retry with the same one returns the submission already made: 200, "replayed": true, and no second submission. A first submit answers 201.
  • revision (optional) - the revision you read from GET. If somebody has saved the form since, 409. Without it the current revision is used, which is right for an integration that is the only one filling the form in.
  • Submitting again replaces the earlier submission on the task; the earlier one is kept and recorded.
  • Refusals: 422 for a missing required answer or a bad value (the Forms validation), 404 for a requirement that is not on this task, 403 without the permission, or when the key's analyst has no Forms access or Read only Tasks.

Required forms are part of the task's completion check, so after this, completing the task over the API (PATCH its status, or /move to a closed column) is allowed.


โœ… Checklists (#273)

The checklists on a task, and answering their steps. The same shape as on tickets - since #271 tickets and tasks share one checklist engine, so an integration reads and answers a step the same way on either. Writes go through the same rules as the app: a step that asks for a value needs one, a step that asks for a result is answered rather than ticked, and a fail needs a note.

Empty while checklists on tasks are switched off (Tasks โ†’ Settings โ†’ Checklists), and a PATCH is then 422 disabled. Where Tasks โ†’ Settings โ†’ Evidence refuses changes to a completed task's checklist, a PATCH on a completed task is 422 checklist_locked. The change goes on the step's history, marked (via the API).

๐ŸŸข GET /tasks/{id}/checklists ย  ๐Ÿ”‘ task_checklists.read

{ "data": [ {
    "id": 31, "title": "New starter", "template_id": 4, "template_version": 3,
    "closure": "block", "steps_done": 1, "steps_total": 3,
    "steps": [
      { "id": 318, "title": "Asset tag", "description": null, "mandatory": true, "suggested_role": "Desktop",
        "asks_for": "value", "value_prompt": "The laptop's tag", "completed": true, "value": "AT-4471",
        "result": null, "note": null, "completed_by": "Sam Patel", "completed_at": "2026-11-11T10:02:00Z" },
      { "id": 319, "title": "Backups verified", "description": "Check last night's job.", "mandatory": true,
        "suggested_role": null, "asks_for": "result", "value_prompt": null, "completed": false, "value": null,
        "result": null, "note": null, "completed_by": null, "completed_at": null }
    ] } ] }
  • asks_for is how the step is answered: tick, value (a tick with a text answer) or result (pass, fail or na).
  • closure is what closing / completing does with mandatory steps still outstanding, after the company setting: warn (allowed, and recorded) or block (refused). A step with a result - including a fail - is not outstanding.

๐ŸŸ  PATCH /tasks/{id}/checklists/steps/{step_id} ย  ๐Ÿ”‘ task_checklists.update

Send either completed or result:

Body Does
{ "completed": true } Tick a tick step
{ "completed": true, "value": "AT-4471" } Tick a value step with its answer
{ "completed": false } Untick - clears the value and any result
{ "result": "pass" } / { "result": "na" } Answer a result step
{ "result": "fail", "note": "Job 42 failed overnight" } A fail, with what went wrong (required)

Returns the step as it now stands. Errors: 404 - the task or step does not exist, is outside the key's companies, or the step is on another task; 422 missing_field - a value or a fail's note is missing, or a result step was sent completed; 422 invalid_field - neither or both of completed and result, a completed that is not true / false, or an unknown result.


๐Ÿงพ History (#438)

What the task window's History tab shows, newest first - status changes, who completed it, date and assignee changes, title, description, priority, estimate, tag and link edits, scheduled work, comments and time logged, company moves. Contributed by @cloudcogsio in PR #457.

  • The same reader as the History tab (TaskHistory::forTask()), so anything the History tab gains appears here with no API change.
  • Its own permission, task_history.read (Task history on the key's permission list), the same as the ticket, problem and change audit endpoints. Existing keys do not get it until it is ticked.
  • Company scope as everywhere: a task outside the key's companies is 404, the same as one that does not exist.
  • Checklist step entries carry a step's result, value and exception note, so they are included only when the key also has task_checklists.read and Checklists is switched on - the same rule as GET /tasks/{id}/checklists.
  • Comments are one line, never their text, so no task_comments.read is needed.
  • A failed read is an error. A history table that Database Verification has not created yet is no entries; any other database error is a 500, never an empty list that looks like "nothing happened".
  • No paging. Up to the newest 500 entries of each of event, audit and step, plus every comment and time entry.

๐ŸŸข GET /tasks/{id}/history ย  ๐Ÿ”‘ task_history.read

{ "data": [
    { "at": "2026-11-30T14:05:00Z", "kind": "event", "type": "status_changed", "who": "Sam Patel",
      "actor_kind": "analyst", "from": "In Progress", "to": "Done", "detail": {}, "job_run_id": null },
    { "at": "2026-11-30T13:40:00Z", "kind": "read", "type": "comment_added", "who": "Sam Patel",
      "actor_kind": "analyst", "from": null, "to": null, "detail": { "comment_id": 812 }, "job_run_id": null },
    { "at": "2026-11-29T09:12:00Z", "kind": "event", "type": "description_changed", "who": "Alex Moore",
      "actor_kind": "analyst", "from": null, "to": null, "detail": { "revision": 57 }, "job_run_id": null }
] }
Field Meaning
at When, ISO 8601 UTC
kind Which record the entry came from: event (the task's history), audit (older audit rows - company moves, checklist overrides, calendar sync), step (a checklist step's change) or read (a comment or time entry read in from its own table)
type What happened, e.g. status_changed, completed, description_changed, time_logged, comment_added
who, actor_kind The person, and whether it was an analyst, a workflow, the API and so on
from, to The value before and after, where the change has one
detail Extra facts for the type - always an object, {} when there are none. A time_logged entry marked "as_now": true was read from the time entry as it stands today, because its original logging was never recorded
job_run_id The scheduled run that made the change, when one did

Errors: 403 without task_history.read; 404 - no such task, or one outside the key's companies.

๐ŸŸข GET /tasks/{id}/history/revisions/{revision} ย  ๐Ÿ”‘ task_history.read + tasks.read

A description change's text before and after - the History tab's View. The revision is the detail.revision of a description_changed entry. The text is the task's description, so the key also needs tasks.read, as GET /tasks/{id} does.

{ "data": { "id": 57, "at": "2026-11-29T09:12:00Z", "who": "Alex Moore",
            "before": "<p>Renew the certificate.</p>",
            "after": "<p>Renew the certificate and update the load balancer.</p>" } }

Errors: 403 without either permission; 404 - no such revision, a revision of another task, or a task outside the key's companies (none of the text is in the answer).


๐Ÿ“š Reference data

Under the shared ๐Ÿ”‘ reference.read permission:

Endpoint Returns
๐ŸŸข GET /task-statuses The board columns with is_closed, colour, display_order (seeded To Do โ†’ In Progress โ†’ Blocked โ†’ Done โ†’ Cancelled)
๐ŸŸข GET /task-priorities Low / Medium / High / Urgent (plus custom)
๐ŸŸข GET /task-tags The curated tag list with colours and usage counts

๐Ÿงช Worked example: sprint-bot standup report

A read-only key (tasks: read) posts a morning summary to your chat tool:

B="https://your-server/api/v1"; K="Authorization: Bearer fitsm_โ€ฆ"

# Overdue tasks by assignee
curl -s -H "$K" "$B/tasks?overdue=true&sort=due_date&per_page=100" \
  | jq -r '.data[] | "\(.due_date)  \(.assigned_analyst.name // "unassigned")  \(.title)"'

# Board totals per column
for s in "To Do" "In Progress" "Blocked"; do
  n=$(curl -s -H "$K" "$B/tasks?status=$(echo $s | sed 's/ /+/g')" | jq '.meta.total')
  echo "$s: $n"
done

And the automation direction โ€” a deployment pipeline creating a follow-up task with a subtask checklist:

P=$(curl -s -X POST "$B/tasks" -H "$K" -H "Content-Type: application/json" \
  -d '{"title":"Post-deploy checks for release 2.4","priority":"High","due_date":"2026-07-05"}' | jq -r '.data.id')
for step in "Smoke-test portal login" "Check error rates" "Confirm backups ran"; do
  curl -s -o /dev/null -X POST "$B/tasks" -H "$K" -H "Content-Type: application/json" \
    -d "{\"title\": \"$step\", \"parent_task_id\": $P}"
done

Under the hood: REST API โ€” How It Works ยท Other modules: Tickets ยท Assets ยท Problems ยท Changes ยท Knowledge ยท Keys & permissions: System โ†’ API (System module) ยท Module docs: Tasks.

Related