Skip to main content
GET
/
v2
/
repos
Get repositories
curl --request GET \
  --url https://api.ghostsecurity.ai/v2/repos \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.ghostsecurity.ai/v2/repos"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.ghostsecurity.ai/v2/repos', 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.ghostsecurity.ai/v2/repos",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$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://api.ghostsecurity.ai/v2/repos"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.ghostsecurity.ai/v2/repos")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.ghostsecurity.ai/v2/repos")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "has_more": true,
  "items": [
    {
      "archived": true,
      "cast_scan_enabled": true,
      "clone_url": "<string>",
      "created_at": "<string>",
      "default_branch_name": "<string>",
      "description": "<string>",
      "full_name": "<string>",
      "id": "<string>",
      "installation_id": "<string>",
      "languages": {},
      "last_commit_hash": "<string>",
      "last_commit_hash_link": "<string>",
      "last_committed_at": "<string>",
      "last_scanned_at": "<string>",
      "name": "<string>",
      "organization_id": "<string>",
      "package_findings": 123,
      "private": true,
      "projects": [
        {
          "business_criticality": "<string>",
          "cast_scan_enabled": true,
          "components": [
            {
              "criticality": 123,
              "description": "<string>",
              "folder_name": "<string>",
              "type": "<string>"
            }
          ],
          "created_at": "<string>",
          "dependencies_file": "<string>",
          "deployment_usage": "<string>",
          "deployments": {},
          "enabled": true,
          "evidence": "<string>",
          "exposure": "<string>",
          "file_extensions": [
            "<string>"
          ],
          "findings_count": 123,
          "frameworks": [
            "<string>"
          ],
          "has_custom_metadata": true,
          "id": "<string>",
          "languages": [
            "<string>"
          ],
          "last_committed_at": "<string>",
          "last_scan_id": "<string>",
          "last_scan_status": "<string>",
          "last_scanned_at": "<string>",
          "organization_id": "<string>",
          "owner": "<string>",
          "primary_framework": "<string>",
          "primary_language": "<string>",
          "provider": "<string>",
          "purpose": "<string>",
          "relative_path": "<string>",
          "repo": {
            "id": "<string>",
            "name": "<string>",
            "url": "<string>"
          },
          "scanner_business_criticality": "<string>",
          "scanner_exposure": "<string>",
          "scanner_summary": "<string>",
          "sensitive_data_types": [
            "<string>"
          ],
          "size": 123,
          "summary": "<string>",
          "updated_at": "<string>",
          "user_business_criticality": "<string>",
          "user_exposure": "<string>",
          "user_summary": "<string>"
        }
      ],
      "provider": "<string>",
      "provider_id": "<string>",
      "scan_branch": "<string>",
      "secret_findings": 123,
      "size": 123,
      "summary": "<string>",
      "updated_at": "<string>",
      "url": "<string>"
    }
  ],
  "next_cursor": "eyJzb3J0X3ZhbHVlIjoiMjAyNC0wMS0xNVQxMDozMDowMFoiLCJkb2N1bWVudF9pZCI6InJlcG8xMjMiLCJzb3J0X2ZpZWxkIjoiY3JlYXRlZF9hdCJ9",
  "total": 250
}
{
"error": "Unauthorized"
}
{
"error": "Internal server error"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

cursor
string

Pagination cursor

sort
enum<string>
default:created_at

Sort field

Available options:
created_at,
updated_at,
last_committed_at
order
enum<string>
default:desc

Sort order

Available options:
asc,
desc
size
integer
default:100

Page size

Required range: 1 <= x <= 1000

Response

OK

has_more
boolean

Indicates if there are more items available

Example:

true

items
object[]

The response items

next_cursor
string

Cursor for the next page

Example:

"eyJzb3J0X3ZhbHVlIjoiMjAyNC0wMS0xNVQxMDozMDowMFoiLCJkb2N1bWVudF9pZCI6InJlcG8xMjMiLCJzb3J0X2ZpZWxkIjoiY3JlYXRlZF9hdCJ9"

total
integer

Total count of items (if available)

Example:

250