# 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.

- Page: https://fous.com/methods/stackoverflow.com/search-questions
- Method: `stackoverflow.com/search_questions`, version 1
- Website: stackoverflow.com
- Returns: title, score, answer count, accepted-answer flag, tags, asked date, views, link, question number
- Effect: read (it gets data and changes nothing)
- Sign-in: none needed
- Cost: 1 credit per completed run (1¢ with pay as you go); failed runs are free
- Verified: Nov 2, 2026

## Inputs

| Field | Type | Required | In the run below | Description |
|---|---|---|---|---|
| `tag` | string | no |  | Limit results to a technology tag, for example: python. |
| `sort` | string | no | `"newest"` | Order questions by match, score, or most recently asked; for example: relevance. One of "relevance", "votes", "newest". Default "relevance". |
| `query` | string | yes | `"python"` | Describe the programming problem to find, for example: how to merge two dictionaries in python. |
| `max_results` | integer | no | `10` | Maximum number of questions to return, from 1 to 50; for example: 10. Default 10. |
| `answered_only` | boolean | no | `true` | Return only questions with at least one answer; for example: true. Default true. |

## Output

From a run on Oct 23, 2026, shortened. Its input:

```json
{
  "sort": "newest",
  "query": "python",
  "max_results": 10,
  "answered_only": true
}
```

Its output:

```json
{
  "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
    }
  ]
}
```

## Run it

From code, with a Fous API key in `FOUS_API_KEY`; the answer's `data` holds the output:

```bash
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}}'
```

From an AI agent connected to the Fous MCP server: its `run` with the same method and input. To connect one, give it `set up https://fous.com/SKILL.md`.

## 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

## Input schema

```json
{
  "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

```json
{
  "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
}
```

## See more

- [Stack Overflow API: Get answer](https://fous.com/methods/stackoverflow.com/get-answer.md): Gets 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.
- [Reddit API: Search posts](https://fous.com/methods/reddit.com/search-posts.md): Finds 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.
- [Bluesky API: Search posts](https://fous.com/methods/bsky.app/search-posts.md): Searches 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.
- [Hacker News API: Search stories](https://fous.com/methods/news.ycombinator.com/search-stories.md): Searches 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.
- [GitHub API: Search repositories](https://fous.com/methods/github.com/search-repositories.md): Finds public GitHub repositories by keywords, with an optional language filter and sort order. Returns up to 100 matches.
- [Slickdeals API: Search deals](https://fous.com/methods/slickdeals.net/search-deals.md): Searches community-posted Slickdeals deals by product or keyword, optionally limited to a store and hiding expired deals, ordered by relevance, newest or most popular.
- [crates.io API: Search crates](https://fous.com/methods/crates.io/search-crates.md): Finds Rust crates on crates.io by keywords, sorted by relevance, total downloads, recent downloads, or newest creation.
- [Remote OK API: Search remote jobs](https://fous.com/methods/remoteok.com/search-jobs.md): Searches Remote OK jobs by role or skill. Results can be filtered by listed region and by minimum annual USD salary.
- [All Stack Overflow methods](https://fous.com/methods/stackoverflow.com.md)
