Skip to content

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.

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 os
from alter_sdk import App
from 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()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
queryobjectRequired within parentAdditional keys: not allowed
query.qstringRequired within parent
query.sortstringOptionalOne of: comments, reactions, reactions-+1, reactions—1, reactions-smile, reactions-thinking_face, reactions-heart, reactions-tada, interactions, created, updated
query.orderstringOptionalDefault: desc
One of: desc, asc
query.per_pageintegerOptionalDefault: 30
query.pageintegerOptionalDefault: 1
query.advanced_searchstringOptional
query.search_typestringOptionalOne of: semantic, hybrid

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$objectRoot
incomplete_resultsbooleanRequired within parent
itemsarrayRequired within parent
items[]ModelEach itemExpand Search issues and pull requests — response body — items item
lexical_fallback_reasonarrayOptionalWhen 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[]stringEach itemKnown 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_typestringRequired within parentThe type of search that was performed. Possible values are `lexical`, `semantic`, or `hybrid`.
Known values: lexical, semantic, hybrid
total_countJSONRequired within parent
total_count (anyOf 1)integerAlternative
total_count (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:.[0-9]+)?(?:[eE][+-]?[0-9]+)?$

Referenced models: Search issues and pull requests — response body — items item

19 more schemas are linked from the tables above, on the schema pages.

Search issues and pull requests — response body — items item
FieldTypePresenceDescription and constraints
$objectRootIssue Search Result Item
active_lock_reasonJSONOptional
active_lock_reason (anyOf 1)stringAlternative
active_lock_reason (anyOf 2)nullAlternative
assigneesJSONOptional
assignees (anyOf 1)arrayAlternative
assignees (anyOf 1)[]ModelEach itemExpand List users — response body — item
assignees (anyOf 2)nullAlternative
author_associationstringRequired within parentHow the author is associated with the repository.
Known values: COLLABORATOR, CONTRIBUTOR, FIRST_TIMER, FIRST_TIME_CONTRIBUTOR, MANNEQUIN, MEMBER, NONE, OWNER
bodystringOptional
body_htmlstringOptional
body_textstringOptional
closed_atJSONRequired within parent
closed_at (anyOf 1)stringAlternativeFormat: date-time
closed_at (anyOf 2)nullAlternative
commentsJSONRequired within parent
comments (anyOf 1)integerAlternative
comments (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
comments_urlstringRequired within parentFormat: uri
created_atstringRequired within parentFormat: date-time
draftbooleanOptional
events_urlstringRequired within parentFormat: uri
html_urlstringRequired within parentFormat: uri
idJSONRequired within parent
id (anyOf 1)integerAlternativeFormat: int64
id (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
issue_dependencies_summaryModelOptionalExpand Get an issue — response body — issue dependencies summary
issue_field_valuesarrayOptional
issue_field_values[]ModelEach itemExpand Add issue field values to an issue — response body — item
labelsarrayRequired within parent
labels[]objectEach item
labels[].archived_atJSONOptional
labels[].archived_at (anyOf 1)stringAlternativeTimestamp indicating when the label was archived, or `null` if it has not been archived.
Format: date-time
labels[].archived_at (anyOf 2)nullAlternative
labels[].archived_byJSONOptional
labels[].archived_by (anyOf 1)JSONAlternativeThe user who archived the label, or `null` if it has not been archived.
labels[].archived_by (anyOf 1) (allOf 1)ModelAll variants applyExpand List users — response body — item
labels[].archived_by (anyOf 2)nullAlternative
labels[].colorstringOptional
labels[].defaultbooleanOptional
labels[].descriptionJSONOptional
labels[].description (anyOf 1)stringAlternative
labels[].description (anyOf 2)nullAlternative
labels[].idJSONOptional
labels[].id (anyOf 1)integerAlternativeFormat: int64
labels[].id (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
labels[].namestringOptional
labels[].node_idstringOptional
labels[].urlstringOptional
labels_urlstringRequired within parent
lockedbooleanRequired within parent
milestoneModelRequired within parentExpand Get an issue — response body — milestone
node_idstringRequired within parent
numberJSONRequired within parent
number (anyOf 1)integerAlternative
number (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
performed_via_github_appModelOptionalExpand Get an app — response body
pinned_commentModelOptionalExpand Get an issue — response body — pinned comment
pull_requestobjectOptional
pull_request.diff_urlJSONRequired within parent
pull_request.diff_url (anyOf 1)stringAlternativeFormat: uri
pull_request.diff_url (anyOf 2)nullAlternative
pull_request.html_urlJSONRequired within parent
pull_request.html_url (anyOf 1)stringAlternativeFormat: uri
pull_request.html_url (anyOf 2)nullAlternative
pull_request.merged_atJSONOptional
pull_request.merged_at (anyOf 1)stringAlternativeFormat: date-time
pull_request.merged_at (anyOf 2)nullAlternative
pull_request.patch_urlJSONRequired within parent
pull_request.patch_url (anyOf 1)stringAlternativeFormat: uri
pull_request.patch_url (anyOf 2)nullAlternative
pull_request.urlJSONRequired within parent
pull_request.url (anyOf 1)stringAlternativeFormat: uri
pull_request.url (anyOf 2)nullAlternative
reactionsModelOptionalExpand Get an issue — response body — reactions
repositoryModelOptionalExpand List repositories for the authenticated user — response body — item
repository_urlstringRequired within parentFormat: uri
scoreJSONRequired within parent
score (anyOf 1)numberAlternative
score (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
statestringRequired within parent
state_reasonJSONOptional
state_reason (anyOf 1)stringAlternative
state_reason (anyOf 2)nullAlternative
statusJSONOptional
status (anyOf 1)ModelAlternativeExpand Get an issue — response body — status category, id, name
status (anyOf 2)nullAlternative
sub_issues_summaryModelOptionalExpand Get an issue — response body — sub issues summary
text_matchesModelOptionalExpand Search code — response body — items item text matches
timeline_urlstringOptionalFormat: uri
titlestringRequired within parent
typeModelOptionalExpand Create an issue type — response body
updated_atstringRequired within parentFormat: date-time
urlstringRequired within parentFormat: uri
userModelRequired within parentExpand 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 an issue type — 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 — status category, id, name

Get an issue — response body — pinned comment
FieldTypePresenceDescription and constraints
$JSONRoot
$ (anyOf 1)ModelAlternativeExpand Get an issue — response body — pinned comment author association, body, body html, body text, created at, html url, id, issue url, minimized, node id, performed via github app, pin, reactions, updated at, url, user
$ (anyOf 2)nullAlternative

Referenced models: Get an issue — response body — pinned comment author association, body, body html, body text, created at, html url, id, issue url, minimized, node id, performed via github app, pin, reactions, updated at, url, user

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"}

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand how our website, product, and documentation are used.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

Advertising

Shares visits and sign-ups with Meta, Reddit, and X so we can measure which of our ads work.

You can change these choices at any time from Cookie settings.