Stack Exchange API v2.0
This is the documentation for the v2.0 read-only (with optional authentication) 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
Applications should be registered on Stack Apps to get a request key. Request keys grant more requests per day, and are necessary for using access_tokens created via authentication.
All API responses are JSON, we do support JSONP with the callback query parameter.
Every response in the API is returned in a common "wrapper" object, for easier and more consistent parsing.
Additionally, all API responses are compressed. 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 subject to a number of throttles. In general, applications should strive to make as few requests as possible to satisfy their function.
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.
Developers can trim API responses down to just the fields they are interested in using custom filters. Many types have fields that are not normally returned (question bodies, for example) that can likewise be requested via a custom filter.
There are a few methods which require that the application be acting on behalf of a user in order to be invoked. For authentication purposes, the Stack Exchange API implements OAuth 2.0 (templated on Facebook's implementation in pursuit of developer familiarity).
A number of methods in the Stack Exchange API accept dates as parameters and return dates as properties, the format of these dates is consistent and documented. The cliff-notes version is, all dates in the Stack Exchange API are in unix epoch time.
Unless otherwise noted, the maximum size of any page is 100, any {ids} parameter likewise is capped at 100 elements, all indexes
start at 1.
If a parameter name is plural it accepts vectorized requests, otherwise a single value may be passed. Compare users/{id}/inbox and /users/{ids}.
It is possible to compose reasonably complex queries against the live Stack Exchange sites using the min, max,
fromdate, todate, and sort parameters. Most, but not all, methods accept some or all of these parameters,
the documentation for individual methods will highlight which do. Most methods also have a common set of paging parameters.
Top Level Types
The following types are returned as the top level type (found in items on the common response object) by methods.
Note that some top level types can also be returned as members of other types, for example answers on question objects.
Access Tokens
Each of these methods returns access_token objects. To acquire access tokens for user accounts, refer to the authentication documentation.
access_tokens when it is done with them.
access_tokens it has, useful for debugging.
Answers
Each of these methods returns answer objects.
Badges
Each of these methods returns badge objects.
Comments
Each of these methods returns comment objects.
Errors
Each of these methods returns error objects.
Events
Each of these methods returns event objects.
Filters
Each of these methods returns filter objects. For an explanation of creating and using filters, refer to the filter documentation.
Inbox Items
Each of these methods returns inbox_item objects.
Info
Each of these methods returns info objects.
Network Users
Each of these methods returns network_user objects. When compared to the user type, network_user is optimized for fetching across the entire Stack Exchange network.
Merge History
Each of these methods returns account_merge objects.
Notifications
Each of these methods returns notification objects.
Posts
Each of these methods returns post objects.
Privileges
Each of these methods returns privilege objects.
Questions
Each of these methods returns question objects.
Question Timelines
Each of these methods returns question_timeline objects.
Reputation
Each of these methods returns reputation objects.
Reputation History
Each of these methods returns reputation_history objects.
Revisions
Each of these methods returns revision objects.
Sites
Each of these methods returns site objects.
Suggested Edits
Each of these methods returns suggested_edit objects.
Tags
Each of these methods returns tag objects.
Tag Scores
Each of these methods returns tag_score objects.
Tag Synonyms
Each of these methods returns tag_synonym objects.
Tag Wikis
Each of these methods returns tag_wiki objects.
Top Tags
Each of these methods returns top_tag objects.
Users
Each of these methods returns user objects.
User Timeline
Each of these methods returns user_timeline objects.
Write Permissions
Each of these methods returns write_permission objects.
Member Types
The following types are not returned directly by any method, but are found as members on other types.