Search Codebase
curl --request POST \
--url https://api.wistx.ai/v1/search/codebase \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"repositories": [
"<string>"
],
"resource_ids": [
"<string>"
],
"resource_types": [
"<string>"
],
"file_types": [
"<string>"
],
"code_type": "<string>",
"cloud_provider": "<string>",
"include_sources": true,
"include_ai_analysis": true,
"limit": 123
}
'import requests
url = "https://api.wistx.ai/v1/search/codebase"
payload = {
"query": "<string>",
"repositories": ["<string>"],
"resource_ids": ["<string>"],
"resource_types": ["<string>"],
"file_types": ["<string>"],
"code_type": "<string>",
"cloud_provider": "<string>",
"include_sources": True,
"include_ai_analysis": True,
"limit": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
repositories: ['<string>'],
resource_ids: ['<string>'],
resource_types: ['<string>'],
file_types: ['<string>'],
code_type: '<string>',
cloud_provider: '<string>',
include_sources: true,
include_ai_analysis: true,
limit: 123
})
};
fetch('https://api.wistx.ai/v1/search/codebase', 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.wistx.ai/v1/search/codebase",
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>',
'repositories' => [
'<string>'
],
'resource_ids' => [
'<string>'
],
'resource_types' => [
'<string>'
],
'file_types' => [
'<string>'
],
'code_type' => '<string>',
'cloud_provider' => '<string>',
'include_sources' => true,
'include_ai_analysis' => true,
'limit' => 123
]),
CURLOPT_HTTPHEADER => [
"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.wistx.ai/v1/search/codebase"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"repositories\": [\n \"<string>\"\n ],\n \"resource_ids\": [\n \"<string>\"\n ],\n \"resource_types\": [\n \"<string>\"\n ],\n \"file_types\": [\n \"<string>\"\n ],\n \"code_type\": \"<string>\",\n \"cloud_provider\": \"<string>\",\n \"include_sources\": true,\n \"include_ai_analysis\": true,\n \"limit\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
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.wistx.ai/v1/search/codebase")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"repositories\": [\n \"<string>\"\n ],\n \"resource_ids\": [\n \"<string>\"\n ],\n \"resource_types\": [\n \"<string>\"\n ],\n \"file_types\": [\n \"<string>\"\n ],\n \"code_type\": \"<string>\",\n \"cloud_provider\": \"<string>\",\n \"include_sources\": true,\n \"include_ai_analysis\": true,\n \"limit\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wistx.ai/v1/search/codebase")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"repositories\": [\n \"<string>\"\n ],\n \"resource_ids\": [\n \"<string>\"\n ],\n \"resource_types\": [\n \"<string>\"\n ],\n \"file_types\": [\n \"<string>\"\n ],\n \"code_type\": \"<string>\",\n \"cloud_provider\": \"<string>\",\n \"include_sources\": true,\n \"include_ai_analysis\": true,\n \"limit\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {
"results": [
{
"article_id": "abc123",
"resource_id": "res_xyz789",
"title": "RDS Backup Configuration",
"content": "resource \"aws_db_instance\" \"main\" {\n backup_retention_period = 7\n backup_window = \"03:00-04:00\"\n ...",
"source_url": "https://github.com/myorg/infrastructure/blob/main/rds.tf",
"file_path": "rds.tf",
"tags": [".tf", "terraform", "rds"],
"similarity_score": 0.95
}
],
"resources": [
{
"resource_id": "res_xyz789",
"name": "Infrastructure Repo",
"resource_type": "repository",
"repo_url": "https://github.com/myorg/infrastructure"
}
],
"total": 1,
"highlights": [
{
"article_id": "abc123",
"highlight": "...backup_retention_period = 7\n backup_window = \"03:00-04:00\"...",
"file_path": "rds.tf"
}
],
"ai_analysis": {
"summary": "Found RDS backup configuration using Terraform",
"key_findings": ["Backup retention: 7 days", "Backup window: 03:00-04:00 UTC"]
}
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123,
"query_time_ms": 245
}
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": "query is required"
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123
}
}
{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or expired token"
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123
}
}
{
"error": {
"code": "QUOTA_EXCEEDED",
"message": "Query quota exceeded",
"details": {
"limit_type": "queries_per_month",
"current": 1000,
"limit": 1000
}
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123
}
}
{
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123
}
}
{
"error": {
"code": "DATABASE_ERROR",
"message": "Database connection failed"
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123
}
}
Search
Search Codebase
Search user’s indexed repositories, documentation, and documents
POST
/
v1
/
search
/
codebase
Search Codebase
curl --request POST \
--url https://api.wistx.ai/v1/search/codebase \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"repositories": [
"<string>"
],
"resource_ids": [
"<string>"
],
"resource_types": [
"<string>"
],
"file_types": [
"<string>"
],
"code_type": "<string>",
"cloud_provider": "<string>",
"include_sources": true,
"include_ai_analysis": true,
"limit": 123
}
'import requests
url = "https://api.wistx.ai/v1/search/codebase"
payload = {
"query": "<string>",
"repositories": ["<string>"],
"resource_ids": ["<string>"],
"resource_types": ["<string>"],
"file_types": ["<string>"],
"code_type": "<string>",
"cloud_provider": "<string>",
"include_sources": True,
"include_ai_analysis": True,
"limit": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
repositories: ['<string>'],
resource_ids: ['<string>'],
resource_types: ['<string>'],
file_types: ['<string>'],
code_type: '<string>',
cloud_provider: '<string>',
include_sources: true,
include_ai_analysis: true,
limit: 123
})
};
fetch('https://api.wistx.ai/v1/search/codebase', 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.wistx.ai/v1/search/codebase",
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>',
'repositories' => [
'<string>'
],
'resource_ids' => [
'<string>'
],
'resource_types' => [
'<string>'
],
'file_types' => [
'<string>'
],
'code_type' => '<string>',
'cloud_provider' => '<string>',
'include_sources' => true,
'include_ai_analysis' => true,
'limit' => 123
]),
CURLOPT_HTTPHEADER => [
"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.wistx.ai/v1/search/codebase"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"repositories\": [\n \"<string>\"\n ],\n \"resource_ids\": [\n \"<string>\"\n ],\n \"resource_types\": [\n \"<string>\"\n ],\n \"file_types\": [\n \"<string>\"\n ],\n \"code_type\": \"<string>\",\n \"cloud_provider\": \"<string>\",\n \"include_sources\": true,\n \"include_ai_analysis\": true,\n \"limit\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
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.wistx.ai/v1/search/codebase")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"repositories\": [\n \"<string>\"\n ],\n \"resource_ids\": [\n \"<string>\"\n ],\n \"resource_types\": [\n \"<string>\"\n ],\n \"file_types\": [\n \"<string>\"\n ],\n \"code_type\": \"<string>\",\n \"cloud_provider\": \"<string>\",\n \"include_sources\": true,\n \"include_ai_analysis\": true,\n \"limit\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wistx.ai/v1/search/codebase")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"repositories\": [\n \"<string>\"\n ],\n \"resource_ids\": [\n \"<string>\"\n ],\n \"resource_types\": [\n \"<string>\"\n ],\n \"file_types\": [\n \"<string>\"\n ],\n \"code_type\": \"<string>\",\n \"cloud_provider\": \"<string>\",\n \"include_sources\": true,\n \"include_ai_analysis\": true,\n \"limit\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {
"results": [
{
"article_id": "abc123",
"resource_id": "res_xyz789",
"title": "RDS Backup Configuration",
"content": "resource \"aws_db_instance\" \"main\" {\n backup_retention_period = 7\n backup_window = \"03:00-04:00\"\n ...",
"source_url": "https://github.com/myorg/infrastructure/blob/main/rds.tf",
"file_path": "rds.tf",
"tags": [".tf", "terraform", "rds"],
"similarity_score": 0.95
}
],
"resources": [
{
"resource_id": "res_xyz789",
"name": "Infrastructure Repo",
"resource_type": "repository",
"repo_url": "https://github.com/myorg/infrastructure"
}
],
"total": 1,
"highlights": [
{
"article_id": "abc123",
"highlight": "...backup_retention_period = 7\n backup_window = \"03:00-04:00\"...",
"file_path": "rds.tf"
}
],
"ai_analysis": {
"summary": "Found RDS backup configuration using Terraform",
"key_findings": ["Backup retention: 7 days", "Backup window: 03:00-04:00 UTC"]
}
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123,
"query_time_ms": 245
}
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": "query is required"
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123
}
}
{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or expired token"
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123
}
}
{
"error": {
"code": "QUOTA_EXCEEDED",
"message": "Query quota exceeded",
"details": {
"limit_type": "queries_per_month",
"current": 1000,
"limit": 1000
}
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123
}
}
{
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123
}
}
{
"error": {
"code": "DATABASE_ERROR",
"message": "Database connection failed"
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123
}
}
Search your indexed codebase (repositories, documentation, and documents) using natural language queries.
string
required
Natural language search question (1-10,000 characters)
string[]
List of repositories to search (owner/repo format, e.g.,
["owner/repo", "another/org/repo"])string[]
Filter by specific indexed resources (alternative to repositories)
string[]
Filter by resource type:
repository, documentation, documentstring[]
Filter by file extensions (e.g.,
[".tf", ".yaml", ".py", ".md"])string
Filter by code type:
terraform, kubernetes, docker, pythonstring
Filter by cloud provider mentioned in code (e.g.,
aws, gcp, azure)boolean
default:"true"
Include source code snippets in results
boolean
default:"true"
Include AI-analyzed results with explanations
integer
default:"1000"
Maximum number of results (1-1000)
Request Example
curl -X POST "https://api.wistx.ai/v1/search/codebase" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "How do we configure RDS database backups?",
"repositories": ["myorg/infrastructure"],
"file_types": [".tf", ".yaml"],
"include_sources": true,
"include_ai_analysis": true,
"limit": 1000
}'
import requests
url = "https://api.wistx.ai/v1/search/codebase"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"query": "How do we configure RDS database backups?",
"repositories": ["myorg/infrastructure"],
"file_types": [".tf", ".yaml"],
"include_sources": True,
"include_ai_analysis": True,
"limit": 1000
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
const response = await fetch("https://api.wistx.ai/v1/search/codebase", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
query: "How do we configure RDS database backups?",
repositories: ["myorg/infrastructure"],
file_types: [".tf", ".yaml"],
include_sources: true,
include_ai_analysis: true,
limit: 1000
})
});
const data = await response.json();
console.log(data);
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
url := "https://api.wistx.ai/v1/search/codebase"
data := map[string]interface{}{
"query": "How do we configure RDS database backups?",
"repositories": []string{"myorg/infrastructure"},
"file_types": []string{".tf", ".yaml"},
"include_sources": true,
"include_ai_analysis": true,
"limit": 1000,
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
}
require 'net/http'
require 'json'
uri = URI('https://api.wistx.ai/v1/search/codebase')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request['Authorization'] = 'Bearer YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request.body = {
query: "How do we configure RDS database backups?",
repositories: ["myorg/infrastructure"],
file_types: [".tf", ".yaml"],
include_sources: true,
include_ai_analysis: true,
limit: 20
}.to_json
response = http.request(request)
puts response.body
<?php
$url = "https://api.wistx.ai/v1/search/codebase";
$data = [
"query" => "How do we configure RDS database backups?",
"repositories" => ["myorg/infrastructure"],
"file_types" => [".tf", ".yaml"],
"include_sources" => true,
"include_ai_analysis" => true,
"limit" => 20
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import java.nio.charset.StandardCharsets;
HttpClient client = HttpClient.newHttpClient();
String json = "{\"query\":\"How do we configure RDS database backups?\",\"repositories\":[\"myorg/infrastructure\"],\"file_types\":[\".tf\",\".yaml\"],\"include_sources\":true,\"include_ai_analysis\":true,\"limit\":20}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.wistx.ai/v1/search/codebase"))
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Response Example
{
"data": {
"results": [
{
"article_id": "abc123",
"resource_id": "res_xyz789",
"title": "RDS Backup Configuration",
"content": "resource \"aws_db_instance\" \"main\" {\n backup_retention_period = 7\n backup_window = \"03:00-04:00\"\n ...",
"source_url": "https://github.com/myorg/infrastructure/blob/main/rds.tf",
"file_path": "rds.tf",
"tags": [".tf", "terraform", "rds"],
"similarity_score": 0.95
}
],
"resources": [
{
"resource_id": "res_xyz789",
"name": "Infrastructure Repo",
"resource_type": "repository",
"repo_url": "https://github.com/myorg/infrastructure"
}
],
"total": 1,
"highlights": [
{
"article_id": "abc123",
"highlight": "...backup_retention_period = 7\n backup_window = \"03:00-04:00\"...",
"file_path": "rds.tf"
}
],
"ai_analysis": {
"summary": "Found RDS backup configuration using Terraform",
"key_findings": ["Backup retention: 7 days", "Backup window: 03:00-04:00 UTC"]
}
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123,
"query_time_ms": 245
}
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": "query is required"
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123
}
}
{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or expired token"
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123
}
}
{
"error": {
"code": "QUOTA_EXCEEDED",
"message": "Query quota exceeded",
"details": {
"limit_type": "queries_per_month",
"current": 1000,
"limit": 1000
}
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123
}
}
{
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123
}
}
{
"error": {
"code": "DATABASE_ERROR",
"message": "Database connection failed"
},
"metadata": {
"request_id": "req_123",
"timestamp": 1234567890.123
}
}
Rate Limits
- Professional: 2,000 queries/month
- Team: 10,000 queries/month
- Enterprise: Unlimited queries/month