GitHub: Search issues and pull requests
GitHub search.searchIssuesAndPullRequests: arguments, response, policy and SDK examples.
← Search operations · Get started
Operation github.search_issues_and_pull_requests
Provider route: GET /search/issues. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/github with npm, or alter-sdk-github with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { GitHubIntegration } from "@alter-ai/github";
async function execute(input: Parameters<GitHubIntegration["search"]["searchIssuesAndPullRequests"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new GitHubIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.search.searchIssuesAndPullRequests(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_github import GitHubIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = GitHubIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.search.search_issues_and_pull_requests(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
query | object | Required within parent | Additional keys: not allowed |
query.q | string | Required within parent | |
query.sort | string | Optional | One of: comments, reactions, reactions-+1, reactions—1, reactions-smile, reactions-thinking_face, reactions-heart, reactions-tada, interactions, created, updated |
query.order | string | Optional | Default: desc One of: desc, asc |
query.per_page | integer | Optional | Default: 30 |
query.page | integer | Optional | Default: 1 |
query.advanced_search | string | Optional | |
query.search_type | string | Optional | One of: semantic, hybrid |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
incomplete_results | boolean | Required within parent | |
items | array | Required within parent | |
items[] | Model | Each item | Expand Search issues and pull requests — response body — items item |
lexical_fallback_reason | array | Optional | When a semantic or hybrid search falls back to lexical search, this field contains the reasons for the fallback. Only present when a fallback occurred. |
lexical_fallback_reason[] | string | Each item | Known values: 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_type | string | Required within parent | The type of search that was performed. Possible values are `lexical`, `semantic`, or `hybrid`. Known values: lexical, semantic, hybrid |
total_count | JSON | Required within parent | |
total_count (anyOf 1) | integer | Alternative | |
total_count (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Referenced models: Search issues and pull requests — response body — items item
Schemas
Section titled “Schemas”18 more schemas are linked from the tables above, on the schema pages.
Search issues and pull requests — response body — items item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Issue Search Result Item |
active_lock_reason | JSON | Optional | |
active_lock_reason (anyOf 1) | string | Alternative | |
active_lock_reason (anyOf 2) | null | Alternative | |
assignees | JSON | Optional | |
assignees (anyOf 1) | array | Alternative | |
assignees (anyOf 1)[] | Model | Each item | Expand List users — response body — item |
assignees (anyOf 2) | null | Alternative | |
author_association | string | Required within parent | How the author is associated with the repository. Known values: COLLABORATOR, CONTRIBUTOR, FIRST_TIMER, FIRST_TIME_CONTRIBUTOR, MANNEQUIN, MEMBER, NONE, OWNER |
body | string | Optional | |
body_html | string | Optional | |
body_text | string | Optional | |
closed_at | JSON | Required within parent | |
closed_at (anyOf 1) | string | Alternative | Format: date-time |
closed_at (anyOf 2) | null | Alternative | |
comments | JSON | Required within parent | |
comments (anyOf 1) | integer | Alternative | |
comments (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
comments_url | string | Required within parent | Format: uri |
created_at | string | Required within parent | Format: date-time |
draft | boolean | Optional | |
events_url | string | Required within parent | Format: uri |
html_url | string | Required within parent | Format: uri |
id | JSON | Required within parent | |
id (anyOf 1) | integer | Alternative | Format: int64 |
id (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
issue_dependencies_summary | Model | Optional | Expand Get an issue — response body — issue dependencies summary |
issue_field_values | array | Optional | |
issue_field_values[] | Model | Each item | Expand Add issue field values to an issue — response body — item |
labels | array | Required within parent | |
labels[] | object | Each item | |
labels[].archived_at | JSON | Optional | |
labels[].archived_at (anyOf 1) | string | Alternative | Timestamp indicating when the label was archived, or `null` if it has not been archived. Format: date-time |
labels[].archived_at (anyOf 2) | null | Alternative | |
labels[].archived_by | JSON | Optional | |
labels[].archived_by (anyOf 1) | JSON | Alternative | The user who archived the label, or `null` if it has not been archived. |
labels[].archived_by (anyOf 1) (allOf 1) | Model | All variants apply | Expand List users — response body — item |
labels[].archived_by (anyOf 2) | null | Alternative | |
labels[].color | string | Optional | |
labels[].default | boolean | Optional | |
labels[].description | JSON | Optional | |
labels[].description (anyOf 1) | string | Alternative | |
labels[].description (anyOf 2) | null | Alternative | |
labels[].id | JSON | Optional | |
labels[].id (anyOf 1) | integer | Alternative | Format: int64 |
labels[].id (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
labels[].name | string | Optional | |
labels[].node_id | string | Optional | |
labels[].url | string | Optional | |
labels_url | string | Required within parent | |
locked | boolean | Required within parent | |
milestone | Model | Required within parent | Expand Get an issue — response body — milestone |
node_id | string | Required within parent | |
number | JSON | Required within parent | |
number (anyOf 1) | integer | Alternative | |
number (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
performed_via_github_app | Model | Optional | Expand Get an app — response body |
pinned_comment | Model | Optional | Expand Get an issue — response body — pinned comment |
pull_request | object | Optional | |
pull_request.diff_url | JSON | Required within parent | |
pull_request.diff_url (anyOf 1) | string | Alternative | Format: uri |
pull_request.diff_url (anyOf 2) | null | Alternative | |
pull_request.html_url | JSON | Required within parent | |
pull_request.html_url (anyOf 1) | string | Alternative | Format: uri |
pull_request.html_url (anyOf 2) | null | Alternative | |
pull_request.merged_at | JSON | Optional | |
pull_request.merged_at (anyOf 1) | string | Alternative | Format: date-time |
pull_request.merged_at (anyOf 2) | null | Alternative | |
pull_request.patch_url | JSON | Required within parent | |
pull_request.patch_url (anyOf 1) | string | Alternative | Format: uri |
pull_request.patch_url (anyOf 2) | null | Alternative | |
pull_request.url | JSON | Required within parent | |
pull_request.url (anyOf 1) | string | Alternative | Format: uri |
pull_request.url (anyOf 2) | null | Alternative | |
reactions | Model | Optional | Expand Get an issue — response body — reactions |
repository | Model | Optional | Expand List repositories for the authenticated user — response body — item |
repository_url | string | Required within parent | Format: uri |
score | JSON | Required within parent | |
score (anyOf 1) | number | Alternative | |
score (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
state | string | Required within parent | |
state_reason | JSON | Optional | |
state_reason (anyOf 1) | string | Alternative | |
state_reason (anyOf 2) | null | Alternative | |
sub_issues_summary | Model | Optional | Expand Get an issue — response body — sub issues summary |
text_matches | Model | Optional | Expand Search code — response body — items item text matches |
timeline_url | string | Optional | Format: uri |
title | string | Required within parent | |
type | Model | Optional | Expand Create issue type for an organization — response body |
updated_at | string | Required within parent | Format: date-time |
url | string | Required within parent | Format: uri |
user | Model | Required within parent | Expand Get an issue — response body — user |
Referenced models: Get an app — response body, Get an issue — response body — issue dependencies summary, Add issue field values to an issue — response body — item, Create issue type for an organization — response body, Get an issue — response body — pinned comment, Get an issue — response body — milestone, Get an issue — response body — user, Get an issue — response body — reactions, List repositories for the authenticated user — response body — item, Search code — response body — items item text matches, List users — response body — item, Get an issue — response body — sub issues summary
Get an issue — response body — issue dependencies summary
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
blocked_by | JSON | Required within parent | |
blocked_by (anyOf 1) | integer | Alternative | |
blocked_by (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
blocking | JSON | Required within parent | |
blocking (anyOf 1) | integer | Alternative | |
blocking (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
total_blocked_by | JSON | Required within parent | |
total_blocked_by (anyOf 1) | integer | Alternative | |
total_blocked_by (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
total_blocking | JSON | Required within parent | |
total_blocking (anyOf 1) | integer | Alternative | |
total_blocking (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: github.search_issues_and_pull_requests. Catalog operation: search/issues-and-pull-requests. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Pinned headers: {"X-GitHub-Api-Version": "2026-03-10", "User-Agent": "Alter", "Accept": "application/vnd.github+json"}