---
title: Using the Opscompass Resource Scanning API
description: Within the Opscompass CLI Client, users are now able to trigger scans of individual resources or whole cloud accounts.
---

[Skip to content](https://kb.opscompass.com/knowledge/using-the-resource-scanning-api#main-content)

[![Opscompass](https://kb.opscompass.com/hubfs/opscompass-logo-2024-web-small.svg)](https://opscompass.com)

- [Home](https://opscompass.com/)
- [Why Opscompass](https://opscompass.com/why-opscompass/)
- Product
  
  Show submenu for Product

    - [Inventory](https://opscompass.com/inventory/)
    - [Configuration Drift](https://opscompass.com/product/configuration-drift/)
    - [Compliance](https://opscompass.com/product/compliance/)
    - [Licenses](https://opscompass.com/solutions/licenses/)
- Solutions
  
  Show submenu for Solutions

    - [Hybrid and Multi-Cloud Visibility](https://opscompass.com/solutions/multi-cloud-visibility/)
- [About Us](https://opscompass.com/company/)

Open main navigation

Close main navigation

- [Home](https://opscompass.com/)
- [Why Opscompass](https://opscompass.com/why-opscompass/)
- Product
  
  Show submenu for Product

    - [Inventory](https://opscompass.com/inventory/)
    - [Configuration Drift](https://opscompass.com/product/configuration-drift/)
    - [Compliance](https://opscompass.com/product/compliance/)
    - [Licenses](https://opscompass.com/solutions/licenses/)
- Solutions
  
  Show submenu for Solutions

    - [Hybrid and Multi-Cloud Visibility](https://opscompass.com/solutions/multi-cloud-visibility/)
- [About Us](https://opscompass.com/company/)
- [Get a Demo](https://opscompass.com/demo/)

[Get a Demo](https://opscompass.com/demo/)

 What are you looking for?

- There are no suggestions because the search field is empty.

1. [Help Center](https://kb.opscompass.com/knowledge)
2. [Opscompass Integrations](https://kb.opscompass.com/knowledge/opscompass-integrations)

# Using the Opscompass Resource Scanning API

## Within the Opscompass CLI Client, users are now able to trigger scans of individual resources or whole cloud accounts.

### Getting Started

This article assumes that you have already downloaded and configured the Opscompass CLI against your Opscompass environment. For more information regarding installation and setup you can reference the article Getting Started with [Opscompass Command Line Interface](https://kb.opscompass.com/knowledge/opscompass-command-line-interface). If you have previously set up the CLI, ensure that you are running the latest version, to do this simply run the command 'Opscompass' and if you are out of date, the CLI will prompt you with the appropriate command to run to update. 

Example Update Message:

![](https://kb.opscompass.com/hubfs/50AE4ED9-BC24-413D-A973-B2A691D61AFB-png.jpeg)

### Resource Scan Overview

Within Opscompass there is a concept of a resource scan. During a resource scan, Opscompass fetches the latest cloud provider resource configurations analyzes of the data retrieved. Examples of some analyses taken during a scan are: 

- Comparison of resource configuration against compliance checks, possibly resulting in newly discovered or fixed compliance problems.
- Comparison of previously retrieved resource configuration, possibly resulting in drift.
- For applicable resources, retrieve cloud provider metrics for resources.

A scan in Opscompass occurs is triggered usually: 

1. Periodically, every 8 hours (depending on the type of cloud account).
2. Initially when a cloud account is connected.

 The resource scan CLI call is a third option for when a cloud account or resource can be scanned in Opscompass. The CLI command accepts the following parameters 

| --company | This parameter is required. Expects the input to be a company slug of the company in which the cloud account lives within. |
| --- | --- |
| --account | This parameter is required. This is the cloud identifier of the account you wish to scan. Only specifying the account with no other optional parameters will scan the entirety of the cloud account. |
| -- ids | This parameter is optional. Expects the input to be a list of numerical Opscompass assigned identifiers. |
| -- resourceIds | This parameter is optional. Expects the input to be a list of cloud identifiers for the resources you wish to scan. |
| --resourceTags | This parameter is optional. Expects the tag values of the resources within the account to scan. |

 

Help message as seen within the CLI: 

![](https://kb.opscompass.com/hs-fs/hubfs/C447948F-CB11-4CB2-9CE9-1E250A69FFD7-png.jpeg?width=688&height=80&name=C447948F-CB11-4CB2-9CE9-1E250A69FFD7-png.jpeg)

#### Scanning a Whole Cloud Account

As mentioned previously, you can initiate a whole account scan by only specifying the required parameters company & account. Below is an example:

```
Opscompass resources scan --company my-Company --account 123456789876
```

#### Scanning Resources by Tags

One optional parameter 'resourceTags' allows for scanning resources within an account context, but only ones having the resource tag that is passed. Below is an example: 

```
Opscompass resources scan --company my-Company --account 123456789876 --resourceTags deployment-06-01-2023 
```

#### Scanning Resources by ID

The optional parameters 'ids' and 'resourceIds' allow for scanning individual resources within an account context. Below is an example of specifically scanning 3 resources by their Opscompass numerical id. 

```
Opscompass resources scan --company my-Company --account 123465789876 --ids 10123,20312,876231
```

### How long does a scan take?

Currently there is no method for tracking an Opscompass scan after initiated. Depending on request frequency and timing of the request the scan could take around 15 to 20 minutes to completion. 

 

- [About Opscompass](https://kb.opscompass.com/knowledge/about-opscompass#main-content)

    - [Company Information](https://kb.opscompass.com/knowledge/about-opscompass#company-information)
- [Getting Started](https://kb.opscompass.com/knowledge/getting-started#main-content)

    - [Logging In](https://kb.opscompass.com/knowledge/getting-started#logging-in)
    - [Connecting Cloud Accounts](https://kb.opscompass.com/knowledge/getting-started#connecting-cloud-accounts)
    - [Users and Teams](https://kb.opscompass.com/knowledge/getting-started#users-and-teams)
- [Opscompass CLI](https://kb.opscompass.com/knowledge/opscompass-cli#main-content)

    - [Getting Started](https://kb.opscompass.com/knowledge/opscompass-cli#getting-started)
    - [Resources](https://kb.opscompass.com/knowledge/opscompass-cli#resources)
    - [Accounts](https://kb.opscompass.com/knowledge/opscompass-cli#accounts)
    - [Compliance](https://kb.opscompass.com/knowledge/opscompass-cli#compliance)
    - [Licensing](https://kb.opscompass.com/knowledge/opscompass-cli#licensing)
    - [Examples](https://kb.opscompass.com/knowledge/opscompass-cli#examples)
    - [AI Skills](https://kb.opscompass.com/knowledge/opscompass-cli#ai-skills)
- [Opscompass FAQs](https://kb.opscompass.com/knowledge/opscompass-faqs#main-content)

    - [General](https://kb.opscompass.com/knowledge/opscompass-faqs#general)
- [New Features](https://kb.opscompass.com/knowledge/new-features)
- [Account Management](https://kb.opscompass.com/knowledge/account-management)
- [Compliance](https://kb.opscompass.com/knowledge/compliance)
- [Documents](https://kb.opscompass.com/knowledge/documents)
- [Drift](https://kb.opscompass.com/knowledge/drift)
- [Inventory](https://kb.opscompass.com/knowledge/inventory)
- [Licenses](https://kb.opscompass.com/knowledge/licenses#main-content)

    - [Oracle](https://kb.opscompass.com/knowledge/licenses#oracle)
    - [SQL Server](https://kb.opscompass.com/knowledge/licenses#sql-server)
- [Navigation and Dashboard](https://kb.opscompass.com/knowledge/navigation-and-dashboard)
- [Opscompass Integrations](https://kb.opscompass.com/knowledge/opscompass-integrations)
- [Tutorials](https://kb.opscompass.com/knowledge/tutorials#main-content)

    - [CLI](https://kb.opscompass.com/knowledge/tutorials#cli)

[![Opscompass](https://kb.opscompass.com/hubfs/opscompass-logo-2024-web-small.svg "Opscompass")](http://opscompass.com)

<https://opscompass.com/contact/> <https://www.linkedin.com/company/opscompass/>

Copyright © 2025, Opscompass