---
title: "Update a comment"
method: PATCH
path: "/posts/{postId}/comments/{commentId}"
tags: ["Comments"]
---

# Update a comment

`PATCH /posts/{postId}/comments/{commentId}`

Update an existing comment to correct or revise it

## Path parameters

- `postId` string, uuid, required
- `commentId` string, uuid, required

## Request body

- UpdateCommentRequest
  - `username` string, required — Username of the comment author (for validation)
  - `content` string, required — Updated content of the comment

## Response `200`

Comment updated successfully

- Comment
  - `id` string, uuid, required — Unique identifier for the comment
  - `postId` string, uuid, required — ID of the post this comment belongs to
  - `username` string, required — Username of the comment author
  - `content` string, required — Content of the comment
  - `createdAt` string, date-time, required — Timestamp when the comment was created
  - `updatedAt` string, date-time, required — Timestamp when the comment was last updated

## Other responses

- `400` — Bad request - invalid input or validation error
- `404` — Resource not found
- `500` — Internal server error

## Changes

- **2026-07-17** `41c89b420e85` — 6 breaking, 1 info
  - added the new path request parameter `commentId`
  - added the new path request parameter `postId`
  - the `content` response property's maxLength was increased from `500` to `1000` for the response status `200`
  - the `details` response's property type changed from `object` to `array` for status `400`
  - …3 more
- **2025-05-30** `2775bd09f55e` — 4 breaking, 3 warning, 6 info
  - added the new required request property `username`
  - the `content` request property's minLength was increased from `0` to `1`
  - the `id` response's property type changed from `integer` to `string`, and format from no format to `uuid` for status `200`
  - the `postId` response's property type changed from `integer` to `string`, and format from no format to `uuid` for status `200`
  - …9 more
- **2025-05-30** `dbaf42ae4311` — 11 breaking, 4 warning, 1 info
  - for the `path` request parameter `commentId`, the type changed from `string` to `integer`, and format from `uuid` to no format
  - for the `path` request parameter `postId`, the type changed from `string` to `integer`, and format from `uuid` to no format
  - the `content` response property's maxLength was unset from `1000` for the response status `200`
  - the `username` response property's maxLength was unset from `50` for the response status `200`
  - …12 more

[Change history](https://skmtc.dev/azure/apis/simple-social-media-api/changes/posts/:postId/comments/:commentId/patch.md)

---

[API](https://skmtc.dev/azure/apis/simple-social-media-api.md) · [All operations](https://skmtc.dev/azure/apis/simple-social-media-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/azure/simple-social-media-api/revisions/41c89b420e85/schema)
