Stack Overflow search API
Search Stack Overflow questions by text and tags, sorted by relevance, votes, activity or date, with bodies, scores and answer counts in the Stack Exchange API’s own shape.
GET /v1/stackoverflow/search1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/stackoverflow/search?q=pandas%20groupby&tagged=python",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "items": [ { "question_id": 10373660, "title": "Converting a Pandas GroupBy multiindex output from Series back to DataFrame", "link": "https://stackoverflow.com/questions/10373660/converting-a-pandas-groupby-multiindex-output-from-series-back-to-dataframe", "body": "<p>I have a dataframe:</p>\n<pre class=\"lang-none prettyprint-override\"><code> City Name\n0 Seattle Alice\n1 S…", "tags": [ "python", "pandas", "… 3 more" ], "owner": { "user_id": 468604, "display_name": "saveenr", "reputation": 8669, "link": "https://stackoverflow.com/users/468604/saveenr", "user_type": "registered", "account_id": 214559, "profile_image": "https://www.gravatar.com/avatar/da090f8d6e0a531cf983314f61a6ae0a?s=256&d=identicon&r=PG" }, "is_answered": true, "accepted_answer_id": 10374456, "answer_count": 13, "score": 696, "view_count": 1165315, "creation_date": 1335715835, "last_activity_date": 1700267920, "protected_date": 1465553574, "last_edit_date": 1700267920, "content_license": "CC BY-SA 4.0" }, { "question_id": 22219004, "title": "How to group dataframe rows into list in pandas groupby", "link": "https://stackoverflow.com/questions/22219004/how-to-group-dataframe-rows-into-list-in-pandas-groupby", "body": "<p>Given a dataframe, I want to groupby the first column and get second column as lists in rows, so that a dataframe lik…", "tags": [ "python", "pandas", "… 3 more" ], "owner": { "user_id": 1296816, "display_name": "Abhishek Thakur", "reputation": 17075, "link": "https://stackoverflow.com/users/1296816/abhishek-thakur", "user_type": "registered", "account_id": 1359101, "accept_rate": 80, "profile_image": "https://www.gravatar.com/avatar/b9f660be4e78b83f2cda8e0a5ca0b567?s=256&d=identicon&r=PG" }, "is_answered": true, "accepted_answer_id": 22221675, "answer_count": 16, "score": 594, "view_count": 679178, "creation_date": 1394094669, "last_activity_date": 1698772094, "last_edit_date": 1698772094, "content_license": "CC BY-SA 4.0" }, "… 28 more" ], "has_more": true, "page": 1, "page_size": 30}Parameters
| Name | Type | Description |
|---|---|---|
qquery · required | string | Search terms. Example: pandas groupby. |
taggedquery | string | Tags, separated by ; or ,. |
sortquery | "relevance" | "votes" | "activity" | "creation" | One of relevance, votes, activity, creation. |
pagequery | integer | Page number, 1 to 25. Defaults to 1. |
limitquery | integer | Rows per page, 1 to 100. Defaults to 30. |
sincequery | string | Only rows published on or after this date: YYYY-MM-DD (midnight UTC) or an ISO 8601 timestamp. Example: 2026-01-01. |
untilquery | string | Only 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 StackOverflowQuestions, in Stack Overflow’s own JSON.
| Field | Type | Description |
|---|---|---|
items | StackOverflowQuestion[] | |
has_more | boolean | |
page | integer | |
page_size | integer |
Status codes
| Status | Meaning |
|---|---|
200 | A page of matching questions. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | The question does not exist or was deleted. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | Stack Overflow is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Questions
Are bodies included?
Yes, as HTML.
Stack Overflow is a trademark of Stack Exchange, Inc. We are not affiliated with or endorsed by Stack Exchange, Inc.