List scans
curl --request GET \
--url https://app.codethreat.com/api/v1/scans \
--header 'X-API-Key: <api-key>'import requests
url = "https://app.codethreat.com/api/v1/scans"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://app.codethreat.com/api/v1/scans', 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://app.codethreat.com/api/v1/scans",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.codethreat.com/api/v1/scans"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.codethreat.com/api/v1/scans")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.codethreat.com/api/v1/scans")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body"<unknown>"Core Resources
Scans
Get a paginated list of security scans
GET
/
scans
List scans
curl --request GET \
--url https://app.codethreat.com/api/v1/scans \
--header 'X-API-Key: <api-key>'import requests
url = "https://app.codethreat.com/api/v1/scans"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://app.codethreat.com/api/v1/scans', 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://app.codethreat.com/api/v1/scans",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.codethreat.com/api/v1/scans"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.codethreat.com/api/v1/scans")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.codethreat.com/api/v1/scans")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body"<unknown>"Scans API
Trigger and manage security scans via API.Trigger Scan
POST /v1/scans
{
"repository_id": "repo_123",
"branch": "main"
}
{
"scan_id": "scan_456",
"status": "PENDING",
"repository_id": "repo_123",
"branch": "main",
"created_at": "2024-03-15T14:32:18Z"
}
Get Scan Status
GET /v1/scans/:scan_id
{
"scan_id": "scan_456",
"status": "COMPLETED",
"repository_id": "repo_123",
"branch": "main",
"violations": {
"critical": 2,
"high": 5,
"medium": 12,
"low": 8,
"info": 0
},
"started_at": "2024-03-15T14:32:20Z",
"completed_at": "2024-03-15T14:35:42Z"
}
List Scans
GET /v1/scans?repository_id=repo_123&limit=10
{
"scans": [
{
"scan_id": "scan_456",
"status": "COMPLETED",
"created_at": "2024-03-15T14:32:18Z"
}
],
"pagination": {
"page": 1,
"total": 42
}
}
What’s Next?
Violations API
Get violation data
Repositories API
Manage repositories
Authorizations
API key for authentication. Generate from your organization settings.
Query Parameters
Page number
Required range:
x >= 1Items per page
Required range:
1 <= x <= 100Filter by repository
Filter by status
Available options:
PENDING, SCANNING, COMPLETED, FAILED Filter by scan type
Available options:
sast, sca, secrets, iac Available options:
startedAt, completedAt, status Available options:
asc, desc Response
200 - application/json
Successful response
The response is of type any.
Was this page helpful?
