Scan a cloud environment
Using jq
jqSNYK_ORG_ID="YOUR-ORGANIZATION-ID" && \
SNYK_API_TOKEN="YOUR-API-TOKEN" && \
SNYK_ENV_ID=$(curl -s -X GET \
"https://api.snyk.io/rest/orgs/${SNYK_ORG_ID}/cloud/environments?version=2022-12-21~beta&kind=aws,azure,google" \
-H "Authorization: token ${SNYK_API_TOKEN}" | jq -r '.data[0].id') && \
curl -X POST \
"https://api.snyk.io/rest/orgs/${SNYK_ORG_ID}/cloud/scans?version=2022-12-21~beta" \
-H "Authorization: token ${SNYK_API_TOKEN}" \
-H "Content-Type:application/vnd.api+json" -d "{
\"data\": {
\"relationships\": {
\"environment\": {
\"data\": {
\"id\": \"${SNYK_ENV_ID}\",
\"type\": \"environment\"
}
}
},
\"type\": \"resource\"
}
}"Without jq
jqFind the environment ID
Trigger the scan
Understand the API response
Check scan status
View all scans for an Organization
Last updated
Was this helpful?

