Stack Overflow

List Stack Overflow post comments

List every comment on a Stack Overflow question or answer.

GET/v1/stack-overflow/posts/{postId}/comments
1credit
x-api-keystringheader

API key (`sfk_...`)

Parameters
2
postIdintegerrequiredpath

Post id (a question or an answer) on the chosen site, e.g. `11227902`.

≥ 1 · ≤ 2147483647

sitestringoptionalquery

Stack Exchange site, by its API name (`askubuntu`, `serverfault`, `math`, `ru.stackoverflow`). Default: `stackoverflow`. The sites endpoint lists them all.

Response fields
39

Endpoint-specific response payload.

datalookupStatus
string

`not_found` when the post does not exist or was deleted. A post with no comments is `found` with an empty list.

one of: found, not_found

datasite
string

The Stack Exchange site the comments belong to.

datapostId
integer

The question or answer the comments are on.

Every comment on the post, oldest first.

datacomments[]id
integer

Comment id.

datacomments[]postId
integernullable

The question or answer the comment is on.

datacomments[]postType
stringnullable

Whether the comment is on a question or an answer; null when not known.

one of: question, answer, null

datacomments[]url
stringnullable

Link to the comment.

datacomments[]score
integernullable

Upvotes the comment received.

datacomments[]edited
booleannullable

Whether the comment was edited. The flag comes from the route that returned the comment, so the same comment can differ between routes.

datacomments[]createdAt
stringnullable

When it was written, ISO 8601 UTC.

Who wrote it.

datacomments[]authorid
integernullable

User id on this site; null for a deleted user.

datacomments[]authoraccountId
integernullable

Network-wide account id, the same on every site.

datacomments[]authorname
stringnullable

Display name.

datacomments[]authorurl
stringnullable

Profile URL.

datacomments[]authorimageUrl
stringnullable

Avatar URL.

datacomments[]authorreputation
integernullable

Reputation on this site.

datacomments[]authortype
stringnullable

Kind of account.

one of: registered, moderator, unregistered, does_not_exist, team_admin, null

datacomments[]authoracceptRate
integernullable

Percent of the user's questions with an accepted answer; null when not shown.

The user the comment is addressed to, when it is a reply. Null when the comment is not a reply; on the comments-by-post routes it is always null because those routes do not carry reply targets.

datacomments[]replyToid
integernullable

User id on this site; null for a deleted user.

datacomments[]replyToaccountId
integernullable

Network-wide account id, the same on every site.

datacomments[]replyToname
stringnullable

Display name.

datacomments[]replyTourl
stringnullable

Profile URL.

datacomments[]replyToimageUrl
stringnullable

Avatar URL.

datacomments[]replyToreputation
integernullable

Reputation on this site.

datacomments[]replyTotype
stringnullable

Kind of account.

one of: registered, moderator, unregistered, does_not_exist, team_admin, null

datacomments[]replyToacceptRate
integernullable

Percent of the user's questions with an accepted answer; null when not shown.

datacomments[]isByPostAuthor
booleannullable

Whether the comment's author wrote the post it is on; null on lists that do not carry it.

datacomments[]license
stringnullable

Content licence, e.g. `CC BY-SA 4.0`.

datacomments[]bodyHtml
stringnullable

Comment text as HTML.

datacomments[]bodyMarkdown
stringnullable

Comment text as Markdown; null on lists that do not carry it.

datacomplete
boolean

False when the post has more than 1000 comments and the list stops there.

Metadata describing the request and billing outcome.

metarequestId
string

Unique request identifier for tracing this API call.

min 1 chars

metacreditsCharged
integer

Credits charged for this request.

≥ 0

metaversion
string

Public API version that served the response.

one of: v1

Code example

curl "https://api.socialfetch.dev/v1/stack-overflow/posts/11227902/comments" \
  -H "x-api-key: YOUR_API_KEY"

Responses

Comment listing.