# Target

## Get a list of targets.

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

Returns a paginated list of targets.

[https://app.halosecurity.com/user/security/targets/list](https://app.halosecurity.com/user/security/targets/list?)

#### Query Parameters

| Name       | Type    | Description                                                              |
| ---------- | ------- | ------------------------------------------------------------------------ |
| sort       | Integer | `0` = Name *(default)*                                                   |
| sort\_desc | Integer | <p><code>0</code> = No <em>(default)</em></p><p><code>1</code> = Yes</p> |

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

```javascript
{
    "list": [
        {
            "target": {
                "target_name": "example",
                "target_id": 1,
                "target": "www.example.com"
            }
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Get the details of a target.

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

Returns the details of a target.

[https://app.halosecurity.com/user/security/targets/list](https://app.halosecurity.com/user/security/targets/list?)

#### Query Parameters

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

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

```javascript
{
    "target": {
        "recent_scan_ids": [
            "id1",
            "id2",
            "id3",
            "id4",
            "id5"
        ],
        "target_name": "example",
        "date_created": "0000-00-00 00:00",
        "ip": "0.0.0.0",
        "target_id": 1,
        "target": "www.example.com",
        "geo": "US-CA",
        "scan_id": "id0",
        "scan_frequency": 1,
        "scan_hour": 1,
        "next_scan_date": "0000-00-00 00:00",
        "scan_pci": 0,
        "scan_network": 0,
        "scan_website": 0
    }
}
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

## Update details of a target.

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

Update details of a target. Requires the `security_target_update` permission.

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

[https://app.halosecurity.com/user/security/targets/list](https://app.halosecurity.com/user/security/targets/list?)

#### Query Parameters

| Name                                         | Type     | Description                                |
| -------------------------------------------- | -------- | ------------------------------------------ |
| target\_id<mark style="color:red;">\*</mark> | Integer  |                                            |
| name                                         | String   |                                            |
| tag                                          | String   | Multiple. Sets only these tags.            |
| tag\_add                                     | String   | Multiple. Add tags to existing.            |
| tag\_remove                                  | String   | Multiple. Remove tags from existing.       |
| next\_scan\_date                             | DateTime | YYYY-MM-DD HH24:MI UTC                     |
| scan\_hour                                   | Integer  | Hour of day to scan (0-23). -1 for random. |

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

```javascript
{
    "success": 1
}
```

{% endtab %}

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

```javascript
{
    "code": 0,
    "message": "next_scan_date not valid"
}
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}
