Get Detection Count
We have introduced the detection count API to get the detection count for your subscription. You can apply filters to get the detection count on specific models and detection criteria, such as attack type, severity, category, and so on.
Use this API to count all the detections (or only the one matching the provided QQL).
All the newly introduced Activation Key APIs can be accessed only with the Qualys Gateway URLs. To learn more about using the API Gateway URL, refer API URLs section at Identify your Qualys Platform.
Input ParametersInput Parameters
You can use the following input parameters for detection count API.
| Parameter | Data Type | Optional/ Mandatory | Description |
|---|---|---|---|
| filter | String | Optional | Use this parameter to filter the detections based on the queries on models or detections. For the list of filters for models, refer to Search for Models. For the list of filters on detection, refer to Search for Detections. |
Sample with detection countSample with detection count
Request POST Data
curl -X 'POST' \ {
'<qualys_base_url>/tai/api/1.0/detection/count' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <JWT_token>' \
-H 'Content-Type: application/json' \
-d '{
"filter": {
"modelQql": "asset.name: Test Hugging Face",
"detectionQql": "detection.attack: Jailbreak-Abj"
}
}
API Response
{
"count": 155
}
Sample with blank requestSample with blank request
API Request
No Body
Request POST Data
{
"count": 1371
}
Sample with both QQL - combination 1Sample with both QQL - combination 1
API Request
curl -X 'POST' \
'<qualys_base_url>/tai/api/1.0/detection/count' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <JWT_token>' \
-H 'Content-Type: application/json' \
-d '{
"filter": {
"modelQql": "model.runtime:Azure OpenAI or model.runtime:Chat Completion",
"detectionQql": "detection.failTestPercentage>10"
}
}
Request POST Data
{
"count": 104
}
Sample with both QQL - combination 2Sample with both QQL - combination 2
API Request
curl -X 'POST' \
'<qualys_base_url>/tai/api/1.0/detection/count' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <JWT_token>' \
-H 'Content-Type: application/json' \
-d '{
"filter": {
"modelQql": "model.lastScanStatus:FINISHED and model.runtime:AWS Bedrock or model.runtime:Hugging Face",
"detectionQql": "detection.failTestPercentage>50 and detection.severity>=3"
}
}
Request POST Data
{
"count": 60
}
Sample with only detection QQLSample with only detection QQL
API Request
curl -X 'POST' \
'<qualys_base_url>/tai/api/1.0/detection/count' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <JWT_token>' \
-H 'Content-Type: application/json' \
-d '{
"filter": {
"detectionQql": "detection.failTestPercentage>10 and detection.severity>=2"
}
}
Request POST Data
{
"count": 670
}