---
title: "Search GitHub repos, conversations, discussions, or code"
method: POST
path: "/api/v1/github/search"
tags: ["GitHub"]
---

# Search GitHub repos, conversations, discussions, or code

`POST /api/v1/github/search`

## Request

- Base URL: `https://glim.sh`
- URL: `https://glim.sh/api/v1/github/search`
- Auth: one of:
  - none
  - API key in header `x-api-key`
  - HTTP bearer
  - API key in query parameter `apiKey`

Search GitHub repositories, conversations (issues + PRs), discussions, or code. Supports GitHub search syntax.

## Request body

- object
  - `query` string, required: Search query in full GitHub search syntax: qualifiers (repo:owner/name, org:/user:, language:, path: with globs, symbol:, content:, is:, stars:>N, label:, sort:stars), boolean AND/OR/NOT with parentheses, "exact strings", and /regex/. kind=repos: minimal distinctive keywords - the project/library name (GOOD: 'rtk', 'react query'; BAD: 'rtk rust token killer' - every extra word must ALL match and buries the real repo; filter with qualifiers, not prose). kind=code: ONE literal code pattern as it appears in files ('useState('), an "exact string", a /regex/, or symbol:name for definitions; narrow with repo:/language:/path:, not extra words. kind=conversations: keywords plus filters (is:issue, label:bug). kind=discussions: keywords plus repo:/org:/author:/is:answered/category: - a separate GitHub index from issues/PRs, so a thread that lives in Discussions is invisible to kind=conversations (and vice versa). category: matches the repo's own category name (Ideas, Q&A) and needs a repo: scope; sort: does not apply. Caution: sort: REPLACES relevance ranking (sort:reactions = most-popular thread mentioning the words anywhere, incl. comments) - omit sort: for best-match. Not supported in code search: license:, enterprise:, is:vendored, is:generated.
  - `kind` 'repos' | 'conversations' | 'code' | 'discussions': What to search: 'repos', 'conversations' (issues+PRs), 'discussions' (GitHub Discussions - a separate index from issues/PRs), or 'code' (literal/regex/symbol search across 2.8M+ public GitHub repos). Optional - inferred from the query: is:answered/category: implies discussions, is:/label:/author: implies conversations, path:/symbol:/content://regex/ implies code, stars:/topic:/in:readme implies repos, otherwise repos. type:code / type:repos / type:discussions in the query also works. A conversations search that matches nothing is retried as discussions, so an answer that lives in Discussions is not silently missed.
  - `repo` string: Scope to one repository. Accepts 'owner/name', a github.com URL, or a partial 'owner/' (code). Works with any kind; setting it with kind=repos routes the search to conversations, since repo-name search can't scope to one repo. Equivalent to a repo: qualifier in the query (if both are given they must match).
  - `page` integer: Page number
  - `per_page` integer: Results per page

## Response `200`

Search results

