Stack Overflow hub

Stack Overflow User Comments API

Every comment one user has written, with the post it is on, its score and its text.

GET /v1/stack-overflow/users/{memberId}/comments

1 credit Failed requests are free

About this endpoint

GET /v1/stack-overflow/users/{memberId}/comments returns a page of comments by one user. Each comment has id, postId, postType, url, score, edited, createdAt, author, replyTo, isByPostAuthor, license, bodyHtml and bodyMarkdown.

Sort by creation (the default) or votes. The creation sort pages with a keyset cursor, so it keeps going past the 25 page ceiling; the votes sort returns up to 2,500 rows and then stops with limitReached. Rows with equal scores can repeat or skip on the votes sort. For a user with more than 2,500 comments, votes returns the first 100 rows and then sets limitReached; use creation to walk the list. A user with no comments is found with an empty list; a user id that does not exist is not_found.

Stack Overflow User Comments API FAQ

How do I tell which post a comment is on?

postId is the question or answer id and postType says which it is. url links to the comment on the site.

How many credits does a page cost?

Pricing is documented on the operation in the API registry (shown on this page). Confirm on every response with meta.creditsCharged: that field is the billing source of truth. Each paginated page is a separate billed request.

Does this include reply details?

When the list carries them, replyTo names the user the comment answers and isByPostAuthor says whether the author wrote the post. Both can be null when not available.

Which sort should I use to walk every comment?

sort=creation, the default. It uses a keyset cursor and keeps paging; votes stops at 2,500 rows, or after its first 100 rows for a user with more than 2,500 comments. Rows with equal scores can repeat or skip on votes.