Stack Overflow

Get comments on Stack Overflow posts

Get the comments on up to 100 Stack Overflow questions and answers in one call.

GET/v1/stack-overflow/posts/comments
x-api-keystringheader

API key (`sfk_...`)

Parameters
2
idsarrayrequiredquery

Post (question or answer) ids, comma-separated, 1 to 100, e.g. `11227809,11227902`. Duplicates are dropped.

sitestringoptionalquery

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

Response fields
42

Endpoint-specific response payload.

datasite
string

The Stack Exchange site the comments belong to.

One entry per distinct requested id, in the order first asked. Duplicates are dropped.

dataposts[]postId
integer

The post id that was asked for.

dataposts[]lookupStatus
string

`not_found` when the post does not exist or was deleted.

one of: found, not_found

dataposts[]postType
stringnullable

Whether the post is a question or an answer; null when not found.

one of: question, answer, null

dataposts[]commentCount
integernullable

Comments on the post as Stack Exchange counts them; null when not found.

dataposts[]commentsComplete
booleannullable

False when the post has more comments than this list holds; null when not found.

The post's comments, oldest first; empty when not found.

dataposts[]comments[]id
integer

Comment id.

dataposts[]comments[]postId
integernullable

The question or answer the comment is on.

dataposts[]comments[]postType
stringnullable

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

one of: question, answer, null

dataposts[]comments[]url
stringnullable

Link to the comment.

dataposts[]comments[]score
integernullable

Upvotes the comment received.

dataposts[]comments[]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.

dataposts[]comments[]createdAt
stringnullable

When it was written, ISO 8601 UTC.

Who wrote it.

dataposts[]comments[]authorid
integernullable

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

dataposts[]comments[]authoraccountId
integernullable

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

dataposts[]comments[]authorname
stringnullable

Display name.

dataposts[]comments[]authorurl
stringnullable

Profile URL.

dataposts[]comments[]authorimageUrl
stringnullable

Avatar URL.

dataposts[]comments[]authorreputation
integernullable

Reputation on this site.

dataposts[]comments[]authortype
stringnullable

Kind of account.

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

dataposts[]comments[]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.

dataposts[]comments[]replyToid
integernullable

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

dataposts[]comments[]replyToaccountId
integernullable

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

dataposts[]comments[]replyToname
stringnullable

Display name.

dataposts[]comments[]replyTourl
stringnullable

Profile URL.

dataposts[]comments[]replyToimageUrl
stringnullable

Avatar URL.

dataposts[]comments[]replyToreputation
integernullable

Reputation on this site.

dataposts[]comments[]replyTotype
stringnullable

Kind of account.

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

dataposts[]comments[]replyToacceptRate
integernullable

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

dataposts[]comments[]isByPostAuthor
booleannullable

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

dataposts[]comments[]license
stringnullable

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

dataposts[]comments[]bodyHtml
stringnullable

Comment text as HTML.

dataposts[]comments[]bodyMarkdown
stringnullable

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

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/comments?ids=11227809,11227902" \
  -H "x-api-key: YOUR_API_KEY"

Responses

Comments by post.