---
title: "Post a new comment / discussion message to a task. Supports plain comments, internal notes, replies to existing messages, and file attachments."
method: POST
path: "/api/TaskDiscussion"
tags: ["TaskDiscussion"]
---

# Post a new comment / discussion message to a task. Supports plain comments, internal notes, replies to existing messages, and file attachments.

`POST /api/TaskDiscussion`

To attach files, first upload each file via POST /api/FileAttachment (without a LinkTo) — that returns a FileAttachmentID with AttachmentType='Draft'. Then pass those IDs in FileAttachmentIDs here. Each ID must be owned by the current user and not already linked to another entity. Maximum 8 attachments per message; ResponseBody is capped at 16,000 characters.
            
To @mention a user — which notifies them and adds them as a follower of the task — embed a mention span in ResponseBody. The span MUST carry a class attribute immediately before data-mentionid, e.g.
&lt;span class="mention" data-mentionid="12345"&gt;@Firstname Lastname&lt;/span&gt;.
The class attribute is required: a span with only data-mentionid (no class) is stored as plain text and is NOT parsed as a mention, so the user is neither notified nor followed. Resolve the numeric user id via GET /api/User. Repeat the span to mention multiple users.

## Request body

- NewTaskDiscussion — Request payload for posting a new comment / discussion message to a task. Use POST /api/FileAttachment first to upload any attachments and pass the resulting FileAttachmentIDs here.
  - `TaskID` integer — The TaskID to post the discussion message to. Required.
  - `ResponseBody` string — The message body. May contain a limited HTML subset (sanitised on save). Required unless FileAttachmentIDs is non-empty. To @mention a user (notifies them and adds them as a task follower), include a span that carries a class attribute immediately before data-mentionid, e.g. &lt;span class="mention" data-mentionid="12345"&gt;@Firstname Lastname&lt;/span&gt;. The class attribute is required — a span with data-mentionid but no class is stored as plain text and is NOT treated as a mention. Resolve the numeric user id via GET /api/User.
  - `isInternalNote` boolean — True to post as an internal note (not visible to external/customer users). Only team members may post internal notes. Default: false.
  - `ReplyToMessageID` integer — Optional. The TaskResponseID of an existing message on the same task being replied to. Set null/0/omit for a top-level message.
  - `FileAttachmentIDs` integer[] — Optional. List of FileAttachmentIDs returned from prior /api/FileAttachment uploads to attach to this message. Each must be owned by the current user and not already linked (AttachmentType='Draft'). Maximum 8 per message.

## Response `200`

The newly created discussion message in the same shape used inside the Get TaskDiscussion responses[] array.

- TaskDiscussionResponse — A single message in a task discussion, including author, body text, timestamps, attachments, and reply context.
  - `TaskResponseID` integer — Unique identifier for this discussion message.
  - `CreatedByName` string — Display name of the message author.
  - `isActive` boolean — Whether this message is active (not deleted).
  - `CreatedByUserIDFK` integer — User ID of the message author.
  - `ResponseBody` string — The message content (may contain HTML).
  - `DateCreatedString` string — Formatted creation date string.
  - `canDelete` boolean — Whether the current user can delete this message.
  - `canEdit` boolean — Whether the current user can edit this message (author + not system + active membership).
  - `attachments` TaskDiscussionResponseAttachment[] — List of file attachments on this message.
    - `FileAttachmentID` integer — Unique identifier for the file attachment.
    - `Filename` string — Storage filename of the attachment.
    - `DateCreatedString` string — Formatted creation date of the attachment.
    - `provider` string — Storage provider code for the attachment.
    - `FileExtension` string — File extension (e.g. '.pdf', '.png').
    - `PublicFileURL` string — Public URL to download the attachment.
    - `PreviewURL` string — URL for a preview/thumbnail of the attachment.
    - `CanPreview` boolean — Whether a preview is available for this attachment.
    - `Type` string — MIME type or category of the attachment.
    - `URL` string — Direct URL to the attachment.
    - `Preview` string — Preview image URL.
    - `Name` string — Attachment name.
    - `Size` string — File size in human-readable format.
  - `isInternalNote` boolean — Whether this is an internal note (not visible to external contacts).
  - `Unread` string — Whether this message is unread by the current user.
  - `isSystem` boolean — Whether this is a system-generated message (e.g. status change notification).
  - `isEdited` boolean — True if the author has edited this message after posting; drives the (edited) UI indicator.
  - `DateLastEditedUtc` string, date-time — Timestamp (UTC) of the most recent user edit. Null if never edited. Distinct from DateUpdated.
  - `ReplyToMessageID` integer — The message ID this is a reply to, if any.
  - `ReplyToDateCreated` string, date-time — Creation date of the message being replied to.
  - `ReplyToCreatedByUserIDFK` integer — User ID of the author of the message being replied to.
  - `ReplyToUserName` string — Author name of the message being replied to.
  - `ReplyToBody` string — Body of the message being replied to.
  - `ReplyToFileID1` integer
  - `ReplyToFilePreview1` string
  - `ReplyToFileProvider1` string
  - `ReplyToFileName1` string
  - `ReplyToFileType1` string

---

[API](https://skmtc.net/avaza/apis/avaza-api-documentation.md) · [All operations](https://skmtc.net/avaza/apis/avaza-api-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/avaza/avaza-api-documentation/versions/1eeadf750514/schema)
