For example, if I want to know the number of users who asked and answered about PHP.

Currently, I can just get the list of questions and its total number, but it's not enough, because one user could ask more than one question.

And I just don't know how to get the same thing for answers.

Wasted 2 days trying to figure out how to do it having just 10000 requests and got no idea about it.

1 Answer 1


The API is not a good tool for this (more below). Use the Stack Exchange Data Explorer (SEDE) for this kind of bulk analysis.

For example, this SEDE query shows the number of unique users who asked and/or answered in the PHP tag:

Unique, Overall, Active Users:   384,835
Active Question Askers:          256,140
Active Answerers:                209,108
Questions by Deleted Users:       10,631
Answers by Deleted Users:          9,630


  1. That query is parameterized, so you can easily change which tag(s) are searched against.
  2. There is no way to distinguish one deleted user from another deleted user (they all have NULL as a user id, typically).
  3. Deleted questions and answers are not in either the SEDE databases nor in the API results.

Now, you can get the same kind of information from the API, and without busting the (registered) quota, if you limit by tag.

  1. The /questions route, with an appropriate filter and parameters, will return question AND answer, user information:

      "answers": [ {
          "owner": { "user_id": 3675899 },
          "is_accepted": true,
          "score": 1,
          "answer_id": 31881563
      } ],
      "tags": [
      "owner": { "user_id": 1052507 },
      "accepted_answer_id": 31881563,
      "answer_count": 1,
      "score": 0,
      "creation_date": 1438960575,
      "question_id": 31881201

    So, from that one call, we see the user ID of both a question and of all its answers.

  2. Even on Stack Overflow, the most popular tag (javascript) still only has 912,571 questions.
    Which means that, using the query from step 1, limited by at least one tag, you can get the user information for all questions and their answers with only 9126 API calls. ;)

  3. Your script or app would then collate and process all the pages of results to extract the same summary as given by the SEDE query, above.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .