Open documentation ↗Overview
Q&A forum for developers
StackExchange is a development API from stackexchange.com. Requests are authenticated with OAuth. It is served over HTTPS. Its OpenAPI description documents 124 endpoints.
At a glance
- Authentication
- OAuth
- HTTPS
- Yes
- CORS
- Unknown
- Category
- Development
- Base URL
https://api.stackexchange.com/2.0- Version
- 2.0
- Endpoints
- 124
- OpenAPI
- Specification ↗
- Spec updated
- 2021-06-21
Make a first request
Replace the placeholders; the documentation says exactly where credentials go.
curl -X GET "https://api.stackexchange.com/2.0/answers" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN"const response = await fetch("https://api.stackexchange.com/2.0/answers", {
method: "GET",
headers: {
"Accept": "application/json",
"Authorization": "Bearer YOUR_TOKEN",
},
});
const data = await response.json();
console.log(data);import requests
response = requests.request(
"GET",
"https://api.stackexchange.com/2.0/answers",
headers={
"Accept": "application/json",
"Authorization": "Bearer YOUR_TOKEN",
},
timeout=30,
)
print(response.json())Endpoints
| Method | Path | What it does |
|---|---|---|
| GET | /access-tokens/{accessTokens} | Reads the properties for a set of access tokens. |
| GET | /access-tokens/{accessTokens}/invalidate | Immediately expires the access tokens passed. This method is meant to allow an application to discard any active access tokens it no longer needs. |
| GET | /answers | Returns all the undeleted answers in the system. |
| GET | /answers/{ids} | Gets the set of answers identified by ids. |
| GET | /answers/{ids}/comments | Gets the comments on a set of answers. |
| GET | /apps/{accessTokens}/de-authenticate | Passing valid access_tokens to this method causes the application that created them to be de-authorized by the user associated with each access_token. This will |
| GET | /badges | Returns all the badges in the system. |
| GET | /badges/name | Gets all explicitly named badges in the system. |
| GET | /badges/recipients | Returns recently awarded badges in the system. |
| GET | /badges/tags | Returns the badges that are awarded for participation in specific tags. |
| GET | /badges/{ids} | Gets the badges identified in id. |
| GET | /badges/{ids}/recipients | Returns recently awarded badges in the system, constrained to a certain set of badges. |
| GET | /comments | Gets all the comments on the site. |
| GET | /comments/{ids} | Gets the comments identified in id. |
| POST | /comments/{id}/delete | Deletes a comment. |
| POST | /comments/{id}/edit | Edit an existing comment. |
| GET | /errors | Returns the various error codes that can be produced by the API. |
| GET | /errors/{id} | This method allows you to generate an error. |
| GET | /events | Returns a stream of events that have occurred on the site. |
| GET | /filters/create | Creates a new filter given a list of includes, excludes, a base filter, and whether or not this filter should be "unsafe". |
| GET | /filters/{filters} | Returns the fields included by the given filters, and the "safeness" of those filters. |
| GET | /inbox | Returns a user's inbox. |
| GET | /inbox/unread | Returns the unread items in a user's inbox. |
| GET | /info | Returns a collection of statistics about the site. |
| GET | /me | Returns the user associated with the passed access_token. |
| GET | /me/answers | Returns the answers owned by the user associated with the given access_token. |
| GET | /me/associated | Returns all of a user's associated accounts, given an access_token for them. |
| GET | /me/badges | Returns the badges earned by the user associated with the given access_token. |
| GET | /me/comments | Returns the comments owned by the user associated with the given access_token. |
| GET | /me/comments/{toId} | Returns the comments owned by the user associated with the given access_token that are in reply to the user identified by {toId}. |
| GET | /me/favorites | Returns the questions favorites by the user associated with the given access_token. |
| GET | /me/inbox | Returns the user identified by access_token's inbox. |
| GET | /me/inbox/unread | Returns the unread items in the user identified by access_token's inbox. |
| GET | /me/mentioned | Returns the comments mentioning the user associated with the given access_token. |
| GET | /me/merges | Returns a record of merges that have occurred involving a user identified by an access_token. |
| GET | /me/notifications | Returns a user's notifications, given an access_token. |
| GET | /me/notifications/unread | Returns a user's unread notifications, given an access_token. |
| GET | /me/privileges | Returns the privileges the user identified by access_token has. |
| GET | /me/questions | Returns the questions owned by the user associated with the given access_token. |
| GET | /me/questions/featured | Returns the questions that have active bounties offered by the user associated with the given access_token. |
| GET | /me/questions/no-answers | Returns the questions owned by the user associated with the given access_token that have no answers. |
| GET | /me/questions/unaccepted | Returns the questions owned by the user associated with the given access_token that have no accepted answer. |
| GET | /me/questions/unanswered | Returns the questions owned by the user associated with the given access_token that are not considered answered. |
| GET | /me/reputation | Returns the reputation changed for the user associated with the given access_token. |
| GET | /me/reputation-history | Returns user's public reputation history. |
| GET | /me/reputation-history/full | Returns user's full reputation history, including private events. |
| GET | /me/suggested-edits | Returns the suggested edits the user identified by access_token has submitted. |
| GET | /me/tags | Returns the tags the user identified by the access_token passed is active in. |
| GET | /me/tags/{tags}/top-answers | Returns the top 30 answers the user associated with the given access_token has posted in response to questions with the given tags. |
| GET | /me/tags/{tags}/top-questions | Returns the top 30 questions the user associated with the given access_token has posted in response to questions with the given tags. |
| GET | /me/timeline | Returns a subset of the actions the user identified by the passed access_token has taken on the site. |
| GET | /me/top-answer-tags | Returns the user identified by access_token's top 30 tags by answer score. |
| GET | /me/top-question-tags | Returns the user identified by access_token's top 30 tags by question score. |
| GET | /me/write-permissions | Returns the write permissions a user has via the api, given an access token. |
| GET | /notifications | Returns a user's notifications. |
| GET | /notifications/unread | Returns a user's unread notifications. |
| GET | /posts | Fetches all posts (questions and answers) on the site. |
| GET | /posts/{ids} | Fetches a set of posts by ids. |
| GET | /posts/{ids}/comments | Gets the comments on the posts identified in ids, regardless of the type of the posts. |
| GET | /posts/{ids}/revisions | Returns edit revisions for the posts identified in ids. |
| GET | /posts/{ids}/suggested-edits | Returns suggsted edits on the posts identified in ids. |
| POST | /posts/{id}/comments/add | Create a new comment. |
| GET | /privileges | Returns the earnable privileges on a site. |
| GET | /questions | Gets all the questions on the site. |
| GET | /questions/featured | Returns all the questions with active bounties in the system. |
| GET | /questions/no-answers | Returns questions which have received no answers. |
| GET | /questions/unanswered | Returns questions the site considers to be unanswered. |
| GET | /questions/{ids} | Returns the questions identified in {ids}. |
| GET | /questions/{ids}/answers | Gets the answers to a set of questions identified in id. |
| GET | /questions/{ids}/comments | Gets the comments on a question. |
| GET | /questions/{ids}/linked | Gets questions which link to those questions identified in {ids}. |
| GET | /questions/{ids}/related | Returns questions that the site considers related to those identified in {ids}. |
| GET | /questions/{ids}/timeline | Returns a subset of the events that have happened to the questions identified in id. |
| GET | /revisions/{ids} | Returns edit revisions identified by ids in {ids}. |
| GET | /search | Searches a site for any questions which fit the given criteria. |
| GET | /search/advanced | Searches a site for any questions which fit the given criteria. |
| GET | /similar | Returns questions which are similar to a hypothetical one based on a title and tag combination. |
| GET | /sites | Returns all sites in the network. |
| GET | /suggested-edits | Returns all the suggested edits in the systems. |
| GET | /suggested-edits/{ids} | Returns suggested edits identified in ids. |
| GET | /tags | Returns the tags found on a site. |
| GET | /tags/moderator-only | Returns the tags found on a site that only moderators can use. |
| GET | /tags/required | Returns the tags found on a site that fulfill required tag constraints on questions. |
| GET | /tags/synonyms | Returns all tag synonyms found a site. |
| GET | /tags/{tags}/faq | Returns the frequently asked questions for the given set of tags in {tags}. |
| GET | /tags/{tags}/info | Returns tag objects representing the tags in {tags} found on the site. |
| GET | /tags/{tags}/related | Returns the tags that are most related to those in {tags}. |
| GET | /tags/{tags}/synonyms | Gets all the synonyms that point to the tags identified in {tags}. If you're looking to discover all the tag synonyms on a site, use the /tags/synonyms methods |
| GET | /tags/{tags}/wikis | Returns the wikis that go with the given set of tags in {tags}. |
| GET | /tags/{tag}/top-answerers/{period} | Returns the top 30 answerers active in a single tag, of either all-time or the last 30 days. |
| GET | /tags/{tag}/top-askers/{period} | Returns the top 30 askers active in a single tag, of either all-time or the last 30 days. |
| GET | /users | Returns all users on a site. |
| GET | /users/moderators | Gets those users on a site who can exercise moderation powers. |
| GET | /users/moderators/elected | Returns those users on a site who both have moderator powers, and were actually elected. |
| GET | /users/{ids} | Gets the users identified in ids in {ids}. |
| GET | /users/{ids}/answers | Returns the answers the users in {ids} have posted. |
| GET | /users/{ids}/associated | Returns all of a user's associated accounts, given their account_ids in {ids}. |
| GET | /users/{ids}/badges | Get the badges the users in {ids} have earned. |
| GET | /users/{ids}/comments | Get the comments posted by users in {ids}. |
| GET | /users/{ids}/comments/{toid} | Get the comments that the users in {ids} have posted in reply to the single user identified in {toid}. |
Showing the first 100 of 124 endpoints; the full list is in the documentation.
Questions
Does the StackExchange API need an API key?
Yes. The StackExchange API uses OAuth authentication; the documentation explains how to get credentials.
Does the StackExchange API support HTTPS?
Yes, the StackExchange API is served over HTTPS.
How many endpoints does the StackExchange API have?
Its OpenAPI description lists 124 endpoints in version 2.0. The first 100 are shown on this page.
What are alternatives to the StackExchange API?
Other Development APIs include Cloudflare, Azure DevOps, IPify, App Store Connect API, IPinfo.
Similar development APIs
Compare alternatives →Cloudflare
DevelopmentManage DNS, CDN, Workers and other services; documented with an official OpenAPI 3.0 spec
Azure DevOps
DevelopmentThe Azure DevOps basic components of a REST API request/response pair
IPify
DevelopmentA simple IP Address API
App Store Connect API
DevelopmentThe data structure that represents an app store connect api resource.
IPinfo
DevelopmentAnother simple IP Address API
IBM Text to Speech
DevelopmentConvert text to speech
Listed from public-apis (MIT), public-apis database (MIT), APIs.guru (CC0).