---
title: "Searches through source code"
method: GET
path: "/search"
tags: ["search"]
---

# Searches through source code

`GET /search`

Performs a search through the full Debian Code Search corpus, blocking until all results are available (might take a few seconds depending on the search query).

Search results are ordered by their ranking (best results come first).

## Query parameters

- `query` string, required
- `match_mode` 'literal' | 'regexp'

## Response `200`

All search results

- SearchResult[]
  - `package` string, required — The Debian source package containing this search result, including the full Debian version number.
  - `path` string, required — Path to the file containing the this search result, starting with `package`.
  - `line` integer, required — Line number containing the search result.
  - `context_before` string[] — Up to 2 full lines before the search result (see `context`).
  - `context` string, required — The full line containing the search result.
  - `context_after` string[] — Up to 2 full lines after the search result (see `context`).

## Other responses

- `403` — The x-dcs-apikey header was either not set at all, or contained an invalid (no longer valid?) API key. Please see https://codesearch.debian.net/apikeys/ for obtaining a key.

---

[API](https://skmtc.dev/debian/apis/debian-code-search.md) · [All operations](https://skmtc.dev/debian/apis/debian-code-search/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/debian/debian-code-search/revisions/671129ae43ea/schema)
