filiptronicek / gh-sponsors-api

A REST API for GitHub Sponsors
https://ghs.vercel.app/
MIT License
37 stars 5 forks source link
github rest-api sponsors

GitHub Sponsors API

An unofficial REST API for GitHub Sponsors.

If you need something for GraphQL instead, there is an official API provided by GitHub. Some links and examples can be found in the Notes section.

Endpoints

/v2/count/user/

Get the count of people who sponsor user. Includes private sponsors.

Example query: https://ghs.vercel.app/v2/count/filiptronicek/

Example response: ```json { "status": "success", "sponsors": { "current": 4, "past": 10 } } ```

/v3/sponsors/user/

Get details of people who sponsor user. Does not include private sponsors.

Example query: https://ghs.vercel.app/v3/sponsors/filiptronicek

Example response: ```json { "status": "success", "sponsors": { "current": [ { "username": "aellopos", "avatar": "https://avatars.githubusercontent.com/u/39790985?s=60&v=4" }, { "username": "mosh98", "avatar": "https://avatars.githubusercontent.com/u/48658042?s=60&v=4" }, { "username": "kahy9", "avatar": "https://avatars.githubusercontent.com/u/48121432?s=60&v=4" }, { "username": "0ndras3k", "avatar": "https://avatars.githubusercontent.com/u/57116019?s=60&v=4" }, { "username": "AdamSchinzel", "avatar": "https://avatars.githubusercontent.com/u/66002635?s=60&v=4" }, { "username": "czM1K3", "avatar": "https://avatars.githubusercontent.com/u/45005362?s=60&v=4" }, { "username": "svobodavl", "avatar": "https://avatars.githubusercontent.com/u/58887042?s=60&v=4" }, { "username": "bigint", "avatar": "https://avatars.githubusercontent.com/u/69431456?s=60&v=4" }, { "username": "anuraghazra", "avatar": "https://avatars.githubusercontent.com/u/35374649?s=60&v=4" } ], "past": [ { "username": "scraptechguy", "avatar": "https://avatars.githubusercontent.com/u/75474651?s=60&v=4" }, { "username": "bdougie", "avatar": "https://avatars.githubusercontent.com/u/5713670?s=60&v=4" }, { "username": "kdaigle", "avatar": "https://avatars.githubusercontent.com/u/2501?s=60&v=4" } ] } } ```

/sponsoring/user/

Get all users who are sponsored by user.

Example query: https://ghs.vercel.app/sponsoring/svobodavl

Example response: ```json { "sponsorees": [ { "handle": "filiptronicek", "avatar": "https://avatars.githubusercontent.com/u/29888641?s=88&u=152b134e3e6e3d003ecd55fdde31c4171144c771&v=4", "profile": "https://github.com/filiptronicek" } ] } ```

Notes

query {
  user(login: "filiptronicek") {
    ... on Sponsorable {
      sponsors(first: 100) {
        totalCount
        nodes {
          ... on User { login }
          ... on Organization { login }
        }
      }
    }
  }
}
query {
  user(login: "cheshire137") {
    sponsoring(first: 10) {
      totalCount
      nodes {
        ... on User { login }
        ... on Organization { login }
      }
    }
  }
}