100 free credits. No credit card required. Get a key

Stack Overflow answers API

The answers to a Stack Overflow question with their bodies, scores and which one is accepted, by votes, activity or date.

GET /v1/stackoverflow/questions/{id}/answers1 credit per callRefunded on failure
import os, requests

res = requests.get(
    "https://api.groundsocial.dev/v1/stackoverflow/questions/11227809/answers?sort=votes",
    headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()
Response
200 · 1 credit
{
"items": [
{
"answer_id": 11227902,
"question_id": 11227809,
"body": "<p><strong>You are a victim of <a href=\"https://en.wikipedia.org/wiki/Branch_predictor\" rel=\"noreferrer\">branch predicti…",
"owner": {
"user_id": 922184,
"display_name": "Mysticial",
"reputation": 473523,
"link": "https://stackoverflow.com/users/922184/mysticial",
"user_type": "registered",
"account_id": 559988,
"profile_image": "https://i.sstatic.net/h7WDB.jpg?s=256"
},
"is_accepted": true,
"score": 35295,
"creation_date": 1340805402,
"last_activity_date": 1709573833,
"last_edit_date": 1709573833,
"content_license": "CC BY-SA 4.0"
},
{
"answer_id": 11227877,
"question_id": 11227809,
"body": "<p><strong>Branch prediction.</strong></p>\n<p>With a sorted array, the condition <code>data[c] &gt;= 128</code> is first…",
"owner": {
"user_id": 1011995,
"display_name": "Daniel Fischer",
"reputation": 184654,
"link": "https://stackoverflow.com/users/1011995/daniel-fischer",
"user_type": "registered",
"account_id": 996105,
"profile_image": "https://i.sstatic.net/Jca5Q.jpg?s=256"
},
"is_accepted": false,
"score": 4767,
"creation_date": 1340805285,
"last_activity_date": 1470383590,
"last_edit_date": 1592644375,
"content_license": "CC BY-SA 4.0"
},
"… 23 more"
],
"has_more": false,
"page": 1,
"page_size": 30
}

Parameters

NameTypeDescription
idpath · requiredstringA question id or its stackoverflow.com link. Example: 11227809.
sortquery"votes" | "activity" | "creation"One of votes, activity, creation.
pagequeryintegerPage number, 1 to 25. Defaults to 1.
limitqueryintegerRows per page, 1 to 100. Defaults to 30.
sincequerystringOnly rows published on or after this date: YYYY-MM-DD (midnight UTC) or an ISO 8601 timestamp. Example: 2026-01-01.
untilquerystringOnly rows published on or before this date: YYYY-MM-DD (that whole UTC day) or an ISO 8601 timestamp. Example: 2026-12-31.
Response fields

200 with a StackOverflowAnswers, in Stack Overflow’s own JSON.

FieldTypeDescription
itemsStackOverflowAnswer[]
has_moreboolean
pageinteger
page_sizeinteger
Status codes
StatusMeaning
200A page of answers.
400Invalid input. Nothing was charged.
401Missing or invalid API key.
402Not enough credits, a spend cap was reached, or payment is required.
403The target is private, or the account is suspended.
404The question does not exist or was deleted.
429Too many requests. Wait for Retry-After seconds.
503Stack Overflow is temporarily unavailable. Retryable; nothing was charged.

Every error has code, message, hint and retryable. All error codes

Questions

How many answers a page?

Up to 100, pages 1 to 25.

Stack Overflow is a trademark of Stack Exchange, Inc. We are not affiliated with or endorsed by Stack Exchange, Inc.