- object: GithubSearchResponse
  - `kind` 'repos' | 'conversations' | 'code' | 'discussions', required: The kind that was searched
  - `results` union[], required: Matches, shaped by kind
    - union
      - object: GithubRepo
        - `id` number, required
        - `full_name` string, required
        - `description` string
        - `language` string
        - `stargazers_count` number
        - `forks_count` number
        - `open_issues_count` number
        - `default_branch` string
        - `created_at` string
        - `updated_at` string
        - `pushed_at` string
        - `topics` string[]
        - `license` object: GithubLicense
          - `spdx_id` string
          - `name` string
        - `homepage` string
        - `size` number
        - `archived` boolean
        - `fork` boolean
        - `parent` string
        - `subscribers_count` number
        - `has_issues` boolean
        - `owner` object: GithubOwner
          - `login` string, required
          - `avatar_url` string
          - `type` string
        - `readme` string
      - object: GithubPr
        - `number` number, required
        - `title` string, required
        - `html_url` string
        - `body` string
        - `state` string
        - `author` string
        - `labels` object[]
          - `name` string, required
          - `color` string
        - `created_at` string
        - `updated_at` string
        - `closed_at` string
        - `state_reason` string
        - `closed_by` string
        - `assignees` string[]
        - `milestone` string
        - `locked` boolean
        - `author_association` string
        - `reactions` object: GithubReactions
        - `sub_issues` object
          - `total` number, required
          - `completed` number, required
        - `comments_count` number
        - `comments` object[]
          - `id` number, required
          - `body` string
          - `author` string
          - `created_at` string
          - `updated_at` string
          - `author_association` string
          - `reactions` object: GithubReactions
          - `parent_id` number
        - `comments_page` number
        - `links` object[]
          - `type` 'cross_referenced' | 'connected' | 'disconnected' | 'closed' | 'reopened' | 'referenced' | 'duplicate' | 'not_duplicate' | 'renamed' | 'transferred' | 'converted_to_discussion', required
          - `actor` string
          - `at` string
          - `number` number
          - `title` string
          - `url` string
          - `state` string
          - `is_pr` boolean
          - `sha` string
          - `from` string
        - `merged` boolean
        - `merged_at` string
        - `merged_by` string
        - `merge_commit_sha` string
        - `draft` boolean
        - `head_ref` string
        - `base_ref` string
        - `head_repo` string
        - `commits` number
        - `requested_reviewers` string[]
        - `additions` number
        - `deletions` number
        - `changed_files` number
        - `reviews` object[]
          - `author` string
          - `state` string, required
          - `body` string
          - `submitted_at` string
        - `review_comments` object[]
          - `id` number, required
          - `body` string
          - `author` string
          - `created_at` string
          - `updated_at` string
          - `author_association` string
          - `reactions` object: GithubReactions
          - `parent_id` number
          - `path` string
          - `line` number
        - `files` object[]
          - `filename` string, required
          - `status` string
          - `additions` number
          - `deletions` number
          - `changes` number
          - `patch` string
      - object: GithubDiscussion
        - `number` number, required
        - `title` string, required
        - `html_url` string
        - `body` string
        - `state` string
        - `author` string
        - `labels` object[]
          - `name` string, required
          - `color` string
        - `created_at` string
        - `updated_at` string
        - `closed_at` string
        - `state_reason` string
        - `closed_by` string
        - `assignees` string[]
        - `milestone` string
        - `locked` boolean
        - `author_association` string
        - `reactions` object: GithubReactions
        - `sub_issues` object
          - `total` number, required
          - `completed` number, required
        - `comments_count` number
        - `comments` object[]
          - `id` number, required
          - `body` string
          - `author` string
          - `created_at` string
          - `updated_at` string
          - `author_association` string
          - `reactions` object: GithubReactions
          - `parent_id` number
        - `comments_page` number
        - `links` object[]
          - `type` 'cross_referenced' | 'connected' | 'disconnected' | 'closed' | 'reopened' | 'referenced' | 'duplicate' | 'not_duplicate' | 'renamed' | 'transferred' | 'converted_to_discussion', required
          - `actor` string
          - `at` string
          - `number` number
          - `title` string
          - `url` string
          - `state` string
          - `is_pr` boolean
          - `sha` string
          - `from` string
        - `repo` string
        - `category` string
        - `answer_url` string
        - `answer_by` string
      - object: GithubIssue
        - `number` number, required
        - `title` string, required
        - `html_url` string
        - `body` string
        - `state` string
        - `author` string
        - `labels` object[]
          - `name` string, required
          - `color` string
        - `created_at` string
        - `updated_at` string
        - `closed_at` string
        - `state_reason` string
        - `closed_by` string
        - `assignees` string[]
        - `milestone` string
        - `locked` boolean
        - `author_association` string
        - `reactions` object: GithubReactions
        - `sub_issues` object
          - `total` number, required
          - `completed` number, required
        - `comments_count` number
        - `comments` object[]
          - `id` number, required
          - `body` string
          - `author` string
          - `created_at` string
          - `updated_at` string
          - `author_association` string
          - `reactions` object: GithubReactions
          - `parent_id` number
        - `comments_page` number
        - `links` object[]
          - `type` 'cross_referenced' | 'connected' | 'disconnected' | 'closed' | 'reopened' | 'referenced' | 'duplicate' | 'not_duplicate' | 'renamed' | 'transferred' | 'converted_to_discussion', required
          - `actor` string
          - `at` string
          - `number` number
          - `title` string
          - `url` string
          - `state` string
          - `is_pr` boolean
          - `sha` string
          - `from` string
      - object: GithubCodeResult
        - `repo` string, required
        - `path` string, required
        - `url` string
        - `branch` string
        - `license` string
        - `snippets` object[]
          - `line` number
          - `text` string, required
  - `total_count` number, required: Matches found (files, for code)
  - `incomplete_results` boolean, required: Whether coverage was cut short
  - `has_more` boolean, required: Whether another page exists
  - `next_cursor` string: Pass as `page` for the next page
  - `notice` string: How the search was interpreted - re-routing, query grouping, degraded coverage. Can mean the query was rewritten.

## Other responses

- `400`: Bad Request
- `402`: Payment Required
- `502`: Upstream Error

---

[API](https://skmtc.dev/glim/apis/glim-sh.md) · [All operations](https://skmtc.dev/glim/apis/glim-sh/llms.txt) · [OpenAPI document](https://skmtc.dev/glim/apis/glim-sh/revisions/0094e5226d73?raw)
