Regex Search
curl --request POST \
--url https://api.wistx.ai/v1/search/regex \
--header 'Content-Type: application/json' \
--data '
{
"pattern": "<string>",
"template": "<string>",
"repositories": [
{}
],
"resource_ids": [
{}
],
"resource_types": [
{}
],
"file_types": [
{}
],
"code_type": "<string>",
"cloud_provider": "<string>",
"case_sensitive": true,
"multiline": true,
"dotall": true,
"include_context": true,
"context_lines": 123,
"limit": 123,
"timeout": 123
}
'import requests
url = "https://api.wistx.ai/v1/search/regex"
payload = {
"pattern": "<string>",
"template": "<string>",
"repositories": [{}],
"resource_ids": [{}],
"resource_types": [{}],
"file_types": [{}],
"code_type": "<string>",
"cloud_provider": "<string>",
"case_sensitive": True,
"multiline": True,
"dotall": True,
"include_context": True,
"context_lines": 123,
"limit": 123,
"timeout": 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({
pattern: '<string>',
template: '<string>',
repositories: [{}],
resource_ids: [{}],
resource_types: [{}],
file_types: [{}],
code_type: '<string>',
cloud_provider: '<string>',
case_sensitive: true,
multiline: true,
dotall: true,
include_context: true,
context_lines: 123,
limit: 123,
timeout: 123
})
};
fetch('https://api.wistx.ai/v1/search/regex', 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/regex",
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([
'pattern' => '<string>',
'template' => '<string>',
'repositories' => [
[
]
],
'resource_ids' => [
[
]
],
'resource_types' => [
[
]
],
'file_types' => [
[
]
],
'code_type' => '<string>',
'cloud_provider' => '<string>',
'case_sensitive' => true,
'multiline' => true,
'dotall' => true,
'include_context' => true,
'context_lines' => 123,
'limit' => 123,
'timeout' => 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/regex"
payload := strings.NewReader("{\n \"pattern\": \"<string>\",\n \"template\": \"<string>\",\n \"repositories\": [\n {}\n ],\n \"resource_ids\": [\n {}\n ],\n \"resource_types\": [\n {}\n ],\n \"file_types\": [\n {}\n ],\n \"code_type\": \"<string>\",\n \"cloud_provider\": \"<string>\",\n \"case_sensitive\": true,\n \"multiline\": true,\n \"dotall\": true,\n \"include_context\": true,\n \"context_lines\": 123,\n \"limit\": 123,\n \"timeout\": 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/regex")
.header("Content-Type", "application/json")
.body("{\n \"pattern\": \"<string>\",\n \"template\": \"<string>\",\n \"repositories\": [\n {}\n ],\n \"resource_ids\": [\n {}\n ],\n \"resource_types\": [\n {}\n ],\n \"file_types\": [\n {}\n ],\n \"code_type\": \"<string>\",\n \"cloud_provider\": \"<string>\",\n \"case_sensitive\": true,\n \"multiline\": true,\n \"dotall\": true,\n \"include_context\": true,\n \"context_lines\": 123,\n \"limit\": 123,\n \"timeout\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wistx.ai/v1/search/regex")
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 \"pattern\": \"<string>\",\n \"template\": \"<string>\",\n \"repositories\": [\n {}\n ],\n \"resource_ids\": [\n {}\n ],\n \"resource_types\": [\n {}\n ],\n \"file_types\": [\n {}\n ],\n \"code_type\": \"<string>\",\n \"cloud_provider\": \"<string>\",\n \"case_sensitive\": true,\n \"multiline\": true,\n \"dotall\": true,\n \"include_context\": true,\n \"context_lines\": 123,\n \"limit\": 123,\n \"timeout\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {
"matches": [
{
"file_path": "src/config.py",
"line_number": 42,
"match": "api_key = 'sk-1234567890abcdef'",
"context_before": [
"# Configuration",
"def get_config():"
],
"context_after": [
" return config",
""
],
"resource_id": "resource_123"
}
],
"resources": [
{
"_id": "resource_123",
"name": "my-repo",
"resource_type": "repository"
}
],
"total": 1,
"pattern_info": {
"pattern": "api[_-]?key\\s*=\\s*['\"]([^'\"]+)['\"]",
"template": "api_key",
"flags": {
"case_sensitive": false,
"multiline": false,
"dotall": false
},
"warnings": []
},
"performance": {
"search_time_seconds": 2.34,
"files_searched": 150,
"matches_found": 1
}
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0,
"query_time_ms": 2340
}
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": "Either pattern or template must be provided"
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key",
"details": null
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"error": {
"code": "QUOTA_EXCEEDED",
"message": "Query quota exceeded. Limit: 50 queries/month, Current: 50",
"details": {
"limit_type": "queries_per_month",
"current": 50,
"limit": 50
}
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred",
"details": "Database connection failed"
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
Search
Regex Search
Search user’s indexed codebase using regex patterns
POST
/
v1
/
search
/
regex
Regex Search
curl --request POST \
--url https://api.wistx.ai/v1/search/regex \
--header 'Content-Type: application/json' \
--data '
{
"pattern": "<string>",
"template": "<string>",
"repositories": [
{}
],
"resource_ids": [
{}
],
"resource_types": [
{}
],
"file_types": [
{}
],
"code_type": "<string>",
"cloud_provider": "<string>",
"case_sensitive": true,
"multiline": true,
"dotall": true,
"include_context": true,
"context_lines": 123,
"limit": 123,
"timeout": 123
}
'import requests
url = "https://api.wistx.ai/v1/search/regex"
payload = {
"pattern": "<string>",
"template": "<string>",
"repositories": [{}],
"resource_ids": [{}],
"resource_types": [{}],
"file_types": [{}],
"code_type": "<string>",
"cloud_provider": "<string>",
"case_sensitive": True,
"multiline": True,
"dotall": True,
"include_context": True,
"context_lines": 123,
"limit": 123,
"timeout": 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({
pattern: '<string>',
template: '<string>',
repositories: [{}],
resource_ids: [{}],
resource_types: [{}],
file_types: [{}],
code_type: '<string>',
cloud_provider: '<string>',
case_sensitive: true,
multiline: true,
dotall: true,
include_context: true,
context_lines: 123,
limit: 123,
timeout: 123
})
};
fetch('https://api.wistx.ai/v1/search/regex', 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/regex",
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([
'pattern' => '<string>',
'template' => '<string>',
'repositories' => [
[
]
],
'resource_ids' => [
[
]
],
'resource_types' => [
[
]
],
'file_types' => [
[
]
],
'code_type' => '<string>',
'cloud_provider' => '<string>',
'case_sensitive' => true,
'multiline' => true,
'dotall' => true,
'include_context' => true,
'context_lines' => 123,
'limit' => 123,
'timeout' => 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/regex"
payload := strings.NewReader("{\n \"pattern\": \"<string>\",\n \"template\": \"<string>\",\n \"repositories\": [\n {}\n ],\n \"resource_ids\": [\n {}\n ],\n \"resource_types\": [\n {}\n ],\n \"file_types\": [\n {}\n ],\n \"code_type\": \"<string>\",\n \"cloud_provider\": \"<string>\",\n \"case_sensitive\": true,\n \"multiline\": true,\n \"dotall\": true,\n \"include_context\": true,\n \"context_lines\": 123,\n \"limit\": 123,\n \"timeout\": 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/regex")
.header("Content-Type", "application/json")
.body("{\n \"pattern\": \"<string>\",\n \"template\": \"<string>\",\n \"repositories\": [\n {}\n ],\n \"resource_ids\": [\n {}\n ],\n \"resource_types\": [\n {}\n ],\n \"file_types\": [\n {}\n ],\n \"code_type\": \"<string>\",\n \"cloud_provider\": \"<string>\",\n \"case_sensitive\": true,\n \"multiline\": true,\n \"dotall\": true,\n \"include_context\": true,\n \"context_lines\": 123,\n \"limit\": 123,\n \"timeout\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wistx.ai/v1/search/regex")
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 \"pattern\": \"<string>\",\n \"template\": \"<string>\",\n \"repositories\": [\n {}\n ],\n \"resource_ids\": [\n {}\n ],\n \"resource_types\": [\n {}\n ],\n \"file_types\": [\n {}\n ],\n \"code_type\": \"<string>\",\n \"cloud_provider\": \"<string>\",\n \"case_sensitive\": true,\n \"multiline\": true,\n \"dotall\": true,\n \"include_context\": true,\n \"context_lines\": 123,\n \"limit\": 123,\n \"timeout\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {
"matches": [
{
"file_path": "src/config.py",
"line_number": 42,
"match": "api_key = 'sk-1234567890abcdef'",
"context_before": [
"# Configuration",
"def get_config():"
],
"context_after": [
" return config",
""
],
"resource_id": "resource_123"
}
],
"resources": [
{
"_id": "resource_123",
"name": "my-repo",
"resource_type": "repository"
}
],
"total": 1,
"pattern_info": {
"pattern": "api[_-]?key\\s*=\\s*['\"]([^'\"]+)['\"]",
"template": "api_key",
"flags": {
"case_sensitive": false,
"multiline": false,
"dotall": false
},
"warnings": []
},
"performance": {
"search_time_seconds": 2.34,
"files_searched": 150,
"matches_found": 1
}
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0,
"query_time_ms": 2340
}
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": "Either pattern or template must be provided"
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key",
"details": null
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"error": {
"code": "QUOTA_EXCEEDED",
"message": "Query quota exceeded. Limit: 50 queries/month, Current: 50",
"details": {
"limit_type": "queries_per_month",
"current": 50,
"limit": 50
}
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred",
"details": "Database connection failed"
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
Search your indexed repositories, documentation, and documents using regex patterns. Perfect for exact pattern matching, security audits (finding secrets, API keys), compliance checks (finding violations), and code analysis.
Endpoint
POST /v1/search/regex
Request Body
string
Regular expression pattern to search for (required if template not provided). Maximum length: 10,000 characters.
string
Use pre-built pattern template instead of custom pattern. Available templates:
api_key, password, secret_key, token, credential, private_key, ssh_key, aws_access_key, aws_secret_key, github_token, slack_token, jwt_token, ip_address, email, credit_card, ssn, unencrypted_storage, public_access, publicly_accessible, missing_backup, no_encryption, no_versioning, no_logging, no_mfa, insecure_protocol, latest_tag, no_resource_limits, hardcoded_port, hardcoded_url, function_definition, class_definition, terraform_resource, terraform_data_source, terraform_variable, kubernetes_secret, kubernetes_configmap, docker_expose, docker_volume, ansible_vault, ansible_playbook, cloudformation_resource, cloudformation_output.array
List of repositories to search (owner/repo format, e.g.,
["owner/repo"]).array
Filter by specific indexed resource IDs.
array
Filter by resource type:
repository, documentation, document.array
Filter by file extensions (e.g.,
[".tf", ".yaml", ".py", ".md"]).string
Filter by code type:
terraform, kubernetes, docker, python.string
Filter by cloud provider mentioned in code:
aws, gcp, azure.boolean
default:"false"
Case-sensitive matching.
boolean
default:"false"
Multiline mode (^ and $ match line boundaries).
boolean
default:"false"
Dot matches newline.
boolean
default:"true"
Include surrounding code context around matches.
integer
default:"3"
Number of lines before/after match to include in context.
integer
default:"100"
Maximum number of results to return.
number
default:"30.0"
Maximum search time in seconds.
Request Example
curl --request POST \
--url https://api.wistx.ai/v1/search/regex \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"template": "api_key",
"repositories": ["owner/repo"],
"include_context": true,
"context_lines": 3,
"limit": 50
}'
import requests
api_key = "YOUR_API_KEY"
response = requests.post(
"https://api.wistx.ai/v1/search/regex",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
},
json={
"template": "api_key",
"repositories": ["owner/repo"],
"include_context": True,
"context_lines": 3,
"limit": 50
}
)
print(response.json())
const apiKey = "YOUR_API_KEY";
const response = await fetch("https://api.wistx.ai/v1/search/regex", {
method: "POST",
headers: {
"Authorization": `Bearer ${apiKey}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
template: "api_key",
repositories: ["owner/repo"],
include_context: true,
context_lines: 3,
limit: 50
})
});
const data = await response.json();
console.log(data);
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
apiKey := "YOUR_API_KEY"
payload := map[string]interface{}{
"template": "api_key",
"repositories": []string{"owner/repo"},
"include_context": true,
"context_lines": 3,
"limit": 50,
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.wistx.ai/v1/search/regex", bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer "+apiKey)
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/regex')
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 = {
template: "api_key",
repositories: ["owner/repo"],
include_context: true,
context_lines: 3,
limit: 50
}.to_json
response = http.request(request)
puts response.body
<?php
$apiKey = "YOUR_API_KEY";
$data = [
"template" => "api_key",
"repositories" => ["owner/repo"],
"include_context" => true,
"context_lines" => 3,
"limit" => 50
];
$ch = curl_init("https://api.wistx.ai/v1/search/regex");
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);
echo $response;
?>
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import com.fasterxml.jackson.databind.ObjectMapper;
String apiKey = "YOUR_API_KEY";
Map<String, Object> payload = Map.of(
"template", "api_key",
"repositories", List.of("owner/repo"),
"include_context", true,
"context_lines", 3,
"limit", 50
);
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(payload);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.wistx.ai/v1/search/regex"))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Response Example
{
"data": {
"matches": [
{
"file_path": "src/config.py",
"line_number": 42,
"match": "api_key = 'sk-1234567890abcdef'",
"context_before": [
"# Configuration",
"def get_config():"
],
"context_after": [
" return config",
""
],
"resource_id": "resource_123"
}
],
"resources": [
{
"_id": "resource_123",
"name": "my-repo",
"resource_type": "repository"
}
],
"total": 1,
"pattern_info": {
"pattern": "api[_-]?key\\s*=\\s*['\"]([^'\"]+)['\"]",
"template": "api_key",
"flags": {
"case_sensitive": false,
"multiline": false,
"dotall": false
},
"warnings": []
},
"performance": {
"search_time_seconds": 2.34,
"files_searched": 150,
"matches_found": 1
}
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0,
"query_time_ms": 2340
}
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": "Either pattern or template must be provided"
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key",
"details": null
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"error": {
"code": "QUOTA_EXCEEDED",
"message": "Query quota exceeded. Limit: 50 queries/month, Current: 50",
"details": {
"limit_type": "queries_per_month",
"current": 50,
"limit": 50
}
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
{
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred",
"details": "Database connection failed"
},
"metadata": {
"request_id": "req_abc123",
"timestamp": 1704067200.0
}
}
Rate Limits
| Plan | Queries/Month |
|---|---|
| Professional | 2,000 |
| Team | 10,000 |
| Enterprise | Unlimited |