Stack Overflow API: Search questions
Finds Stack Overflow programming questions matching plain-language search words, optionally filtered by tag and answer status, with a chosen sort order.
Unofficial. Not affiliated with or endorsed by Stack Overflow.
Inputs
Values from the run on Oct 23, 2026, shown under Output.
- Tag optional
tag Limit results to a technology tag, for example: python.
Not set
- Sort optional
sort Order questions by match, score, or most recently asked; for example: relevance.
newest
One of
relevance,votes,newest. Defaultrelevance.- Query, required
query Describe the programming problem to find, for example: how to merge two dictionaries in python.
python
- Max Results optional
max_results Maximum number of questions to return, from 1 to 50; for example: 10.
10
Whole number from 1 to 50. Default
10.- Answered Only optional
answered_only Return only questions with at least one answer; for example: true.
true
True or false. Default
true.
Input as JSON
{ "sort": "newest", "query": "python", "max_results": 10, "answered_only": true}Output
{ "questions": [ { "link": "https://stackoverflow.com/questions/80011903/how-can-i-split-double-hyphens-in-a-python-word-counter-while-preserving-single" , "tags": [ "python", "regex", "string" ], "score": 1, "title": "How can I split double hyphens in a Python word counter while preserving single hyphens and apostrophes?", "asked_date": "2026-10-22", "view_count": 188, "answer_count": 4, "question_number": 80011903, "has_accepted_answer": false }, { "link": "https://stackoverflow.com/questions/80011495/how-do-i-start-object-initialization-without-blocking-program-shutdown" , "tags": [ "best-practices", "python", "asynchronous" ], "score": 1, "title": "How do I start object initialization without blocking program shutdown?", "asked_date": "2026-10-21", "view_count": 248, "answer_count": 2, "question_number": 80011495, "has_accepted_answer": false }, { "link": "https://stackoverflow.com/questions/80011410/text-preprocessing-packages-in-addition-to-mustache-that-are-importable-both-int" , "tags": [ "tooling-recommendation", "python", "ruby" ], "score": -1, "title": "Text preprocessing packages in addition to Mustache that are importable both into Python code and Ruby code", "asked_date": "2026-10-20", "view_count": 203, "answer_count": 1, "question_number": 80011410, "has_accepted_answer": false } ]}Code
curl https://api.fous.com/v1/runs \ -H "Authorization: Bearer $FOUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"method":"stackoverflow.com/search_questions","input":{"sort":"newest","query":"python","max_results":10,"answered_only":true}}' # Save as fous.py, then run: python3 fous.pyimport json, os, timefrom urllib.error import HTTPErrorfrom urllib.request import Request, urlopenAPI = "https://api.fous.com/v1/runs" KEY = os.environ["FOUS_API_KEY"]HEADERS = { "Authorization": f"Bearer {KEY}", "Content-Type": "application/json" ,}def call(url, body=None): data = json.dumps(body).encode() if body else None request = Request(url, data, HEADERS) try: with urlopen(request, timeout=120) as r: return r.status, json.load(r) except HTTPError as error: message = json.load(error)["error"]["message"] raise RuntimeError(message) from errorstatus, run = call(API, { "method": "stackoverflow.com/search_questions" , "input": { "sort": "newest", "query": "python", "max_results": 10, "answered_only": True }})# 202: still going after 30 s. Ask again until it ends.while status == 202: time.sleep(2) status, run = call(f"{API}/{run['id']}")print(json.dumps(run["data"], indent=2))// Save as fous.mjs, then run: node fous.mjsconst api = "https://api.fous.com/v1/runs" ;const headers = { Authorization: `Bearer ${process.env.FOUS_API_KEY}`, "Content-Type": "application/json" ,};let response = await fetch(api, { method: "POST", headers, body: JSON.stringify({ "method": "stackoverflow.com/search_questions" , "input": { "sort": "newest", "query": "python", "max_results": 10, "answered_only": true } }), signal: AbortSignal.timeout(120_000),});let run = await response.json();// 202: still going after 30 s. Ask again until it ends.while (response.status === 202) { await new Promise((done) => setTimeout(done, 2_000)); response = await fetch(`${api}/${run.id}`, { headers }); run = await response.json();}if (!response.ok) throw new Error(run.error.message);console.log(run.data);# Connect your agent to Fous once, over MCP (Streamable HTTP):# https://api.fous.com/mcp# Set FOUS_API_KEY first: create a key at https://app.fous.com/keys.# Claude Codeclaude mcp add \ --scope user \ --transport http fous https://api.fous.com/mcp \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Codexcodex mcp add fous \ --url https://api.fous.com/mcp \ --bearer-token-env-var FOUS_API_KEY# Cursor, VS Code, Windsurf, Cline and morenpx -y add-mcp https://api.fous.com/mcp -g -n fous \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Then ask your agent:# "Use Fous to run stackoverflow.com/search_questions# with {"sort":"newest","query":"python","max_results":10,"answered_only":true}"Over HTTP, the answer’s data holds the output. A run still going after 30 seconds answers 202 with its id: ask GET /v1/runs/{id} until it ends.
Schema
Input schema
{ "type": "object", "required": [ "query" ], "properties": { "tag": { "type": "string", "description": "Limit results to a technology tag, for example: python." }, "sort": { "enum": [ "relevance", "votes", "newest" ], "type": "string", "default": "relevance", "description": "Order questions by match, score, or most recently asked; for example: relevance." }, "query": { "type": "string", "minLength": 1, "description": "Describe the programming problem to find, for example: how to merge two dictionaries in python." }, "max_results": { "type": "integer", "default": 10, "maximum": 50, "minimum": 1, "description": "Maximum number of questions to return, from 1 to 50; for example: 10." }, "answered_only": { "type": "boolean", "default": true, "description": "Return only questions with at least one answer; for example: true." } }}Output schema
{ "type": "object", "required": [ "questions" ], "properties": { "questions": { "type": "array", "items": { "type": "object", "required": [ "title", "score", "answer_count", "has_accepted_answer", "tags", "asked_date", "view_count", "link", "question_number" ], "properties": { "link": { "type": "string", "description": "Question page link." }, "tags": { "type": "array", "items": { "type": "string" }, "description": "Technology tags." }, "score": { "type": [ "integer", "null" ], "description": "Net vote score." }, "title": { "type": "string", "description": "Question title." }, "asked_date": { "type": [ "string", "null" ], "format": "date", "description": "Date the question was asked." }, "view_count": { "type": [ "integer", "null" ], "description": "Number of views." }, "answer_count": { "type": [ "integer", "null" ], "description": "Number of answers." }, "question_number": { "type": "integer", "description": "Stack Overflow question number." }, "has_accepted_answer": { "type": "boolean", "description": "Whether the asker accepted an answer." } }, "additionalProperties": false }, "description": "Matching Stack Overflow questions." } }, "additionalProperties": false}- Price
- 1 credit per completed run (1¢ with pay as you go); failed runs are free.
- Method
stackoverflow.com/search_questions- Returns
- title, score, answer count, accepted-answer flag, tags, asked date, views, link, question number
Use it from your agent
Give your agent this line. It reads SKILL.md, gets a Fous API key and connects the Fous MCP server. Its run then takes the method stackoverflow.com/search_questions with the inputs above.
Ask your agent
- find questions about parsing JSON in javascript sorted by votes, limit 15, only answered
- how to fix 'undefined reference to main' error in C, most recent first
- show top voted questions tagged java-streams about grouping a list by key
- search stackoverflow for python pandas dataframe merge keeping unmatched rows, sorted by relevance
- what questions were asked newest about docker container networking with no answer filter
See more
All Stack Overflow methodsGets a Stack Overflow question and its best answers, from a question link or a plain-word search. A search picks the most relevant answered question. The accepted answer comes first, then answers by score.
stackoverflow.com/get_answerFinds public Reddit posts by topic, optionally in one community, for a time window and sort order. Returns up to 100 posts in Reddit search order with score, comment count, text and link.
reddit.com/search_postsSearches public Bluesky posts for words, optionally ordered by latest or top and filtered by date, author or language. Search indexing may lag behind new posts.
bsky.app/search_postsSearches Hacker News stories or comments by words, date range and sort order. Comments include their parent story's website link when one exists; text-only stories have no website link.
news.ycombinator.com/search_storiesFinds public GitHub repositories by keywords, with an optional language filter and sort order. Returns up to 100 matches.
github.com/search_repositoriesSearches community-posted Slickdeals deals by product or keyword, optionally limited to a store and hiding expired deals, ordered by relevance, newest or most popular.
slickdeals.net/search_dealsFinds Rust crates on crates.io by keywords, sorted by relevance, total downloads, recent downloads, or newest creation.
crates.io/search_cratesSearches Remote OK jobs by role or skill. Results can be filtered by listed region and by minimum annual USD salary.
remoteok.com/search_jobs