Skip to main content
POST
/
comments
Create Comment
curl --request POST \
  --url https://api.example.com/comments \
  --header 'Content-Type: application/json' \
  --data '
{
  "body": "<string>",
  "filePath": "<string>",
  "lineNumber": 123,
  "pullRequestId": "<string>",
  "parentCommentId": 123
}
'
{
  "id": "<string>",
  "body": "<string>",
  "filePath": "<string>",
  "lineNumber": 123,
  "pullRequestId": "<string>",
  "userId": 123,
  "parentCommentId": "<string>",
  "resolved": true,
  "createdAt": "<string>",
  "updatedAt": "<string>"
}
Create a new comment on a pull request. Comments can be top-level or replies to existing comments using the parentCommentId field for threaded discussions.

Authentication

This endpoint requires JWT authentication. Include the JWT token in the Authorization header:
Authorization: Bearer <token>

Request Body

body
string
required
The content of the comment
filePath
string
required
The file path where the comment is being made
lineNumber
number
required
The line number in the file where the comment applies
pullRequestId
string
required
The ID of the pull request this comment belongs to
parentCommentId
number
The ID of the parent comment if this is a reply in a threaded conversation. Omit this field for top-level comments.

Response

id
string
The unique identifier for the comment
body
string
The content of the comment
filePath
string
The file path where the comment was made
lineNumber
number
The line number in the file
pullRequestId
string
The ID of the pull request
userId
number
The ID of the user who created the comment
parentCommentId
string
The ID of the parent comment if this is a reply
resolved
boolean
Whether this comment thread has been resolved (default: false)
createdAt
string
ISO 8601 timestamp of when the comment was created
updatedAt
string
ISO 8601 timestamp of when the comment was last updated

Example

curl -X POST https://api.diffy.com/comments \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "body": "This function could be optimized by caching the result",
    "filePath": "src/utils/processor.ts",
    "lineNumber": 42,
    "pullRequestId": "123456789"
  }'

Creating a threaded reply

curl -X POST https://api.diffy.com/comments \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "body": "Good catch! I'll add memoization here.",
    "filePath": "src/utils/processor.ts",
    "lineNumber": 42,
    "pullRequestId": "123456789",
    "parentCommentId": 1
  }'

Build docs developers (and LLMs) love