Skip to main content
9 of 22
key behavior has changed in the face of >1 key
Kevin Montrose
  • 18.7k
  • 6
  • 35
  • 62

Getting Started with the API

The Stack Exchange API is based on standard HTTP and URLs, just like the web page you're browsing now. Except instead of HTML, the responses are all in JSON.

Let's say we wanted to call the stats method:

http://api.stackoverflow.com/0.8/stats?key=appkey

  • api.stackoverflow.com - the site to query
  • 0.8 - the api version
  • stats - the method
  • key=appkey - a parameter to pass to the method

The response:

{
  "statistics": [
    {
      "total_questions": 680175,
      "total_unanswered": 104562,
      "total_answers": 1910940,
      "total_comments": 2678849,
      "total_votes": 6720440,
      "total_badges": 688675,
      "total_users": 242593,
      "questions_per_minute": 1.75,
      "answers_per_minute": 3.76,
      "badges_per_minute": 1.55,
      "api_version": {
        "version": "0.8",
        "revision": "1.0.1234.5678"
      }
    }
  ]
}

(for a full list of possible API methods, refer to the documentation.)

##Do I need an API key?

A single IP address can only make a limited number of requests per day to the API. This limit is determined at by the presence of an API key. Should an IP address be using more than one key, the highest request limit will be used.

API daily limits:

  • Key: 10,000
  • No Key: 300

The No Key limit is meant to facilitate experimentation, not for deployed apps.

Requests with invalid or revoked keys are not completed, they are not stepped down to the No Key limit.

For further discussion of keys, refer to this question.

##Register for an API Key


##How do I announce my application, library, or wrapper?

Create a question here and tag it [app] or [library]. Please refer to How to list your application on Stack Apps for suggested formatting.

Kevin Montrose
  • 18.7k
  • 6
  • 35
  • 62