So I have a list of GitHub user ID's, and I need to use the GitHub API to fetch the metadata for each user. I can use (https://api.github.com/user/#useridhere) to get metadata for a single user, but I would like to pass many ID numbers at once to generate one file.
-
I hope this works for you. https://stackoverflow.com/questions/16982569/making-multiple-api-calls-in-parallel-using-python-ipython – hbamithkumara Nov 19 '19 at 19:03
2 Answers
If you're willing to use the User's login you can use the V4 GraphQL API to do this. You'll build the query dynamically and then you'll be able to get all of the data in one response.
query {
user1: user(login: "JPHaus") {
...UserFragment
}
user2: user(login: "mjpieters") {
...UserFragment
}
user3: user(login: "benbalter") {
...UserFragment
}
}
fragment UserFragment on User {
id
createdAt
company
databaseId
email
location
login
name
updatedAt
url
}
You can use the GraphQL Explorer to test it out. More about Fragments here.

- 1,365
- 7
- 34
- 62
This answer is for the REST API since the question is tagged rest
. See Jonathan Porter's answer about the GraphQL API.
According to the GitHub REST API v3 documentation, the following queries for user metadata are supported:
- Get a single user
- Get the authenticated user
- Update the authenticated user
- Get contextual information about a user
- Get all users
Only the last one of these returns metadata for multiple users, but it isn't what you want:
Lists all users, in the order that they signed up on GitHub. This list includes personal user accounts and organization accounts. Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of users.
So, at least for version 3 of their API, there is no endpoint which you can query for multiple users by a list of IDs. You will have to make one request per user ID.

- 47,440
- 4
- 68
- 97