Setup Service Accounts API

POST/flexscan-api/rest/v1/service-accounts/setup

This API configures scan settings for a registered service account. It updates the scan configuration (regions, scan interval, resource types, scan types, tag filters) and provisions per-region infrastructure by publishing SETUP_REGION events.

If you remove any region(s) as part of a setup modification, the subnet associated with the removed region’s infrastructure will not be deleted automatically. You will need to manually delete the subnet for the removed region a few hours after the region removal process completes.

Input parametersInput parameters

Parameter Mandatory/Optional Data Type Description
accountId Mandatory String Service account identifier (must be in REGISTERED state)
regions Mandatory Array of String Cloud regions to enable for scanning (e.g.,["us-east1", "eastus"])
scanInterval Optional Integer Scan interval in hours. Range: 24–720.
resourceTypes Optional Array of String Resource types to scan. Allowed value: vm.
vmScanTypes Optional Array of String VM scan types. Options: os, sca (case-insensitive).
mustHaveTags Optional Array of String Resources must have ALL of these tags (AND logic). Format: "key=value"
atLeastOneTag Optional Array of String Resources must have AT LEAST ONE of these tags (OR logic). Format: "key=value"
noneOfTheTag Optional Array of String Resources with ANY of these tags are excluded. Format: "key=value"

 All string list parameters are automatically converted to lowercase. For SCA scan types, the os parameter must also be included.
Currently, these input parameters are referred to as tags, but in GCP they are called labels.

Tag Behavior: If a tag parameter is set to an empty array ([]) or null, no filtering is applied for that parameter. When all three tag parameters are empty or null, all resources are scanned.

Tag Format Examples by Cloud:

  • AWS: "Environment=Production", "Owner:PlatformTeam" (both equals and colon separators are supported)
  • Azure: "environment=production", "owner=platform-team" (keys are case-sensitive)
  • GCP: "environment=production", "owner=platform-team" (only the equals separator is supported)

Sample - Setup a Service Account with Tag FiltersSample - Setup a Service Account with Tag Filters

API Request

curl -X POST \
  '<qualys_gateway_url>/flexscan-api/rest/v1/service-accounts/setup' \
  -H 'Authorization: Bearer <qas-jwt-token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "accountId": "my-gcp-project-XXX",
    "regions": ["us-east1", "us-west1"],
    "scanInterval": 24,
    "resourceTypes": ["vm"],
    "vmScanTypes": ["os"],
    "mustHaveTags": ["env=production"],
    "atLeastOneTag": ["team=platform", "team=infra"],
    "noneOfTheTag": ["ignore=true"]
  }'

API Response

{
  "data": {
    "status": "ACCEPTED",
    "accountId": "my-gcp-project-XXX",
    "cloudType": "GCP",
    "previousRegions": ["us-west1"],
    "currentRegions": ["us-east1", "us-west1"],
    "addedRegions": ["us-east1"],
    "removedRegions": [],
    "scanInterval": 24,
    "resourceTypes": ["vm"],
    "vmScanTypes": ["os"],
    "mustHaveTags": ["env=production"],
    "atLeastOneTag": ["team=platform", "team=infra"],
    "noneOfTheTag": ["ignore=true"]
  },
  "errors": [],
  "meta": {
    "timestamp": "2026-05-28T11:30:00Z"
  }
}