Skip to main content
7 of 19
Added information about jsonp
Greg Bray
  • 175
  • 1
  • 3
  • 8

API Documentation and Help

The Stack Exchange API is partially self documenting.

##Method List

All API methods can be found at http://api.stackoverflow.com/n.n/help
where n.n represents the version of the API, such as 0.8

##Specific Method

Additional documentation can be found on any method by including the help query parameter on an otherwise valid request.

For instance, documentation for the method /comments/{id} can be found at http://api.stackoverflow.com/n.n/comments/1?help.

If the help URL is requested in a common web browser, a HTML styled version of the JSON help will be returned. Otherwise, the JSON help will be returned.

JSON Example for /comments/{id}:

{ "help": { "documentation": "Gets the comments associated with the question/answer with 'id'.", "parameters": { "body": { "name": "body", "description": "When \"true\", a post's body will be included in the response. Default is \"false\".", "values": "boolean", "optional": true }, "comments": { "name": "comments", "description": "When \"true\", any comments on a post will be included in the response. Default is \"false\".", "values": "boolean", "optional": true }, "sort": { "name": "sort", "description": "How a collection should be sorted. Various values include \"active\", \"creation\", \"views\", \"votes\".", "values": "one of creation (default), or votes", "optional": true }, "order": { "name": "order", "description": "How the current should be ordered, either \"asc\" or \"desc\". Default is \"desc\".", "values": "one of desc (default), or asc", "optional": true }, "min": { "name": "min", "description": "Minimum of the range to include in the current .", "values": "number", "optional": true }, "max": { "name": "max", "description": "Maximum of the range to include in the current .", "values": "number", "optional": true }, "fromdate": { "name": "fromdate", "description": "Unix timestamp of the minimum date to be returned when sorting by date.", "values": "number", "optional": true }, "todate": { "name": "todate", "description": "Unix timestamp of the maximum date to be returned when sorting by date.", "values": "number", "optional": true }, "page": { "name": "page", "description": "The pagination offset for the current collection. Affected by the specified .", "values": "number", "optional": true }, "pagesize": { "name": "pagesize", "description": "The number of collection results to display during pagination. Should be between 1 and 100 inclusive.", "values": "number", "optional": true }, "id": { "name": "id", "description": "A single primary key identifier or a vectorized, semicolon-delimited list of identifiers.", "values": "string", "optional": false } } } } 

###Global Method Parameters

All methods accept the following parameters:

  • type=jsontext: responds with mime-type text/json.
  • key={key}: validates this request to a specific application. (More here)
  • jsonp=functionname: returns JSON with Padding instead of standard JSON

##Supported Sites

The following family sites are currently supported by the api:

  • stackoverflow.com
  • serverfault.com
  • superuser.com
  • meta.stackoverflow.com
  • stackapps.com
Kevin Montrose
  • 18.6k
  • 6
  • 36
  • 62