Skip to content
NewIntroducing lobstr.io API v2: Web Data for AI Agents
Stack Overflow: Search questionsTry it

Stack Overflow: Search questions

One page of a Stack Overflow search, up to 100 questions, each whole: its text, every answer and every comment, the votes, views, tags, authors, and why it is closed when it is.

1 credita callWorks today
Try itDocs
1Request
Words to search for, anywhere in a question (its title, its text, its tags), as Stack Overflow's own search reads them.
Tags the questions must have, all of them (python and asyncio: the questions tagged both), as Stack Overflow writes them (python, c++, asp.net-core).
The order of the questions: relevance, Stack Overflow's own search order; newest, the latest asked first; activity, the latest answered, commented or edited first; votes, the highest scored first among every question that matches, however loosely (with query, popular questions that only mention the words come first).
1 credit a call
Code, from the fields above
curl https://api.lobstr.io/v2/run \
  -H "Authorization: Bearer $LOBSTR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "stackoverflow",
    "operation": "questions/search",
    "options": {
      "query": "httpx timeout",
      "tags": [
        "python"
      ],
      "has_accepted_answer": false,
      "is_closed": false,
      "is_migrated": false,
      "has_notice": false,
      "is_wiki": false,
      "sort": "votes"
    }
  }'
2Response

An example answer, from the contract. Run it on your own input with your API key.

{
  "object": "run",
  "id": "run_5qinq6gxtyhrop2g242vebn6m4",
  "livemode": true,
  "source": "stackoverflow",
  "operation": "questions/search",
  "version": "1.0.1",
  "schema_url": "https://api.lobstr.io/v2/catalog/stackoverflow/questions/search",
  "options": {
    "query": "httpx timeout",
    "tags": [
      "python"
    ],
    "sort": "votes"
  },
  "fields": null,
  "status": "succeeded",
  "count": 1,
  "has_more": false,
  "next": null,
  "cost": {
    "credits": 1
  },
  "results": [
    {
      "object": "question",
      "position": 1,
      "id": 10000001,
      "ids": {
        "question_id": 10000001
      },
      "url": "https://stackoverflow.com/questions/10000001/how-do-i-set-a-timeout-on-an-httpx-request",
      "share_url": "https://stackoverflow.com/q/10000001",
      "title": "How do I set a timeout on an httpx request?",
      "tags": [
        "python",
        "httpx"
      ],
      "body_html": "<p>My request hangs forever when the server does not answer. How do I set a timeout?</p>\n",
      "body_markdown": "My request hangs forever when the server does not answer. How do I set a timeout?",
      "score": 42,
      "upvote_count": 43,
      "downvote_count": 1,
      "favorite_count": 0,
      "view_count": 51200,
      "answer_count": 1,
      "comment_count": 1,
      "is_answered": true,
      "accepted_answer_id": 10000002,
      "close_vote_count": 0,
      "reopen_vote_count": 0,
      "delete_vote_count": 0,
      "created_at": "2024-03-14T09:26:53Z",
      "last_activity_at": "2025-06-02T17:40:11Z",
      "last_edited_at": "2024-03-14T10:02:31Z",
      "owner": {
        "id": 1000001,
        "account_id": 2000001,
        "name": "Jane Doe",
        "url": "https://stackoverflow.com/users/1000001/jane-doe",
        "avatar_url": "https://www.gravatar.com/avatar/00000000000000000000000000000000?s=256&d=identicon&r=PG",
        "type": "registered",
        "reputation": 1234,
        "accept_rate": 80,
        "badges": {
          "gold": 0,
          "silver": 5,
          "bronze": 12
        }
      },
      "last_editor": null,
      "closed": null,
      "locked_at": null,
      "protected_at": null,
      "community_owned_at": null,
      "bounty": null,
      "notice": null,
      "migrated_from": null,
      "migrated_to": null,
      "content_license": null,
      "answers": [
        {
          "id": 10000002,
          "url": "https://stackoverflow.com/questions/10000001/how-do-i-set-a-timeout-on-an-httpx-request/10000002#10000002",
          "share_url": "https://stackoverflow.com/a/10000002",
          "body_html": "<p>Pass <code>timeout=10.0</code> to the client.</p>\n",
          "body_markdown": "Pass `timeout=10.0` to the client.",
          "score": 57,
          "upvote_count": 57,
          "downvote_count": 0,
          "is_accepted": true,
          "created_at": "2024-03-14T09:41:07Z",
          "last_activity_at": "2024-03-14T09:41:07Z",
          "last_edited_at": null,
          "locked_at": null,
          "community_owned_at": null,
          "owner": {
            "id": 1000003,
            "account_id": 2000003,
            "name": "John Smith",
            "url": "https://stackoverflow.com/users/1000003/john-smith",
            "avatar_url": null,
            "type": "registered",
            "reputation": 48210,
            "accept_rate": null,
            "badges": {
              "gold": 12,
              "silver": 80,
              "bronze": 120
            }
          },
          "last_editor": null,
          "bounty_awarded": null,
          "recommended_by": [],
          "posted_by_collectives": [],
          "content_license": "CC BY-SA 4.0",
          "comment_count": 0,
          "comments": []
        }
      ],
      "comments": [
        {
          "id": 130000001,
          "url": "https://stackoverflow.com/questions/10000001/how-do-i-set-a-timeout-on-an-httpx-request#comment130000001_10000001",
          "body_html": "Which version of httpx do you use?",
          "body_markdown": "Which version of httpx do you use?",
          "score": 2,
          "is_edited": false,
          "created_at": "2024-03-14T09:30:12Z",
          "owner": null,
          "reply_to_user": null,
          "content_license": "CC BY-SA 4.0"
        }
      ],
      "source_url": "https://api.stackexchange.com/2.3/search/advanced?site=stackoverflow&page=1&pagesize=100&order=desc&sort=votes&q=httpx%20timeout&tagged=python&filter=tvdphAWpCmQIKKbhPRIUXwhmqHNHrzzUDek3PwM4rHR",
      "observed_at": "2026-12-02T12:00:00Z"
    }
  ]
}

