API Searching user repositories and filtering by organization

Hi all,

I’m working on a project that allows the user to link their GitHub account and then select some repository later on in a launch flow. One of the features that I want to support is being able to let the user select which organizations they want to be able to select repositories from, as some users don’t want to see their personal repositories in the selection dropdown.

However, I’m having a hard time figuring out how to do this efficiently with the REST API. The two options I found were the search endpoint and the list endpoint. However, neither of these seem to work because search doesn’t have an option to only filter by repos that the user has access too (and also limits the number of organizations you can filter by), and the list repositories endpoint has no efficient way to filter the results using the list of organizations the user wants to appear).

I know that other platforms (like gitguardian for example) have a way of doing this. Is there some API endpoint/parameter that can I can use?

Thanks in advance for the help!