For teams building internal tools on their own code

Code Search API with Semantic Code Search for Private GitHub Repos

GitHub's REST code search matches keywords, looks only at the default branch and allows 10 requests a minute. That is fine for a script that greps one org. It falls short when you want a Slack bot, a support console or an internal portal to find code by what it does. CodeIndex gives you a semantic code search API over your private GitHub repositories that returns files, line ranges and plain-English answers as JSON.

14-day trial with Pro features, API included. Card charged only when it ends.

codeindex.ai/repositories/add

Index a GitHub repository

Connect GitHub, paste a repo URL, and ask your first question in minutes.

You

Where do we validate webhook signatures?

AI

In app/Http/Middleware/VerifySignature.php, called from the webhook route group. Two other files reference it.

14-day trial on the plan you choose, card charged only when it ends. Plans from $49/month billed annually for 5 users.

Short answer

A code search API lets your own software query an index of your source code. CodeIndex exposes one over private GitHub repositories: POST a natural language query to /api/search and get back up to 50 ranked snippets with file path, line range, language and a relevance score, or POST to /api/chat for an answer that cites the code. API access comes with Pro at $149 a month billed annually ($299 month to month) for 20 users, 50 repos and 10,000 queries a month, and with Enterprise at $499 a month billed annually for 30,000 queries.

50

Ranked results per search call, each with file, lines and score

10,000

API and app queries a month on Pro, 30,000 on Enterprise

3 modes

Chat endpoint answers in search, explain or architecture mode

$149/mo

CodeIndex Pro billed annually, API access included

Example request to the CodeIndex search endpoint and the JSON response with file path, line range, language and score

Ask for behavior, get back the exact file and lines

The query in this example never says DeliverWebhook or backoff. It describes what the code does, and the index matches it to the job class that retries webhook deliveries. Your bot or portal gets a file path, a line range, the snippet and a score it can rank or filter on, so it can link straight to the code on GitHub.

What the CodeIndex code search API returns

Two endpoints cover most internal tools. Search returns ranked code. Chat returns an explanation built from that code with citations.

Semantic search endpoint

POST /api/search with a repository ID and a query of up to 500 characters. Results come back ranked by meaning, with file path, start and end line, language, the snippet and a similarity score.

Cited answers endpoint

POST /api/chat with a question of up to 2,000 characters. Pick search, explain or architecture mode and pass a session ID to keep a follow-up conversation in context.

Repository management

Add a GitHub repo with POST /api/ingest, poll its indexing status, trigger a reindex after a big merge and remove repos you no longer need, all from your own scripts.

Private repos and your branch

Index public or private GitHub repositories on the branch you choose, not only the default branch that GitHub's REST search covers.

Simple bearer keys

Every request carries an Authorization header with a ci_ prefixed key tied to your team. Keys only see repositories that belong to that team.

Same index as the app

Engineers who use the web app and the tools you build on the API read from one index, so a Slack bot never answers from stale code your team has already changed.

Code search APIs compared for private repositories

Each option is the right call for somebody. Use this table to see which one fits a team on GitHub that wants search by meaning from its own tools.

GitHub REST search code GitLab semantic search API Sourcegraph API CodeIndex API
Matching Keywords and qualifiers By meaning Keyword, regex and structural By meaning
Code host GitHub GitLab Many hosts GitHub
Branches Default branch only Indexed project Configurable Branch you choose
Limits 10 requests a minute, 1,000 results, files under 384 KB Beta, limits not published Set by your instance 10,000 queries a month on Pro
Cited plain-English answers No No, search only Through Deep Search credits Yes, /api/chat
Price Included with GitHub Premium or Ultimate plus a Duo add-on Enterprise from $16,000 a year From $149/mo billed annually

GitHub limits from docs.github.com REST search docs. GitLab requirements from docs.gitlab.com (beta since 18.7). Sourcegraph and CodeIndex prices from their pricing pages, checked October 2026.

How to start calling the code search API

  1. 1

    Connect a GitHub repo

    Paste a repository URL in the box at the top of this page and create your account. Sign in with GitHub to grant access to private repositories.

  2. 2

    Wait for the index

    Most repositories finish indexing within minutes. The status endpoint tells your script when a repo is ready to query.

  3. 3

    Create an API key

    Open API keys in your account settings and create a team key. It starts with ci_ and goes in the Authorization header as a bearer token.

  4. 4

    Call search or chat

    Send a POST with the repository ID and your query. Parse the JSON and show files, lines and links wherever your team works.

What teams build on a code search API

