Skip to main content

Edit Post

PUT /post/:postId​

Description​

Updates a post owned by the authenticated user. You can change text, privacy, emotion, and attached media.

Request Parameters​

Requires Authentication: true​

PATH PARAMS​

NameTypeRequiredDescription
postIdstringYesMongoDB post ID.

BODY (multipart/form-data)​

NameTypeRequiredDescription
datastringNoNew post text.
privacystringNopublic, private, close friends, or close_friends.
emotionnumberNoInteger from 0 to 100.
filesfile[]NoNew media to add, up to the route upload limit.
keepMediaIdsstring[]NoIDs of media that should remain attached to the post.

Usage Example​

const formData = new FormData()
formData.append("data", "Edited text")
formData.append("keepMediaIds", JSON.stringify(["66ca560de464036ce909f08b"]))

await axios.put("https://api.daykeeper.app/post/66ca560de464036ce909f08a", formData, {
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "multipart/form-data",
},
})

Success Response​

{
"message": "post updated successfully"
}

Error Response​

CodeDescription
400Invalid data, privacy, or emotion
401Missing or invalid access token
404Post not found
413Text too long
500Server error