Skip to content
DocsAssistant from code

Guides

Assistant from code

Ask Taskloader's project assistant from your code: ask, wait for the answer with long-polling, read it, and apply or dismiss its suggested changes.

Updated View as Markdown

On this page

Every Taskloader project has an assistant that answers questions about the project ("What is overdue, and who owns it?", "How did last week go?") with text, numbers, charts and task lists, and can suggest changes that a person applies. This guide asks it from code.

ToYou need
AskThe assistant, projects:read and tasks:read scopes, and any role in the project. Without files:read, the answer is written without the names of files, nor hears earlier answers in the conversation that read them.
Read answers and conversationsassistant, projects:read and tasks:read as well, because answers quote the project. Conversations are private: each person sees only their own, and they are deleted when the person leaves the project or is removed from it. An answer that read file names needs files:read too, and every answer to a question asked in the app did: without it, get_assistant_message answers 403 insufficient_scope (its requiredScopes include files:read), and get_assistant_thread and list_assistant_messages leave such answers out (a page can hold fewer than limit).
Apply suggested changesassistant plus the scope of each change you apply (tasks:write, and comments:write for comments), and the editor role or above.
Dismiss suggestions, delete conversationsassistant.

Note To answer, the assistant sends the question and the project's data to Taskloader's AI provider, as it does in the app; the Privacy Policy lists exactly what. Questions count against the asker's allowance of 60 questions an hour, shared by the app and every key and connected app. One API key or connected app can ask at most 30 an hour (15 at once).

1. Ask

#
HTTP
POST /projects/{projectId}/assistant/questions
FieldMeaning
textThe question: 1 to 4,000 characters of plain text. Line breaks (stored as \n, a Windows \r\n counts once) and tabs are fine; other control characters answer 400 validation_failed.
threadIdContinue an earlier conversation (thr_…): the assistant sees what was said before. Leave it out to start a new one.
todayThe asker's date (YYYY-MM-DD), so "overdue" and "this week" mean what they expect.
timeZoneThe asker's IANA time zone, such as Europe/Berlin, when you do not send today.
taskKeyA task the question is about, such as TL-012.

Send an Idempotency-Key: a retried request then asks once, not twice.

