# Конечные точки REST API для поиска

Используйте REST API для поиска конкретных элементов на GitHub.

## О поиске

REST API можно использовать для поиска определенного элемента, который требуется найти. Например, можно найти пользователя или определенный файл в репозитории. Это похоже на поиск в Google. API поиска предназначен для поиска одного результата, который вы ищете (или, возможно, несколько результатов). Так же, как при поиске в Google, иногда требуется просмотреть несколько страниц результатов поиска, чтобы найти элемент, который лучше всего соответствует вашим требованиям. Для удовлетворения этих потребностей GitHub REST API предоставляет **до 1000 результатов для каждого поиска**.

Поиск можно сузить с помощью запросов. Дополнительные сведения о синтаксисе поискового запроса см. в разделе [Конечные точки REST API для поиска](/ru/enterprise-server@3.20/rest/search/search#constructing-a-search-query).

### Ранжирование результатов поиска

Если в качестве параметра запроса не указан другой параметр сортировки, результаты сортируются по лучшему совпадению в порядке убывания. Для повышения вероятности появления наиболее релевантного элемента в верхней части списка результатов используется множество факторов.

### Ограничение скорости

> \[!NOTE]
> Ограничения скорости отключены по умолчанию для GitHub Enterprise Server. Обратитесь к администратору сайта, чтобы подтвердить ограничения скорости для вашего экземпляра.

REST API имеет настраиваемое ограничение скорости для поиска. Для прошедших проверку подлинности запросов можно создавать до 30 запросов в минуту. Для запросов без проверки подлинности ограничение скорости позволяет выполнять не более 10 запросов в минуту.

Сведения о том, как определить текущее состояние ограничения скорости, см. в разделе ["Ограничение](/ru/enterprise-server@3.20/rest/rate-limit/rate-limit) скорости".

### Создание поискового запроса

Каждая конечная точка для поиска использует [параметры запроса](https://en.wikipedia.org/wiki/Query_string) для выполнения поиска GitHub. Примеры, включающие параметры конечной точки и запроса, см. в отдельных конечных точках.

Запрос может содержать любое сочетание квалификаторов поиска, поддерживаемых GitHubв . Формат поискового запроса:

```text
SEARCH_KEYWORD_1 SEARCH_KEYWORD_N QUALIFIER_1 QUALIFIER_N
```

Например, если вы хотите искать все *репозитории* принадлежащие `defunkt` и содержащие слова `GitHub` и `Octocat` в файле README, вы должны использовать следующий запрос к конечной точке *поисковые репозитории*:

```text
GitHub Octocat in:readme user:defunkt
```

**Примечание.** Обязательно используйте предпочитаемый кодировщик HTML для вашего языка для создания строк запроса. Например:

```javascript
// JavaScript
const queryString = 'q=' + encodeURIComponent('GitHub Octocat in:readme user:defunkt');
```

Полный список доступных квалификаторов, их формат и пример их использования см [. в AUTOTITLE](/ru/enterprise-server@3.20/search-github/searching-on-github) . Сведения об использовании операторов для сопоставления определенных значений, дат или исключения результатов см. в разделе [Основные сведения о синтаксисе поиска](/ru/enterprise-server@3.20/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax).

### Ограничения на длину запроса

Вы не можете использовать запросы, которые:

* Длиннее 256 символов (не включая операторы или квалификаторы).
* Имеют более пяти `AND`операторов `OR`или `NOT` операторов.

Эти поисковые запросы возвращают сообщение об ошибке "Сбой проверки".

### Ограничения области поиска

Чтобы обеспечить быстрый доступ к REST API для всех пользователей, мы ограничиваем количество репозиториев, которые будут выполнять поиск по запросу. REST API найдет до 4000 репозиториев, которые соответствуют фильтрам и возвращают результаты из этих репозиториев.

### Время ожидания и неполные результаты

Чтобы обеспечить быструю настройку REST API для всех пользователей, мы ограничиваем время выполнения любого отдельного запроса. Для запросов, [превышающих ограничение времени](https://developer.github.com/changes/2014-04-07-understanding-search-results-and-potential-timeouts/), API возвращает совпадения, которые уже были найдены до истечения времени ожидания, и в ответе свойство `incomplete_results` имеет значение `true`.

Превышение времени ожидания не обязательно означает, что результаты поиска будут неполными.
Возможно, были бы найдены другие результаты, а возможно и нет.

### Доступ к ошибкам и недостающим результатам поиска

Вам нужно успешно пройти проверку подлинности и получить доступ к репозиториям в поисковых запросах. В противном случае появится ошибка `422 Unprocessable Entry` с сообщением "Сбой проверки". Например, поиск завершится ошибкой, если запрос включает в себя `repo:`или `user:``org:`квалификаторы, запрашивающие ресурсы, к которым у вас нет доступа при входеGitHub.

Когда поисковый запрос запрашивает несколько ресурсов, ответ будет содержать только те ресурсы, к которым у вас есть доступ, и **не** предоставит сообщение об ошибке со списком ресурсов, которые не были возвращены.

Например, если поисковый запрос ищет в репозиториях `octocat/test` и `codertocat/test`, а у вас есть доступ только к `octocat/test`, в ответе будут результаты для `octocat/test`, но не для `codertocat/test`. Это поведение имитирует работу GitHubпоиска.

### Метаданные сопоставления текста

В GitHubпротивном случае можно использовать контекст, предоставляемый фрагментами кода и выделениями в результатах поиска. Конечные точки для поиска возвращают дополнительные метаданные, которые позволяют выделить соответствующие условия поиска при отображении результатов поиска.

Запросы могут принимать эти фрагменты текста в ответе, и каждый фрагмент сопровождается числовыми смещениями, определяющими точное расположение каждого соответствующего поискового термина.

Чтобы получить эти метаданные в результатах поиска, укажите тип данных `text-match` в заголовке `Accept`.

```shell
application/vnd.github.text-match+json
```

При указании типа данных `text-match` вы получите дополнительный ключ `text_matches` в полезных данных JSON, который содержит сведения о позиции поисковых терминов в тексте, и свойство `property` с поисковым термином. Внутри массива `text_matches` каждый объект содержит следующие атрибуты:

| Имя           | Описание                                                                                                                                                                                                                                        |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `object_url`  | URL-адрес ресурса, содержащего строковое свойство, соответствующее одному из поисковому термину.                                                                                                                                                |
| `object_type` | Имя типа ресурса в этом объекте `object_url`.                                                                                                                                                                                                   |
| `property`    | Имя свойства ресурса в `object_url`. Это свойство является строкой, которая соответствует одному из поисковых терминов. (В JSON, возвращенном из `object_url`, полное содержимое свойства `fragment` будет находится в свойстве с этим именем.) |
| `fragment`    | Подмножество значения `property`. Это фрагмент текста, соответствующий одному или нескольким поисковым терминам.                                                                                                                                |
| `matches`     | Массив из одного или нескольких поисковых терминов, присутствующих в свойстве `fragment`. Индексы (т. е. смещения) относительно фрагмента. (Они не относятся к *полному* содержимому свойства `property`.)                                      |

#### Пример

Используя команду и приведенный `curl`[выше пример поиска](#search-issues-and-pull-requests) проблемы, запрос API будет выглядеть следующим образом:

```shell
curl -H 'Accept: application/vnd.github.text-match+json' \
'http(s)://HOSTNAME/api/v3/search/issues?q=windows+label:bug \
+language:python+state:open&sort=created&order=asc'
```

Ответ будет содержать массив `text_matches` для каждого результата поиска. Приведенный ниже JSON содержит два объекта в массиве `text_matches`.

Первое совпадение текста произошло в свойстве `body` проблемы. Мы видим фрагмент текста из текста проблемы. Поисковый термин (`windows`) отображается дважды в этом фрагменте, и у нас есть индексы для каждого вхождения.

Второе совпадение текста произошло в свойстве `body` одного из комментариев проблемы. У нас есть URL-адрес этого комментария проблемы. И, конечно, мы видим фрагмент текста комментария. Поисковый термин (`windows`) появляется один раз в этом фрагменте.

```json
{
  "text_matches": [
    {
      "object_url": "https://api.github.com/repositories/215335/issues/132",
      "object_type": "Issue",
      "property": "body",
      "fragment": "comprehensive windows font I know of).\n\nIf we can find a commonly
      distributed windows font that supports them then no problem (we can use html
      font tags) but otherwise the '(21)' style is probably better.\n",
      "matches": [
        {
          "text": "windows",
          "indices": [
            14,
            21
          ]
        },
        {
          "text": "windows",
          "indices": [
            78,
            85
          ]
        }
      ]
    },
    {
      "object_url": "https://api.github.com/repositories/215335/issues/comments/25688",
      "object_type": "IssueComment",
      "property": "body",
      "fragment": " right after that are a bit broken IMHO :). I suppose we could
      have some hack that maxes out at whatever the font does...\n\nI'll check
      what the state of play is on Windows.\n",
      "matches": [
        {
          "text": "Windows",
          "indices": [
            163,
            170
          ]
        }
      ]
    }
  ]
}
```

> \[!NOTE]
> Most endpoints use `Authorization: Bearer <YOUR-TOKEN>` and `Accept: application/vnd.github+json` headers, plus `X-GitHub-Api-Version: 2022-11-28`. Curl examples below omit these standard headers for brevity.

## Search code

```
GET /search/code
```

Searches for query terms inside of a file. This method returns up to 100 results per page.
When searching for code, you can get text match metadata for the file content and file path fields when you pass the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.
For example, if you want to find the definition of the addClass function inside jQuery repository, your query would look something like this:
q=addClass+in:file+language:js+repo:jquery/jquery
This query searches for the keyword addClass within a file's contents. The query limits the search to files where the language is JavaScript in the jquery/jquery repository.
Considerations for code search:
Due to the complexity of searching code, there are a few restrictions on how searches are performed:

Only the default branch is considered. In most cases, this will be the master branch.
Only files smaller than 384 KB are searchable.
You must always include at least one search term when searching source code. For example, searching for language:go is not valid, while amazing language:go is.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and 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 Enterprise Server. The REST API supports different qualifiers than the web interface for GitHub Enterprise Server. To learn more about the format of the query, see Constructing a search query. See "Searching code" for a detailed list of qualifiers.

* **`sort`** (string)
  Sorts the results of your query. Can only be indexed, which indicates how recently a file has been indexed by the GitHub Enterprise Server search infrastructure. Default: best match
  Can be one of: `indexed`

* **`order`** (string)
  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.
  Default: `desc`
  Can be one of: `desc`, `asc`

* **`per_page`** (integer)
  The number of results per page (max 100). For more information, see "Using pagination in the REST API."
  Default: `30`

* **`page`** (integer)
  The page number of the results to fetch. For more information, see "Using pagination in the REST API."
  Default: `1`

### HTTP response status codes

* **200** - OK

* **304** - Not modified

* **403** - Forbidden

* **422** - Validation failed, or the endpoint has been spammed.

* **503** - Service unavailable

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/search/code
```

**Response schema (Status: 200):**

* `total_count`: required, integer
* `incomplete_results`: required, boolean
* `items`: required, array of `Code Search Result Item`:
  * `name`: required, string
  * `path`: required, string
  * `sha`: required, string
  * `url`: required, string, format: uri
  * `git_url`: required, string, format: uri
  * `html_url`: required, string, format: uri
  * `repository`: required, `Minimal Repository`:
    * `id`: required, integer, format: int64
    * `node_id`: required, string
    * `name`: required, string
    * `full_name`: required, string
    * `owner`: required, `Simple User`:
      * `name`: string or null
      * `email`: string or null
      * `login`: required, string
      * `id`: required, integer, format: int64
      * `node_id`: required, string
      * `avatar_url`: required, string, format: uri
      * `gravatar_id`: required, string or null
      * `url`: required, string, format: uri
      * `html_url`: required, string, format: uri
      * `followers_url`: required, string, format: uri
      * `following_url`: required, string
      * `gists_url`: required, string
      * `starred_url`: required, string
      * `subscriptions_url`: required, string, format: uri
      * `organizations_url`: required, string, format: uri
      * `repos_url`: required, string, format: uri
      * `events_url`: required, string
      * `received_events_url`: required, string, format: uri
      * `type`: required, string
      * `site_admin`: required, boolean
      * `starred_at`: string
      * `user_view_type`: string
    * `private`: required, boolean
    * `html_url`: required, string, format: uri
    * `description`: required, string or null
    * `fork`: required, boolean
    * `url`: required, string, format: uri
    * `archive_url`: required, string
    * `assignees_url`: required, string
    * `blobs_url`: required, string
    * `branches_url`: required, string
    * `collaborators_url`: required, string
    * `comments_url`: required, string
    * `commits_url`: required, string
    * `compare_url`: required, string
    * `contents_url`: required, string
    * `contributors_url`: required, string, format: uri
    * `deployments_url`: required, string, format: uri
    * `downloads_url`: required, string, format: uri
    * `events_url`: required, string, format: uri
    * `forks_url`: required, string, format: uri
    * `git_commits_url`: required, string
    * `git_refs_url`: required, string
    * `git_tags_url`: required, string
    * `git_url`: string
    * `issue_comment_url`: required, string
    * `issue_events_url`: required, string
    * `issues_url`: required, string
    * `keys_url`: required, string
    * `labels_url`: required, string
    * `languages_url`: required, string, format: uri
    * `merges_url`: required, string, format: uri
    * `milestones_url`: required, string
    * `notifications_url`: required, string
    * `pulls_url`: required, string
    * `releases_url`: required, string
    * `ssh_url`: string
    * `stargazers_url`: required, string, format: uri
    * `statuses_url`: required, string
    * `subscribers_url`: required, string, format: uri
    * `subscription_url`: required, string, format: uri
    * `tags_url`: required, string, format: uri
    * `teams_url`: required, string, format: uri
    * `trees_url`: required, string
    * `clone_url`: string
    * `mirror_url`: string or null
    * `hooks_url`: required, string, format: uri
    * `svn_url`: string
    * `homepage`: string or null
    * `language`: string or null
    * `forks_count`: integer
    * `stargazers_count`: integer
    * `watchers_count`: integer
    * `size`: integer
    * `default_branch`: string
    * `open_issues_count`: integer
    * `is_template`: boolean
    * `topics`: array of string
    * `has_issues`: boolean
    * `has_projects`: boolean
    * `has_wiki`: boolean
    * `has_pages`: boolean
    * `has_downloads`: boolean
    * `has_discussions`: boolean
    * `has_pull_requests`: boolean
    * `pull_request_creation_policy`: string, enum: `all`, `collaborators_only`
    * `archived`: boolean
    * `disabled`: boolean
    * `visibility`: string
    * `pushed_at`: string or null, format: date-time
    * `created_at`: string or null, format: date-time
    * `updated_at`: string or null, format: date-time
    * `permissions`: object:
      * `admin`: boolean
      * `maintain`: boolean
      * `push`: boolean
      * `triage`: boolean
      * `pull`: boolean
    * `role_name`: string
    * `temp_clone_token`: string
    * `delete_branch_on_merge`: boolean
    * `subscribers_count`: integer
    * `network_count`: integer
    * `code_of_conduct`: `Code Of Conduct`:
      * `key`: required, string
      * `name`: required, string
      * `url`: required, string, format: uri
      * `body`: string
      * `html_url`: required, string or null, format: uri
    * `license`: object or null:
      * `key`: string
      * `name`: string
      * `spdx_id`: string
      * `url`: string or null
      * `node_id`: string
    * `forks`: integer
    * `open_issues`: integer
    * `watchers`: integer
    * `allow_forking`: boolean
    * `web_commit_signoff_required`: boolean
    * `security_and_analysis`: object or null:
      * `advanced_security`: object:
        * `status`: string, enum: `enabled`, `disabled`
      * `code_security`: object:
        * `status`: string, enum: `enabled`, `disabled`
      * `dependabot_security_updates`: object:
        * `status`: string, enum: `enabled`, `disabled`
      * `secret_scanning`: object:
        * `status`: string, enum: `enabled`, `disabled`
      * `secret_scanning_push_protection`: object:
        * `status`: string, enum: `enabled`, `disabled`
      * `secret_scanning_non_provider_patterns`: object:
        * `status`: string, enum: `enabled`, `disabled`
    * `custom_properties`: object, additional properties allowed
  * `score`: required, number
  * `file_size`: integer
  * `language`: string or null
  * `last_modified_at`: string, format: date-time
  * `line_numbers`: array of string
  * `text_matches`: array of objects:
    * `object_url`: string
    * `object_type`: string or null
    * `property`: string
    * `fragment`: string
    * `matches`: array of objects:
      * `text`: string
      * `indices`: array of integer

## Search commits

```
GET /search/commits
```

Find commits via various criteria on the default branch (usually main). This method returns up to 100 results per page.
When searching for commits, you can get text match metadata for the message field when you provide the text-match media type. For more details about how to receive highlighted search results, see Text match
metadata.
For example, if you want to find commits related to CSS in the octocat/Spoon-Knife repository. Your query would look something like this:
q=repo:octocat/Spoon-Knife+css

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and 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 Enterprise Server. The REST API supports the same qualifiers as the web interface for GitHub Enterprise Server. To learn more about the format of the query, see Constructing a search query. See "Searching commits" for a detailed list of qualifiers.

* **`sort`** (string)
  Sorts the results of your query by author-date or committer-date. Default: best match
  Can be one of: `author-date`, `committer-date`

* **`order`** (string)
  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.
  Default: `desc`
  Can be one of: `desc`, `asc`

* **`per_page`** (integer)
  The number of results per page (max 100). For more information, see "Using pagination in the REST API."
  Default: `30`

* **`page`** (integer)
  The page number of the results to fetch. For more information, see "Using pagination in the REST API."
  Default: `1`

### HTTP response status codes

* **200** - OK

* **304** - Not modified

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/search/commits
```

**Response schema (Status: 200):**

* `total_count`: required, integer
* `incomplete_results`: required, boolean
* `items`: required, array of `Commit Search Result Item`:
  * `url`: required, string, format: uri
  * `sha`: required, string
  * `html_url`: required, string, format: uri
  * `comments_url`: required, string, format: uri
  * `commit`: required, object:
    * `author`: required, object:
      * `name`: required, string
      * `email`: required, string
      * `date`: required, string, format: date-time
    * `committer`: required, any of:
      * **null**
      * **Git User**
        * `name`: string
        * `email`: string
        * `date`: string, format: date-time
    * `comment_count`: required, integer
    * `message`: required, string
    * `tree`: required, object:
      * `sha`: required, string
      * `url`: required, string, format: uri
    * `url`: required, string, format: uri
    * `verification`: `Verification`:
      * `verified`: required, boolean
      * `reason`: required, string
      * `payload`: required, string or null
      * `signature`: required, string or null
      * `verified_at`: required, string or null
  * `author`: required, any of:
    * **null**
    * **Simple User**
      * `name`: string or null
      * `email`: string or null
      * `login`: required, string
      * `id`: required, integer, format: int64
      * `node_id`: required, string
      * `avatar_url`: required, string, format: uri
      * `gravatar_id`: required, string or null
      * `url`: required, string, format: uri
      * `html_url`: required, string, format: uri
      * `followers_url`: required, string, format: uri
      * `following_url`: required, string
      * `gists_url`: required, string
      * `starred_url`: required, string
      * `subscriptions_url`: required, string, format: uri
      * `organizations_url`: required, string, format: uri
      * `repos_url`: required, string, format: uri
      * `events_url`: required, string
      * `received_events_url`: required, string, format: uri
      * `type`: required, string
      * `site_admin`: required, boolean
      * `starred_at`: string
      * `user_view_type`: string
  * `committer`: required, any of:
    * **null**
    * **Git User** (see above)
  * `parents`: required, array of objects:
    * `url`: string
    * `html_url`: string
    * `sha`: string
  * `repository`: required, `Minimal Repository`:
    * `id`: required, integer, format: int64
    * `node_id`: required, string
    * `name`: required, string
    * `full_name`: required, string
    * `owner`: required, `Simple User` (see above)
    * `private`: required, boolean
    * `html_url`: required, string, format: uri
    * `description`: required, string or null
    * `fork`: required, boolean
    * `url`: required, string, format: uri
    * `archive_url`: required, string
    * `assignees_url`: required, string
    * `blobs_url`: required, string
    * `branches_url`: required, string
    * `collaborators_url`: required, string
    * `comments_url`: required, string
    * `commits_url`: required, string
    * `compare_url`: required, string
    * `contents_url`: required, string
    * `contributors_url`: required, string, format: uri
    * `deployments_url`: required, string, format: uri
    * `downloads_url`: required, string, format: uri
    * `events_url`: required, string, format: uri
    * `forks_url`: required, string, format: uri
    * `git_commits_url`: required, string
    * `git_refs_url`: required, string
    * `git_tags_url`: required, string
    * `git_url`: string
    * `issue_comment_url`: required, string
    * `issue_events_url`: required, string
    * `issues_url`: required, string
    * `keys_url`: required, string
    * `labels_url`: required, string
    * `languages_url`: required, string, format: uri
    * `merges_url`: required, string, format: uri
    * `milestones_url`: required, string
    * `notifications_url`: required, string
    * `pulls_url`: required, string
    * `releases_url`: required, string
    * `ssh_url`: string
    * `stargazers_url`: required, string, format: uri
    * `statuses_url`: required, string
    * `subscribers_url`: required, string, format: uri
    * `subscription_url`: required, string, format: uri
    * `tags_url`: required, string, format: uri
    * `teams_url`: required, string, format: uri
    * `trees_url`: required, string
    * `clone_url`: string
    * `mirror_url`: string or null
    * `hooks_url`: required, string, format: uri
    * `svn_url`: string
    * `homepage`: string or null
    * `language`: string or null
    * `forks_count`: integer
    * `stargazers_count`: integer
    * `watchers_count`: integer
    * `size`: integer
    * `default_branch`: string
    * `open_issues_count`: integer
    * `is_template`: boolean
    * `topics`: array of string
    * `has_issues`: boolean
    * `has_projects`: boolean
    * `has_wiki`: boolean
    * `has_pages`: boolean
    * `has_downloads`: boolean
    * `has_discussions`: boolean
    * `has_pull_requests`: boolean
    * `pull_request_creation_policy`: string, enum: `all`, `collaborators_only`
    * `archived`: boolean
    * `disabled`: boolean
    * `visibility`: string
    * `pushed_at`: string or null, format: date-time
    * `created_at`: string or null, format: date-time
    * `updated_at`: string or null, format: date-time
    * `permissions`: object:
      * `admin`: boolean
      * `maintain`: boolean
      * `push`: boolean
      * `triage`: boolean
      * `pull`: boolean
    * `role_name`: string
    * `temp_clone_token`: string
    * `delete_branch_on_merge`: boolean
    * `subscribers_count`: integer
    * `network_count`: integer
    * `code_of_conduct`: `Code Of Conduct`:
      * `key`: required, string
      * `name`: required, string
      * `url`: required, string, format: uri
      * `body`: string
      * `html_url`: required, string or null, format: uri
    * `license`: object or null:
      * `key`: string
      * `name`: string
      * `spdx_id`: string
      * `url`: string or null
      * `node_id`: string
    * `forks`: integer
    * `open_issues`: integer
    * `watchers`: integer
    * `allow_forking`: boolean
    * `web_commit_signoff_required`: boolean
    * `security_and_analysis`: object or null:
      * `advanced_security`: object:
        * `status`: string, enum: `enabled`, `disabled`
      * `code_security`: object:
        * `status`: string, enum: `enabled`, `disabled`
      * `dependabot_security_updates`: object:
        * `status`: string, enum: `enabled`, `disabled`
      * `secret_scanning`: object:
        * `status`: string, enum: `enabled`, `disabled`
      * `secret_scanning_push_protection`: object:
        * `status`: string, enum: `enabled`, `disabled`
      * `secret_scanning_non_provider_patterns`: object:
        * `status`: string, enum: `enabled`, `disabled`
    * `custom_properties`: object, additional properties allowed
  * `score`: required, number
  * `node_id`: required, string
  * `text_matches`: array of objects:
    * `object_url`: string
    * `object_type`: string or null
    * `property`: string
    * `fragment`: string
    * `matches`: array of objects:
      * `text`: string
      * `indices`: array of integer

## Search issues and pull requests

```
GET /search/issues
```

Find issues by state and keyword. This method returns up to 100 results per page.
When searching for issues, you can get text match metadata for the issue title, issue body, and issue comment body fields when you pass the text-match media type. For more details about how to receive highlighted
search results, see Text match metadata.
For example, if you want to find the oldest unresolved Python bugs on Windows. Your query might look something like this.
q=windows+label:bug+language:python+state:open\&sort=created\&order=asc
This query searches for the keyword windows, within any open issue that is labeled as bug. The search runs across repositories whose primary language is Python. The results are sorted by creation date in ascending order, which means the oldest issues appear first in the search results.
Note

For requests made by GitHub Apps with a user access token, you can't retrieve a combination of issues and pull requests in a single query. Requests that don't include the is:issue or is:pull-request qualifier will receive an HTTP 422 Unprocessable Entity response. To get results for both issues and pull requests, you must send separate queries for issues and pull requests. For more information about the is qualifier, see "Searching only issues or pull requests."

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and 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 Enterprise Server. The REST API supports the same qualifiers as the web interface for GitHub Enterprise Server. To learn more about the format of the query, see Constructing a search query. See "Searching issues and pull requests" for a detailed list of qualifiers.

* **`sort`** (string)
  Sorts the results of your query by the number of comments, reactions, reactions-+1, reactions--1, reactions-smile, reactions-thinking\_face, reactions-heart, reactions-tada, or interactions. You can also sort results by how recently the items were created or updated, Default: best match
  Can be one of: `comments`, `reactions`, `reactions-+1`, `reactions--1`, `reactions-smile`, `reactions-thinking_face`, `reactions-heart`, `reactions-tada`, `interactions`, `created`, `updated`

* **`order`** (string)
  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.
  Default: `desc`
  Can be one of: `desc`, `asc`

* **`per_page`** (integer)
  The number of results per page (max 100). For more information, see "Using pagination in the REST API."
  Default: `30`

* **`page`** (integer)
  The page number of the results to fetch. For more information, see "Using pagination in the REST API."
  Default: `1`

* **`advanced_search`** (string)
  Set to true to use advanced search.
  Example: <http://api.github.com/search/issues?q={query}&advanced_search=true>

* **`search_type`** (string)
  The type of search to perform on issues. When not specified, the default is lexical search.

semantic — performs a pure semantic (vector) search using embedding-based understanding.
hybrid — combines semantic search with lexical search for best results.

Semantic and hybrid search require authentication and are rate limited to 10 requests per minute.
Only applies to issue searches (/search/issues).
Can be one of: `semantic`, `hybrid`

### HTTP response status codes

* **200** - OK

* **304** - Not modified

* **401** - Requires authentication

* **403** - Forbidden

* **422** - Validation failed, or the endpoint has been spammed.

* **503** - Service unavailable

### Code examples

#### Example 1: Status Code 200

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/search/issues
```

**Response schema (Status: 200):**

* `total_count`: required, integer
* `incomplete_results`: required, boolean
* `items`: required, array of `Issue Search Result Item`:
  * `url`: required, string, format: uri
  * `repository_url`: required, string, format: uri
  * `labels_url`: required, string
  * `comments_url`: required, string, format: uri
  * `events_url`: required, string, format: uri
  * `html_url`: required, string, format: uri
  * `id`: required, integer, format: int64
  * `node_id`: required, string
  * `number`: required, integer
  * `title`: required, string
  * `locked`: required, boolean
  * `active_lock_reason`: string or null
  * `assignees`: array of `Simple User` or null:
    * `name`: string or null
    * `email`: string or null
    * `login`: required, string
    * `id`: required, integer, format: int64
    * `node_id`: required, string
    * `avatar_url`: required, string, format: uri
    * `gravatar_id`: required, string or null
    * `url`: required, string, format: uri
    * `html_url`: required, string, format: uri
    * `followers_url`: required, string, format: uri
    * `following_url`: required, string
    * `gists_url`: required, string
    * `starred_url`: required, string
    * `subscriptions_url`: required, string, format: uri
    * `organizations_url`: required, string, format: uri
    * `repos_url`: required, string, format: uri
    * `events_url`: required, string
    * `received_events_url`: required, string, format: uri
    * `type`: required, string
    * `site_admin`: required, boolean
    * `starred_at`: string
    * `user_view_type`: string
  * `user`: required, any of:
    * **null**
    * **Simple User** (see above)
  * `labels`: required, array of objects:
    * `id`: integer, format: int64
    * `node_id`: string
    * `url`: string
    * `name`: string
    * `color`: string
    * `default`: boolean
    * `description`: string or null
  * `sub_issues_summary`: `Sub-issues Summary`:
    * `total`: required, integer
    * `completed`: required, integer
    * `percent_completed`: required, integer
  * `issue_dependencies_summary`: `Issue Dependencies Summary`:
    * `blocked_by`: required, integer
    * `blocking`: required, integer
    * `total_blocked_by`: required, integer
    * `total_blocking`: required, integer
  * `issue_field_values`: array of `Issue Field Value`:
    * `issue_field_id`: required, integer, format: int64
    * `issue_field_name`: string
    * `node_id`: required, string
    * `data_type`: required, string, enum: `text`, `single_select`, `multi_select`, `number`, `date`
    * `value`: required, any of:
      * **string**
      * **number**
      * **integer**
    * `single_select_option`: object or null:
      * `id`: required, integer, format: int64
      * `name`: required, string
      * `color`: required, string
    * `multi_select_options`: array of objects or null:
      * `id`: required, integer, format: int64
      * `name`: required, string
      * `color`: required, string
  * `state`: required, string
  * `state_reason`: string or null
  * `assignee`: required, any of:
    * **null**
    * **Simple User** (see above)
  * `milestone`: required, any of:
    * **null**
    * **Milestone**
      * `url`: required, string, format: uri
      * `html_url`: required, string, format: uri
      * `labels_url`: required, string, format: uri
      * `id`: required, integer
      * `node_id`: required, string
      * `number`: required, integer
      * `state`: required, string, enum: `open`, `closed`, default: `"open"`
      * `title`: required, string
      * `description`: required, string or null
      * `creator`: required, any of:
        * **null**
        * **Simple User** (see above)
      * `open_issues`: required, integer
      * `closed_issues`: required, integer
      * `created_at`: required, string, format: date-time
      * `updated_at`: required, string, format: date-time
      * `closed_at`: required, string or null, format: date-time
      * `due_on`: required, string or null, format: date-time
  * `comments`: required, integer
  * `created_at`: required, string, format: date-time
  * `updated_at`: required, string, format: date-time
  * `closed_at`: required, string or null, format: date-time
  * `text_matches`: array of objects:
    * `object_url`: string
    * `object_type`: string or null
    * `property`: string
    * `fragment`: string
    * `matches`: array of objects:
      * `text`: string
      * `indices`: array of integer
  * `pull_request`: object:
    * `merged_at`: string or null, format: date-time
    * `diff_url`: required, string or null, format: uri
    * `html_url`: required, string or null, format: uri
    * `patch_url`: required, string or null, format: uri
    * `url`: required, string or null, format: uri
  * `body`: string
  * `score`: required, number
  * `author_association`: required, string, enum: `COLLABORATOR`, `CONTRIBUTOR`, `FIRST_TIMER`, `FIRST_TIME_CONTRIBUTOR`, `MANNEQUIN`, `MEMBER`, `NONE`, `OWNER`
  * `draft`: boolean
  * `repository`: `Repository`:
    * `id`: required, integer, format: int64
    * `node_id`: required, string
    * `name`: required, string
    * `full_name`: required, string
    * `license`: required, any of:
      * **null**
      * **License Simple**
        * `key`: required, string
        * `name`: required, string
        * `url`: required, string or null, format: uri
        * `spdx_id`: required, string or null
        * `node_id`: required, string
        * `html_url`: string, format: uri
    * `forks`: required, integer
    * `permissions`: object:
      * `admin`: required, boolean
      * `pull`: required, boolean
      * `triage`: boolean
      * `push`: required, boolean
      * `maintain`: boolean
    * `owner`: required, `Simple User` (see above)
    * `private`: required, boolean, default: `false`
    * `html_url`: required, string, format: uri
    * `description`: required, string or null
    * `fork`: required, boolean
    * `url`: required, string, format: uri
    * `archive_url`: required, string
    * `assignees_url`: required, string
    * `blobs_url`: required, string
    * `branches_url`: required, string
    * `collaborators_url`: required, string
    * `comments_url`: required, string
    * `commits_url`: required, string
    * `compare_url`: required, string
    * `contents_url`: required, string
    * `contributors_url`: required, string, format: uri
    * `deployments_url`: required, string, format: uri
    * `downloads_url`: required, string, format: uri
    * `events_url`: required, string, format: uri
    * `forks_url`: required, string, format: uri
    * `git_commits_url`: required, string
    * `git_refs_url`: required, string
    * `git_tags_url`: required, string
    * `git_url`: required, string
    * `issue_comment_url`: required, string
    * `issue_events_url`: required, string
    * `issues_url`: required, string
    * `keys_url`: required, string
    * `labels_url`: required, string
    * `languages_url`: required, string, format: uri
    * `merges_url`: required, string, format: uri
    * `milestones_url`: required, string
    * `notifications_url`: required, string
    * `pulls_url`: required, string
    * `releases_url`: required, string
    * `ssh_url`: required, string
    * `stargazers_url`: required, string, format: uri
    * `statuses_url`: required, string
    * `subscribers_url`: required, string, format: uri
    * `subscription_url`: required, string, format: uri
    * `tags_url`: required, string, format: uri
    * `teams_url`: required, string, format: uri
    * `trees_url`: required, string
    * `clone_url`: required, string
    * `mirror_url`: required, string or null, format: uri
    * `hooks_url`: required, string, format: uri
    * `svn_url`: required, string, format: uri
    * `homepage`: required, string or null, format: uri
    * `language`: required, string or null
    * `forks_count`: required, integer
    * `stargazers_count`: required, integer
    * `watchers_count`: required, integer
    * `size`: required, integer
    * `default_branch`: required, string
    * `open_issues_count`: required, integer
    * `is_template`: boolean, default: `false`
    * `topics`: array of string
    * `has_issues`: required, boolean, default: `true`
    * `has_projects`: required, boolean, default: `true`
    * `has_wiki`: required, boolean, default: `true`
    * `has_pages`: required, boolean
    * `has_downloads`: required, boolean, default: `true`, deprecated
    * `has_discussions`: boolean, default: `false`
    * `has_pull_requests`: boolean, default: `true`
    * `pull_request_creation_policy`: string, enum: `all`, `collaborators_only`
    * `archived`: required, boolean, default: `false`
    * `disabled`: required, boolean
    * `visibility`: string, default: `"public"`
    * `pushed_at`: required, string or null, format: date-time
    * `created_at`: required, string or null, format: date-time
    * `updated_at`: required, string or null, format: date-time
    * `allow_rebase_merge`: boolean, default: `true`
    * `temp_clone_token`: string
    * `allow_squash_merge`: boolean, default: `true`
    * `allow_auto_merge`: boolean, default: `false`
    * `delete_branch_on_merge`: boolean, default: `false`
    * `allow_update_branch`: boolean, default: `false`
    * `use_squash_pr_title_as_default`: boolean, default: `false`, deprecated
    * `squash_merge_commit_title`: string, enum: `PR_TITLE`, `COMMIT_OR_PR_TITLE`
    * `squash_merge_commit_message`: string, enum: `PR_BODY`, `COMMIT_MESSAGES`, `BLANK`
    * `merge_commit_title`: string, enum: `PR_TITLE`, `MERGE_MESSAGE`
    * `merge_commit_message`: string, enum: `PR_BODY`, `PR_TITLE`, `BLANK`
    * `allow_merge_commit`: boolean, default: `true`
    * `allow_forking`: boolean
    * `web_commit_signoff_required`: boolean, default: `false`
    * `open_issues`: required, integer
    * `watchers`: required, integer
    * `master_branch`: string
    * `starred_at`: string
    * `anonymous_access_enabled`: boolean
    * `code_search_index_status`: object:
      * `lexical_search_ok`: boolean
      * `lexical_commit_sha`: string
  * `body_html`: string
  * `body_text`: string
  * `timeline_url`: string, format: uri
  * `type`: `Issue Type`:
    * `id`: required, integer
    * `node_id`: required, string
    * `name`: required, string
    * `description`: required, string or null
    * `color`: string or null, enum: `gray`, `blue`, `green`, `yellow`, `orange`, `red`, `pink`, `purple`, `null`
    * `created_at`: string, format: date-time
    * `updated_at`: string, format: date-time
    * `is_enabled`: boolean
  * `performed_via_github_app`: any of:
    * **null**
    * **GitHub app**
      * `id`: required, integer
      * `slug`: string
      * `node_id`: required, string
      * `client_id`: string
      * `owner`: required, one of:
        * **Simple User** (see above)
        * **Enterprise**
          * `description`: string or null
          * `html_url`: required, string, format: uri
          * `website_url`: string or null, format: uri
          * `id`: required, integer
          * `node_id`: required, string
          * `name`: required, string
          * `slug`: required, string
          * `created_at`: required, string or null, format: date-time
          * `updated_at`: required, string or null, format: date-time
          * `avatar_url`: required, string, format: uri
      * `name`: required, string
      * `description`: required, string or null
      * `external_url`: required, string, format: uri
      * `html_url`: required, string, format: uri
      * `created_at`: required, string, format: date-time
      * `updated_at`: required, string, format: date-time
      * `permissions`: required, object, additional properties: string:
        * `issues`: string
        * `checks`: string
        * `metadata`: string
        * `contents`: string
        * `deployments`: string
      * `events`: required, array of string
      * `installations_count`: integer
  * `pinned_comment`: any of:
    * **null**
    * **Issue Comment**
      * `id`: required, integer, format: int64
      * `node_id`: required, string
      * `url`: required, string, format: uri
      * `body`: string
      * `body_text`: string
      * `body_html`: string
      * `html_url`: required, string, format: uri
      * `user`: required, any of:
        * **null**
        * **Simple User** (see above)
      * `created_at`: required, string, format: date-time
      * `updated_at`: required, string, format: date-time
      * `issue_url`: required, string, format: uri
      * `author_association`: string, enum: `COLLABORATOR`, `CONTRIBUTOR`, `FIRST_TIMER`, `FIRST_TIME_CONTRIBUTOR`, `MANNEQUIN`, `MEMBER`, `NONE`, `OWNER`
      * `performed_via_github_app`: any of:
        * **null**
        * **GitHub app** (see above)
      * `reactions`: `Reaction Rollup`:
        * `url`: required, string, format: uri
        * `total_count`: required, integer
        * `+1`: required, integer
        * `-1`: required, integer
        * `laugh`: required, integer
        * `confused`: required, integer
        * `heart`: required, integer
        * `hooray`: required, integer
        * `eyes`: required, integer
        * `rocket`: required, integer
      * `pin`: any of:
        * **null**
        * **Pinned Issue Comment**
          * `pinned_at`: required, string, format: date-time
          * `pinned_by`: required, any of:
            * **null**
            * **Simple User** (see above)
      * `minimized`: any of:
        * **null**
        * **Minimized Issue Comment**
          * `reason`: required, string or null
  * `reactions`: `Reaction Rollup` (see above)
* `search_type`: required, string, enum: `lexical`, `semantic`, `hybrid`
* `lexical_fallback_reason`: array of string, enum: `no_text_terms`, `quoted_text`, `non_issue_target`, `or_boolean_not_supported`, `no_accessible_repos`, `server_error`, `only_non_semantic_fields_requested`, `service_unavailable`

#### Example 2: Status Code 200

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/search/issues
```

**Response schema (Status: 200):**

* `total_count`: required, integer
* `incomplete_results`: required, boolean
* `items`: required, array of `Issue Search Result Item`:
  * `url`: required, string, format: uri
  * `repository_url`: required, string, format: uri
  * `labels_url`: required, string
  * `comments_url`: required, string, format: uri
  * `events_url`: required, string, format: uri
  * `html_url`: required, string, format: uri
  * `id`: required, integer, format: int64
  * `node_id`: required, string
  * `number`: required, integer
  * `title`: required, string
  * `locked`: required, boolean
  * `active_lock_reason`: string or null
  * `assignees`: array of `Simple User` or null:
    * `name`: string or null
    * `email`: string or null
    * `login`: required, string
    * `id`: required, integer, format: int64
    * `node_id`: required, string
    * `avatar_url`: required, string, format: uri
    * `gravatar_id`: required, string or null
    * `url`: required, string, format: uri
    * `html_url`: required, string, format: uri
    * `followers_url`: required, string, format: uri
    * `following_url`: required, string
    * `gists_url`: required, string
    * `starred_url`: required, string
    * `subscriptions_url`: required, string, format: uri
    * `organizations_url`: required, string, format: uri
    * `repos_url`: required, string, format: uri
    * `events_url`: required, string
    * `received_events_url`: required, string, format: uri
    * `type`: required, string
    * `site_admin`: required, boolean
    * `starred_at`: string
    * `user_view_type`: string
  * `user`: required, any of:
    * **null**
    * **Simple User** (see above)
  * `labels`: required, array of objects:
    * `id`: integer, format: int64
    * `node_id`: string
    * `url`: string
    * `name`: string
    * `color`: string
    * `default`: boolean
    * `description`: string or null
  * `sub_issues_summary`: `Sub-issues Summary`:
    * `total`: required, integer
    * `completed`: required, integer
    * `percent_completed`: required, integer
  * `issue_dependencies_summary`: `Issue Dependencies Summary`:
    * `blocked_by`: required, integer
    * `blocking`: required, integer
    * `total_blocked_by`: required, integer
    * `total_blocking`: required, integer
  * `issue_field_values`: array of `Issue Field Value`:
    * `issue_field_id`: required, integer, format: int64
    * `issue_field_name`: string
    * `node_id`: required, string
    * `data_type`: required, string, enum: `text`, `single_select`, `multi_select`, `number`, `date`
    * `value`: required, any of:
      * **string**
      * **number**
      * **integer**
    * `single_select_option`: object or null:
      * `id`: required, integer, format: int64
      * `name`: required, string
      * `color`: required, string
    * `multi_select_options`: array of objects or null:
      * `id`: required, integer, format: int64
      * `name`: required, string
      * `color`: required, string
  * `state`: required, string
  * `state_reason`: string or null
  * `assignee`: required, any of:
    * **null**
    * **Simple User** (see above)
  * `milestone`: required, any of:
    * **null**
    * **Milestone**
      * `url`: required, string, format: uri
      * `html_url`: required, string, format: uri
      * `labels_url`: required, string, format: uri
      * `id`: required, integer
      * `node_id`: required, string
      * `number`: required, integer
      * `state`: required, string, enum: `open`, `closed`, default: `"open"`
      * `title`: required, string
      * `description`: required, string or null
      * `creator`: required, any of:
        * **null**
        * **Simple User** (see above)
      * `open_issues`: required, integer
      * `closed_issues`: required, integer
      * `created_at`: required, string, format: date-time
      * `updated_at`: required, string, format: date-time
      * `closed_at`: required, string or null, format: date-time
      * `due_on`: required, string or null, format: date-time
  * `comments`: required, integer
  * `created_at`: required, string, format: date-time
  * `updated_at`: required, string, format: date-time
  * `closed_at`: required, string or null, format: date-time
  * `text_matches`: array of objects:
    * `object_url`: string
    * `object_type`: string or null
    * `property`: string
    * `fragment`: string
    * `matches`: array of objects:
      * `text`: string
      * `indices`: array of integer
  * `pull_request`: object:
    * `merged_at`: string or null, format: date-time
    * `diff_url`: required, string or null, format: uri
    * `html_url`: required, string or null, format: uri
    * `patch_url`: required, string or null, format: uri
    * `url`: required, string or null, format: uri
  * `body`: string
  * `score`: required, number
  * `author_association`: required, string, enum: `COLLABORATOR`, `CONTRIBUTOR`, `FIRST_TIMER`, `FIRST_TIME_CONTRIBUTOR`, `MANNEQUIN`, `MEMBER`, `NONE`, `OWNER`
  * `draft`: boolean
  * `repository`: `Repository`:
    * `id`: required, integer, format: int64
    * `node_id`: required, string
    * `name`: required, string
    * `full_name`: required, string
    * `license`: required, any of:
      * **null**
      * **License Simple**
        * `key`: required, string
        * `name`: required, string
        * `url`: required, string or null, format: uri
        * `spdx_id`: required, string or null
        * `node_id`: required, string
        * `html_url`: string, format: uri
    * `forks`: required, integer
    * `permissions`: object:
      * `admin`: required, boolean
      * `pull`: required, boolean
      * `triage`: boolean
      * `push`: required, boolean
      * `maintain`: boolean
    * `owner`: required, `Simple User` (see above)
    * `private`: required, boolean, default: `false`
    * `html_url`: required, string, format: uri
    * `description`: required, string or null
    * `fork`: required, boolean
    * `url`: required, string, format: uri
    * `archive_url`: required, string
    * `assignees_url`: required, string
    * `blobs_url`: required, string
    * `branches_url`: required, string
    * `collaborators_url`: required, string
    * `comments_url`: required, string
    * `commits_url`: required, string
    * `compare_url`: required, string
    * `contents_url`: required, string
    * `contributors_url`: required, string, format: uri
    * `deployments_url`: required, string, format: uri
    * `downloads_url`: required, string, format: uri
    * `events_url`: required, string, format: uri
    * `forks_url`: required, string, format: uri
    * `git_commits_url`: required, string
    * `git_refs_url`: required, string
    * `git_tags_url`: required, string
    * `git_url`: required, string
    * `issue_comment_url`: required, string
    * `issue_events_url`: required, string
    * `issues_url`: required, string
    * `keys_url`: required, string
    * `labels_url`: required, string
    * `languages_url`: required, string, format: uri
    * `merges_url`: required, string, format: uri
    * `milestones_url`: required, string
    * `notifications_url`: required, string
    * `pulls_url`: required, string
    * `releases_url`: required, string
    * `ssh_url`: required, string
    * `stargazers_url`: required, string, format: uri
    * `statuses_url`: required, string
    * `subscribers_url`: required, string, format: uri
    * `subscription_url`: required, string, format: uri
    * `tags_url`: required, string, format: uri
    * `teams_url`: required, string, format: uri
    * `trees_url`: required, string
    * `clone_url`: required, string
    * `mirror_url`: required, string or null, format: uri
    * `hooks_url`: required, string, format: uri
    * `svn_url`: required, string, format: uri
    * `homepage`: required, string or null, format: uri
    * `language`: required, string or null
    * `forks_count`: required, integer
    * `stargazers_count`: required, integer
    * `watchers_count`: required, integer
    * `size`: required, integer
    * `default_branch`: required, string
    * `open_issues_count`: required, integer
    * `is_template`: boolean, default: `false`
    * `topics`: array of string
    * `has_issues`: required, boolean, default: `true`
    * `has_projects`: required, boolean, default: `true`
    * `has_wiki`: required, boolean, default: `true`
    * `has_pages`: required, boolean
    * `has_downloads`: required, boolean, default: `true`, deprecated
    * `has_discussions`: boolean, default: `false`
    * `has_pull_requests`: boolean, default: `true`
    * `pull_request_creation_policy`: string, enum: `all`, `collaborators_only`
    * `archived`: required, boolean, default: `false`
    * `disabled`: required, boolean
    * `visibility`: string, default: `"public"`
    * `pushed_at`: required, string or null, format: date-time
    * `created_at`: required, string or null, format: date-time
    * `updated_at`: required, string or null, format: date-time
    * `allow_rebase_merge`: boolean, default: `true`
    * `temp_clone_token`: string
    * `allow_squash_merge`: boolean, default: `true`
    * `allow_auto_merge`: boolean, default: `false`
    * `delete_branch_on_merge`: boolean, default: `false`
    * `allow_update_branch`: boolean, default: `false`
    * `use_squash_pr_title_as_default`: boolean, default: `false`, deprecated
    * `squash_merge_commit_title`: string, enum: `PR_TITLE`, `COMMIT_OR_PR_TITLE`
    * `squash_merge_commit_message`: string, enum: `PR_BODY`, `COMMIT_MESSAGES`, `BLANK`
    * `merge_commit_title`: string, enum: `PR_TITLE`, `MERGE_MESSAGE`
    * `merge_commit_message`: string, enum: `PR_BODY`, `PR_TITLE`, `BLANK`
    * `allow_merge_commit`: boolean, default: `true`
    * `allow_forking`: boolean
    * `web_commit_signoff_required`: boolean, default: `false`
    * `open_issues`: required, integer
    * `watchers`: required, integer
    * `master_branch`: string
    * `starred_at`: string
    * `anonymous_access_enabled`: boolean
    * `code_search_index_status`: object:
      * `lexical_search_ok`: boolean
      * `lexical_commit_sha`: string
  * `body_html`: string
  * `body_text`: string
  * `timeline_url`: string, format: uri
  * `type`: `Issue Type`:
    * `id`: required, integer
    * `node_id`: required, string
    * `name`: required, string
    * `description`: required, string or null
    * `color`: string or null, enum: `gray`, `blue`, `green`, `yellow`, `orange`, `red`, `pink`, `purple`, `null`
    * `created_at`: string, format: date-time
    * `updated_at`: string, format: date-time
    * `is_enabled`: boolean
  * `performed_via_github_app`: any of:
    * **null**
    * **GitHub app**
      * `id`: required, integer
      * `slug`: string
      * `node_id`: required, string
      * `client_id`: string
      * `owner`: required, one of:
        * **Simple User** (see above)
        * **Enterprise**
          * `description`: string or null
          * `html_url`: required, string, format: uri
          * `website_url`: string or null, format: uri
          * `id`: required, integer
          * `node_id`: required, string
          * `name`: required, string
          * `slug`: required, string
          * `created_at`: required, string or null, format: date-time
          * `updated_at`: required, string or null, format: date-time
          * `avatar_url`: required, string, format: uri
      * `name`: required, string
      * `description`: required, string or null
      * `external_url`: required, string, format: uri
      * `html_url`: required, string, format: uri
      * `created_at`: required, string, format: date-time
      * `updated_at`: required, string, format: date-time
      * `permissions`: required, object, additional properties: string:
        * `issues`: string
        * `checks`: string
        * `metadata`: string
        * `contents`: string
        * `deployments`: string
      * `events`: required, array of string
      * `installations_count`: integer
  * `pinned_comment`: any of:
    * **null**
    * **Issue Comment**
      * `id`: required, integer, format: int64
      * `node_id`: required, string
      * `url`: required, string, format: uri
      * `body`: string
      * `body_text`: string
      * `body_html`: string
      * `html_url`: required, string, format: uri
      * `user`: required, any of:
        * **null**
        * **Simple User** (see above)
      * `created_at`: required, string, format: date-time
      * `updated_at`: required, string, format: date-time
      * `issue_url`: required, string, format: uri
      * `author_association`: string, enum: `COLLABORATOR`, `CONTRIBUTOR`, `FIRST_TIMER`, `FIRST_TIME_CONTRIBUTOR`, `MANNEQUIN`, `MEMBER`, `NONE`, `OWNER`
      * `performed_via_github_app`: any of:
        * **null**
        * **GitHub app** (see above)
      * `reactions`: `Reaction Rollup`:
        * `url`: required, string, format: uri
        * `total_count`: required, integer
        * `+1`: required, integer
        * `-1`: required, integer
        * `laugh`: required, integer
        * `confused`: required, integer
        * `heart`: required, integer
        * `hooray`: required, integer
        * `eyes`: required, integer
        * `rocket`: required, integer
      * `pin`: any of:
        * **null**
        * **Pinned Issue Comment**
          * `pinned_at`: required, string, format: date-time
          * `pinned_by`: required, any of:
            * **null**
            * **Simple User** (see above)
      * `minimized`: any of:
        * **null**
        * **Minimized Issue Comment**
          * `reason`: required, string or null
  * `reactions`: `Reaction Rollup` (see above)
* `search_type`: required, string, enum: `lexical`, `semantic`, `hybrid`
* `lexical_fallback_reason`: array of string, enum: `no_text_terms`, `quoted_text`, `non_issue_target`, `or_boolean_not_supported`, `no_accessible_repos`, `server_error`, `only_non_semantic_fields_requested`, `service_unavailable`

## Search labels

```
GET /search/labels
```

Find labels in a repository with names or descriptions that match search keywords. Returns up to 100 results per page.
When searching for labels, you can get text match metadata for the label 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.
For example, if you want to find labels in the linguist repository that match bug, defect, or enhancement. Your query might look like this:
q=bug+defect+enhancement\&repository\_id=64778136
The labels that best match the query appear first in the search results.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`repository_id`** (integer) (required)
  The id of the repository.

* **`q`** (string) (required)
  The search keywords. This endpoint does not accept qualifiers in the query. To learn more about the format of the query, see Constructing a search query.

* **`sort`** (string)
  Sorts the results of your query by when the label was created or updated. Default: best match
  Can be one of: `created`, `updated`

* **`order`** (string)
  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.
  Default: `desc`
  Can be one of: `desc`, `asc`

* **`per_page`** (integer)
  The number of results per page (max 100). For more information, see "Using pagination in the REST API."
  Default: `30`

* **`page`** (integer)
  The page number of the results to fetch. For more information, see "Using pagination in the REST API."
  Default: `1`

### HTTP response status codes

* **200** - OK

* **304** - Not modified

* **403** - Forbidden

* **404** - Resource not found

* **422** - Validation failed, or the endpoint has been spammed.

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/search/labels
```

**Response schema (Status: 200):**

* `total_count`: required, integer
* `incomplete_results`: required, boolean
* `items`: required, array of `Label Search Result Item`:
  * `id`: required, integer
  * `node_id`: required, string
  * `url`: required, string, format: uri
  * `name`: required, string
  * `color`: required, string
  * `default`: required, boolean
  * `description`: required, string or null
  * `score`: required, number
  * `text_matches`: array of objects:
    * `object_url`: string
    * `object_type`: string or null
    * `property`: string
    * `fragment`: string
    * `matches`: array of objects:
      * `text`: string
      * `indices`: array of integer

## Search repositories

```
GET /search/repositories
```

Find repositories via various criteria. This method returns up to 100 results per page.
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.
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.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and 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 Enterprise Server. The REST API supports the same qualifiers as the web interface for GitHub Enterprise Server. To learn more about the format of the query, see Constructing a search query. See "Searching for repositories" for a detailed list of qualifiers.

* **`sort`** (string)
  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
  Can be one of: `stars`, `forks`, `help-wanted-issues`, `updated`

* **`order`** (string)
  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.
  Default: `desc`
  Can be one of: `desc`, `asc`

* **`per_page`** (integer)
  The number of results per page (max 100). For more information, see "Using pagination in the REST API."
  Default: `30`

* **`page`** (integer)
  The page number of the results to fetch. For more information, see "Using pagination in the REST API."
  Default: `1`

### HTTP response status codes

* **200** - OK

* **304** - Not modified

* **422** - Validation failed, or the endpoint has been spammed.

* **503** - Service unavailable

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/search/repositories
```

**Response schema (Status: 200):**

* `total_count`: required, integer
* `incomplete_results`: required, boolean
* `items`: required, array of `Repo Search Result Item`:
  * `id`: required, integer
  * `node_id`: required, string
  * `name`: required, string
  * `full_name`: required, string
  * `owner`: required, any of:
    * **null**
    * **Simple User**
      * `name`: string or null
      * `email`: string or null
      * `login`: required, string
      * `id`: required, integer, format: int64
      * `node_id`: required, string
      * `avatar_url`: required, string, format: uri
      * `gravatar_id`: required, string or null
      * `url`: required, string, format: uri
      * `html_url`: required, string, format: uri
      * `followers_url`: required, string, format: uri
      * `following_url`: required, string
      * `gists_url`: required, string
      * `starred_url`: required, string
      * `subscriptions_url`: required, string, format: uri
      * `organizations_url`: required, string, format: uri
      * `repos_url`: required, string, format: uri
      * `events_url`: required, string
      * `received_events_url`: required, string, format: uri
      * `type`: required, string
      * `site_admin`: required, boolean
      * `starred_at`: string
      * `user_view_type`: string
  * `private`: required, boolean
  * `html_url`: required, string, format: uri
  * `description`: required, string or null
  * `fork`: required, boolean
  * `url`: required, string, format: uri
  * `created_at`: required, string, format: date-time
  * `updated_at`: required, string, format: date-time
  * `pushed_at`: required, string, format: date-time
  * `homepage`: required, string or null, format: uri
  * `size`: required, integer
  * `stargazers_count`: required, integer
  * `watchers_count`: required, integer
  * `language`: required, string or null
  * `forks_count`: required, integer
  * `open_issues_count`: required, integer
  * `master_branch`: string
  * `default_branch`: required, string
  * `score`: required, number
  * `forks_url`: required, string, format: uri
  * `keys_url`: required, string
  * `collaborators_url`: required, string
  * `teams_url`: required, string, format: uri
  * `hooks_url`: required, string, format: uri
  * `issue_events_url`: required, string
  * `events_url`: required, string, format: uri
  * `assignees_url`: required, string
  * `branches_url`: required, string
  * `tags_url`: required, string, format: uri
  * `blobs_url`: required, string
  * `git_tags_url`: required, string
  * `git_refs_url`: required, string
  * `trees_url`: required, string
  * `statuses_url`: required, string
  * `languages_url`: required, string, format: uri
  * `stargazers_url`: required, string, format: uri
  * `contributors_url`: required, string, format: uri
  * `subscribers_url`: required, string, format: uri
  * `subscription_url`: required, string, format: uri
  * `commits_url`: required, string
  * `git_commits_url`: required, string
  * `comments_url`: required, string
  * `issue_comment_url`: required, string
  * `contents_url`: required, string
  * `compare_url`: required, string
  * `merges_url`: required, string, format: uri
  * `archive_url`: required, string
  * `downloads_url`: required, string, format: uri
  * `issues_url`: required, string
  * `pulls_url`: required, string
  * `milestones_url`: required, string
  * `notifications_url`: required, string
  * `labels_url`: required, string
  * `releases_url`: required, string
  * `deployments_url`: required, string, format: uri
  * `git_url`: required, string
  * `ssh_url`: required, string
  * `clone_url`: required, string
  * `svn_url`: required, string, format: uri
  * `forks`: required, integer
  * `open_issues`: required, integer
  * `watchers`: required, integer
  * `topics`: array of string
  * `mirror_url`: required, string or null, format: uri
  * `has_issues`: required, boolean
  * `has_projects`: required, boolean
  * `has_pages`: required, boolean
  * `has_wiki`: required, boolean
  * `has_downloads`: required, boolean
  * `has_discussions`: boolean
  * `has_pull_requests`: boolean
  * `pull_request_creation_policy`: string, enum: `all`, `collaborators_only`
  * `archived`: required, boolean
  * `disabled`: required, boolean
  * `visibility`: string
  * `license`: required, any of:
    * **null**
    * **License Simple**
      * `key`: required, string
      * `name`: required, string
      * `url`: required, string or null, format: uri
      * `spdx_id`: required, string or null
      * `node_id`: required, string
      * `html_url`: string, format: uri
  * `permissions`: object:
    * `admin`: required, boolean
    * `maintain`: boolean
    * `push`: required, boolean
    * `triage`: boolean
    * `pull`: required, boolean
  * `text_matches`: array of objects:
    * `object_url`: string
    * `object_type`: string or null
    * `property`: string
    * `fragment`: string
    * `matches`: array of objects:
      * `text`: string
      * `indices`: array of integer
  * `temp_clone_token`: string
  * `allow_merge_commit`: boolean
  * `allow_squash_merge`: boolean
  * `allow_rebase_merge`: boolean
  * `allow_auto_merge`: boolean
  * `delete_branch_on_merge`: boolean
  * `allow_forking`: boolean
  * `is_template`: boolean
  * `web_commit_signoff_required`: boolean

## Search topics

```
GET /search/topics
```

Find topics via various criteria. Results are sorted by best match. This method returns up to 100 results per page. See "Searching topics" for a detailed list of qualifiers.
When searching for topics, you can get text match metadata for the topic's short\_description, description, name, or display\_name field when you pass the text-match media type. For more details about how to receive highlighted search results, see Text match metadata.
For example, if you want to search for topics related to Ruby that are featured on <https://github.com/topics>. Your query might look like this:
q=ruby+is:featured
This query searches for topics with the keyword ruby and limits the results to find only topics that are featured. The topics that are the best match for the query appear first in the search results.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and 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 Enterprise Server. The REST API supports the same qualifiers as the web interface for GitHub Enterprise Server. To learn more about the format of the query, see Constructing a search query.

* **`per_page`** (integer)
  The number of results per page (max 100). For more information, see "Using pagination in the REST API."
  Default: `30`

* **`page`** (integer)
  The page number of the results to fetch. For more information, see "Using pagination in the REST API."
  Default: `1`

### HTTP response status codes

* **200** - OK

* **304** - Not modified

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/search/topics
```

**Response schema (Status: 200):**

* `total_count`: required, integer
* `incomplete_results`: required, boolean
* `items`: required, array of `Topic Search Result Item`:
  * `name`: required, string
  * `display_name`: required, string or null
  * `short_description`: required, string or null
  * `description`: required, string or null
  * `created_by`: required, string or null
  * `released`: required, string or null
  * `created_at`: required, string, format: date-time
  * `updated_at`: required, string, format: date-time
  * `featured`: required, boolean
  * `curated`: required, boolean
  * `score`: required, number
  * `repository_count`: integer or null
  * `logo_url`: string or null, format: uri
  * `text_matches`: array of objects:
    * `object_url`: string
    * `object_type`: string or null
    * `property`: string
    * `fragment`: string
    * `matches`: array of objects:
      * `text`: string
      * `indices`: array of integer
  * `related`: array of objects or null:
    * `topic_relation`: object:
      * `id`: integer
      * `name`: string
      * `topic_id`: integer
      * `relation_type`: string
  * `aliases`: array of objects or null:
    * `topic_relation`: object:
      * `id`: integer
      * `name`: string
      * `topic_id`: integer
      * `relation_type`: string

## Search users

```
GET /search/users
```

Find users via various criteria. This method returns up to 100 results per page.
When searching for users, you can get text match metadata for the issue login, public email, and name fields when you pass the text-match media type. For more details about highlighting search results, see Text match metadata. For more details about how to receive highlighted search results, see Text match metadata.
For example, if you're looking for a list of popular users, you might try this query:
q=tom+repos:%3E42+followers:%3E1000
This query searches for users with the name tom. The results are restricted to users with more than 42 repositories and over 1,000 followers.
This endpoint does not accept authentication and will only include publicly visible users. As an alternative, you can use the GraphQL API. The GraphQL API requires authentication and will return private users, including Enterprise Managed Users (EMUs), that you are authorized to view. For more information, see "GraphQL Queries."

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and 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 Enterprise Server. The REST API supports the same qualifiers as the web interface for GitHub Enterprise Server. To learn more about the format of the query, see Constructing a search query. See "Searching users" for a detailed list of qualifiers.

* **`sort`** (string)
  Sorts the results of your query by number of followers or repositories, or when the person joined GitHub Enterprise Server. Default: best match
  Can be one of: `followers`, `repositories`, `joined`

* **`order`** (string)
  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.
  Default: `desc`
  Can be one of: `desc`, `asc`

* **`per_page`** (integer)
  The number of results per page (max 100). For more information, see "Using pagination in the REST API."
  Default: `30`

* **`page`** (integer)
  The page number of the results to fetch. For more information, see "Using pagination in the REST API."
  Default: `1`

### HTTP response status codes

* **200** - OK

* **304** - Not modified

* **422** - Validation failed, or the endpoint has been spammed.

* **503** - Service unavailable

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/search/users
```

**Response schema (Status: 200):**

* `total_count`: required, integer
* `incomplete_results`: required, boolean
* `items`: required, array of `User Search Result Item`:
  * `login`: required, string
  * `id`: required, integer, format: int64
  * `node_id`: required, string
  * `avatar_url`: required, string, format: uri
  * `gravatar_id`: required, string or null
  * `url`: required, string, format: uri
  * `html_url`: required, string, format: uri
  * `followers_url`: required, string, format: uri
  * `subscriptions_url`: required, string, format: uri
  * `organizations_url`: required, string, format: uri
  * `repos_url`: required, string, format: uri
  * `received_events_url`: required, string, format: uri
  * `type`: required, string
  * `score`: required, number
  * `following_url`: required, string
  * `gists_url`: required, string
  * `starred_url`: required, string
  * `events_url`: required, string
  * `public_repos`: integer
  * `public_gists`: integer
  * `followers`: integer
  * `following`: integer
  * `created_at`: string, format: date-time
  * `updated_at`: string, format: date-time
  * `name`: string or null
  * `bio`: string or null
  * `email`: string or null, format: email
  * `location`: string or null
  * `site_admin`: required, boolean
  * `hireable`: boolean or null
  * `text_matches`: array of objects:
    * `object_url`: string
    * `object_type`: string or null
    * `property`: string
    * `fragment`: string
    * `matches`: array of objects:
      * `text`: string
      * `indices`: array of integer
  * `blog`: string or null
  * `company`: string or null
  * `suspended_at`: string or null, format: date-time
  * `user_view_type`: string