Skip to content

Create a canvas comment thread

POST
/projects/{projectId}/comment-threads
import { FloraClient } from '@flora-ai/flora';
const client = new FloraClient({ apiKey: process.env['FLORA_API_KEY'] });
const comment = await client.projects.comments.create({
projectId: '<projectId>',
body: '<body>',
x: 1,
y: 1,
});
console.log(comment);

Pins a new comment thread on the project canvas at x/y and posts the first message. Optionally attach the pin to a canvas node with node_id (UUID or short id such as n7; unknown short ids are rejected) and offset_x/offset_y. author chooses whether the comment is attributed to the credential’s user (user, the default) or to FLORA (flora). author=flora is reserved for Flora’s own FAUNA, Chat, and Create agents; customer API keys and MCP credentials receive forbidden. Generation review threads cannot be created here. Guests who can comment on the project can create threads; they do not need edit or generate permission. Mutating public API requests support an optional Idempotency-Key header for client retries; duplicate keys within two hours return idempotency_duplicate.

Error responses use the standard error body.

projectId
required

Project identifier

string
/^prj_\S+$/

Project identifier

Media type application/json
object
body
required

Plain-text comment body

string
>= 1 characters <= 10000 characters
x
required

Canvas X coordinate of the pin

number
y
required

Canvas Y coordinate of the pin

number
node_id

Attach the pin to this canvas node

string
>= 1 characters
offset_x

Horizontal offset from the node’s origin when node_id is set. Defaults to 0.

number
offset_y

Vertical offset from the node’s origin when node_id is set. Defaults to 0.

number
author

Who the comment is attributed to. user posts as the credential’s user. flora posts as FLORA, the product voice, and is accepted only from Flora’s own FAUNA, Chat, and Create credentials. Customer API keys and MCP credentials cannot use flora. Defaults to user.

string
Allowed values: user flora

Comment thread created.

Media type application/json
object
comment_thread_id
required

Comment thread identifier

string
/^cth_\S+$/
project_id
required

Project identifier

string
/^prj_\S+$/
workspace_id
required

Workspace identifier

string
/^ws_\S+$/
status
required

Whether the thread is still open

string
Allowed values: open resolved
resolved_at
required
Any of:
number
created_at
required

When the thread was created, as a Unix timestamp in milliseconds

number
last_comment_at
required
Any of:
number
comment_count
required

Number of live comments in the thread

integer
anchor
required

Where the thread is pinned. canvas is a pin on the project canvas. generation is a review thread on a generation.

string
Allowed values: canvas generation
generation_id

Public run id of the generation this review thread is pinned to. Absent on canvas threads.

string
/^run_\S+$/
position
required
object
x
required

Canvas X coordinate of the pin

number
y
required

Canvas Y coordinate of the pin

number
node_id

Canvas node the pin is attached to, when pinned to a node

string
preview
required
Any of:
object
comment_id
required

Comment identifier

string
/^cmt_\S+$/
body
required

Plain-text comment body

string
author
required
object
type
required

Author kind

string
Allowed values: user anonymous flora
name
required

Display name

string
profile_image_url

Author profile image URL

string format: uri
created_at
required

When the comment was created, as a Unix timestamp in milliseconds

number
messages
required

Live comments in the thread, oldest first

Array<object>
object
comment_id
required

Comment identifier

string
/^cmt_\S+$/
body
required

Plain-text comment body

string
author
required
object
type
required

Author kind

string
Allowed values: user anonymous flora
name
required

Display name

string
profile_image_url

Author profile image URL

string format: uri
created_at
required

When the comment was created, as a Unix timestamp in milliseconds

number
Example
{
"comment_thread_id": "cth_abc123",
"project_id": "prj_abc123",
"workspace_id": "ws_abc123",
"status": "open",
"anchor": "canvas",
"generation_id": "run_abc123",
"preview": {
"comment_id": "cmt_abc123",
"body": "Looks good — ship it.",
"author": {
"type": "user",
"name": "Ada Lovelace"
}
},
"messages": [
{
"comment_id": "cmt_abc123",
"body": "Looks good — ship it.",
"author": {
"type": "user",
"name": "Ada Lovelace"
}
}
]
}