Search documentation, code and symbols
Search documentation, source code, and symbols across packages, public repositories, and documentation sites. Results include matching text and source locations you can use to read the original page or file.
Use this endpoint to discover relevant documentation and implementations across projects. Searches can return while indexing or searching is still in progress; use GET /v1/searches/{search_ref} to retrieve subsequent results and status.
Selector catalogue
Use the following selectors with the fields query parameter to choose which fields the response includes. See Choose what the response includes for details.
| Selector | Data | Default |
|---|---|---|
results | Matching items, their text, relevance scores, source locations, and coverage information. | Yes |
results.highlights | Highlight locations within result titles and summaries. Also includes results. | No |
results.* | Results and highlights together. | No |
sources | Source status, applied filters, coverage, and suggested documentation sites. | No |
progress | Search request details, readiness counts, and available or suggested versions and refs. | No |
curl --request POST \
--url https://api.githits.dev/v1/searches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"limit": 10,
"query": "name:run",
"sources": [
"code",
"symbol"
],
"targets": [
{
"name": "serde",
"registry": "crates"
}
],
"wait_timeout_ms": 20000
}
'import requests
url = "https://api.githits.dev/v1/searches"
payload = {
"limit": 10,
"query": "name:run",
"sources": ["code", "symbol"],
"targets": [
{
"name": "serde",
"registry": "crates"
}
],
"wait_timeout_ms": 20000
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
limit: 10,
query: 'name:run',
sources: ['code', 'symbol'],
targets: [{name: 'serde', registry: 'crates'}],
wait_timeout_ms: 20000
})
};
fetch('https://api.githits.dev/v1/searches', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.githits.dev/v1/searches",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'limit' => 10,
'query' => 'name:run',
'sources' => [
'code',
'symbol'
],
'targets' => [
[
'name' => 'serde',
'registry' => 'crates'
]
],
'wait_timeout_ms' => 20000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.githits.dev/v1/searches"
payload := strings.NewReader("{\n \"limit\": 10,\n \"query\": \"name:run\",\n \"sources\": [\n \"code\",\n \"symbol\"\n ],\n \"targets\": [\n {\n \"name\": \"serde\",\n \"registry\": \"crates\"\n }\n ],\n \"wait_timeout_ms\": 20000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.githits.dev/v1/searches")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"limit\": 10,\n \"query\": \"name:run\",\n \"sources\": [\n \"code\",\n \"symbol\"\n ],\n \"targets\": [\n {\n \"name\": \"serde\",\n \"registry\": \"crates\"\n }\n ],\n \"wait_timeout_ms\": 20000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.githits.dev/v1/searches")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"limit\": 10,\n \"query\": \"name:run\",\n \"sources\": [\n \"code\",\n \"symbol\"\n ],\n \"targets\": [\n {\n \"name\": \"serde\",\n \"registry\": \"crates\"\n }\n ],\n \"wait_timeout_ms\": 20000\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Headers
Optional caller-defined session ID: one to 64 ASCII letters, digits, underscores or hyphens, preserved exactly. Supply the header at most once. Invalid supplied IDs return 400 INVALID_SESSION_ID; no session is created.
1 - 64^[A-Za-z0-9_-]{1,64}$Query Parameters
Comma-separated results/results.highlights/results.*/sources/progress; default results, 2048 decoded bytes. No arbitrary leaf masks.
Use the case-sensitive selectors in the catalogue. Order and duplicate selectors do not affect the result. ASCII whitespace around selectors is ignored. The decoded value is limited to 2048 UTF-8 bytes. Empty or unknown selectors and repeated fields query parameters return 400 VALIDATION_ERROR. A group does not include nested groups unless the catalogue says so; only listed wildcard bundles are supported.
2048Body
Strict initial search input; selectors are parsed by HTTP before execution.
Response
Source-qualified immediate, interim or terminal observation
One canonical source observation; a reference does not imply active work.
curl --request POST \
--url https://api.githits.dev/v1/searches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"limit": 10,
"query": "name:run",
"sources": [
"code",
"symbol"
],
"targets": [
{
"name": "serde",
"registry": "crates"
}
],
"wait_timeout_ms": 20000
}
'import requests
url = "https://api.githits.dev/v1/searches"
payload = {
"limit": 10,
"query": "name:run",
"sources": ["code", "symbol"],
"targets": [
{
"name": "serde",
"registry": "crates"
}
],
"wait_timeout_ms": 20000
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
limit: 10,
query: 'name:run',
sources: ['code', 'symbol'],
targets: [{name: 'serde', registry: 'crates'}],
wait_timeout_ms: 20000
})
};
fetch('https://api.githits.dev/v1/searches', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.githits.dev/v1/searches",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'limit' => 10,
'query' => 'name:run',
'sources' => [
'code',
'symbol'
],
'targets' => [
[
'name' => 'serde',
'registry' => 'crates'
]
],
'wait_timeout_ms' => 20000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.githits.dev/v1/searches"
payload := strings.NewReader("{\n \"limit\": 10,\n \"query\": \"name:run\",\n \"sources\": [\n \"code\",\n \"symbol\"\n ],\n \"targets\": [\n {\n \"name\": \"serde\",\n \"registry\": \"crates\"\n }\n ],\n \"wait_timeout_ms\": 20000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.githits.dev/v1/searches")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"limit\": 10,\n \"query\": \"name:run\",\n \"sources\": [\n \"code\",\n \"symbol\"\n ],\n \"targets\": [\n {\n \"name\": \"serde\",\n \"registry\": \"crates\"\n }\n ],\n \"wait_timeout_ms\": 20000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.githits.dev/v1/searches")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"limit\": 10,\n \"query\": \"name:run\",\n \"sources\": [\n \"code\",\n \"symbol\"\n ],\n \"targets\": [\n {\n \"name\": \"serde\",\n \"registry\": \"crates\"\n }\n ],\n \"wait_timeout_ms\": 20000\n}"
response = http.request(request)
puts response.read_body