Skip to main content

Ban Or Unban Post

POST /admin/post/:postId

Description

Toggles a post's banned status.

Request Parameters

Requires Authentication: true

Requires Admin Role: true

PATH PARAMS

NameTypeRequiredDescription
postIdstringYesMongoDB post ID.

BODY

NameTypeRequiredDescription
reasonstringNoBan or unban reason.

Success Response

{
"message": "johndoe's post from 2026-03-18T00:00:00.000Z banned successfully"
}

or

{
"message": "johndoe's post from 2026-03-18T00:00:00.000Z unbanned successfully"
}

Error Response

CodeDescription
401Missing or invalid access token
402User is not an admin
404Post not found
413Reason too long
500Server error