Skip to main content

PATCH /api/posts/[id]

Updates a post. Only the post owner can update it. All fields are optional.
Requires authentication. Owner only.

Request Body

Same fields as Create Post, all optional. Images cannot be updated after creation.

Response (200)

{
  "message": "Post updated successfully",
  "post": { ... }
}

Errors

StatusCodeReason
400VALIDATION_ERRORInvalid fields
401UNAUTHORIZEDNot authenticated
403FORBIDDENNot the post owner
404NOT_FOUNDPost not found