Stack Exchange API v2.3

This is the documentation for the v2.3 Stack Exchange API (with both authentication and write support). 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 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.

The maximum page number that will be returned for anonymous API access (no access token or app key) is 25

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.

Some methods require access_tokens with particular scopes, such as private_info (/users/{id}/reputation-history/full for example) or write_access (/questions/add). Certain fields require access_tokens with the private_info scope, such as answer.upvoted; the documentation for each time makes note of these fields.

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.

Allows an application to dispose of access_tokens when it is done with them.

Allows an application to inspect access_tokens it has, useful for debugging.

Allows an application to de-authorize itself for a set of users.

Tag Preferences

Each of these methods returns achievement objects.

Get a user's recent network-wide achievements, given their account id. auth required

Answers

Each of these methods returns answer objects.

Get all answers on the site.

Get answers identified by a set of ids.

Casts an accept vote on the given answer. auth required

Undoes an accept vote on the given answer. auth required

Deletes the given answer. auth required

Casts a downvote on the given answer. auth required

Undoes a downvote on the given answer. auth required

Edits the given answer. auth required

Casts an upvote on the given answer. auth required

Undoes an upvote on the given answer. auth required

Casts a flag on the given answer. auth required

Get the answers to the questions identified by a set of ids.

Creates an answer on the given question. auth required

Renders a hypothetical answer to a question.

Get the answers posted by the users identified by a set of ids.

Get the top answers a user has posted on questions with a set of tags.

Get answers identified by a set of slugs.

Badges

Each of these methods returns badge objects.

Get all badges on the site, in alphabetical order.

Get the badges identified by ids.

Get the recent recipients of the given badges.

Get all non-tagged-based badges in alphabetical order.

Get badges recently awarded on the site.

Get all tagged-based badges in alphabetical order.

Get the badges earned by the users identified by a set of ids.

Collectives

Each of these methods returns Collective objects.

Get all Collectives on the site, in alphabetical order.

Get Collectives identified by a set of slugs.

Collective Reports

Each of these methods returns Collective report objects.

Get reports identified by a set of slugs. auth required

Comments

Each of these methods returns comment objects.

Get comments on the answers identified by a set of ids.

Get comments on the articles identified by a set of ids.

Get all comments on the site.

Get comments identified by a set of ids.

Delete a comment identified by its id. auth required

Edit a comment identified by its id. auth required

Casts a flag on the given comment. auth required

Casts an upvote on the given comment. auth required

Undoes an upvote on the given comment. auth required

Get comments on the posts (question or answer) identified by a set of ids.

Create a new comment on the post identified by id. auth required

Renders a hypothetical comment on the given post.

Get the comments on the questions identified by a set of ids.

Get the comments posted by the users identified by a set of ids.

Get the comments posted by a set of users in reply to another user.

Get the comments that mention one of the users identified by a set of ids.

Errors

Each of these methods returns error objects.

Get descriptions of all the errors that the API could return.

Events

Each of these methods returns event objects.

Get recent events that have occurred on the site. Effectively a stream of new users and content. auth required

Filters

Each of these methods returns filter objects. For an explanation of creating and using filters, refer to the filter documentation.

Create a new filter.

Decode a set of filters, useful for debugging purposes.

Flag Options

Each of these methods returns flag_option objects.

Returns valid flag options for the given answer. auth required

Returns valid flag options for the given comment. auth required

Returns valid flag options which are also close reasons for the given question. auth required

Returns valid flag options for the given question. auth required

Inbox Items

Each of these methods returns inbox_item objects.

Get a user's inbox, outside of the context of a site. auth required

Get the unread items in a user's inbox, outside of the context of a site. auth required

Get a user's inbox. auth required

Get the unread items in a user's inbox. auth required

Info

Each of these methods returns info objects.

Get information about the entire site.

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.

Get a user's associated accounts.

Merge History

Each of these methods returns account_merge objects.

Get the merges a user's accounts has undergone.

Network Activity

Each of these methods returns network_activity objects.

Gets a user's activity across the Stack Exchange network.

Notifications

Each of these methods returns notification objects.

Get a user's notifications, outside of the context of a site. auth required

Get a user's unread notifications, outside of the context of a site. auth required

Get a user's notifications. auth required

Get a user's unread notifications. auth required

Posts

Each of these methods returns post objects.

Get all posts (questions and answers) in the system.

Get all posts identified by a set of ids. Useful for when the type of post (question or answer) is not known.

