List violations
curl --request GET \
--url https://app.codethreat.com/api/v1/violations \
--header 'X-API-Key: <api-key>'import requests
url = "https://app.codethreat.com/api/v1/violations"
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/violations', 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/violations",
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/violations"
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/violations")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.codethreat.com/api/v1/violations")
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
Violations
Get a paginated list of security violations
GET
/
violations
List violations
curl --request GET \
--url https://app.codethreat.com/api/v1/violations \
--header 'X-API-Key: <api-key>'import requests
url = "https://app.codethreat.com/api/v1/violations"
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/violations', 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/violations",
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/violations"
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/violations")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.codethreat.com/api/v1/violations")
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>"Violations API
Access and manage security violations via API.List Violations
GET /v1/violations?repository_id=repo_123&severity=critical,high
{
"violations": [
{
"violation_id": "vio_789",
"title": "SQL Injection in user_controller.py",
"severity": "CRITICAL",
"cvss_score": 9.1,
"epss_score": 68.5,
"type": "SAST",
"status": "OPEN",
"file_path": "api/user_controller.py",
"line_number": 45
}
],
"pagination": {
"page": 1,
"total": 27
}
}
Get Violation Details
GET /v1/violations/:violation_id
{
"violation_id": "vio_789",
"title": "SQL Injection in user_controller.py",
"description": "User input directly interpolated into SQL query...",
"severity": "CRITICAL",
"cvss_score": 9.1,
"epss_score": 68.5,
"type": "SAST",
"cwe": "CWE-89",
"status": "OPEN",
"file_path": "api/user_controller.py",
"line_number": 45,
"code_snippet": "query = f\"SELECT * FROM users WHERE id = {user_id}\"",
"remediation": "Use parameterized queries...",
"first_detected": "2024-03-10T08:15:00Z",
"last_seen": "2024-03-15T14:35:42Z"
}
Update Violation Status
POST /v1/violations/:violation_id/suppress
{
"justification": "Input validated on line 42 before use"
}
What’s Next?
Scans API
Trigger scans
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 <= 100Available options:
critical, high, medium, low, info Available options:
open, fixed, ignored, false_positive Response
200 - application/json
Successful response
The response is of type any.
Was this page helpful?
