---
agentTools:
  projectIndex: https://uspacy.readme.io/llms.txt
---

# Update a comment

Updates the message content of an existing comment. Only the comment author or users with appropriate permissions can update a comment.

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "components": {
    "schemas": {
      "errorMessage": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        }
      },
      "Date": {
        "type": "number",
        "description": "timestamp in seconds",
        "default": 0,
        "example": 1654180120
      },
      "EntityTypes": {
        "oneOf": [
          {
            "type": "string",
            "enum": [
              "comment",
              "post",
              "task"
            ]
          },
          {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_\\-]+$"
          }
        ],
        "description": "Entity type name. You can use one of the predefined values (comment, post, task) or provide any custom string value matching the pattern.\n"
      },
      "CommentServiceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "example": 1
          },
          "entityType": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EntityTypes"
              },
              {
                "example": "post"
              }
            ]
          },
          "entityId": {
            "type": "integer",
            "format": "int64",
            "example": 1
          },
          "message": {
            "type": "string",
            "example": "Message comment"
          },
          "authorId": {
            "type": "string",
            "example": 1
          },
          "date": {
            "$ref": "#/components/schemas/Date"
          },
          "mentioned": {
            "$ref": "#/components/schemas/MentionedDto"
          },
          "notify": {
            "$ref": "#/components/schemas/NotifyDto"
          }
        }
      },
      "UpdateCommentServiceDto": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "example": "Message post"
          }
        }
      },
      "MentionedDto": {
        "type": "object",
        "properties": {
          "users": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "example": [
              32,
              85
            ]
          },
          "groups": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "example": [
              43,
              12,
              2
            ]
          },
          "departments": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "example": []
          }
        }
      },
      "NotifyDto": {
        "type": "object",
        "properties": {
          "users": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "example": [
              32,
              85
            ]
          },
          "groups": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "example": [
              43,
              12,
              2
            ]
          },
          "departments": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "example": []
          }
        }
      }
    },
    "responses": {
      "UnauthorizedError": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/errorMessage"
            }
          }
        }
      }
    }
  },
  "info": {
    "title": "Comments service",
    "description": "API for managing comments on various entities such as posts, tasks, and other content types. Supports threaded comments, mentions, reactions, and notifications.",
    "version": "1.0.0"
  },
  "tags": [
    {
      "name": "comments",
      "description": "Operations for managing comments on entities"
    }
  ],
  "servers": [
    {
      "url": "https://{domain}.uspacy.ua",
      "description": "Ukrainian server"
    },
    {
      "url": "https://{domain}.uspacy.eu",
      "description": "EU server"
    },
    {
      "url": "https://{domain}.uspacy.com.br",
      "description": "Brazilian server"
    },
    {
      "url": "https://{domain}.uspacy.com",
      "description": "International server"
    }
  ],
  "paths": {
    "/comments/v1/comments/{commentId}": {
      "patch": {
        "operationId": "CommentsController_updateComment",
        "summary": "Update a comment",
        "description": "Updates the message content of an existing comment. Only the comment author or users with appropriate permissions can update a comment.\n",
        "parameters": [
          {
            "in": "path",
            "name": "commentId",
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "required": true,
            "description": "The unique identifier of the comment to update",
            "example": 45
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Updated comment content",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCommentServiceDto"
              },
              "example": {
                "message": "Updated comment text with corrections."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Comment updated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommentServiceDto"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          }
        },
        "tags": [
          "comments"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 104,
      "1": 104,
      "2": 244,
      "3": 177,
      "4": 218,
      "5": 104,
      "6": 82,
      "7": 0,
      "8": 18,
      "9": 32,
      "10": 73,
      "11": 78
    }
  }
}
```