List repositories
curl --request GET \
--url https://app.codethreat.com/api/v1/repositories \
--header 'X-API-Key: <api-key>'import requests
url = "https://app.codethreat.com/api/v1/repositories"
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/repositories', 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/repositories",
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/repositories"
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/repositories")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.codethreat.com/api/v1/repositories")
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
Repositories
Get a paginated list of repositories for the authenticated organization
GET
/
repositories
List repositories
curl --request GET \
--url https://app.codethreat.com/api/v1/repositories \
--header 'X-API-Key: <api-key>'import requests
url = "https://app.codethreat.com/api/v1/repositories"
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/repositories', 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/repositories",
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/repositories"
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/repositories")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.codethreat.com/api/v1/repositories")
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>"Repositories API
Manage repositories programmatically via API.List Repositories
GET /v1/repositories
{
"repositories": [
{
"repository_id": "repo_123",
"name": "my-app",
"vcs_provider": "github",
"default_branch": "main",
"last_scan_at": "2024-03-15T14:35:42Z",
"security_score": 85
}
],
"pagination": {
"page": 1,
"total": 15
}
}
Get Repository
GET /v1/repositories/:repository_id
{
"repository_id": "repo_123",
"name": "my-app",
"vcs_provider": "github",
"vcs_url": "https://github.com/org/my-app",
"default_branch": "main",
"security_score": 85,
"total_violations": 27,
"violations_by_severity": {
"critical": 2,
"high": 5,
"medium": 12,
"low": 8
},
"last_scan_at": "2024-03-15T14:35:42Z",
"created_at": "2024-01-10T09:00:00Z"
}
Update Repository Settings
PATCH /v1/repositories/:repository_id
{
"auto_scan_on_push": true,
"auto_scan_on_pr": true
}
What’s Next?
Scans API
Trigger repository scans
Violations API
View repository violations
Authorizations
API key for authentication. Generate from your organization settings.
Query Parameters
Page number
Required range:
x >= 1Items per page
Required range:
1 <= x <= 100Search repositories by name
Filter by provider
Available options:
github, gitlab, bitbucket, azure_devops Filter by status
Available options:
active, inactive, archived Available options:
name, createdAt, updatedAt, lastScanAt Available options:
asc, desc Response
200 - application/json
Successful response
The response is of type any.
Was this page helpful?