A Slack bot that answers code questions

Someone asks where refunds are calculated. The bot calls /api/chat and replies in the thread with an explanation and links to the exact lines, so a senior engineer does not have to stop and answer.

Support and success consoles

Support engineers paste a customer's error message into an internal tool that searches the code for where that message is raised and shows the surrounding logic.

Internal developer portals

Add a search box to Backstage or your own portal that finds code across 50 services by intent, next to the docs and ownership data you already show.

AI agents that need grounded context

Feed ranked snippets with file paths into your own agent or review pipeline so it reasons over real code from your repositories instead of guessing.

Does GitHub have a code search API?

Yes. GitHub's REST API has a search code endpoint, but it matches keywords and qualifiers rather than meaning. It requires authentication, allows 10 requests per minute, returns at most 1,000 results per search, only looks at the default branch and skips files larger than 384 KB. It works well for finding a known string. It cannot answer a question like where the app throttles password resets unless those words appear in the code.

The newer code search you use on github.com is a different engine from the REST endpoint, and its own limits (100 results in the UI, files up to 350 KiB) do not carry over to the API.

Is there a semantic code search API for private repositories?

Yes. A semantic code search API embeds your code and your query so results match intent, not exact tokens. For private GitHub repositories, CodeIndex provides one on its Pro and Enterprise plans with a published monthly price. GitLab offers a semantic search endpoint in beta for GitLab projects on Premium or Ultimate with a Duo add-on, and Sourcegraph offers APIs on its Enterprise plan, which starts at $16,000 a year.

If your code lives on GitHub and you want an API this week without a sales call, CodeIndex is the shortest path. If it lives on GitLab, the GitLab endpoint keeps everything in one vendor.

How do I search code in a private GitHub repository using the API?

To search code in a private GitHub repository through an API, authenticate with a token that has access to the repo and call a search endpoint scoped to it. With GitHub's REST API that means a personal access token or GitHub App and a query with a repo qualifier. With CodeIndex you connect the repo once, then POST to /api/search with the repository ID and a natural language query, using your ci_ key as a bearer token.

The practical difference is the query. GitHub needs the words that are in the file. CodeIndex accepts a description of what the code does.

What is the GitHub code search API rate limit?

The GitHub REST search code endpoint allows 10 requests per minute for an authenticated user, separate from the general REST limit of 5,000 requests an hour. A bot serving a busy engineering channel can hit that ceiling quickly, and every page of results counts as a request. CodeIndex counts API calls against a monthly query allowance instead: 10,000 a month (up to 1,000 a day) on Pro and 30,000 a month on Enterprise.

How much does a code search API cost?

GitHub's REST code search is included with any GitHub account. Semantic code search APIs cost more because they need embeddings and model calls. CodeIndex includes API access on Pro at $149 a month billed annually ($299 month to month) and on Enterprise at $499 a month billed annually ($999 month to month). There is no per-call fee inside the allowance and no separate model bill. See CodeIndex pricing for the full plan limits.

What the API does not do

We would rather you know this before the trial. CodeIndex indexes GitHub only, so GitLab, Bitbucket and Azure DevOps repos are out. It is a hosted service with no self-managed option. The API reads and explains code. It does not open pull requests or run batch refactors, and the Starter plan does not include API access.

Frequently asked questions

Which plans include the CodeIndex API?

API access is included on Pro ($149 a month billed annually, 20 users, 50 repos, 10,000 queries a month) and Enterprise ($499 a month billed annually, unlimited users and repos, 30,000 queries a month). Starter does not include API access.

Does the trial include the API?

Yes. The 14-day trial runs with Pro features, so you can create a key and call the search and chat endpoints before you pay. Your card is charged only when the trial ends.

How many results does the search endpoint return?

You set a limit from 1 to 50 per call, with 20 as the default. Each result includes the file path, line range, language, the code snippet and a relevance score.

Can the API search across several repositories?

Each search call targets one repository ID. To cover several repos, call search for each one in parallel and merge the results by score in your tool. The web app searches all connected repos together.

Do I need my own LLM or embedding key?

No. CodeIndex runs the embeddings and the model calls behind the API and includes them in the plan price, so there is no separate model bill. API keys only see repositories that belong to the team that created them.

Is the GitHub code search API free?

GitHub's REST search code endpoint is included with a GitHub account, with a limit of 10 requests per minute, default branch only and keyword matching. It is a good fit for scripts that look for a known string.

Query your own code from your own tools

Connect a GitHub repo, create a key and make your first semantic search call today. 14-day trial with Pro features.