Skip to main content
POST
Add Comment Annotations
Use this API to add comment annotations to a document within an organization.
  • You can add comments on an element, text or page.
  • You can provide HTML or text content.
  • Additional filters can be applied using location IDs.

Endpoint

POST https://api.velt.dev/v2/commentannotations/add

Headers

string
required
Your API key.
string
required

Body

Params

object
required

Example Requests

Add comment annotation by organizationId, documentId and location

Add comment annotation with user tagging

In this example, {{user_sarah_chen}} in the commentText will be replaced with “Sarah Chen” on the frontend, displaying as “Hey Sarah Chen, can you review this color scheme? I think we should use a darker shade for better contrast.”

Add comment annotation with permission verification

When verifyUserPermissions is enabled, the API verifies the user has access to the document before creating the comment annotation. If verification fails, the request will be rejected.

Add comment annotation with activity tracking

Add comment annotation with access context

Add an agent suggestion (finding)

Set type: "suggestion" and attach an agent block to the root comment (commentData[0]). The server generates the annotation-level agent block and stamps sourceType: "agent".
To attach a finding from an agent run through your own framework, use agentSource: "external" and supply your own agentName and agentId (executionId is optional):

Add a suggestion with a proposed-change payload

Set type: "suggestion" and attach a suggestion object describing what should change. The server persists the payload verbatim and stamps suggestion.status: "pending"; any caller-supplied status is dropped. Additional custom fields inside suggestion are stored as-is.

Add a private (restricted) comment annotation

Use visibility to limit who can see the annotation.

Response

data is a map of results, keyed per annotation, not an array.

Success Response

Result fields

boolean
Outcome for this annotation. The envelope reports success only when every entry succeeded and no user was permission denied.
string
The annotation ID. annotationId is optional on input, so the server generates one when you do not supply it.
number[]
IDs of the comments created inside this annotation.
string
Success message, or the reason this annotation failed.
string
Agent annotations only. Echoes back commentData[0].agent.reason.findingId exactly as you sent it. The field is omitted for non-agent annotations.

Correlating results back to your own records

Read entry.annotationId from each result, never the map key. The server generates annotationId, and results are written into the map as each write completes, so the map order does not match the order you submitted. For agent annotations, findingId is the reliable way to match a created annotation back to the record it came from. Entries for annotations rejected by permission checks are recorded before an ID exists. When you did not supply an annotationId for one of those, its key falls back to __velt_denied:<index>, where <index> is its position in the commentAnnotations array you sent, and the entry has no annotationId field to read. That key is reserved: annotation IDs cannot contain a colon, so it never collides with one of yours.

Failure Response

When some annotations fail or a user is permission denied, the error carries the same per-annotation map in details. Entries marked "success": true inside details were created, so treat a failed request as a partial write and read details instead of assuming nothing was saved.