Is it possible to global search with api?

I want to globally search code across all the repositories on github. Is this possible to do with the api? Moreover, can I sort the results by stars? Also is it possible to search a chunk of code not just a line or function?

:wave: @powerthe900, welcome to the GitHub Support Community and thanks for asking these questions!

The REST API has an endpoint for searching repositories. The endpoint’s parameters offers a sort field that you can leverage to sort the results of your query by number of stars, among other values.

There’s also an endpoint for searching code and its parameters support a query field that should contain one or more search keywords and qualifiers. To learn more about the format of the query, see Constructing a search query. See “Searching code” for a detailed list of qualifiers.