List scans (beta)
curl --request POST \
--url https://semgrep.dev/api/v1/deployments/{deploymentId}/scans/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"branch": "<string>",
"cursor": "<string>",
"deploymentId": 123,
"is_full_scan": 123,
"is_partial_scan": true,
"limit": 123,
"products": [],
"repository_id": 123,
"since": "2023-11-07T05:31:56Z",
"total_time": {
"max": 123,
"min": 123
}
}
'import requests
url = "https://semgrep.dev/api/v1/deployments/{deploymentId}/scans/search"
payload = {
"branch": "<string>",
"cursor": "<string>",
"deploymentId": 123,
"is_full_scan": 123,
"is_partial_scan": True,
"limit": 123,
"products": [],
"repository_id": 123,
"since": "2023-11-07T05:31:56Z",
"total_time": {
"max": 123,
"min": 123
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
branch: '<string>',
cursor: '<string>',
deploymentId: 123,
is_full_scan: 123,
is_partial_scan: true,
limit: 123,
products: [],
repository_id: 123,
since: '2023-11-07T05:31:56Z',
total_time: {max: 123, min: 123}
})
};
fetch('https://semgrep.dev/api/v1/deployments/{deploymentId}/scans/search', 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://semgrep.dev/api/v1/deployments/{deploymentId}/scans/search",
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([
'branch' => '<string>',
'cursor' => '<string>',
'deploymentId' => 123,
'is_full_scan' => 123,
'is_partial_scan' => true,
'limit' => 123,
'products' => [
],
'repository_id' => 123,
'since' => '2023-11-07T05:31:56Z',
'total_time' => [
'max' => 123,
'min' => 123
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://semgrep.dev/api/v1/deployments/{deploymentId}/scans/search"
payload := strings.NewReader("{\n \"branch\": \"<string>\",\n \"cursor\": \"<string>\",\n \"deploymentId\": 123,\n \"is_full_scan\": 123,\n \"is_partial_scan\": true,\n \"limit\": 123,\n \"products\": [],\n \"repository_id\": 123,\n \"since\": \"2023-11-07T05:31:56Z\",\n \"total_time\": {\n \"max\": 123,\n \"min\": 123\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://semgrep.dev/api/v1/deployments/{deploymentId}/scans/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"branch\": \"<string>\",\n \"cursor\": \"<string>\",\n \"deploymentId\": 123,\n \"is_full_scan\": 123,\n \"is_partial_scan\": true,\n \"limit\": 123,\n \"products\": [],\n \"repository_id\": 123,\n \"since\": \"2023-11-07T05:31:56Z\",\n \"total_time\": {\n \"max\": 123,\n \"min\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://semgrep.dev/api/v1/deployments/{deploymentId}/scans/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"branch\": \"<string>\",\n \"cursor\": \"<string>\",\n \"deploymentId\": 123,\n \"is_full_scan\": 123,\n \"is_partial_scan\": true,\n \"limit\": 123,\n \"products\": [],\n \"repository_id\": 123,\n \"since\": \"2023-11-07T05:31:56Z\",\n \"total_time\": {\n \"max\": 123,\n \"min\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"cursor": "<string>",
"scans": [
{
"branch": "main",
"commit": "6d3de02545f820febf2af9820568fa5f697d4087",
"completed_at": "2020-11-18T23:30:10.216Z",
"deployment_id": "<string>",
"enabled_products": [
"secrets"
],
"exit_code": 0,
"findings_counts": {
"code": 2,
"secrets": 1,
"supply_chain": 1,
"total": 4
},
"id": "<string>",
"is_full_scan": true,
"is_partial_scan": false,
"repository_id": "<string>",
"started_at": "2020-11-18T23:28:12.391Z",
"status": "SCAN_STATUS_RUNNING",
"total_time": 17.32
}
]
}Scans
List scans (beta)
List the scans associated with a particular repository over the past 30 days.
POST
/
api
/
v1
/
deployments
/
{deploymentId}
/
scans
/
search
List scans (beta)
curl --request POST \
--url https://semgrep.dev/api/v1/deployments/{deploymentId}/scans/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"branch": "<string>",
"cursor": "<string>",
"deploymentId": 123,
"is_full_scan": 123,
"is_partial_scan": true,
"limit": 123,
"products": [],
"repository_id": 123,
"since": "2023-11-07T05:31:56Z",
"total_time": {
"max": 123,
"min": 123
}
}
'import requests
url = "https://semgrep.dev/api/v1/deployments/{deploymentId}/scans/search"
payload = {
"branch": "<string>",
"cursor": "<string>",
"deploymentId": 123,
"is_full_scan": 123,
"is_partial_scan": True,
"limit": 123,
"products": [],
"repository_id": 123,
"since": "2023-11-07T05:31:56Z",
"total_time": {
"max": 123,
"min": 123
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
branch: '<string>',
cursor: '<string>',
deploymentId: 123,
is_full_scan: 123,
is_partial_scan: true,
limit: 123,
products: [],
repository_id: 123,
since: '2023-11-07T05:31:56Z',
total_time: {max: 123, min: 123}
})
};
fetch('https://semgrep.dev/api/v1/deployments/{deploymentId}/scans/search', 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://semgrep.dev/api/v1/deployments/{deploymentId}/scans/search",
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([
'branch' => '<string>',
'cursor' => '<string>',
'deploymentId' => 123,
'is_full_scan' => 123,
'is_partial_scan' => true,
'limit' => 123,
'products' => [
],
'repository_id' => 123,
'since' => '2023-11-07T05:31:56Z',
'total_time' => [
'max' => 123,
'min' => 123
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://semgrep.dev/api/v1/deployments/{deploymentId}/scans/search"
payload := strings.NewReader("{\n \"branch\": \"<string>\",\n \"cursor\": \"<string>\",\n \"deploymentId\": 123,\n \"is_full_scan\": 123,\n \"is_partial_scan\": true,\n \"limit\": 123,\n \"products\": [],\n \"repository_id\": 123,\n \"since\": \"2023-11-07T05:31:56Z\",\n \"total_time\": {\n \"max\": 123,\n \"min\": 123\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://semgrep.dev/api/v1/deployments/{deploymentId}/scans/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"branch\": \"<string>\",\n \"cursor\": \"<string>\",\n \"deploymentId\": 123,\n \"is_full_scan\": 123,\n \"is_partial_scan\": true,\n \"limit\": 123,\n \"products\": [],\n \"repository_id\": 123,\n \"since\": \"2023-11-07T05:31:56Z\",\n \"total_time\": {\n \"max\": 123,\n \"min\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://semgrep.dev/api/v1/deployments/{deploymentId}/scans/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"branch\": \"<string>\",\n \"cursor\": \"<string>\",\n \"deploymentId\": 123,\n \"is_full_scan\": 123,\n \"is_partial_scan\": true,\n \"limit\": 123,\n \"products\": [],\n \"repository_id\": 123,\n \"since\": \"2023-11-07T05:31:56Z\",\n \"total_time\": {\n \"max\": 123,\n \"min\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"cursor": "<string>",
"scans": [
{
"branch": "main",
"commit": "6d3de02545f820febf2af9820568fa5f697d4087",
"completed_at": "2020-11-18T23:30:10.216Z",
"deployment_id": "<string>",
"enabled_products": [
"secrets"
],
"exit_code": 0,
"findings_counts": {
"code": 2,
"secrets": 1,
"supply_chain": 1,
"total": 4
},
"id": "<string>",
"is_full_scan": true,
"is_partial_scan": false,
"repository_id": "<string>",
"started_at": "2020-11-18T23:28:12.391Z",
"status": "SCAN_STATUS_RUNNING",
"total_time": 17.32
}
]
}Authorizations
Path Parameters
Body
application/json
Only get scans that ran an explicit subset of rules rather than the full rule set (if false, only get scans that ran the full rule set). Independent of is_full_scan: a supply chain incident scan covers the whole project but runs only the rules for that incident, so it reports is_full_scan: true and is_partial_scan: true.
Only get scans that have one of these statuses
| value | description |
|---|---|
| SCAN_STATUS_RUNNING | The scan is currently running |
| SCAN_STATUS_COMPLETED | The scan has completed successfully (0 or 1 exit code) |
| SCAN_STATUS_PENDING | The scan is queued and waiting to start |
| SCAN_STATUS_CANCELLED | The scan was cancelled before completion |
| SCAN_STATUS_ERROR | The scan has exited with a failure (exit code not 0 or 1) |
| SCAN_STATUS_NEVER_FINISHED | The scan did not report an error or success after over an hour |
| SCAN_STATUS_SKIPPED | The execution was skipped |
Available options:
SCAN_STATUS_RUNNING, SCAN_STATUS_COMPLETED, SCAN_STATUS_PENDING, SCAN_STATUS_CANCELLED, SCAN_STATUS_ERROR, SCAN_STATUS_NEVER_FINISHED, SCAN_STATUS_SKIPPED Was this page helpful?