48 fields per question

Every call returns them for each record, in the results of its JSON answer.

Search questions

48 fields
object
text
question
position
number
The question's rank in the search, across pages.
1
id
number
The question's id on Stack Overflow, as in its address.
10,000,001
ids.question_id
number
10,000,001

What it costs

Billed by the call: 1 credits, whatever the page holds (up to 100 questions). Pick how many calls a month.

Every plan

1 credit a call

Calls a month

100

Per 100 calls

Free

On the free plan, up to 100 calls a month.

Live

Built to run

Every call counts; a day is green at 95% successful.

Successful calls
100.00%
Median call
2.2 s
90 days agoToday
95% or more (SLA)90 to 95%75 to 90%Under 75%

A call fails when the site does not answer or we cannot read its answer; a wrong input is not counted.

Frequently asked questions

What people ask before calling stackoverflow/questions/search.

Search questions

When do I use it?

You need what Stack Overflow's developers asked and answered about something: search its questions by words, by tags (every tag given), by words of the title or the body, by author, by a link they hold, by date, by how many answers or views they have, or by whether they are answered, closed, migrated or community wiki. Each question comes whole in the same call: its text in HTML and in Markdown, every answer (the accepted one says so) and every comment of both, with their scores, dates, authors and licence; no other call is needed to read them. Sort by relevance (Stack Overflow's own search), newest, latest activity or votes. Follow next for the following page: a search goes to 25 pages of 100, 2,500 questions; narrow it by dates (created_after, created_before) to go further. For one question you already have, by its id or its link, use stackoverflow/questions/get.

