Skip to main content
POST
/
api
/
agents
/
scan
/
start
Start Agent Scan
curl --request POST \
  --url https://api.codeant.ai/api/agents/scan/start \
  --header 'Content-Type: application/json' \
  --data '
{
  "service": "github",
  "repo": "owner/repository",
  "accessToken": "ghp_xxxxxxxxxxxx",
  "branch": "main",
  "instructionPrompt": "threat_hunting",
  "includeFiles": "src/**/*.py,lib/**/*.js",
  "excludeFiles": "tests/**,node_modules/**"
}
'
import requests

url = "https://api.codeant.ai/api/agents/scan/start"

payload = {
"service": "github",
"repo": "owner/repository",
"accessToken": "ghp_xxxxxxxxxxxx",
"branch": "main",
"instructionPrompt": "threat_hunting",
"includeFiles": "src/**/*.py,lib/**/*.js",
"excludeFiles": "tests/**,node_modules/**"
}
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({
service: 'github',
repo: 'owner/repository',
accessToken: 'ghp_xxxxxxxxxxxx',
branch: 'main',
instructionPrompt: 'threat_hunting',
includeFiles: 'src/**/*.py,lib/**/*.js',
excludeFiles: 'tests/**,node_modules/**'
})
};

fetch('https://api.codeant.ai/api/agents/scan/start', 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.codeant.ai/api/agents/scan/start",
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([
'service' => 'github',
'repo' => 'owner/repository',
'accessToken' => 'ghp_xxxxxxxxxxxx',
'branch' => 'main',
'instructionPrompt' => 'threat_hunting',
'includeFiles' => 'src/**/*.py,lib/**/*.js',
'excludeFiles' => 'tests/**,node_modules/**'
]),
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.codeant.ai/api/agents/scan/start"

payload := strings.NewReader("{\n \"service\": \"github\",\n \"repo\": \"owner/repository\",\n \"accessToken\": \"ghp_xxxxxxxxxxxx\",\n \"branch\": \"main\",\n \"instructionPrompt\": \"threat_hunting\",\n \"includeFiles\": \"src/**/*.py,lib/**/*.js\",\n \"excludeFiles\": \"tests/**,node_modules/**\"\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.codeant.ai/api/agents/scan/start")
.header("Content-Type", "application/json")
.body("{\n \"service\": \"github\",\n \"repo\": \"owner/repository\",\n \"accessToken\": \"ghp_xxxxxxxxxxxx\",\n \"branch\": \"main\",\n \"instructionPrompt\": \"threat_hunting\",\n \"includeFiles\": \"src/**/*.py,lib/**/*.js\",\n \"excludeFiles\": \"tests/**,node_modules/**\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.codeant.ai/api/agents/scan/start")

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 \"service\": \"github\",\n \"repo\": \"owner/repository\",\n \"accessToken\": \"ghp_xxxxxxxxxxxx\",\n \"branch\": \"main\",\n \"instructionPrompt\": \"threat_hunting\",\n \"includeFiles\": \"src/**/*.py,lib/**/*.js\",\n \"excludeFiles\": \"tests/**,node_modules/**\"\n}"

response = http.request(request)
puts response.read_body
{
  "message": "Scan started successfully",
  "scanId": "aB3xK9mP2q",
  "filesQueued": 142
}
{
"error": "Missing required parameter: instructionPrompt"
}
{
"error": "Failed to start scan"
}

Body

application/json
service
enum<string>
required

Version control service provider

Available options:
github,
gitlab,
azuredevops,
bitbucket
Example:

"github"

repo
string
required

Repository identifier (format varies by service)

Example:

"owner/repository"

accessToken
string
required

OAuth or personal access token for the VCS service

Example:

"ghp_xxxxxxxxxxxx"

branch
string
required

Git branch to analyze

Example:

"main"

instructionPrompt
string
required

Analysis type. Use threat_hunting for security threat detection.

Example:

"threat_hunting"

commitId
string
default:""

Specific commit SHA to analyze. If omitted, the latest commit on the branch is used.

Example:

"abc123def456"

includeFiles
string
default:""

Comma-separated glob patterns for files to include in analysis

Example:

"src/**/*.py,lib/**/*.js,app/**/*.ts"

excludeFiles
string
default:""

Comma-separated glob patterns for files to exclude from analysis

Example:

"tests/**,node_modules/**,dist/**"

azureDevopsBaseUrl
string
default:https://dev.azure.com

Base URL for Azure DevOps (for self-hosted instances)

gitlab_base_url
string
default:https://gitlab.com

Base URL for GitLab (for self-hosted instances)

github_base_url
string
default:https://github.com

Base URL for GitHub (for GitHub Enterprise Server)

bitbucket_base_url
string
default:https://api.bitbucket.org/2.0

Base URL for Bitbucket (for Bitbucket Data Center)

Response

Agent scan successfully started

message
string

Success message

Example:

"Scan started successfully"

scanId
string

Unique identifier for the scan. Use this to retrieve results and check status.

Example:

"aB3xK9mP2q"

filesQueued
integer

Number of files queued for analysis

Example:

142