Skip to main content
Restores a previously soft-deleted post, making it visible again in the feed. Only the post owner can restore their own posts.

Endpoint

POST /api/posts/{id}/restore

Authentication

This endpoint requires authentication. Only the post owner can restore their post.

Path Parameters

id
long
required
The unique identifier (PostID) of the post to restore

Request Body

userName
string
required
The username of the account requesting restoration. Must be the post owner.

Request Example

curl -X POST https://api.example.com/api/posts/12345/restore \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "userName": "john_doe"
  }'

Response

Returns 204 No Content when the post is successfully restored. The following changes are made to the post:
  • isDeleted is set to false
  • DeletedAt is cleared (set to null)
The post becomes visible again in feeds and can be accessed through normal retrieval endpoints.

Error Responses

"This account does not exist"
Returned when the username in the request body is not found.
"This post does not exist"
Returned when no post exists with the specified ID.
"This user does not own the post"
Returned when the requesting user is not the owner of the post.
Returned when the post is not currently marked as deleted (i.e., attempting to restore a post that isn’t deleted).

Build docs developers (and LLMs) love