Stack Overflow hub

Stack Overflow Search API

Find questions by words, tags, author and status, and get whole questions or highlighted excerpts.

GET /v1/stack-overflow/questions/search

1 credit Failed requests are free

About this endpoint

GET /v1/stack-overflow/questions/search takes at least one of q, title, body, tagged, notTagged or user, plus filters such as accepted, closed, answersMin, viewsMin, createdAfter and createdBefore. mode=full, the default, returns questions with the same fields as the questions list. mode=excerpt returns questions and answers that matched, each with excerptHtml (highlighted HTML) and bodyHtml (the full text as plain text), plus itemType, questionId, answerId, isAccepted and equivalentTagSearch.

Sort by relevance (the default), creation, activity or votes. A date range needs a sort other than relevance, and creation is the only sort that pages without a ceiling. Every search is HTTP 200, with an empty list when nothing matched.

Stack Overflow Search API FAQ

What is the difference between full and excerpt mode?

mode=full returns matching questions in data.questions. mode=excerpt returns matching questions and answers in data.excerpts, each with a snippet that has the matched words in a highlight span. The two lists are never both filled.

How many credits does a search cost?

Pricing is documented on the operation in the API registry (shown on this page). Confirm on every response with meta.creditsCharged: that field is the billing source of truth. Each paginated page is a separate billed request.

How do I search by tag and date?

Set tagged to one or more tags and a createdAfter and createdBefore range, then choose sort=creation, activity or votes. A range is refused with the default relevance sort.

Why does the search stop before the results run out?

Sorts other than creation return up to 2,500 rows per list (625 with include=body), then stop and set limitReached to true. Rows with equal scores can repeat or skip on those sorts. Use sort=creation when you need to walk the whole result set.