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

# Search code across public GitHub repositories



## OpenAPI

````yaml /openapi.json post /github/search-code
openapi: 3.1.0
info:
  title: Bridgly API
  description: >-
    Web scraping API for LinkedIn, X (Twitter) and Reddit. Authenticated
    endpoints accept a Bridgly API key (`bgly_…`) via `Authorization: Bearer
    <token>`.
  version: 1.0.0
servers:
  - url: https://api.bridgly.app
    description: Production
security: []
tags:
  - name: LinkedIn
    description: Scrape LinkedIn profiles, companies, posts, and search.
  - name: Reddit
    description: Scrape Reddit posts, subreddits, users, and search.
  - name: X (Twitter)
    description: Scrape tweets and search X.
  - name: GitHub
    description: >-
      Fetch GitHub profiles, pinned repos, contributions, repositories, stars,
      and projects via GitHub's GraphQL API.
paths:
  /github/search-code:
    post:
      tags:
        - GitHub
      summary: Search code across public GitHub repositories
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                query:
                  description: >-
                    Free-text search terms, matched against the default fields
                    for this search type, e.g. "web framework".
                  type: string
                owners:
                  description: Limit to these owners (users or orgs). Maps to `user:`.
                  type: array
                  items:
                    type: string
                repos:
                  description: Limit to these "owner/name" repositories. Maps to `repo:`.
                  type: array
                  items:
                    type: string
                language:
                  description: Programming language, e.g. "Go". Maps to `language:`.
                  type: string
                extension:
                  description: >-
                    File extension without the dot, e.g. "ts". Maps to
                    `extension:`.
                  type: string
                filename:
                  description: Exact file name, e.g. "package.json". Maps to `filename:`.
                  type: string
                path:
                  description: >-
                    Path prefix within the repo, e.g. "src/app". Maps to
                    `path:`.
                  type: string
                fork:
                  default: exclude
                  description: Whether to include forks. Defaults to excluding them.
                  type: string
                  enum:
                    - exclude
                    - include
                sort:
                  default: best-match
                  description: Sort field. Defaults to relevance ("best-match").
                  type: string
                  enum:
                    - best-match
                    - indexed
                order:
                  default: desc
                  description: Sort direction. Defaults to "desc".
                  type: string
                  enum:
                    - desc
                    - asc
                count:
                  default: 10
                  description: Number of results per page (1–10). Defaults to 10.
                  type: integer
                  minimum: 1
                  maximum: 10
                page:
                  default: 1
                  description: 1-based page number. Defaults to 1.
                  type: integer
                  minimum: 1
                  maximum: 9007199254740991
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  timeMs:
                    type: number
                    description: >-
                      Wall-clock time the request took to complete, in
                      milliseconds.
                  creditsCost:
                    type: number
                    description: Number of account credits this request consumed.
                  data:
                    type: object
                    properties:
                      query:
                        type: string
                        description: The compiled GitHub search query string that was run.
                      totalCount:
                        anyOf:
                          - type: number
                          - type: 'null'
                        description: >-
                          Total matches GitHub reports (approximate, and capped
                          at 1000 results).
                      results:
                        type: array
                        items:
                          type: object
                          properties:
                            name:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: File name, e.g. "server.ts".
                            path:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: >-
                                File path within the repository, e.g.
                                "src/server.ts".
                            sha:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: Git blob SHA of the matched file.
                            url:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: GitHub API URL of the file.
                            htmlUrl:
                              anyOf:
                                - type: string
                                - type: 'null'
                              description: >-
                                Public GitHub URL of the file on its default
                                branch.
                            repository:
                              type: object
                              properties:
                                id:
                                  anyOf:
                                    - type: number
                                    - type: 'null'
                                  description: Stable numeric repository id, e.g. 2325298.
                                nodeId:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                  description: Repository GraphQL node id.
                                name:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                  description: Repository name, e.g. "linux".
                                fullName:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                  description: >-
                                    Full name including owner, e.g.
                                    "torvalds/linux".
                                ownerLogin:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                  description: Owner login (username or org name).
                                url:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                  description: Public repository URL.
                                isPrivate:
                                  type: boolean
                                  description: Whether the repository is private.
                              required:
                                - id
                                - nodeId
                                - name
                                - fullName
                                - ownerLogin
                                - url
                                - isPrivate
                              additionalProperties: false
                              description: The repository the file lives in.
                          required:
                            - name
                            - path
                            - sha
                            - url
                            - htmlUrl
                            - repository
                          additionalProperties: false
                        description: Code files matching this page.
                      nextPage:
                        anyOf:
                          - type: number
                          - type: 'null'
                        description: >-
                          The next 1-based page number, or null when this is the
                          last page.
                    required:
                      - query
                      - totalCount
                      - results
                      - nextPage
                    additionalProperties: false
                required:
                  - timeMs
                  - creditsCost
                  - data
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
        '402':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: typescript
          label: Bridgly SDK
          source: |-
            import { Bridgly } from 'bridgly';

            const client = new Bridgly({ apiKey: process.env.BRIDGLY_API_KEY });

            const res = await client.github.searchCode({
              fork: "exclude",
              sort: "best-match",
              order: "desc",
              count: 10,
              page: 1,
            });
            if (res.type === 'success') console.log(res.data);
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        A Bridgly API key (`bgly_…`). Metered endpoints deduct credits from the
        resolved account.

````