Search code
curl --request POST \
--url https://api.example.com/api/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"matches": 123,
"contextLines": 123,
"whole": true,
"isRegexEnabled": true,
"isCaseSensitivityEnabled": true
}
'import requests
url = "https://api.example.com/api/search"
payload = {
"query": "<string>",
"matches": 123,
"contextLines": 123,
"whole": True,
"isRegexEnabled": True,
"isCaseSensitivityEnabled": True
}
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({
query: '<string>',
matches: 123,
contextLines: 123,
whole: true,
isRegexEnabled: true,
isCaseSensitivityEnabled: true
})
};
fetch('https://api.example.com/api/search', 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.example.com/api/search",
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([
'query' => '<string>',
'matches' => 123,
'contextLines' => 123,
'whole' => true,
'isRegexEnabled' => true,
'isCaseSensitivityEnabled' => true
]),
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.example.com/api/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"matches\": 123,\n \"contextLines\": 123,\n \"whole\": true,\n \"isRegexEnabled\": true,\n \"isCaseSensitivityEnabled\": true\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.example.com/api/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"matches\": 123,\n \"contextLines\": 123,\n \"whole\": true,\n \"isRegexEnabled\": true,\n \"isCaseSensitivityEnabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/search")
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 \"query\": \"<string>\",\n \"matches\": 123,\n \"contextLines\": 123,\n \"whole\": true,\n \"isRegexEnabled\": true,\n \"isCaseSensitivityEnabled\": true\n}"
response = http.request(request)
puts response.read_body{
"stats": {
"actualMatchCount": 123,
"totalMatchCount": 123,
"duration": 123,
"fileCount": 123,
"filesSkipped": 123,
"contentBytesLoaded": 123,
"indexBytesLoaded": 123,
"crashes": 123,
"shardFilesConsidered": 123,
"filesConsidered": 123,
"filesLoaded": 123,
"shardsScanned": 123,
"shardsSkipped": 123,
"shardsSkippedFilter": 123,
"ngramMatches": 123,
"ngramLookups": 123,
"wait": 123,
"matchTreeConstruction": 123,
"matchTreeSearch": 123,
"regexpsConsidered": 123,
"flushReason": "<string>"
},
"files": [
{
"fileName": {
"text": "<string>",
"matchRanges": [
{
"start": {
"byteOffset": 123,
"lineNumber": 123,
"column": 123
},
"end": {
"byteOffset": 123,
"lineNumber": 123,
"column": 123
}
}
]
},
"webUrl": "<string>",
"repository": "<string>",
"repositoryId": 123,
"language": "<string>",
"chunks": [
{
"content": "<string>",
"matchRanges": [
{
"start": {
"byteOffset": 123,
"lineNumber": 123,
"column": 123
},
"end": {
"byteOffset": 123,
"lineNumber": 123,
"column": 123
}
}
],
"contentStart": {
"byteOffset": 123,
"lineNumber": 123,
"column": 123
},
"symbols": [
{
"symbol": "<string>",
"kind": "<string>",
"parent": {
"symbol": "<string>",
"kind": "<string>"
}
}
]
}
],
"externalWebUrl": "<string>",
"branches": [
"<string>"
],
"content": "<string>"
}
],
"repositoryInfo": [
{
"id": 123,
"name": "<string>",
"displayName": "<string>",
"webUrl": "<string>"
}
],
"isSearchExhaustive": true
}{
"statusCode": 123,
"errorCode": "<string>",
"message": "<string>"
}{
"statusCode": 123,
"errorCode": "<string>",
"message": "<string>"
}Search & Navigation
Search code
Executes a blocking code search and returns all matching file chunks.
POST
/
api
/
search
Search code
curl --request POST \
--url https://api.example.com/api/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"matches": 123,
"contextLines": 123,
"whole": true,
"isRegexEnabled": true,
"isCaseSensitivityEnabled": true
}
'import requests
url = "https://api.example.com/api/search"
payload = {
"query": "<string>",
"matches": 123,
"contextLines": 123,
"whole": True,
"isRegexEnabled": True,
"isCaseSensitivityEnabled": True
}
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({
query: '<string>',
matches: 123,
contextLines: 123,
whole: true,
isRegexEnabled: true,
isCaseSensitivityEnabled: true
})
};
fetch('https://api.example.com/api/search', 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.example.com/api/search",
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([
'query' => '<string>',
'matches' => 123,
'contextLines' => 123,
'whole' => true,
'isRegexEnabled' => true,
'isCaseSensitivityEnabled' => true
]),
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.example.com/api/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"matches\": 123,\n \"contextLines\": 123,\n \"whole\": true,\n \"isRegexEnabled\": true,\n \"isCaseSensitivityEnabled\": true\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.example.com/api/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"matches\": 123,\n \"contextLines\": 123,\n \"whole\": true,\n \"isRegexEnabled\": true,\n \"isCaseSensitivityEnabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/search")
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 \"query\": \"<string>\",\n \"matches\": 123,\n \"contextLines\": 123,\n \"whole\": true,\n \"isRegexEnabled\": true,\n \"isCaseSensitivityEnabled\": true\n}"
response = http.request(request)
puts response.read_body{
"stats": {
"actualMatchCount": 123,
"totalMatchCount": 123,
"duration": 123,
"fileCount": 123,
"filesSkipped": 123,
"contentBytesLoaded": 123,
"indexBytesLoaded": 123,
"crashes": 123,
"shardFilesConsidered": 123,
"filesConsidered": 123,
"filesLoaded": 123,
"shardsScanned": 123,
"shardsSkipped": 123,
"shardsSkippedFilter": 123,
"ngramMatches": 123,
"ngramLookups": 123,
"wait": 123,
"matchTreeConstruction": 123,
"matchTreeSearch": 123,
"regexpsConsidered": 123,
"flushReason": "<string>"
},
"files": [
{
"fileName": {
"text": "<string>",
"matchRanges": [
{
"start": {
"byteOffset": 123,
"lineNumber": 123,
"column": 123
},
"end": {
"byteOffset": 123,
"lineNumber": 123,
"column": 123
}
}
]
},
"webUrl": "<string>",
"repository": "<string>",
"repositoryId": 123,
"language": "<string>",
"chunks": [
{
"content": "<string>",
"matchRanges": [
{
"start": {
"byteOffset": 123,
"lineNumber": 123,
"column": 123
},
"end": {
"byteOffset": 123,
"lineNumber": 123,
"column": 123
}
}
],
"contentStart": {
"byteOffset": 123,
"lineNumber": 123,
"column": 123
},
"symbols": [
{
"symbol": "<string>",
"kind": "<string>",
"parent": {
"symbol": "<string>",
"kind": "<string>"
}
}
]
}
],
"externalWebUrl": "<string>",
"branches": [
"<string>"
],
"content": "<string>"
}
],
"repositoryInfo": [
{
"id": 123,
"name": "<string>",
"displayName": "<string>",
"webUrl": "<string>"
}
],
"isSearchExhaustive": true
}{
"statusCode": 123,
"errorCode": "<string>",
"message": "<string>"
}{
"statusCode": 123,
"errorCode": "<string>",
"message": "<string>"
}Usage
Thequery field supports literal, regexp, and symbol searches with filters for repository, file, language, branch, and more. See the search syntax reference for the full query language.Authorizations
bearerTokenapiKeyHeader
Bearer authentication header of the form Bearer <token>, where <token> is your API key.
Body
application/json
Was this page helpful?
⌘I

