> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blinkops.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Search Issues And Pull Requests

Find issues by state and keyword. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination).

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](https://docs.github.com/rest/reference/search#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 [user-to-server](https://docs.github.com/developers/apps/identifying-and-authorizing-users-for-github-apps#user-to-server-requests) GitHub App requests, 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](https://docs.github.com/github/searching-for-information-on-github/searching-issues-and-pull-requests#search-only-issues-or-pull-requests).".

<Note>
  External Documentation

  To learn more, visit the [GitHub documentation](https://docs.github.com/rest/reference/search#search-issues-and-pull-requests).
</Note>

## Basic Parameters

<div className="integrations-table">
  | Parameter        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
  | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Query            | 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 the web interface for GitHub. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching issues and pull requests](https://docs.github.com/search-github/searching-on-github/searching-issues-and-pull-requests)" for a detailed list of qualifiers. |
  | Return All Pages | Automatically fetch all resources, page by page.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
</div>

## Advanced Parameters

<div className="integrations-table">
  | Parameter | Description                                                                                                                                                                                                                                                                                                                                                                                   |
  | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Order     | 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`.                                                                                                                                                                                                       |
  | Page      | Page number of the results to fetch.                                                                                                                                                                                                                                                                                                                                                          |
  | Per Page  | The number of results per page (max 100).                                                                                                                                                                                                                                                                                                                                                     |
  | Sort      | 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](https://docs.github.com/rest/reference/search#ranking-search-results). |
</div>

## Example Output

```json theme={"dark"}
{
	"value": {
		"incomplete_results": false,
		"items": [
			{
				"assignee": null,
				"author_association": "COLLABORATOR",
				"body": "...",
				"closed_at": null,
				"comments": 15,
				"comments_url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/comments",
				"created_at": "2009-07-12T20:10:41Z",
				"events_url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/events",
				"html_url": "https://github.com/batterseapower/pinyin-toolkit/issues/132",
				"id": 35802,
				"labels": [
					{
						"color": "ff0000",
						"id": 4,
						"name": "bug",
						"node_id": "MDU6TGFiZWw0",
						"url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/labels/bug"
					}
				],
				"labels_url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/labels{/name}",
				"locked": true,
				"milestone": {
					"closed_at": "2013-02-12T13:22:01Z",
					"closed_issues": 8,
					"created_at": "2011-04-10T20:09:31Z",
					"creator": {
						"avatar_url": "https://github.com/images/error/octocat_happy.gif",
						"events_url": "https://api.github.com/users/octocat/events{/privacy}",
						"followers_url": "https://api.github.com/users/octocat/followers",
						"following_url": "https://api.github.com/users/octocat/following{/other_user}",
						"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
						"gravatar_id": "",
						"html_url": "https://github.com/octocat",
						"id": 1,
						"login": "octocat",
						"node_id": "MDQ6VXNlcjE=",
						"organizations_url": "https://api.github.com/users/octocat/orgs",
						"received_events_url": "https://api.github.com/users/octocat/received_events",
						"repos_url": "https://api.github.com/users/octocat/repos",
						"site_admin": false,
						"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
						"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
						"type": "User",
						"url": "https://api.github.com/users/octocat"
					},
					"description": "Tracking milestone for version 1.0",
					"due_on": "2012-10-09T23:39:01Z",
					"html_url": "https://github.com/octocat/Hello-World/milestones/v1.0",
					"id": 1002604,
					"labels_url": "https://api.github.com/repos/octocat/Hello-World/milestones/1/labels",
					"node_id": "MDk6TWlsZXN0b25lMTAwMjYwNA==",
					"number": 1,
					"open_issues": 4,
					"state": "open",
					"title": "v1.0",
					"updated_at": "2014-03-03T18:58:10Z",
					"url": "https://api.github.com/repos/octocat/Hello-World/milestones/1"
				},
				"node_id": "MDU6SXNzdWUzNTgwMg==",
				"number": 132,
				"pull_request": {
					"diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
					"html_url": "https://github.com/octocat/Hello-World/pull/1347",
					"patch_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347",
					"url": "https://api/github.com/repos/octocat/Hello-World/pull/1347"
				},
				"repository_url": "https://api.github.com/repos/batterseapower/pinyin-toolkit",
				"score": 1,
				"state": "open",
				"title": "Line Number Indexes Beyond 20 Not Displayed",
				"updated_at": "2009-07-19T09:23:43Z",
				"url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132",
				"user": {
					"avatar_url": "https://secure.gravatar.com/avatar/934442aadfe3b2f4630510de416c5718?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
					"events_url": "https://api.github.com/users/Nick3C/events{/privacy}",
					"followers_url": "https://api.github.com/users/Nick3C/followers",
					"following_url": "https://api.github.com/users/Nick3C/following{/other_user}",
					"gists_url": "https://api.github.com/users/Nick3C/gists{/gist_id}",
					"gravatar_id": "",
					"html_url": "https://github.com/Nick3C",
					"id": 90254,
					"login": "Nick3C",
					"node_id": "MDQ6VXNlcjkwMjU0",
					"organizations_url": "https://api.github.com/users/Nick3C/orgs",
					"received_events_url": "https://api.github.com/users/Nick3C/received_events",
					"repos_url": "https://api.github.com/users/Nick3C/repos",
					"site_admin": true,
					"starred_url": "https://api.github.com/users/Nick3C/starred{/owner}{/repo}",
					"subscriptions_url": "https://api.github.com/users/Nick3C/subscriptions",
					"type": "User",
					"url": "https://api.github.com/users/Nick3C"
				}
			}
		],
		"total_count": 280
	}
}
```

## Workflow Library Example

[Search Issues and Pull Requests with Github and Send Results Via Email](https://library.blinkops.com/workflows/search-issues-and-pull-requests-with-github-and-send-results-via-email)

<div className="iframe-wrapper">
  <div className="iframe-media">
    <img src="https://mintcdn.com/blinkops-2/ojHYuDeYX5FWuN8a/img/Icons/play-box.svg?fit=max&auto=format&n=ojHYuDeYX5FWuN8a&q=85&s=b8af968e71438a9499c3223c9bd29fb2" alt="Workflow Library" width="16" height="16" data-path="img/Icons/play-box.svg" />

    Preview this Workflow on desktop
  </div>

  <iframe className="iframe" src="https://library.blinkops.com/workflows/search-issues-and-pull-requests-with-github-and-send-results-via-email/canvas" />
</div>
