> **For coding agents and LLMs:** This is one Social Fetch marketing page (markdown export). For API orientation start with [`/llms.txt`](https://www.socialfetch.dev/llms.txt); for auth and crawl rules use [`/agents.txt`](https://www.socialfetch.dev/agents.txt); for every operation use [`/llms-endpoints.txt`](https://www.socialfetch.dev/llms-endpoints.txt).

## This page

- **On-site (HTML):** <https://www.socialfetch.dev/platforms/stack-overflow>
- **Markdown (.mdx) URL:** <https://www.socialfetch.dev/platforms/stack-overflow.mdx>

---

# Stack Overflow API. Questions, answers and people, as JSON.

Read questions, answers, comments, users, tags and edit history from Stack Overflow and 364 other Stack Exchange sites. Name the site, get one JSON shape.

- 365 Stack Exchange sites
- Typed not_found
- 1 credit per request

Social Fetch exposes 23 routes under `/v1/stack-overflow`. Every one takes `site`, the API name of a Stack Exchange site: `stackoverflow` by default, or `askubuntu`, `math`, `ru.stackoverflow` and the rest of the 365 sites that the `sites` route lists. A site host or URL works too.

Question routes cover one question, a list, a search, a title search, a batch lookup by id, and a question's answers. Post routes cover comments on one post or up to 100 posts, revision history, a timeline of everything that happened to a post, and its citation in BibTeX and AMS form. User routes cover a profile, a batch, a search, and a user's answers, questions, comments, tag activity, badges and reputation history. Tag routes cover the tag list and one tag with its wiki, synonyms, related tags and top answerers.

Lookups return `lookupStatus` of `found` or `not_found` with HTTP 200, so a deleted question is a typed miss rather than an error. Lists page with `page.nextCursor`; a list sorted by anything other than time returns up to 2,500 rows and then stops with `limitReached` (625 when it carries text). A user's answer or comment list on an account over 2,500 rows stops after its first 100 rows (25 when it carries text). Batch routes keep the order of the ids you send and charge for each id, found or not.

`meta.creditsCharged` on every response is the billing source of truth.

## What you can get

- One question with its answers and comments when you add `include=answers,comments`.
- Question lists and search with tags, dates, accepted and closed filters, and excerpt mode.
- Batch lookups for up to 100 question, user or post ids per request.
- Users with reputation, badge counts, accept rate, profile text and activity counts.
- A user's answers, questions, comments, tag activity, badges and reputation history.
- Tags with question counts, synonyms, related tags, wiki text and top answerers.
- Post comments, revision history, a full timeline and citation text.
- All 365 Stack Exchange sites from one `sites` list, with aliases and related sites.

## Stack Overflow endpoints

| Endpoint | Request | Credits | Docs |
| --- | --- | --- | --- |
| Question | GET /v1/stack-overflow/questions/{questionId} | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/questions/questionid/get) |
| Questions by id | GET /v1/stack-overflow/questions/batch | 1 credit per question id Up to 100 ids per request Max 100 credits An id that is not a question is still charged Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/questions/batch/get) |
| Questions | GET /v1/stack-overflow/questions | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/questions/get) |
| Search | GET /v1/stack-overflow/questions/search | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/questions/search/get) |
| Similar titles | GET /v1/stack-overflow/questions/title-search | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/questions/title-search/get) |
| Answers | GET /v1/stack-overflow/questions/{questionId}/answers | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/questions/questionid/answers/get) |
| Comments | GET /v1/stack-overflow/posts/{postId}/comments | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/posts/postid/comments/get) |
| Comments by post | GET /v1/stack-overflow/posts/comments | 1 credit per post id Up to 100 ids per request Max 100 credits An id that is not a post is still charged Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/posts/comments/get) |
| Revisions | GET /v1/stack-overflow/posts/{postId}/revisions | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/posts/postid/revisions/get) |
| Timeline | GET /v1/stack-overflow/posts/{postId}/timeline | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/posts/postid/timeline/get) |
| Citation | GET /v1/stack-overflow/posts/{postId}/citation | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/posts/postid/citation/get) |
| User | GET /v1/stack-overflow/users/{memberId} | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/users/memberid/get) |
| Users by id | GET /v1/stack-overflow/users/batch | 1 credit per user id Up to 100 ids per request Max 100 credits An id that is not a user is still charged Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/users/batch/get) |
| Search users | GET /v1/stack-overflow/users/search | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/users/search/get) |
| User answers | GET /v1/stack-overflow/users/{memberId}/answers | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/users/memberid/answers/get) |
| User questions | GET /v1/stack-overflow/users/{memberId}/questions | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/users/memberid/questions/get) |
| User comments | GET /v1/stack-overflow/users/{memberId}/comments | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/users/memberid/comments/get) |
| User tags | GET /v1/stack-overflow/users/{memberId}/tags | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/users/memberid/tags/get) |
| User badges | GET /v1/stack-overflow/users/{memberId}/badges | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/users/memberid/badges/get) |
| User reputation | GET /v1/stack-overflow/users/{memberId}/reputation | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/users/memberid/reputation/get) |
| Tags | GET /v1/stack-overflow/tags | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/tags/get) |
| Tag | GET /v1/stack-overflow/tags/{tag} | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/tags/tag/get) |
| Sites | GET /v1/stack-overflow/sites | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/stack-overflow/sites/get) |

## How to start

1. **Create an API key.** Sign up at Social Fetch and copy a key (`sfk_...`). New accounts get 100 free credits, enough to try every Stack Overflow route a few times.
2. **Pick the site and route.** Use `site` for anything other than Stack Overflow itself. For example `GET /v1/stack-overflow/questions/11?site=stackoverflow` for one question, or `GET /v1/stack-overflow/tags/python?site=stackoverflow&include=wiki` for a tag. Send `x-api-key` on every request.
3. **Page and branch.** Check `data.lookupStatus` before you store a row, keep requesting with `page.nextCursor` while `page.hasMore` is true, and bill from `meta.creditsCharged`.

## Pricing

Each request charges from 1 credit, shown on every endpoint page. Batch routes charge 1 credit per id, including an id that turns out not to exist. Each page of a list is its own request. `meta.creditsCharged` on every response is the billing source of truth, and new accounts start with 100 free credits.

## Compared with the official API

The Stack Exchange network is 365 sites, each with its own host, tag set and error behaviour. Social Fetch puts one route group in front of all of them: one JSON envelope, `lookupStatus` in place of site-specific errors, cursors that say when a list hits a ceiling, and batch routes that answer per id. The site is a parameter, not a separate integration.

## FAQ

### What can I get from the Stack Overflow API?

Questions, answers, comments, users, tags and sites. The 23 routes cover a question lookup, question lists and search, a title search, batches by id, a question's answers, post comments, revision history, a post timeline, citations, user profiles and user activity, the tag list and one tag with its wiki and top answerers.

### How do I read a Stack Exchange site other than Stack Overflow?

Pass `site` on any route: `askubuntu`, `serverfault`, `math`, `ru.stackoverflow` and so on. A host like `math.stackexchange.com` or a full site URL is accepted and reduced to the API name. The sites route lists all 365 names, with each site's URL, audience and related sites.

### What does lookupStatus mean?

`found` means the question, user, tag or post exists and the matching object has data. `not_found` means it does not exist or was deleted, and the object is null. Both come back as HTTP 200, so branch on `lookupStatus` rather than on the status code.

### How do I page through a list?

Read `page.hasMore` and pass `page.nextCursor` back as `cursor` with the same filters. A question, answer, comment or user list sorted by `creation` pages without a ceiling. Every other sort returns up to 2,500 rows (625 when the page carries text), then stops with `limitReached` set to true. On a user with more than 2,500 answers or comments, a sort other than `creation` stops after the first 100 rows (25 with text). Rows with equal scores can repeat or skip on sorts that have ties.

### How much does a request cost?

1 credit for a normal lookup or list page. A batch route charges 1 credit per id, up to 100 ids, and an id that is not a question, user or post is still charged. Failed requests that Social Fetch does not bill are free. Check `meta.creditsCharged` on every response. New accounts start with 100 free credits.

### Can I get a question's answers and comments in one call?

Yes. Add `include=answers,comments` to the question route. `answers` is filled and `answersComplete` says whether it holds every answer the `answerCount` claims. With either part on, a question batch takes at most 10 ids. For a question with many answers, use the answers route and page with `creation`.

### How do I search questions?

Use the search route with `q`, `title`, `body`, `tagged`, `notTagged` or `user`, plus filters such as `accepted`, `closed`, `answersMin`, `viewsMin` and a date range. `mode=excerpt` returns questions and answers with highlighted snippets. The title-search route is different: it returns up to 25 questions whose titles are similar to a title you are drafting.

### What are the batch routes for?

Question, user and post-comment batches take 1 to 100 ids and return one entry per id, in the order you asked. Each entry has its own `lookupStatus`, so a mix of existing and missing ids is a normal 200 response. Each id is billed, including a missing one.

### Are tag lists exact?

Not for `sort=popular` or `sort=activity`. The site picks each page from a ranking that lags the counts it shows, so a tag can be missing from a page and pages can repeat a boundary tag, which we drop. `approximate` is true for those sorts and the rows keep Stack Exchange's ranking. `sort=name` is exact.

### Can I use these routes from agents or MCP?

Yes. Every Stack Overflow route is a typed MCP tool and is reachable through Ask in plain English. Use the typed routes for production jobs and the MCP or Ask surface for exploration.

## Related

- [Stack Overflow Question API](https://www.socialfetch.dev/platforms/stack-overflow/questions-questionid): One question with optional answers and comments (`GET /v1/stack-overflow/questions/{questionId}`).
- [Stack Overflow Search API](https://www.socialfetch.dev/platforms/stack-overflow/questions-search): Search questions by text, tag, date and status (`GET /v1/stack-overflow/questions/search`).
- [Stack Overflow Tag API](https://www.socialfetch.dev/platforms/stack-overflow/tags-tag): A tag with its wiki, synonyms, related tags and top answerers (`GET /v1/stack-overflow/tags/{tag}`).
- [Stack Overflow User API](https://www.socialfetch.dev/platforms/stack-overflow/users-memberid): A profile with reputation, badges and activity counts (`GET /v1/stack-overflow/users/{memberId}`).
- [Ask in plain English](https://www.socialfetch.dev/ask): Route a natural-language question to the matching Stack Overflow operation.
- [Hosted MCP](https://www.socialfetch.dev/mcp): Call Stack Overflow tools from Cursor or Claude with the same credit metering as REST.
