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

Stack Overflow question API

One Stack Overflow question by id or link: title, body, tags, score, views, answer count and accepted answer.

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

res = requests.get(
    "https://api.groundsocial.dev/v1/stackoverflow/questions/11227809",
    headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()
Response
200 · 1 credit
{
"question_id": 11227809,
"title": "Why is conditional processing of a sorted array faster than of an unsorted array?",
"link": "https://stackoverflow.com/questions/11227809/why-is-conditional-processing-of-a-sorted-array-faster-than-of-an-unsorted-…",
"body": "<p>In this C++ code, sorting the data (<em>before</em> the timed region) makes the primary loop ~6x faster:</p>\n<pre cla…",
"tags": [
"java",
"c++",
"… 3 more"
],
"owner": {
"user_id": 87234,
"display_name": "GManNickG",
"reputation": 507447,
"link": "https://stackoverflow.com/users/87234/gmannickg",
"user_type": "registered",
"account_id": 31692,
"accept_rate": 100,
"profile_image": "https://i.sstatic.net/FkjBe.png?s=256"
},
"is_answered": true,
"accepted_answer_id": 11227902,
"answer_count": 25,
"score": 27548,
"view_count": 2044104,
"creation_date": 1340805096,
"last_activity_date": 1788489410,
"protected_date": 1399067470,
"last_edit_date": 1775626532,
"content_license": "CC BY-SA 4.0"
}

Parameters

NameTypeDescription
idpath · requiredstringA question id or its stackoverflow.com link. Example: 11227809.
Response fields

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

FieldTypeDescription
question_idinteger
titlestring
linkstring
bodystringHTML.
tagsstring[]
ownerStackOverflowOwner
is_answeredboolean
accepted_answer_idinteger
answer_countinteger
scoreinteger
view_countinteger
creation_dateinteger
last_activity_dateinteger
closed_dateinteger
closed_reasonstring
Status codes
StatusMeaning
200The question.
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

Does it take a link?

Yes, a stackoverflow.com/questions/… link works as the id.

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