What do I give it?
  • query: Words to search for, anywhere in a question (its title, its text, its tags), as Stack Overflow's own search reads them.
  • tags: Tags the questions must have, all of them (python and asyncio: the questions tagged both), as Stack Overflow writes them (python, c++, asp.net-core). A question has at most five.
  • excluded_tags: Tags the questions must not have, none of them. Needs another criterion beside it (words, tags...).
  • title: Words the question's title must hold, whole, side by side and in this order: connection pool finds "Connection pool is full", not "Pool of connections"; timeout does not find "ReadTimeout". To find a subject, query reaches further.
  • body: Words the question's text must hold, whole, side by side and in this order (read timeout, not timeout read). To find a subject, query reaches further.
  • user: The questions of one author: their user id on Stack Overflow (22656), or the address of their profile (https://stackoverflow.com/users/22656/...).
  • mentions_url: A link that the question or one of its answers holds; * stands for any part of it (https://github.com/encode/httpx*).
  • has_accepted_answer: True for the questions with an accepted answer only, false for those without. Both when left out.
  • is_closed: True for the closed questions only (duplicates, off-topic...), false for the open ones. Both when left out.
  • is_migrated: True for the questions moved from Stack Overflow to another Stack Exchange site only, false for the others. Both when left out.
  • has_notice: True for the questions with a moderator's notice only (a lock, a call for better answers...), false for the others. Both when left out.
  • is_wiki: True for the community wiki questions only, false for the others. Both when left out.
  • answers_min: The questions with at least this many answers.
  • views_min: The questions viewed at least this many times.
  • created_after: The questions asked from this date on (2024-01-31, from its midnight UTC) or from this instant (2024-01-31T12:00:00Z).
  • created_before: The questions asked before this date (before its midnight UTC: 2025-02-01 keeps January 31 whole) or this instant. A month is its first day in created_after and the next month's here: 2025-01-01 and 2025-02-01.
  • sort: The order of the questions: relevance, Stack Overflow's own search order; newest, the latest asked first; activity, the latest answered, commented or edited first; votes, the highest scored first among every question that matches, however loosely (with query, popular questions that only mention the words come first). For the most voted on a subject, sort by relevance and compare their score.
  • order: The sort's direction, desc as each sort says or asc to reverse it (the oldest first, the lowest scored first).
What does it return?

One page of a Stack Overflow search, up to 100 questions, each whole: its text, every answer and every comment, the votes, views, tags, authors, and why it is closed when it is. Every record has the same fields, empty ones included: they are all listed above.

How do I get the next page?

Each answer ends with next: the following call, whole. Send it as it is; it is null after the last page. A page holds 100 records at most, up to page 25.

Pricing

What does a call cost?

1 credit a call, one page of up to 100 questions, each whole with its answers and comments. An empty page and a failed call are free.

When is a call free?
  • an empty page (past the end, or nothing found)
  • a call that fails

Errors

What can go wrong?
  • invalid_input (422): Pass the criteria Stack Overflow's search takes: words, tags as Stack Overflow writes them, an author's id or profile, dates (2024-01-31), and a page from 1 to 25.
  • ip_blocked (503, retry): Stack Overflow's API refused the IPs tried for today. Retry later; failed calls are free.
  • site_unavailable (503, retry): Stack Overflow's API did not answer properly; retry later (not charged).
  • unexpected_answer (424): Stack Overflow's API answered in a shape we do not read yet; we are told and fix it (not charged).
How long can a call take?

30 seconds at most by default, up to 60 with timeout_s. A call past it answers timeout (408), is not charged, and can be sent again.

API and agents

Can my AI agent run it?

Yes: connect the lobstr.io MCP server (https://api.lobstr.io/v2/mcp, your API key as a Bearer token); its run_operation tool runs stackoverflow/questions/search. Its page for agents, in Markdown: stackoverflow/questions/search.md.

Where is its full description?

The contract, as JSON: https://api.lobstr.io/v2/catalog/stackoverflow/questions/search: every option, every field, the price and the errors. This page is drawn from it.

Ready to call it?

An API key in a minute, then the call above, from your code or your agent.