Skip to main content

Search repositories

Find repositories via various criteria. This method returns up to 100 results [per page](https://docs.github.com/[email protected]/rest/overview/resources-in-the-rest-api#pagination). When searching for repositories, you can get text match metadata for the **name** and **description** fields when you pass the `text-match` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/[email protected]/rest/reference/search#text-match-metadata). For example, if you want to search for popular Tetris repositories written in assembly code, your query might look like this: `q=tetris+language:assembly&sort=stars&order=desc` This query searches for repositories with the word `tetris` in the name, the description, or the README. The results are limited to repositories where the primary language is assembly. The results are sorted by stars in descending order, so that the most popular repositories appear first in the search results. When you include the `mercy` preview header, you can also search for multiple topics by adding more `topic:` instances. For example, your query might look like this: `q=topic:ruby+topic:rails`

GET/search/repositories
Source
github-v3-rest.json
Revision
f5f067c1e6f6
Active snapshot
85e53e3d0d65

Request

Query Parameters
q string
required

The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/[email protected]/rest/reference/search#constructing-a-search-query). See "[Searching for repositories](https://docs.github.com/articles/searching-for-repositories/)" for a detailed list of qualifiers.

sort string
optional

Sorts the results of your query by number of `stars`, `forks`, or `help-wanted-issues` or how recently the items were `updated`. Default: [best match](https://docs.github.com/[email protected]/rest/reference/search#ranking-search-results)

order string
optional

Determines whether the first search result returned is the highest number of matches (`desc`) or lowest number of matches (`asc`). This parameter is ignored unless you provide `sort`.

per_page integer
optional

Results per page (max 100)

page integer
optional

Page number of the results to fetch.

Responses

application/json object

Response

incomplete_results boolean
required
items array[Repo Search Result Item object]
required
items Repo Search Result Item object

Repo Search Result Item

allow_forking boolean
optional
allow_merge_commit boolean
optional
allow_rebase_merge boolean
optional
allow_squash_merge boolean
optional
archive_url string
required
archived boolean
required
assignees_url string
required
blobs_url string
required
branches_url string
required
clone_url string
required
collaborators_url string
required
comments_url string
required
commits_url string
required
compare_url string
required
contents_url string
required
contributors_url string<uri>
required
created_at string<date-time>
required
default_branch string
required
delete_branch_on_merge boolean
optional
deployments_url string<uri>
required
description string
requirednullable
disabled boolean
required

Returns whether or not this repository disabled.

downloads_url string<uri>
required
events_url string<uri>
required
fork boolean
required
forks integer
required
forks_count integer
required
forks_url string<uri>
required
full_name string
required
git_commits_url string
required
git_refs_url string
required
git_tags_url string
required
git_url string
required
has_downloads boolean
required
has_issues boolean
required
has_pages boolean
required
has_projects boolean
required
has_wiki boolean
required
homepage string<uri>
requirednullable
hooks_url string<uri>
required
html_url string<uri>
required
id integer
required
is_template boolean
optional
issue_comment_url string
required
issue_events_url string
required
issues_url string
required
keys_url string
required
labels_url string
required
language string
requirednullable
languages_url string<uri>
required
license License Simple object
requirednullable

License Simple

html_url string<uri>
optional
key string
required

Example: mit

name string
required

Example: MIT License

node_id string
required

Example: MDc6TGljZW5zZW1pdA==

spdx_id string
requirednullable

Example: MIT

url string<uri>
requirednullable

Example: https://api.github.com/licenses/mit

master_branch string
optional
merges_url string<uri>
required
milestones_url string
required
mirror_url string<uri>
requirednullable
name string
required
node_id string
required
notifications_url string
required
open_issues integer
required
open_issues_count integer
required
owner Simple User object
requirednullable

Simple User

avatar_url string<uri>
required

Example: https://github.com/images/error/octocat_happy.gif

email string
optionalnullable
events_url string
required

Example: https://api.github.com/users/octocat/events{/privacy}

followers_url string<uri>
required

Example: https://api.github.com/users/octocat/followers

following_url string
required

Example: https://api.github.com/users/octocat/following{/other_user}

gists_url string
required

Example: https://api.github.com/users/octocat/gists{/gist_id}

gravatar_id string
requirednullable

Example: 41d064eb2195891e12d0413f63227ea7

html_url string<uri>
required

Example: https://github.com/octocat

id integer
required

Example: 1

login string
required

Example: octocat

name string
optionalnullable
node_id string
required

Example: MDQ6VXNlcjE=

organizations_url string<uri>
required

Example: https://api.github.com/users/octocat/orgs

received_events_url string<uri>
required

Example: https://api.github.com/users/octocat/received_events

repos_url string<uri>
required

Example: https://api.github.com/users/octocat/repos

site_admin boolean
required
starred_at string
optional

Example: "2020-07-09T00:17:55Z"

starred_url string
required

Example: https://api.github.com/users/octocat/starred{/owner}{/repo}

subscriptions_url string<uri>
required

Example: https://api.github.com/users/octocat/subscriptions

type string
required

Example: User

url string<uri>
required

Example: https://api.github.com/users/octocat

permissions object
optional
admin boolean
required
maintain boolean
optional
pull boolean
required
push boolean
required
triage boolean
optional
private boolean
required
pulls_url string
required
pushed_at string<date-time>
required
releases_url string
required
score number
required
size integer
required
ssh_url string
required
stargazers_count integer
required
stargazers_url string<uri>
required
statuses_url string
required
subscribers_url string<uri>
required
subscription_url string<uri>
required
svn_url string<uri>
required
tags_url string<uri>
required
teams_url string<uri>
required
temp_clone_token string
optional
text_matches Search Result Text Matches array[object]
optional
topics array[string]
optional
trees_url string
required
updated_at string<date-time>
required
url string<uri>
required
visibility string
optional

The repository visibility: public, private, or internal.

watchers integer
required
watchers_count integer
required
total_count integer
required

Not modified

application/json Validation Error object

Validation failed

documentation_url string
required
errors array[object]
optional
items object
code string
required
field string
optional
index integer
optional
message string
optional
resource string
optional
value
optional
message string
required
application/json object

Service unavailable

code string
optional
documentation_url string
optional
message string
optional