# Scan

## Get a list of scans.

<mark style="color:blue;">`GET`</mark> `https://api.halosecurity.com/api/v1/scan/list.json`

Returns a paginated list of scans.

<https://app.halosecurity.com/user/security/targets/scanning>

#### Query Parameters

<table><thead><tr><th width="149.796875">Name</th><th width="136.91796875">Type</th><th>Description</th></tr></thead><tbody><tr><td>sort</td><td>Integer</td><td><code>0</code> = scan id (default)</td></tr><tr><td>sort_desc</td><td>Integer</td><td><p><code>0</code> = No <em>(default)</em></p><p><code>1</code> = Yes</p></td></tr><tr><td>type</td><td>string</td><td><p><code>current</code> = (default)</p><p><code>recent</code> = recent scans per target</p><p><code>prior</code> = prior scans</p><p><code>all</code> = all scans</p></td></tr></tbody></table>

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "list": [
        {
            "scan": {
                "date": "0000-00-00 00:00",
                "scan_id": "id1"
            },
            "target": {
                "target_name": "",
                "target_id": 1,
                "target": "www.example.com"
            }
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Get the details of a scan.

<mark style="color:blue;">`GET`</mark> `https://api.halosecurity.com/api/v1/scan/get.json`

Returns the details of a scan.

<https://app.halosecurity.com/user/security/targets/scanning>

#### Query Parameters

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| scan\_id<mark style="color:red;">\*</mark> | String |             |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "scan": {
        "date": "0000-00-00 00:00",
        "duration": 1000,
        "issue_severity_count": {
            "0": 10,
            "1": 10,
            "2": 10,
            "3": 10,
            "4": 10,
            "5": 10
        },
        "issue_instance_severity_count": {
            "0": 100,
            "1": 100,
            "2": 100,
            "3": 100,
            "4": 100,
            "5": 100
        },
        "issue_count": 10,
        "scan_web": 1,
        "scan_fw": 1,
        "risk_score": 100,
        "scan_was": 0,
        "target_id": 1,
        "scan_id": "id1",
        "scan_vms": 1
    }
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "code": 0,
    "message": "scan_id required"
}
```

{% endtab %}
{% endtabs %}

## Launch a scan on a given target.

<mark style="color:blue;">`GET`</mark> `https://api.halosecurity.com/api/v1/scan/start.json`

Launch a scan on a given target. Requires the `security_scan_start` permission.

Learn about permissions: [permissions](https://docs.halosecurity.com/api/readme/permissions "mention")

<https://app.halosecurity.com/user/security/targets/scanning>

#### Query Parameters

| Name                                        | Type    | Description |
| ------------------------------------------- | ------- | ----------- |
| target\_d<mark style="color:red;">\*</mark> | Integer |             |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "code": 0,
    "message": "Scan Already In Progress (202203161545TIa95TjO45S3ilhFzAvH)"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "code": 0,
    "message": "Scan Already In Progress (202203161545TIa95TjO45S3ilhFzAvH)"
}
```

{% endtab %}

{% tab title="404: Not Found " %}

```javascript
{
    "code": 0,
    "message": "target not found"
}
```

{% endtab %}
{% endtabs %}

## Get a list of active scans.

<mark style="color:blue;">`GET`</mark> `https://api.halosecurity.com/api/v1/scan/inprogress-list.json`

Returns a paginated list of active scans.

<https://app.halosecurity.com/user/security/targets/scanning>

#### Query Parameters

| Name       | Type    | Description                                                              |
| ---------- | ------- | ------------------------------------------------------------------------ |
| sort       | Integer | <p><code>0</code></p><p>= created date (default)</p>                     |
| sort\_desc | Integer | <p><code>0</code> = No <em>(default)</em></p><p><code>1</code> = Yes</p> |
| target\_id | Integer | Filter by target id                                                      |
| scan\_id   | String  | Filter by scan id                                                        |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "list": [
        {
            "date": "0000-00-00 00:00",
            "duration": 1,
            "status_display": "Server - Running",
            "target_name": "www.example.com",
            "target_id": 1,
            "scan_id": "id1",
            "duration_display": "1h 0m",
            "status": 3
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Cancel a scan that is currently in progress.

<mark style="color:blue;">`GET`</mark> `https://api.halosecurity.com/api/v1/scan/inprogress-cancel.json`

Cancel a scan that is currently in progress. Requires the `security_scan_cancel` permission.

Learn about permissions: [permissions](https://docs.halosecurity.com/api/readme/permissions "mention")

<https://app.halosecurity.com/user/security/targets/scanning>

#### Query Parameters

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| scan\_id | String |             |

{% tabs %}
{% tab title="400: Bad Request " %}

```javascript
{
    "code": 0,
    "message": "scan_id required"
}
```

{% endtab %}

{% tab title="404: Not Found " %}

```javascript
{
    "code": 404,
    "message": "scan not found"
}
```

{% endtab %}
{% endtabs %}
