curl --request GET \
--url https://semgrep.dev/api/v1/deployments/{deploymentSlug}/findings \
--header 'Authorization: Bearer <token>'import requests
url = "https://semgrep.dev/api/v1/deployments/{deploymentSlug}/findings"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://semgrep.dev/api/v1/deployments/{deploymentSlug}/findings', 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/{deploymentSlug}/findings",
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://semgrep.dev/api/v1/deployments/{deploymentSlug}/findings"
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://semgrep.dev/api/v1/deployments/{deploymentSlug}/findings")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://semgrep.dev/api/v1/deployments/{deploymentSlug}/findings")
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{
"findings": [
{
"assistant": {
"autofix": {
"explanation": null,
"fix_code": "cookie.setHttpOnly(true);\\nresponse.addCookie(cookie);"
},
"autotriage": {
"reason": "The matched code is used for a non-security related feature.",
"verdict": "false_positive"
},
"component": {
"risk": "high",
"tag": "user data"
},
"guidance": {
"instructions": null,
"summary": "Use a template rendering engine such as EJS instead of string concatenation."
},
"rule_explanation": {
"explanation": "This code is vulnerable to SQL injection because user input from the `username` parameter is directly concatenated into the SQL query string without sanitization or parameterization.",
"summary": "User input directly concatenated into SQL query"
}
},
"categories": [
"security"
],
"click_to_fix_failures": [
{
"created_at": "2024-01-15T10:30:00.000Z",
"reason": "merge conflict in target branch"
}
],
"click_to_fix_prs": [
{
"created_at": "2024-01-15T10:30:00.000Z",
"url": "https://github.com/myorg/myrepo/pull/123"
}
],
"confidence": "medium",
"created_at": "2020-11-18T23:28:12.391Z",
"external_ticket": {
"external_slug": "OPS-158",
"id": 123,
"linked_issue_ids": [
123
],
"url": "<string>"
},
"first_seen_scan_id": 1234,
"id": 1234567,
"line_of_code_url": "https://github.com/semgrep/semgrep/blob/39f95450a7d4d70e54c9edbd109bed8210a36889/src/core_cli/Core_CLI.ml#L1",
"location": {
"column": 8,
"end_column": 16,
"end_line": 124,
"file_path": "frontend/src/corpComponents/Code.tsx",
"line": 120
},
"match_based_id": "0f8c79a6f7e0ff2f908ff5bc366ae1548465069bae8892088051e1c3b4b12c6b8df37d5bcbb181eb868aa79f81f239d14bf2336d552786ab8ccdc7279adf07a6_1",
"ref": "refs/pull/1234/merge",
"relevant_since": "2020-11-18T23:28:12.391Z",
"repository": {
"name": "semgrep",
"url": "https://github.com/semgrep/semgrep"
},
"review_comments": [
{
"external_discussion_id": "af04762b69acfb74c8f9",
"external_note_id": 123523
}
],
"rule": {
"category": "security",
"confidence": "high",
"cwe_names": [
"CWE-319: Cleartext Transmission of Sensitive Information"
],
"message": "This link points to a plaintext HTTP URL. Prefer an encrypted HTTPS URL if possible.",
"name": "html.security.plaintext-http-link.plaintext-http-link",
"owasp_names": [
"A03:2017 - Sensitive Data Exposure",
"A02:2021 - Cryptographic Failures"
],
"subcategories": [
"vuln"
],
"vulnerability_classes": [
"Mishandled Sensitive Information"
]
},
"rule_message": null,
"rule_name": "typescript.react.security.audit.react-no-refs.react-no-refs",
"severity": "medium",
"sourcing_policy": {
"id": 120,
"name": "Default Policy",
"slug": "default-policy"
},
"state": "unresolved",
"state_updated_at": "2020-11-19T23:28:12.391Z",
"status": "open",
"syntactic_id": "440eeface888e78afceac3dc7d4cc2cf",
"triage_comment": "This finding is from the test repo",
"triage_reason": "acceptable_risk",
"triage_state": "untriaged",
"triaged_at": "2020-11-19T23:28:12.391Z"
}
]
}List code, supply chain, or AI-powered detection findings
Request the list of code, supply chain, or AI-powered detection findings in an organization, paginated in pages of 100 entries and limited by the since timestamp. Findings are returned by relevant_since descending (see since in the Query Parameters list). Examples: List SAST findings with pagination, List SCA findings since timestamp, List AI-powered detection findings, List findings with filters.
curl --request GET \
--url https://semgrep.dev/api/v1/deployments/{deploymentSlug}/findings \
--header 'Authorization: Bearer <token>'import requests
url = "https://semgrep.dev/api/v1/deployments/{deploymentSlug}/findings"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://semgrep.dev/api/v1/deployments/{deploymentSlug}/findings', 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/{deploymentSlug}/findings",
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://semgrep.dev/api/v1/deployments/{deploymentSlug}/findings"
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://semgrep.dev/api/v1/deployments/{deploymentSlug}/findings")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://semgrep.dev/api/v1/deployments/{deploymentSlug}/findings")
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{
"findings": [
{
"assistant": {
"autofix": {
"explanation": null,
"fix_code": "cookie.setHttpOnly(true);\\nresponse.addCookie(cookie);"
},
"autotriage": {
"reason": "The matched code is used for a non-security related feature.",
"verdict": "false_positive"
},
"component": {
"risk": "high",
"tag": "user data"
},
"guidance": {
"instructions": null,
"summary": "Use a template rendering engine such as EJS instead of string concatenation."
},
"rule_explanation": {
"explanation": "This code is vulnerable to SQL injection because user input from the `username` parameter is directly concatenated into the SQL query string without sanitization or parameterization.",
"summary": "User input directly concatenated into SQL query"
}
},
"categories": [
"security"
],
"click_to_fix_failures": [
{
"created_at": "2024-01-15T10:30:00.000Z",
"reason": "merge conflict in target branch"
}
],
"click_to_fix_prs": [
{
"created_at": "2024-01-15T10:30:00.000Z",
"url": "https://github.com/myorg/myrepo/pull/123"
}
],
"confidence": "medium",
"created_at": "2020-11-18T23:28:12.391Z",
"external_ticket": {
"external_slug": "OPS-158",
"id": 123,
"linked_issue_ids": [
123
],
"url": "<string>"
},
"first_seen_scan_id": 1234,
"id": 1234567,
"line_of_code_url": "https://github.com/semgrep/semgrep/blob/39f95450a7d4d70e54c9edbd109bed8210a36889/src/core_cli/Core_CLI.ml#L1",
"location": {
"column": 8,
"end_column": 16,
"end_line": 124,
"file_path": "frontend/src/corpComponents/Code.tsx",
"line": 120
},
"match_based_id": "0f8c79a6f7e0ff2f908ff5bc366ae1548465069bae8892088051e1c3b4b12c6b8df37d5bcbb181eb868aa79f81f239d14bf2336d552786ab8ccdc7279adf07a6_1",
"ref": "refs/pull/1234/merge",
"relevant_since": "2020-11-18T23:28:12.391Z",
"repository": {
"name": "semgrep",
"url": "https://github.com/semgrep/semgrep"
},
"review_comments": [
{
"external_discussion_id": "af04762b69acfb74c8f9",
"external_note_id": 123523
}
],
"rule": {
"category": "security",
"confidence": "high",
"cwe_names": [
"CWE-319: Cleartext Transmission of Sensitive Information"
],
"message": "This link points to a plaintext HTTP URL. Prefer an encrypted HTTPS URL if possible.",
"name": "html.security.plaintext-http-link.plaintext-http-link",
"owasp_names": [
"A03:2017 - Sensitive Data Exposure",
"A02:2021 - Cryptographic Failures"
],
"subcategories": [
"vuln"
],
"vulnerability_classes": [
"Mishandled Sensitive Information"
]
},
"rule_message": null,
"rule_name": "typescript.react.security.audit.react-no-refs.react-no-refs",
"severity": "medium",
"sourcing_policy": {
"id": 120,
"name": "Default Policy",
"slug": "default-policy"
},
"state": "unresolved",
"state_updated_at": "2020-11-19T23:28:12.391Z",
"status": "open",
"syntactic_id": "440eeface888e78afceac3dc7d4cc2cf",
"triage_comment": "This finding is from the test repo",
"triage_reason": "acceptable_risk",
"triage_state": "untriaged",
"triaged_at": "2020-11-19T23:28:12.391Z"
}
]
}Authorizations
Path Parameters
Query Parameters
What timestamp should the results start at? If not specified, returns results from all timestamps. Provide epoch timestamp in seconds. Filters using the relevant_since field: the timestamp when this finding was detected by Semgrep (the first time, or when reintroduced).
1636942398.45
Deduplicates findings across all your refs/branches if true. If not specified, returns all findings across all refs/branches without deduplicating them. Set this to true if you are not filtering for a particular set of refs/branches in order to match the counts listed in the Semgrep UI.
true
Which status do you want to include? If not specified, includes all statuses. Findings in the removed state are always excluded from this endpoint. Valid values: open, fixed, ignored, reviewing, fixing, provisionally_ignored
open, fixed, ignored, reviewing, fixing, provisionally_ignored "open"
Which triage reasons do you want to include? If not specified, includes all. This filter is applicable when status is ignored. Valid values: acceptable_risk, false_positive, no_time, no_triage_reason, duplicate
acceptable_risk, false_positive, no_time, no_triage_reason, duplicate ["acceptable_risk", "false_positive"]
Which policy modes do you want to include? If not specified, includes all. Monitor: rule-board-audit, Comment: rule-board-pr-comments, Block: rule-board-block. This filter is applicable when issue_type is sast or unspecified.
[
"rule-board-block",
"rule-board-pr-comments",
"rule-board-audit"
]
List of exposures or reachability types to filter by. If not specified, returns findings across all exposures. This filter is applicable when issue_type=sca is specified. Valid values: reachable, always_reachable, conditionally_reachable, unpinned_dependency, unreachable, unknown
reachable, always_reachable, conditionally_reachable, unpinned_dependency, unreachable, unknown ["reachable", "always_reachable"]
Filter SCA findings by whether they are from malicious dependencies. If not specified, returns all SCA findings. This filter is only applicable when issue_type=sca is specified.
- true: Returns only findings from malicious dependencies
- false: Returns only findings from all other reachabilities (reachable in code, always reachable, conditionally reachable, etc.)
true
Was this page helpful?