Get All Policies in Your Account

Provides a list of all policies in your account.

GET/csapi/v1.3/runtime/policies

Input ParametersInput Parameters

Parameter Mandatory/Optional Data Type Description
pageNumber Optional integer

The page to be returned. The default value is 1.

pageSize

Optional integer

The number of records per page to be included in the response. When not specified, you’ll get 50 records.

filter

Optional string

Specify a string value for a search query to filter the list of policies returned in the output. Only name is supported in filter query. For example, enter filter=name:Default to return policies with “Default” in the name. The search is case sensitive. Double quotes can be used when your search value contains more than one word, such as filter=name:"Test Policy".

Sample - Get all policiesSample - Get all policies

API request

    curl --location --request GET "<qualys_base_url>/csapi/v1.3/runtime/policies"
--header "Authorization: Bearer <token>"
    

Response

    [
    {
        "id": "5e171bef8530d7000151408e",
        "name": "Default Policy",
        "created": "2020-01-09T12:26:23.496Z",
        "updated": "2020-01-09T12:26:23.496Z",
        "description": "Default group policy",
        "policyMode": "ACTIVE"
    },
    {
        "id": "5e171c738530d70001514091",
        "name": "Prevent tampering to hosts file",
        "created": "2020-01-09T12:28:35.761Z",
        "updated": "2020-01-09T12:28:35.761Z",
        "description": "Modifications to 'hosts' and 'resolve.conf' file can result in resolution of Domain name to malicious IP. This policy checks for the 'Write' event on either of the specified files",
        "policyMode": "ACTIVE"
    },
    {
        "id": "5e81cf5df12860000129938c",
        "name": "Deny access in etc v11 Updating With PUT",
        "created": "2020-05-29T04:54:16.432Z",
        "updated": "2020-05-29T04:54:16.432Z",
        "description": "Deny access in /etc dir for important files",
        "policyMode": "INACTIVE"
    },
...
]
    

Sample - Filter policies listSample - Filter policies list

In this sample, we’re filtering the list of policies to only show policies with “Deny” in the policy name.

API request

    curl --location --request GET
"<qualys_base_url>/csapi/v1.3/runtime/policies?filter=name:Deny"
--header "Authorization: Bearer <token>"
    

Response

    [
    {
        "id": "5e171bef8530d7000151408e",
        "name": "Deny Write Static Website Files",
        "created": "2020-01-09T12:26:23.496Z",
        "updated": "2020-01-09T12:26:23.496Z",
        "description": "This sample policy prevents static website files from being altered",
        "policyMode": "ACTIVE"
    },
    {
        "id": "5e171c738530d70001514091",
        "name": "Deny cat command access to /etc/passwd file",
        "created": "2020-01-09T12:28:35.761Z",
        "updated": "2020-01-09T12:28:35.761Z",
        "description": "This sample policy denies access to /etc/passwd file from program cat",
        "policyMode": "ACTIVE"
    },
...
]    
    

 

 

Was this topic helpful?

success Thank you! We're glad to hear that this topic was useful.
success We appreciate your feedback. We'll work to make this topic better for you in the future.