Get all posts (questions and answers) owned by a set of users.

Privileges

Each of these methods returns privilege objects.

Get all the privileges available on the site.

Get the privileges the given user has on the site.

Questions

Each of these methods returns question objects.

Gets all questions the answers identified by ids are on.

Get the questions that are linked to the articles identified by a set of ids.

Get all questions on the site.

Get the questions identified by a set of ids.

Deletes the given question. auth required

Casts a downvote on the given question. auth required

Undoes a downvote on the given question. auth required

Edits the given question. auth required

Bookmarks the given question. (Previously known as "favoriting" a question) auth required

Undoes bookmarking the given question. (Previously known as "favoriting" a question) auth required

Casts a flag on the given question. auth required

Get the questions that link to the questions identified by a set of ids.

Get the questions that are related to the questions identified by a set of ids.

Casts an upvote on the given question. auth required

Undoes an upvote on the given question. auth required

Creates a new question. auth required

Get all questions on the site with active bounties.

Renders a hypothetical question. auth required

Get all questions the site considers unanswered.

Get questions the site considers unanswered within a user's favorite or interesting tags. auth required

Get all questions on the site with no answers.

Search the site for questions meeting certain criteria.

Search the site for questions using most of the on-site search options.

Search the site based on similarity to a title.

Get frequently asked questions in a set of tags.

Get the questions bookmarked (previously known as "favorited") by users identified by a set of ids.

Get the questions asked by the users identified by a set of ids.

Get the questions on which a set of users, have active bounties.

Get the questions asked by a set of users, which have no answers.

Get the questions asked by a set of users, which have at least one answer but no accepted answer.

Get the questions asked by a set of users, which are not considered to be adequately answered.

Get the top questions a user has posted with a set of tags.

Get questions identified by a set of slugs.

Question Timelines

Each of these methods returns question_timeline objects.

Get the timelines of the questions identified by a set of ids.

Reputation

Each of these methods returns reputation objects.

Get a subset of the reputation changes experienced by the users identified by a set of ids.

Reputation History

Each of these methods returns reputation_history objects.

Get a history of a user's reputation, excluding private events.

Get a full history of a user's reputation. auth required

Revisions

Each of these methods returns revision objects.

Get revisions on the set of posts in ids.

Get all revisions identified by a set of ids.

Search Excerpts

Each of these methods returns search_excerpt objects.

Searches a site.

Sites

Each of these methods returns site objects.

Get all the sites in the Stack Exchange network.

Suggested Edits

Each of these methods returns suggested_edit objects.

Get suggested edits on the set of posts in ids.

Get all the suggested edits on the site.

Get the suggested edits identified by a set of ids.

Get the suggested edits provided by users identified by a set of ids.

Creates a suggested edit on an existing answer. auth required

Creates a suggested edit on an existing question. auth required

Tags

Each of these methods returns tag objects.

Get the tags on the site.

Get the tags on the site that only moderators can use.

Get the tags on the site that fulfill required tag constraints.

Get tags on the site by their names.

Get related tags, based on common tag pairings.

Get the tags that the users (identified by a set of ids) have been active in.

Get tags identified by a set of slugs.

Tag Preferences

Each of these methods returns tag_preference objects.

Get a given user's tag preferences. auth required

Edit a user's tag preferences. auth required

Tag Scores

Each of these methods returns tag_score objects.

Get the top answer posters in a specific tag, either in the last month or for all time.

Get the top question askers in a specific tag, either in the last month or for all time.

Tag Synonyms

Each of these methods returns tag_synonym objects.

Get all the tag synonyms on the site.

Get the synonyms for a specific set of tags.

Tag Wikis

Each of these methods returns tag_wiki objects.

Get the wiki entries for a set of tags.

Top Tags

Each of these methods returns top_tag objects.

Get the top tags (by score) a single user has posted answers in.

Get the top tags (by score) a single user has asked questions in.

Get the top tags (by score) a single user has posted in.

Users

Each of these methods returns user objects.

Get all users on the site.

Get the users identified by a set of ids.

Get the users who have moderation powers on the site.

Get the users who are active moderators who have also won a moderator election.

Get users identified by a set of slugs.

User Timeline

Each of these methods returns user_timeline objects.

Get a subset of the actions of that have been taken by the users identified by a set of ids.

Write Permissions

Each of these methods returns write_permission objects.

Get the write access a user has via the API.

Member Types

The following types are not returned directly by any method, but are found as members on other types.