Index Repository
curl --request POST \
--url https://api.wistx.ai/v1/indexing/repositories \
--header 'Content-Type: application/json' \
--data '
{
"repo_url": "<string>",
"branch": "<string>",
"name": "<string>",
"description": "<string>",
"tags": {},
"github_token": "<string>",
"include_patterns": {},
"exclude_patterns": {}
}
'import requests
url = "https://api.wistx.ai/v1/indexing/repositories"
payload = {
"repo_url": "<string>",
"branch": "<string>",
"name": "<string>",
"description": "<string>",
"tags": {},
"github_token": "<string>",
"include_patterns": {},
"exclude_patterns": {}
}
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({
repo_url: '<string>',
branch: '<string>',
name: '<string>',
description: '<string>',
tags: {},
github_token: '<string>',
include_patterns: {},
exclude_patterns: {}
})
};
fetch('https://api.wistx.ai/v1/indexing/repositories', 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/indexing/repositories",
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([
'repo_url' => '<string>',
'branch' => '<string>',
'name' => '<string>',
'description' => '<string>',
'tags' => [
],
'github_token' => '<string>',
'include_patterns' => [
],
'exclude_patterns' => [
]
]),
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/indexing/repositories"
payload := strings.NewReader("{\n \"repo_url\": \"<string>\",\n \"branch\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": {},\n \"github_token\": \"<string>\",\n \"include_patterns\": {},\n \"exclude_patterns\": {}\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/indexing/repositories")
.header("Content-Type", "application/json")
.body("{\n \"repo_url\": \"<string>\",\n \"branch\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": {},\n \"github_token\": \"<string>\",\n \"include_patterns\": {},\n \"exclude_patterns\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wistx.ai/v1/indexing/repositories")
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 \"repo_url\": \"<string>\",\n \"branch\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": {},\n \"github_token\": \"<string>\",\n \"include_patterns\": {},\n \"exclude_patterns\": {}\n}"
response = http.request(request)
puts response.read_body{
"resource_id": "res_abc123",
"status": "pending",
"progress": {
"percentage": 0,
"stage": "queued",
"message": "Repository indexing queued"
},
"message": "Repository indexing started"
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": "repo_url is required"
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"detail": "User ID not found"
}
{
"error": "GITHUB_OAUTH_REQUIRED",
"message": "GitHub connection is required. Please connect your GitHub account in settings.",
"authorization_url": "/v1/oauth/github/authorize"
}
{
"error": "REPOSITORY_ACCESS_DENIED",
"message": "Access denied to this private repository. Check repository permissions."
}
{
"error": {
"code": "QUOTA_EXCEEDED",
"message": "Indexing quota exceeded",
"details": {
"limit_type": "indexes_per_month",
"current": 3,
"limit": 3
}
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"error": {
"code": "INDEXING_ERROR",
"message": "Failed to start repository indexing",
"details": null
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
Indexing
Index Repository
Index a GitHub repository for user-specific search
POST
/
v1
/
indexing
/
repositories
Index Repository
curl --request POST \
--url https://api.wistx.ai/v1/indexing/repositories \
--header 'Content-Type: application/json' \
--data '
{
"repo_url": "<string>",
"branch": "<string>",
"name": "<string>",
"description": "<string>",
"tags": {},
"github_token": "<string>",
"include_patterns": {},
"exclude_patterns": {}
}
'import requests
url = "https://api.wistx.ai/v1/indexing/repositories"
payload = {
"repo_url": "<string>",
"branch": "<string>",
"name": "<string>",
"description": "<string>",
"tags": {},
"github_token": "<string>",
"include_patterns": {},
"exclude_patterns": {}
}
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({
repo_url: '<string>',
branch: '<string>',
name: '<string>',
description: '<string>',
tags: {},
github_token: '<string>',
include_patterns: {},
exclude_patterns: {}
})
};
fetch('https://api.wistx.ai/v1/indexing/repositories', 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/indexing/repositories",
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([
'repo_url' => '<string>',
'branch' => '<string>',
'name' => '<string>',
'description' => '<string>',
'tags' => [
],
'github_token' => '<string>',
'include_patterns' => [
],
'exclude_patterns' => [
]
]),
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/indexing/repositories"
payload := strings.NewReader("{\n \"repo_url\": \"<string>\",\n \"branch\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": {},\n \"github_token\": \"<string>\",\n \"include_patterns\": {},\n \"exclude_patterns\": {}\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/indexing/repositories")
.header("Content-Type", "application/json")
.body("{\n \"repo_url\": \"<string>\",\n \"branch\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": {},\n \"github_token\": \"<string>\",\n \"include_patterns\": {},\n \"exclude_patterns\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wistx.ai/v1/indexing/repositories")
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 \"repo_url\": \"<string>\",\n \"branch\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": {},\n \"github_token\": \"<string>\",\n \"include_patterns\": {},\n \"exclude_patterns\": {}\n}"
response = http.request(request)
puts response.read_body{
"resource_id": "res_abc123",
"status": "pending",
"progress": {
"percentage": 0,
"stage": "queued",
"message": "Repository indexing queued"
},
"message": "Repository indexing started"
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": "repo_url is required"
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"detail": "User ID not found"
}
{
"error": "GITHUB_OAUTH_REQUIRED",
"message": "GitHub connection is required. Please connect your GitHub account in settings.",
"authorization_url": "/v1/oauth/github/authorize"
}
{
"error": "REPOSITORY_ACCESS_DENIED",
"message": "Access denied to this private repository. Check repository permissions."
}
{
"error": {
"code": "QUOTA_EXCEEDED",
"message": "Indexing quota exceeded",
"details": {
"limit_type": "indexes_per_month",
"current": 3,
"limit": 3
}
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"error": {
"code": "INDEXING_ERROR",
"message": "Failed to start repository indexing",
"details": null
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
Index a GitHub repository for user-specific search
curl --request POST \
--url https://api.wistx.ai/v1/indexing/repositories \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"repo_url": "https://github.com/owner/repo",
"branch": "main",
"name": "My Repository",
"description": "Production infrastructure repository",
"tags": ["terraform", "aws"],
"include_patterns": ["**/*.tf", "**/terraform/**"],
"exclude_patterns": ["**/node_modules/**", "**/.git/**"]
}'
import requests
api_key = "YOUR_API_KEY"
url = "https://api.wistx.ai/v1/indexing/repositories"
response = requests.post(
url,
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
},
json={
"repo_url": "https://github.com/owner/repo",
"branch": "main",
"name": "My Repository",
"description": "Production infrastructure repository",
"tags": ["terraform", "aws"],
"include_patterns": ["**/*.tf", "**/terraform/**"],
"exclude_patterns": ["**/node_modules/**", "**/.git/**"]
}
)
data = response.json()
print(f"Indexing started. Resource ID: {data['resource_id']}")
const apiKey = "YOUR_API_KEY";
const url = "https://api.wistx.ai/v1/indexing/repositories";
const response = await fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${apiKey}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
repo_url: "https://github.com/owner/repo",
branch: "main",
name: "My Repository",
description: "Production infrastructure repository",
tags: ["terraform", "aws"],
include_patterns: ["**/*.tf", "**/terraform/**"],
exclude_patterns: ["**/node_modules/**", "**/.git/**"]
})
});
const data = await response.json();
console.log(`Indexing started. Resource ID: ${data.resource_id}`);
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
apiKey := "YOUR_API_KEY"
url := "https://api.wistx.ai/v1/indexing/repositories"
payload := map[string]interface{}{
"repo_url": "https://github.com/owner/repo",
"branch": "main",
"name": "My Repository",
"description": "Production infrastructure repository",
"tags": []string{"terraform", "aws"},
"include_patterns": []string{"**/*.tf", "**/terraform/**"},
"exclude_patterns": []string{"**/node_modules/**", "**/.git/**"},
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", apiKey))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("Indexing started. Resource ID: %v\n", result["resource_id"])
}
require 'net/http'
require 'json'
require 'uri'
api_key = "YOUR_API_KEY"
url = URI("https://api.wistx.ai/v1/indexing/repositories")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer #{api_key}"
request["Content-Type"] = "application/json"
request.body = {
repo_url: "https://github.com/owner/repo",
branch: "main",
name: "My Repository",
description: "Production infrastructure repository",
tags: ["terraform", "aws"],
include_patterns: ["**/*.tf", "**/terraform/**"],
exclude_patterns: ["**/node_modules/**", "**/.git/**"]
}.to_json
response = http.request(request)
data = JSON.parse(response.body)
puts "Indexing started. Resource ID: #{data['resource_id']}"
<?php
$apiKey = "YOUR_API_KEY";
$url = "https://api.wistx.ai/v1/indexing/repositories";
$data = [
"repo_url" => "https://github.com/owner/repo",
"branch" => "main",
"name" => "My Repository",
"description" => "Production infrastructure repository",
"tags" => ["terraform", "aws"],
"include_patterns" => ["**/*.tf", "**/terraform/**"],
"exclude_patterns" => ["**/node_modules/**", "**/.git/**"]
];
$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 " . $apiKey,
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
echo "Indexing started. Resource ID: " . $data['resource_id'];
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.OutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
public class IndexRepository {
public static void main(String[] args) throws Exception {
String apiKey = "YOUR_API_KEY";
URL url = new URL("https://api.wistx.ai/v1/indexing/repositories");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer " + apiKey);
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
JsonObject payload = new JsonObject();
payload.addProperty("repo_url", "https://github.com/owner/repo");
payload.addProperty("branch", "main");
payload.addProperty("name", "My Repository");
payload.addProperty("description", "Production infrastructure repository");
Gson gson = new Gson();
String[] tags = {"terraform", "aws"};
String[] includePatterns = {"**/*.tf", "**/terraform/**"};
String[] excludePatterns = {"**/node_modules/**", "**/.git/**"};
payload.add("tags", gson.toJsonTree(tags));
payload.add("include_patterns", gson.toJsonTree(includePatterns));
payload.add("exclude_patterns", gson.toJsonTree(excludePatterns));
try (OutputStream os = conn.getOutputStream()) {
byte[] input = gson.toJson(payload).getBytes("utf-8");
os.write(input, 0, input.length);
}
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
StringBuilder response = new StringBuilder();
String responseLine;
while ((responseLine = br.readLine()) != null) {
response.append(responseLine.trim());
}
System.out.println(response.toString());
}
}
Request Parameters
string
required
GitHub repository URL in format
https://github.com/owner/repo or owner/repo.string
Branch to index. Defaults to
main if not specified.string
Custom name for the resource. If not provided, uses repository name.
string
Description of the repository.
array[string]
Tags for categorization (e.g.,
["terraform", "aws", "production"]).string
GitHub personal access token. Optional if you’ve connected GitHub OAuth during signup. Required for private repositories.
array[string]
File path patterns to include (glob patterns). Defaults to DevOps-focused paths if not provided.Examples:
["**/terraform/**", "**/*.tf", "**/*.yaml"]array[string]
File path patterns to exclude (glob patterns). Defaults to excluding application code paths if not provided.Examples:
["**/src/**", "**/app/**", "**/node_modules/**"]Response
{
"resource_id": "res_abc123",
"status": "pending",
"progress": {
"percentage": 0,
"stage": "queued",
"message": "Repository indexing queued"
},
"message": "Repository indexing started"
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": "repo_url is required"
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"detail": "User ID not found"
}
{
"error": "GITHUB_OAUTH_REQUIRED",
"message": "GitHub connection is required. Please connect your GitHub account in settings.",
"authorization_url": "/v1/oauth/github/authorize"
}
{
"error": "REPOSITORY_ACCESS_DENIED",
"message": "Access denied to this private repository. Check repository permissions."
}
{
"error": {
"code": "QUOTA_EXCEEDED",
"message": "Indexing quota exceeded",
"details": {
"limit_type": "indexes_per_month",
"current": 3,
"limit": 3
}
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"error": {
"code": "INDEXING_ERROR",
"message": "Failed to start repository indexing",
"details": null
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
Related Endpoints
- Index Documentation - Index a documentation website
- Index Document - Index a single document file
- List Resources - List all indexed resources