Unclear permissions for accessing organization sponsorship data via GraphQL API #175646
Replies: 4 comments
-
|
The likely issue: Your PAT probably only has repo scope, not read:org. Even as Owner, the API token itself needs the right scopes |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
Hello , You are correct that the GitHub Sponsors API documentation for the organization.lifetimeReceivedSponsorshipValues field is not very clear regarding the exact permissions required. Below is a detailed summary of what is needed and why your query may return null or the error Resource not accessible by personal access token.
Being the organization owner is not always sufficient. To query sponsorship-related data, you must either: Be the organization owner and have the Sponsors manager role, or Use a GitHub App configured with the sponsors:read permission. In practice: If you see the “Sponsors” tab in your organization settings, your account can access this data. If not, your account does not yet have the Sponsors admin role.
To verify or delegate sponsorship roles: Go to Organization → Settings → Sponsorships Click on Manage sponsorship settings From there, you can: See who manages Sponsors Add or remove Sponsors managers Enable GitHub Sponsors if it is not yet activated Note: The Billing Manager role does not automatically include Sponsors permissions; these are two distinct roles.
You can use a personal access token, but only if: It belongs to a user who has access to GitHub Sponsors for the organization, and It includes the following scopes: read:org The read:sponsors scope has been required since 2023 for any GraphQL access to GitHub Sponsors endpoints. Resource not accessible by personal access token You can check and configure your token here: Ensure that: The token is authorized for your organization, and The Sponsors: Read-only permission is enabled. |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
Hello,
I’m trying to use the GitHub GraphQL API to query organization sponsorship data via the
lifetimeReceivedSponsorshipValuesfield. However, it is not clear what exact permissions are required to successfully retrieve this information.Here is my current situation:
gh api graphqlor using a Personal Access Token), the result is alwaysnullor I get the errorResource not accessible by personal access token.My questions
Which role/permission is strictly required in order to query
organization { lifetimeReceivedSponsorshipValues }?Where exactly in the Organization Settings can I confirm or manage these permissions?
What is the recommended authentication method?
Background
My goal is fairly simple:
I just want to fetch a list of sponsors for my organization, sorted by their lifetime contribution value, and pull basic profile info (login, name, URL).
My GraphQL query looks like this:
Beta Was this translation helpful? Give feedback.
All reactions