curl https://taskloader.com/api/v1/projects/$PROJECT_ID/assistant/questions \
  -H "Authorization: Bearer $TASKLOADER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d "{\"text\":\"What is overdue, and who owns it?\",\"today\":\"$(date +%F)\"}" | tee message.json

Taskloader answers 202 Accepted at once, with the answer to wait for (a message with status: "queued"), a Location header pointing at it, and Retry-After: 2. The answer itself takes a few seconds.

HTTP
HTTP/1.1 202 Accepted
Content-Type: application/json
Location: /api/v1/assistant/messages/msg_0b6f1d2a8c9e4f00a1b2c3d4e5f60718
Retry-After: 2

{
  "object": "assistant_message",
  "id": "msg_0b6f1d2a8c9e4f00a1b2c3d4e5f60718",
  "threadId": "thr_0b6f1d2a8c9e4f00a1b2c3d4e5f60718",
  "projectId": "prj_0b6f1d2a8c9e4f00a1b2c3d4e5f60718",
  "role": "assistant",
  "status": "queued",
  "steps": [],
  "question": null,
  "answer": null,
  "proposal": null,
  "error": null,
  "model": "openai/gpt-6-luna",
  "usage": null,
  "createdAt": "2026-11-18T10:00:00.123Z",
  "completedAt": null
}

2. Wait for the answer

#

Read the message with wait=25. Taskloader holds the request until the answer is ready or failed, or 25 seconds pass, whichever comes first. Repeat until status is ready or failed.

curl "https://taskloader.com/api/v1/assistant/messages/$(jq -r .id message.json)?wait=25" \
  -H "Authorization: Bearer $TASKLOADER_API_KEY" \
  --max-time 40 | tee answer.json | jq '{status, answer, proposal}'

Taskloader checks for the answer every half second while it holds the request. While the answer is not ready, responses carry Retry-After: 2; without wait, poll no faster than that. Every read of a message counts against your search limit (120 a minute), with or without wait.

3. Read the answer

#

A ready message has an answer:

HTTP
HTTP/1.1 200 OK
Content-Type: application/json

{
  "object": "assistant_message",
  "id": "msg_0b6f1d2a8c9e4f00a1b2c3d4e5f60718",
  "threadId": "thr_0b6f1d2a8c9e4f00a1b2c3d4e5f60718",
  "projectId": "prj_0b6f1d2a8c9e4f00a1b2c3d4e5f60718",
  "role": "assistant",
  "status": "ready",
  "steps": [
    "Read the project",
    "Counted overdue tasks",
    "Wrote the answer"
  ],
  "question": null,
  "answer": {
    "title": null,
    "report": false,
    "blocks": [
      {
        "type": "text",
        "markdown": "Two tasks are overdue. TL-012 is the one to unblock first."
      },
      {
        "type": "metrics",
        "items": [
          {
            "label": "Overdue",
            "value": 2,
            "tone": "risk"
          }
        ]
      }
    ],
    "suggestions": [
      "Who has the most open tasks?"
    ],
    "asOf": "2026-11-18T10:00:09.456Z"
  },
  "proposal": {
    "summary": "Move the launch announcement forward",
    "status": "pending",
    "digest": "fypj2kPMwmILmn_PgaKh7xKt7SHYIPJzRlmmloEhZv0",
    "changes": [
      {
        "index": 0,
        "operation": "update_task",
        "preview": {
          "kind": "update",
          "task": {
            "number": 12,
            "key": "TL-012",
            "title": "Write the launch announcement",
            "ref": "northwind/website-launch/TL-012"
          },
          "fields": [
            {
              "field": "priority",
              "from": "Normal",
              "to": "High",
              "fromValue": "normal",
              "toValue": "high"
            }
          ],
          "links": []
        },
        "result": null
      }
    ]
  },
  "error": null,
  "model": "openai/gpt-6-luna",
  "usage": {
    "inputTokens": 5210,
    "outputTokens": 640
  },
  "createdAt": "2026-11-18T10:00:00.123Z",
  "completedAt": "2026-11-18T10:00:09.456Z"
}
FieldMeaning
titleA short heading, or null
blocksThe answer, as a list of typed blocks (below). Render the types you know and skip the rest.
reporttrue when the answer is a report, meant to be read, printed or shared on its own
suggestionsUp to three follow-up questions the person might ask next
asOfWhen the project data behind the answer was read
Block typeHolds
textmarkdown: paragraphs, lists, emphasis and links
metricsitems, each with a label, a number value, an optional hint and a tone (neutral, risk or good)
chartkind (bar, stacked, donut or line), a title, an optional caption, the palette in colors, and data to draw
tasksA title, the tasks it lists (key, title, status and the other fields a task row shows) and how many match in all, total
calloutA tone (insight, risk or success), a title and markdown
tableAn optional title, columns (headings) and rows (lists of text)

New block types may be added. Metric, chart and task-list blocks are computed by Taskloader from the project, so their numbers match what the API returns. Text and table blocks are written by the AI model: treat any figure in them as the model's reading of the project.

The message also has steps, what the assistant did while answering, each at most 80 characters ("Read the project", "Searched for “launch”", "Read TL-012", "Counted overdue tasks", "Prepared 2 changes", "Wrote the answer"); usage (inputTokens, outputTokens); and model. A failed message has an error and no answer.

4. Apply or dismiss suggested changes

#

When the asker is an editor, an answer can include a proposal: changes the assistant suggests, such as creating tasks, moving them or adding comments. Nothing changes until someone applies them. Answers to viewers never include one.

JSON
{
  "proposal": {
    "summary": "Raise the venue booking, comment on it, and move the press release to review.",
    "status": "pending",
    "digest": "fypj2kPMwmILmn_PgaKh7xKt7SHYIPJzRlmmloEhZv0",
    "changes": [
      {
        "index": 0,
        "operation": "update_task",
        "preview": {
          "kind": "update",
          "task": {
            "key": "TL-001",
            "ref": "northwind/website-launch/TL-001",
            "title": "Book the venue",
            "number": 1
          },
          "fields": [
            {
              "field": "priority",
              "from": "Normal",
              "to": "Urgent",
              "fromValue": "normal",
              "toValue": "urgent"
            }
          ],
          "links": []
        },
        "result": null
      },
      {
        "index": 1,
        "operation": "add_comment",
        "preview": {
          "kind": "comment",
          "task": {
            "key": "TL-001",
            "ref": "northwind/website-launch/TL-001",
            "title": "Book the venue",
            "number": 1
          },
          "message": "Raised: the launch depends on it."
        },
        "result": null
      },
      {
        "index": 2,
        "operation": "move_task",
        "preview": {
          "kind": "move",
          "task": {
            "key": "TL-002",
            "ref": "northwind/website-launch/TL-002",
            "title": "Draft the press release",
            "number": 2
          },
          "fields": [
            {
              "field": "status",
              "from": "Backlog",
              "to": "In review",
              "fromValue": "backlog",
              "toValue": "review"
            }
          ]
        },
        "result": null
      }
    ]
  }
}

Each change names the operation it will run and a preview to show the person. preview.kind is create, update, move, delete, comment or checklist. A field change carries from and to for people (labels, long text cut short) and fromValue and toValue in API values (status and priority names, mem_ ids, YYYY-MM-DD dates, text). Creates and updates also list the links they add to the task: once the change is applied, Taskloader fetches each of those pages for a preview, so show them to the person too.

Show the changes to the person and apply the ones they choose, by index. Send the proposal's digest back as proposalDigest: Taskloader then applies nothing unless the proposal is still exactly what the person saw.

curl "https://taskloader.com/api/v1/assistant/messages/$(jq -r .id message.json)/proposal/apply" \
  -H "Authorization: Bearer $TASKLOADER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d "{\"changes\":[0,2],\"proposalDigest\":\"$(jq -r .proposal.digest answer.json)\"}"
JSON
{
  "object": "proposal_result",
  "messageId": "msg_0b6f1d2a8c9e4f00a1b2c3d4e5f60718",
  "status": "applied",
  "results": [
    { "index": 0, "ok": true, "ref": "northwind/website-launch/TL-001", "version": 4 },
    {
      "index": 2,
      "ok": false,
      "code": "version_conflict",
      "detail": "TL-002 changed since this was proposed, so it was left as it is."
    }
  ]
}
  • changes lists 1 to 40 distinct indexes from the proposal, each smaller than its number of changes; anything else is 400 validation_failed. Changes you leave out cannot be applied later: one apply closes the proposal. Read back, they have result: null: they were not made.
  • Before applying anything, Taskloader checks that it is your own conversation, that you are an editor or above (403 forbidden_role otherwise), and that the key or app has the scope of every chosen change (403 insufficient_scope, whose requiredScopes lists them all). Then nothing is applied.
  • Each change is then applied on its own, through the same operation the API offers, and reports its own result (see below), so a suggestion never overwrites newer work.
  • A proposal is applied once. Applying it again, after it was dismissed, or while an apply is still running answers 409 proposal_closed, with proposalStatus. So does an apply whose proposalDigest is not the proposal's digest any more (proposalStatus: "pending"): nothing is applied; read the answer again and show the person its changes. A retried request with the same Idempotency-Key gets the first answer back once every chosen change has its result; while the changes are still being applied, it answers 409 idempotency_key_in_progress with Retry-After: 1. Retry with the same key, or read the message for each change's result.
  • If Taskloader runs into a problem on its side part way (a timeout, a database restart), the request answers 503 service_unavailable with Retry-After: 60, and Taskloader finishes the changes on its own within a minute or two: then read the message for each change's result, and never apply them again.
  • Applied changes show in task history as made "via Taskloader assistant, applied from" your key or app, for example "via Taskloader assistant, applied from API key “Weekly review”".

What each result means

#

A result is { "index": 0, "ok": true } (for a change to a task, with its ref and its new version, to send with the next change to it; comments and deletes have no version, and a key or app without tasks:read, which can only have applied comments, gets no ref, and a detail that says “the task” in place of its key), or ok: false with a code from the error reference and a detail to show the person. The codes you will meet most:

codeWhy the change was skipped
version_conflictSomeone changed the fields it would change since it was proposed ("TL-012 changed since this was proposed, so it was left as it is."), or, for a delete, changed the task at all ("…so it was not deleted."); or a checklist item it ticks, unticks or removes was renamed since ("TL-005’s checklist item “Outline” changed since this was proposed, so the checklist was left as it is.").
not_foundThe task was deleted meanwhile ("TL-005 no longer exists."), or the conversation was deleted while the changes were being applied ("The conversation was deleted while these changes were being applied, so this change was not made.").
checklist_item_not_foundA checklist item it names is gone ("TL-005 has no checklist item “Outline” any more.").
assignee_not_memberThe person it would assign has left the project.
invalid_tokenYour access was revoked before or while it ran.
forbidden_roleYour role in the project was lowered while the changes were applied.
internal_error, service_unavailableTaskloader ran into a problem on its side applying it, several times over a few minutes, so it was left undone or could not be confirmed (the detail says which). Make it as an ordinary task change if still wanted.
Any other codeSee the error reference, and show detail to the person.

A change whose task already holds the proposed values is reported ok.

To decline the suggestions, dismiss them: POST /assistant/messages/{messageId}/proposal/dismiss answers { "object": "proposal", "messageId": "msg_…", "status": "dismissed" }. A proposal that is not pending any more answers 409 proposal_closed.

Conversations

#

Pass the message's threadId with the next question to continue the conversation, in the same project (a conversation from another project answers 400 validation_failed on /threadId, naming its project): the assistant sees what was said before.

RequestReturns
GET /projects/{projectId}/assistant/threadsYour conversations in the project (never other people's), the most recently active first, each with its latestAnswer: id (msg_…), status and proposalStatus
GET /assistant/threads/{threadId}One conversation with its latest 20 messages, oldest first, and a messagesCursor for earlier ones
GET /assistant/threads/{threadId}/messagesIts messages, oldest first, or newest first with order=newest; pages of up to 100
DELETE /assistant/threads/{threadId}Deletes the conversation and answers { "object": "assistant_thread", "id": "thr_…", "title": "…", "deleted": true } (title is null for a key without projects:read and tasks:read); again, 404; while changes from it are being applied, 409 assistant_busy with that answer's messageId (delete it once they are done)

messagesCursor continues GET /assistant/threads/{threadId}/messages newest first. A cursor remembers its order, so you can leave order out with it; sending the opposite order answers 400 invalid_cursor.

Deleting a conversation does not give back questions from the hourly allowance.

Errors and limits

#
Status and codeMeaningWhat to do
409 assistant_busyThe assistant is still answering in this conversation, or two of your questions (in any conversation), or (deleting it) changes from it are being applied; messageId (msg_…) is that answer, when it is in this projectWait for that answer (GET /assistant/messages/{messageId}?wait=25), then ask again, or start a new conversation; to delete, try again once the changes are applied
429 assistant_hourly_limitThe person asked 60 questions in the last hour, across every appWait Retry-After seconds; tell the person
429 rate_limited with bucket: "assistant"This key or app asked its own hourly number of questions (30)Wait Retry-After seconds
503 assistant_unavailableThe assistant is not set up on this serverDo without it; retrying will not help
409 proposal_closedThe proposed changes were already applied, are being applied, or were dismissedRead the answer again to see each change’s result; the detail names changes that were not applied (and why) and changes that were not chosen (never made)
404 not_foundNo such conversation or message for you: conversations are privateCheck the id; list your conversations with GET /projects/{projectId}/assistant/threads

The limits page has the numbers. The hourly allowance is counted per person from the questions themselves, so deleting conversations does not reset it.