Skip to main content
POST
/
api
/
agents
/
scan
/
history
Get Agent Scan History
curl --request POST \
  --url https://api.codeant.ai/api/agents/scan/history \
  --header 'Content-Type: application/json' \
  --data '
{
  "repo": "owner/repository"
}
'
import requests

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

payload = { "repo": "owner/repository" }
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: 'owner/repository'})
};

fetch('https://api.codeant.ai/api/agents/scan/history', 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/history",
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' => 'owner/repository'
]),
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/history"

payload := strings.NewReader("{\n \"repo\": \"owner/repository\"\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/history")
.header("Content-Type", "application/json")
.body("{\n \"repo\": \"owner/repository\"\n}")
.asString();
require 'uri'
require 'net/http'

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

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\": \"owner/repository\"\n}"

response = http.request(request)
puts response.read_body
{
  "scans": [
    {
      "service": "github",
      "repo_name": "owner/repository",
      "branch": "main",
      "commit_id": "abc123def456",
      "scan_id": "aB3xK9mP2q",
      "prompt": "threat_hunting",
      "timestamp": "2025-03-15T10:30:00Z",
      "num_files": 142
    },
    {
      "service": "github",
      "repo_name": "owner/repository",
      "branch": "develop",
      "commit_id": "def456ghi789",
      "scan_id": "zY8wV7uT6s",
      "prompt": "bug_finding",
      "timestamp": "2025-03-14T08:15:00Z",
      "num_files": 98
    }
  ]
}
{
"error": "Missing or invalid repo parameter"
}
{
"error": "Failed to retrieve scan history"
}

Body

application/json
repo
string
required

Repository identifier

Example:

"owner/repository"

Response

Scan history retrieved successfully

scans
object[]

List of past agent scans, sorted by most recent first