Implementation:Langfuse Langfuse API Comments Schema
Appearance
| Knowledge Sources | |
|---|---|
| Domains | API, Comments |
| Last Updated | 2026-02-14 00:00 GMT |
Overview
Fern API definition for the comments API, enabling collaborative discussion on traces, observations, sessions, and prompts within Langfuse projects.
Description
This file defines the public API contract for managing comments under /api/public. Comments support markdown content (up to 5000 characters) and can be attached to different object types. The file contains three endpoints:
- POST /api/public/comments -- Create a new comment attached to a trace, observation, session, or prompt
- GET /api/public/comments -- List all comments with pagination and filtering by object type, object ID, or author
- GET /api/public/comments/{commentId} -- Get a single comment by its ID
The response types reference commons.Comment for the comment data model.
Usage
Developers reference this definition when:
- Building comment functionality into integrations or automation
- Generating SDK types for the comments API
- Adding new filterable fields or comment object types
- Understanding the comment attachment model across different Langfuse entities
Code Reference
Source Location
- Repository: Langfuse
- File: fern/apis/server/definition/comments.yml
- Lines: 1-73
Signature
service:
auth: true
base-path: /api/public
endpoints:
create:
docs: Create a comment. Comments may be attached to different object types
(trace, observation, session, prompt).
method: POST
path: /comments
request: CreateCommentRequest
response: CreateCommentResponse
get:
docs: Get all comments
method: GET
path: /comments
request:
name: GetCommentsRequest
query-parameters:
page: optional<integer>
limit: optional<integer>
objectType: optional<string>
objectId: optional<string>
authorUserId: optional<string>
response: GetCommentsResponse
get-by-id:
docs: Get a comment by id
method: GET
path: /comments/{commentId}
response: commons.Comment
I/O Contract
Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /api/public/comments | Create a comment attached to a trace, observation, session, or prompt |
| GET | /api/public/comments | List comments with optional filters (objectType, objectId, authorUserId) and pagination |
| GET | /api/public/comments/{commentId} | Get a specific comment by its unique ID |
Key Types
| Type Name | Description |
|---|---|
| CreateCommentRequest | Request body with projectId, objectType, objectId, content (markdown, max 5000 chars), and optional authorUserId |
| CreateCommentResponse | Response containing the created comment's id |
| GetCommentsResponse | Paginated list of commons.Comment objects with MetaResponse |
Usage Examples
# Create a comment on a trace
curl -X POST "https://cloud.langfuse.com/api/public/comments" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"projectId": "project-123",
"objectType": "trace",
"objectId": "trace-456",
"content": "This trace shows unexpected latency in the second generation step."
}'
# List comments for a specific trace
curl -X GET "https://cloud.langfuse.com/api/public/comments?objectType=trace&objectId=trace-456&page=1&limit=20" \
-H "Authorization: Bearer $API_KEY"
# Get a comment by ID
curl -X GET "https://cloud.langfuse.com/api/public/comments/comment-789" \
-H "Authorization: Bearer $API_KEY"
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment