> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spidra.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Stack Overflow

> Get Stack Overflow and Stack Exchange questions with every answer and comment, tags, users, search results and more as structured data, for 1 credit per link.

Scrape a Stack Overflow link and the result comes back with the page's data in a defined structure: a question with every answer and every comment, a list of questions, search results, a tag, a user, and more. Send `"output": "json"` to get just that data, or add a `prompt` or `schema` to shape it your own way ([how results come back](https://docs.spidra.io/sites/overview.md#how-results-come-back)). Each link costs 1 credit, and a link that can't be read costs nothing.

This works on every Stack Exchange site, not just Stack Overflow: Super User, Server Fault, Ask Ubuntu, MathOverflow, the Stack Overflow sites in other languages (such as `ru.stackoverflow.com` and `pt.stackoverflow.com`), every `name.stackexchange.com` site, each site's meta, and old addresses that still redirect, such as `programmers.stackexchange.com`.

## Example

```json theme={null}
{ "urls": ["https://superuser.com/q/149329"], "output": "json", "wait": true }
```

The item's `result`, shortened to one answer:

````json theme={null}
{
  "type": "question",
  "site": "superuser",
  "siteName": "Super User",
  "id": 149329,
  "title": "How do I make a POST request using curl?",
  "url": "https://superuser.com/questions/149329/how-do-i-make-a-post-request-using-curl",
  "tags": ["http", "curl"],
  "score": 2435,
  "upVotes": 2442,
  "downVotes": 7,
  "views": 3088419,
  "answersCount": 7,
  "author": { "name": "Laurie Young", "userType": "does_not_exist" },
  "createdAt": "2008-09-17T15:39:01.000Z",
  "migratedFrom": { "site": "stackoverflow", "siteName": "Stack Overflow", "questionId": 84619 },
  "markdown": "How do I make a [POST][1] request using [cURL][2]'s command-line tool?",
  "license": "CC BY-SA 4.0",
  "attribution": "From Super User, by Laurie Young, https://superuser.com/questions/149329/how-do-i-make-a-post-request-using-curl, licensed under CC BY-SA 4.0.",
  "answers": [
    {
      "id": 149335,
      "position": 1,
      "score": 2808,
      "upVotes": 2809,
      "downVotes": 1,
      "author": { "id": 922502, "name": "Stephen Deken", "url": "https://superuser.com/users/922502/stephen-deken", "reputation": 28289 },
      "createdAt": "2008-09-17T15:43:28.000Z",
      "markdown": "With fields:\n```bash\ncurl --data \"param1=value1&param2=value2\" https://example.com/resource.cgi\n```",
      "commentsCount": 7,
      "comments": [],
      "url": "https://superuser.com/a/149335",
      "license": "CC BY-SA 4.0"
    }
  ]
}
````

## Links that work

| Link | Example | You get |
| - | - | - |
| Question | `/questions/<id>/<title>`, `/q/<id>` | The question with every answer and every comment, votes, views, close, duplicate, bounty and migration details |
| Answer or comment | `/a/<id>`, `/questions/<id>/<title>/<answer id>`, `/posts/comments/<id>` | The whole question, with `focusAnswerId` or `focusCommentId` set |
| Revisions | `/posts/<id>/revisions` | Every edit with its editor, comment, and the title, tags and text before and after |
| Timeline | `/posts/<id>/timeline` | The question's events: answers, comments, edits, the accepted answer and daily vote counts |
| Questions | `/questions`, `/questions/tagged/<tag>`, `/unanswered/tagged/<tag>`, `/questions/linked/<id>`, a site's home page | Question rows. `?tab=` picks newest, active, votes, hot, week, month, bounties, unanswered or noanswers, as on the site |
| Search | `/search?q=...` | The site's results. Its search operators work: `[tag]`, `user:1234`, `score:10`, `answers:0`, `hasaccepted:yes`, `is:answer`, `created:2024` |
| Tags | `/tags`, `/tags?tab=name&filter=py`, `/tags/synonyms` | Tags with question counts and synonyms |
| Tag | `/tags/<tag>/info`, `/tags/<tag>/topusers` | The tag's wiki, synonyms, related tags, frequent questions and its top answerers and askers |
| User | `/users/<id>/<name>`, `/u/<id>` | The profile, top tags, every account the person has across Stack Exchange, people reached and social links |
| User's tabs | `/users/<id>?tab=answers`, `questions`, `tags`, `badges`, `reputation`, `activity`, `comments` | That list, one row each |
| Users | `/users`, `/users?tab=NewUsers`, `/users?tab=moderators`, `/users?search=<name>` | Users with reputation, location, website and about text |
| Network profile | `stackexchange.com/users/<account id>` | Every site the person uses, with reputation and post counts |
| Badges | `/badges`, `/badges?tab=tags`, `/badges/<id>` | Badges with award counts, or one badge and its recent recipients |
| Other site pages | `/help/privileges`, `/collectives`, `/collectives/<name>`, `stackexchange.com/sites`, `stackexchange.com` | Privileges, Collectives and their questions, every site in the network, and the Hot Network Questions |
| Feeds | `/feeds/tag/<tag>`, `/feeds/question/<id>`, `/feeds/user/<id>` | The same data as the page the feed is about |
| Stack Overflow extras | `/beta/challenges`, `/beta/challenges/<id>`, `/jobs/companies`, `/jobs/companies/<name>` | Coding challenges with their entries, and company pages with industry, size, tech stack and benefits |
| Stack Overflow for Agents | `agents.stackoverflow.com`, its post links | Posts by coding agents with trust scores, and each post with its replies |

## Options

Add these to a link:

* `count`: lists read 100 rows by default. Ask for up to 2,500, or `count=all`. Newest-first lists can go to 10,000. The first 100 rows cost the link's 1 credit, and every further 100 is 1 more. A list that runs out sooner costs less.
* `body=true`: on question lists, search and a user's answers or questions, each row's text in Markdown.
* `answer=accepted`: on question lists and search, each question's accepted answer in Markdown, with its score and author.
* `html=true`: on a question, each post's HTML next to its Markdown.
* `linked=true`, `related=true`: on a question, the questions that link to it, or that the site relates to it.
* `fromdate`, `todate`: on question lists and search, only questions asked in that window (`2025-01-01`).
* `type=answers`: on search, answers instead of questions.

```json theme={null}
{ "urls": ["https://stackoverflow.com/questions/tagged/rust?tab=Votes&count=500&answer=accepted"], "output": "json" }
```

## Licence and attribution

Posts on Stack Exchange are shared under Creative Commons BY-SA. Every question, answer and comment comes with its `license` (`CC BY-SA 2.5`, `3.0` or `4.0`), a `licenseUrl` and an `attribution` line naming the site, the author with a link to their profile, and the post's link. If you publish the text, show that attribution.

## Fields

**Question:** `id`, `title`, `url`, `shortUrl`, `tags`, `score`, `upVotes`, `downVotes`, `views`, `favorites`, `answersCount`, `commentsCount`, `isAnswered`, `acceptedAnswerId`, `author`, `lastEditor`, `createdAt`, `lastEditedAt`, `lastActivityAt`, `isClosed`, `closedAt`, `closedReason`, `closedDescription`, `closedBy`, `duplicateOf`, `closeVotes`, `reopenVotes`, `deleteVotes`, `lockedAt`, `protectedAt`, `communityWikiAt`, `notice`, `bounty`, `migratedFrom`, `migratedTo`, `collectives`, `markdown`, `comments`, `answers`, `license`, `licenseUrl` and `attribution`.

**Answer:** `id`, `questionId`, `position`, `isAccepted`, `score`, `upVotes`, `downVotes`, `author`, `lastEditor`, `createdAt`, `lastEditedAt`, `lastActivityAt`, `bountyAwarded`, `recommendedBy`, `markdown`, `commentsCount`, `comments`, `url` and the licence fields.

**Comment:** `id`, `postId`, `postType`, `score`, `author`, `replyTo`, `markdown`, `edited`, `createdAt`, `url` and the licence fields.

**Author:** `id`, `accountId`, `name`, `url`, `reputation`, `userType`, `acceptRate`, `badges` (`gold`, `silver`, `bronze`) and `imageUrl`. A deleted account keeps its name, with `userType: "does_not_exist"`.

**Question in a list:** the question's counts, author, dates, close and bounty fields, licence and link, plus `rank`, and `markdown` or `acceptedAnswer` when you ask for them.

**User:** `id`, `accountId`, `name`, `url`, `reputation`, `reputationChange` (day, week, month, quarter, year), `badges`, `answersCount`, `questionsCount`, `upVotesCast`, `downVotesCast`, `profileViews`, `location`, `websiteUrl`, `about`, `emails` and `aboutLinks` (written in the about text), `createdAt`, `lastAccessAt`, `collectives`, `topTags`, `networkAccounts`, `peopleReached`, `rank`, `socialLinks`, `lastSeen` and `memberFor`.

**Tag:** `name`, `questionsCount`, `synonyms`, `wiki` (`excerpt`, `markdown`), `relatedTags`, `frequentQuestions`, `topAnswerersAllTime`, `topAnswerersMonth`, and on `/topusers` `topAskersAllTime` and `topAskersMonth`, each with `rank`, `user`, `score` and `postsCount`.

## Limits

Only what visitors who aren't signed in can see is available. Pages for signed-in users, such as asking a question or the review queues, fail straight away and cost nothing. So do deleted posts, unknown users and tags, and searches with no results.

Who voted on a post, deleted posts and chat transcripts aren't available. One list goes up to 2,500 rows (newest-first lists up to 10,000); for more, split it by date with `fromdate` and `todate`.

## Templates

Ready-made [templates](https://docs.spidra.io/templates.md) for Stack Overflow and every Stack Exchange site: questions by tag, search, top experts in a tag, everything a user posted, and finding users by name.

> [!NOTE]
>
> Check Stack Exchange's terms before you collect data from it. Posts belong to their authors and are shared under CC BY-SA, which asks you to credit them. You're responsible for how you use what you collect.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.