Skip to main content
Retrieves detailed information about a specific post, including the post content, media, comments, and engagement metrics. The response includes information about whether the viewing user has saved the post and handles blocking relationships.

Endpoint

GET /api/posts/{id}

Authentication

This endpoint does not require authentication, but may return different results for authenticated users.

Path Parameters

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

Request Body

userName
string
Optional username of the viewing user. Used to determine if the post is saved by this user and to check blocking relationships.

Request Example

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

Response

{
  "postOwnerPfpUrl": "https://example.com/pfp/user123.jpg",
  "postOwnerUserName": "jane_smith",
  "dateCreated": "2026-03-04T10:30:00Z",
  "likesCount": 42,
  "postCaption": "Beautiful sunset at the beach today!",
  "postMedias": [
    {
      "postMediaID": 1,
      "postID": 12345,
      "mediaType": "Image",
      "mediaURL": "https://example.com/images/sunset.jpg"
    }
  ],
  "postComments": [
    {
      "commentID": 101,
      "postID": 12345,
      "commenterID": 456,
      "commentText": "Amazing photo!",
      "likeCount": 5,
      "createdAt": "2026-03-04T11:00:00Z",
      "isDeleted": false
    }
  ],
  "isSaved": true
}
postOwnerPfpUrl
string
URL of the post owner’s profile picture. Defaults to “http://default/defaultPfp.png” if not set.
postOwnerUserName
string
Username of the post creator
dateCreated
datetime
Timestamp when the post was created
likesCount
integer
Total number of likes on the post
postCaption
string
The text content of the post (max 800 characters)
postMedias
array
Array of media attachments
postComments
array
Array of comments on the post
isSaved
boolean
Whether the viewing user has saved this post (requires userName in request)

Error Responses

"This post does not exist"
Returned when no post exists with the specified ID.
"This post has been deleted"
Returned when the post exists but has been soft deleted.
"Action cannot be completed due to a block."
Returned when there is a blocking relationship between the viewing user and the post owner.

Build docs developers (and LLMs) love