API Usage

This is the documentation for the v1.1 read-only Stack Exchange API. If you have additional questions, or believe you have encountered a bug, don't hesitate to post a question on Stack Apps.

If your application is in a runnable state (even a beta one), Stack Apps is also the place to list it.

General

All API responses are JSON, we do support JSONP with the jsonp query parameter.

Additionally, all API responses are GZIP'd. The Content-Encoding header is always set, but some proxies will strip this out. The proper way to decode API responses can be found here.

API usage is throttled by IP address. Each IP can make a certain number of requests per-day. Without an API key, this limit is quite low.
Note that API keys are not secret, nor do they "stack." A single IP running a dozen registered applications can make the same number of requests per day as an IP running a single registered application.

API responses are heavily cached. Polling for changes should be done sparingly in any case, and polling at a rate faster than once a minute (for semantically identical requests) is considered abusive.

Application and library developers should be aware that the returned values from the API are not of any particular size, regardless of any limits that may be placed on the Stack Exchange network sites at the moment. Furthermore, the API only makes a best effort attempt to fill all applicable fields on returned objects; an application should be able to handle partial returns sensibly.

Possible values for various "enumeration fields" returned by the API can be found listed here.

Methods

Many API methods are vectorized. That is to say, they will accept multiple values within a single parameter on a request.
If a parameter on this page is in the url path and plural you can pass multiple values separated by semi-colons. The documentation for specific methods will call out vectorized parameters further.

Answers

  • /answers – Get all answers on the site. 1.1
  • /answers/{ids} – Get answers identified by a set of ids.
  • /answers/{ids}/comments – Get comments on the answers identified by a set of ids.

Badges

  • /badges – Get all badges on the site, in alphabetical order.
  • /badges/{ids} – Get all users who have been awarded the badges identified by ids.
  • /badges/name – Get all non-tagged-based badges in alphabetical order.
  • /badges/tags – Get all tagged-based badges in alphabetical order.

Comments

  • /comments – Get all comments on the site. 1.1
  • /comments/{ids} – Get comments identified by a set of ids.
  • /posts/{ids}/comments – Get comments on the posts (question or answer) identified by a set of ids.

Errors

  • /errors/{id} – Simulate an API error for testing purposes.

Privileges

  • /privileges – Get all the privileges available on the site. 1.1

Questions

  • /questions – Get all questions on the site.
  • /questions/{ids} – Get the questions identified by a set of ids.
  • /questions/{ids}/answers – Get the answers to the questions identified by a set of ids.
  • /questions/{ids}/comments – Get the comments on the questions identified by a set of ids.
  • /questions/{ids}/linked – Get the questions that link to the questions identified by a set of ids. 1.1
  • /questions/{ids}/related – Get the questions that are related to the questions identified by a set of ids. 1.1
  • /questions/{ids}/timeline – Get the timelines of the questions identified by a set of ids.
  • /questions/unanswered – Get all questions the site considers unanswered.
  • /questions/no-answers – Get all questions on the site with no answers. 1.1

Revisions

  • /revisions/{ids} – Get all revisions for posts identified by a set of ids.
  • /revisions/{id}/{revision-guid} – Get a specific revision identified by a post id and a revision guid.

Search

  • /search – Search the site for questions meeting certain criteria.
  • /similar – Search the site based on similarity to a title. 1.1

Stats

  • /stats – Get a set of statistics for the entire site.

Tags

  • /tags – Get the tags on the site.
  • /tags/synonyms – Get all the tag synonyms on the site. 1.1
  • /tags/{tags}/synonyms – Get the synonyms for a specific set of tags. 1.1
  • /tags/{tags}/wikis – Get the wiki entries for a set of tags. 1.1
  • /tags/{tag}/top-answerers/{period} – Get the top answer posters in a specific tag, either in the last month or for all time. 1.1
  • /tags/{tag}/top-askers/{period} – Get the top question askers in a specific tag, either in the last month or for all time. 1.1

Users

  • /users – Get all users on the site.
  • /users/{ids} – Get the users identified by a set of ids.
  • /users/{ids}/answers – Get the answers posted by the users identified by a set of ids.
  • /users/{ids}/badges – Get the badges earned by the users identified by a set of ids.
  • /users/{ids}/comments – Get the comments posted by the users identified by a set of ids.
  • /users/{ids}/comments/{to-id} – Get the comments posted by a set of users in reply to another user.
  • /users/{ids}/favorites – Get the questions favorited by users identified by a set of ids.
  • /users/{ids}/mentioned – Get the comments that mention one of the users identified by a set of ids.
  • /users/{ids}/questions – Get the questions asked by the users identified by a set of ids.
  • /users/{ids}/questions/no-answers – Get the questions asked by a set of users, which have no answers. 1.1
  • /users/{ids}/questions/unaccepted – Get the questions asked by a set of users, which have at least one answer but no accepted answer. 1.1
  • /users/{ids}/questions/unanswered – Get the questions asked by a set of users, which are not considered to be adequately answered. 1.1
  • /users/{ids}/reputation – Get a subset of the reputation changes experienced by the users identified by a set of ids.
  • /users/{ids}/tags – Get the tags that the users (identified by a set of ids) have been active in.
  • /users/{id}/tags/{tags}/top-answers – get the top answers a user has posted on questions with a set of tags. 1.1
  • /users/{id}/tags/{tags}/top-questions – get the top questions a user has posted on questions with a set of tags. 1.1
  • /users/{ids}/timeline – Get a subset of the actions of that have been taken by the users identified by a set of ids.
  • /users/{id}/top-answer-tags – Get the top 30 tags (by score) a single user has posted answers in. 1.1
  • /users/{id}/top-question-tags – Get the top 30 tags (by score) a single user has asked questions in. 1.1
  • /users/moderators – Get the users who have moderation powers on the site.

Stack Auth Methods

Stack Auth serves as a central hub for a variety of network wide functions. Accordingly, functions for network wide account lookup and site discovery reside there.

Sites

  • /sites – Get all the sites in the Stack Exchange network.1.1

Users

  • /users/{id}/associated – Get a user's associated accounts.1.1

Note that 1.0 versions of the Stack Auth methods exist. These new methods are trying out some new ideas with regards to the form of API returns on a small scale before the next major API revision.

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.