Skip to main content
POST
/
api
/
analysis
/
results
/
iac
Get IaC Scan Results
curl --request POST \
  --url https://api.codeant.ai/api/analysis/results/iac \
  --header 'Content-Type: application/json' \
  --data '
{
  "repo": "owner/repository",
  "commit_id": "abc123def456",
  "access_token": "ghp_xxxxxxxxxxxx",
  "service": "github"
}
'
import requests

url = "https://api.codeant.ai/api/analysis/results/iac"

payload = {
"repo": "owner/repository",
"commit_id": "abc123def456",
"access_token": "ghp_xxxxxxxxxxxx",
"service": "github"
}
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',
commit_id: 'abc123def456',
access_token: 'ghp_xxxxxxxxxxxx',
service: 'github'
})
};

fetch('https://api.codeant.ai/api/analysis/results/iac', 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/analysis/results/iac",
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',
'commit_id' => 'abc123def456',
'access_token' => 'ghp_xxxxxxxxxxxx',
'service' => 'github'
]),
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/analysis/results/iac"

payload := strings.NewReader("{\n \"repo\": \"owner/repository\",\n \"commit_id\": \"abc123def456\",\n \"access_token\": \"ghp_xxxxxxxxxxxx\",\n \"service\": \"github\"\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/analysis/results/iac")
.header("Content-Type", "application/json")
.body("{\n \"repo\": \"owner/repository\",\n \"commit_id\": \"abc123def456\",\n \"access_token\": \"ghp_xxxxxxxxxxxx\",\n \"service\": \"github\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.codeant.ai/api/analysis/results/iac")

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 \"commit_id\": \"abc123def456\",\n \"access_token\": \"ghp_xxxxxxxxxxxx\",\n \"service\": \"github\"\n}"

response = http.request(request)
puts response.read_body
{
  "results": [
    {
      "check_type": "terraform",
      "results": {
        "failed_checks": [
          {
            "bc_check_id": "BC_AWS_NETWORKING_31",
            "check_id": "CKV_AWS_23",
            "check_name": "Ensure every security group and rule has a description",
            "file_path": "/owner/repository/abc123def456/terraform/main.tf",
            "file_line_range": [
              2,
              25
            ],
            "check_class": "checkov.terraform.checks.resource.aws.SecurityGroupRuleDescription",
            "code_block": [
              [
                2,
                "resource \"aws_security_group\" \"web\" {\n"
              ],
              [
                3,
                "  name_prefix = \"web-sg\"\n"
              ],
              [
                4,
                "\n"
              ],
              [
                5,
                "  ingress {\n"
              ],
              [
                6,
                "    from_port   = 22\n"
              ],
              [
                7,
                "    to_port     = 22\n"
              ],
              [
                8,
                "    protocol    = \"tcp\"\n"
              ],
              [
                9,
                "    cidr_blocks = [\"0.0.0.0/0\"]\n"
              ],
              [
                10,
                "  }\n"
              ],
              [
                11,
                "\n"
              ],
              [
                12,
                "  ingress {\n"
              ],
              [
                13,
                "    from_port   = 80\n"
              ],
              [
                14,
                "    to_port     = 80\n"
              ],
              [
                15,
                "    protocol    = \"tcp\"\n"
              ],
              [
                16,
                "    cidr_blocks = [\"0.0.0.0/0\"]\n"
              ],
              [
                17,
                "  }\n"
              ],
              [
                18,
                "\n"
              ],
              [
                19,
                "  egress {\n"
              ],
              [
                20,
                "    from_port   = 0\n"
              ],
              [
                21,
                "    to_port     = 0\n"
              ],
              [
                22,
                "    protocol    = \"-1\"\n"
              ],
              [
                23,
                "    cidr_blocks = [\"0.0.0.0/0\"]\n"
              ],
              [
                24,
                "  }\n"
              ],
              [
                25,
                "}\n"
              ]
            ],
            "resource": "aws_security_group.web",
            "start_line": 2,
            "end_line": 25
          }
        ]
      }
    }
  ]
}
{
"error": "Access token invalid"
}
{
"error": "Error retrieving IaC scan results"
}

Body

application/json
repo
string
required

Repository identifier (format varies by service)

Example:

"owner/repository"

access_token
string
required

Authentication token for the service

Example:

"ghp_xxxxxxxxxxxx"

service
enum<string>
required

Version control service provider

Available options:
github,
azuredevops,
gitlab,
bitbucket
Example:

"github"

commit_id
string

Git commit SHA or identifier. Either commit_id or branch is required. If both are provided, commit_id takes precedence.

Example:

"abc123def456"

branch
string

Git branch name. When provided without commit_id, the service resolves the latest commit from scan history for this branch. Either commit_id or branch is required.

Example:

"main"

gitlab_base_url
string

Base URL for the service (optional for GitHub, required for GitLab)

Example:

"https://gitlab.com"

Response

IaC scan results retrieved successfully

Infrastructure as Code (IaC) scanning response containing security check results

results
object[]

List of IaC scan results by check type