Comments
The Comments API allows you to create, list, retrieve, and delete comments on files and folders in an Egnyte domain. Comments can also be referred to as notes.
Base URL
https://{domain}.egnyte.com/pubapi/v1/notes
Authentication
All requests require an OAuth 2.0 Bearer token in the Authorization header:
Authorization: Bearer {access_token}
See Authentication for details on obtaining a token.
Add a Comment
Create a new comment on a file or folder.
Request
POST /pubapi/v1/notes
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Path to the file or folder where the comment should be added |
body | string | Yes | The text of the comment |
Example Request
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/notes" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "path": "/Shared/Documents/form.docx", "body": "Test comment" }'
Response
200 OK
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier (UUID) for the comment |
message | string | The text of the comment |
username | string | Username of the comment author |
can_delete | boolean | Whether the current user can delete this comment |
creation_time | string | ISO 8601 timestamp of when the comment was created |
formatted_name | string | Display name of the comment author |
file_path | string | Path to the file or folder the comment is attached to |
group_id | string | Unique identifier for the associated group |
Example Response
{
"id": "4fbba2ef-fb2f-4c54-9392-116f07e39b97",
"message": "Test comment",
"username": "asmith",
"can_delete": true,
"creation_time": "2016-05-18T17:56:39.975+0000",
"formatted_name": "Anna Smith",
"file_path": "/Shared/Documents/testdoc.docx",
"group_id": "628ceb16-b9a0-49f8-a0e4-72b729708f71"
}
List Comments
List all comments for a given file or folder. Administrators can omit the file parameter to list all comments for the domain.
Request
GET /pubapi/v1/notes
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
file | string | No | — | URL-encoded path to the file or folder. If omitted, returns all comments for the domain (admin only) |
start_time | string | No | — | Return comments created after this time (ISO 8601 format). Must be less than end_time if both are provided |
end_time | string | No | — | Return comments created before this time (ISO 8601 format) |
count | integer | No | 25 | Number of results to return (max: 100) |
offset | integer | No | 0 | Zero-based index for pagination |
Note: Dates and times must be in ISO 8601 format. For example, 2012-05-27T22:27:01Z represents 10:27:01 PM on May 27, 2012.
Example Request
curl -i -X GET "https://{domain}.egnyte.com/pubapi/v1/notes?file=%2FShared%2FDocuments%2Fform.docx&count=50" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response
200 OK
| Field | Type | Description |
|---|---|---|
count | integer | Number of comments returned in this response |
offset | integer | Zero-based offset used for this request |
total_results | integer | Total number of comments matching the query |
notes | array | Array of comment objects (see Add a Comment response for object structure) |
Example Response
{
"count": 2,
"offset": 0,
"notes": [
{
"id": "4fbba2ef-fb2f-4c54-9392-116f07e39b97",
"message": "Test comment",
"username": "asmith",
"can_delete": true,
"creation_time": "2016-05-18T17:56:39.975+0000",
"formatted_name": "Anna Smith",
"file_path": "/Shared/Documents/testdoc.docx",
"group_id": "628ceb16-b9a0-49f8-a0e4-72b729708f71"
},
{
"id": "a7a809d3-1c2f-4dd0-8b65-3f2c78eac4c8",
"message": "Test comment 2",
"username": "asmith",
"can_delete": true,
"creation_time": "2016-05-18T18:06:26.000+0000",
"formatted_name": "Anna Smith",
"file_path": "/Shared/Documents/testdoc.docx",
"group_id": "628ceb16-b9a0-49f8-a0e4-72b729708f71"
}
],
"total_results": 2
}
Show Comment
Retrieve the details for a specific comment.
Request
GET /pubapi/v1/notes/{uuid}
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
uuid | string | Yes | The unique identifier for the comment |
Example Request
curl -i -X GET "https://{domain}.egnyte.com/pubapi/v1/notes/a7a809d3-1c2f-4dd0-8b65-3f2c78eac4c8" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response
200 OK
Returns a single comment object. See Add a Comment response for field descriptions.
Example Response
{
"id": "a7a809d3-1c2f-4dd0-8b65-3f2c78eac4c8",
"message": "Test comment 2",
"username": "asmith",
"can_delete": true,
"creation_time": "2016-05-18T18:06:26.000+0000",
"formatted_name": "Anna Smith",
"file_path": "/Shared/Documents/testdoc.docx",
"group_id": "628ceb16-b9a0-49f8-a0e4-72b729708f71"
}
Delete Comment
Delete a specific comment.
Request
DELETE /pubapi/v1/notes/{uuid}
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
uuid | string | Yes | The unique identifier for the comment to delete |
Example Request
curl -i -X DELETE "https://{domain}.egnyte.com/pubapi/v1/notes/a7a809d3-1c2f-4dd0-8b65-3f2c78eac4c8" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response
200 OK
The comment was successfully deleted. No response body is returned.
Error Codes
| Status | Error | Description | Resolution |
|---|---|---|---|
| 400 | Bad Request | Unparsable JSON in request body | Verify JSON syntax is valid |
| 400 | Bad Request | Unsupported JSON property in request | Only include path and body fields when adding a comment |
| 401 | Unauthorized | Invalid or expired token | Refresh your OAuth token and ensure you are logged in |
| 403 | Forbidden | Insufficient permissions on the file or folder | Verify you have read/write access to the resource |
| 404 | Not Found | Comment does not exist | Verify the comment UUID is correct |
| 500 | Internal Server Error | Unexpected server error | Retry the request after a brief delay |
Code Examples
POST /pubapi/v1/notes/{comment_id}
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/notes/{comment_id}" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "path": "/Shared/Documents/form.docx", "body": "Test comment" }'
GET /pubapi/v1/notes/{comment_id}?file=%2FShared%2FDocuments%2Fform.docx
curl -i -X GET "https://{domain}.egnyte.com/pubapi/v1/notes/{comment_id}?file=%2FShared%2FDocuments%2Fform.docx" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
GET /pubapi/v1/notes/{comment_id}
curl -i -X GET "https://{domain}.egnyte.com/pubapi/v1/notes/{comment_id}" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
DELETE /pubapi/v1/notes/{comment_id}
curl -i -X DELETE "https://{domain}.egnyte.com/pubapi/v1/notes/{comment_id}" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Related Resources
- Authentication — How to obtain and refresh OAuth tokens
- File System API — Manage files and folders that comments are attached to
- Best Practices — Rate limiting, pagination, and error handling
