# Security › Anti-DDoS › Observability API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Security product's sections: https://developers.eu.ovhcloud.com/reference/security/llms.txt
> Everything in one file: https://developers.eu.ovhcloud.com/llms-full.txt

> 2 operations of the OVHcloud API. Calls carry `authorization: Bearer $OVH_TOKEN`; the EU host is shown, Canada and the United States answer on api.ca.ovhcloud.com and api.us.ovhcloud.com.

Page: https://developers.eu.ovhcloud.com/reference/security/anti-ddos/observability/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/security/anti-ddos/observability.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/security/anti-ddos/observability.json?format=openapi3

## Operations

- `GET /networkDefense/vac/event` — List VAC detection events
- `GET /networkDefense/vac/traffic` — Get VAC traffic statistics

## List VAC detection events

`GET /v2/networkDefense/vac/event`

Link: https://developers.eu.ovhcloud.com/reference/security/anti-ddos/observability/#get-networkdefense-vac-event

**Status:** Stable production version  
**IAM actions:** `ip:apiovh:networkDefense/vac/event/get`

Returns the detection events of the VAC DDoS protection, with their start and end dates and attack vectors when available. Filter by date range, region or subnet. Ongoing events, not finished, can be requested on their own.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `after` | query | string (date-time) |  | Query events which started after the given date |
| `before` | query | string (date-time) |  | Query events which ended before the given date |
| `ongoingOnly` | query | boolean |  | Query for ongoing events only. If this is set, `after` and `before` parameters are ignored. |
| `region` | query | networkDefense.RegionEnum |  | Query events for the given region — one of `CA`, `EU`, `US` |
| `subnets` | query | ipBlock[] |  | Query events for the given subnets |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | networkDefense.Vac.EventsResponse | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `events` | networkDefense.Vac.Event[] | read-only | List of events |
| `events[].endedAt` | string (date-time) | read-only | End date of the event. Null when the event is ongoing. |
| `events[].startedAt` | string (date-time) | read-only | Start date of the event |
| `events[].subnet` | ipBlock | read-only | IP subnet affected by the event |
| `events[].vectors` | networkDefense.VectorsEnum[] | read-only | Attack vector |

```json
{
  "events": [
    {
      "endedAt": "2024-01-01T12:00:00Z",
      "startedAt": "2024-01-01T12:00:00Z",
      "subnet": "192.0.2.0/24",
      "vectors": [
        "CHARGEN"
      ]
    }
  ]
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/networkDefense/vac/event" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/networkDefense/vac/event")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/networkDefense/vac/event");

print_r($result);
?>
```

## Get VAC traffic statistics

`GET /v2/networkDefense/vac/traffic`

Link: https://developers.eu.ovhcloud.com/reference/security/anti-ddos/observability/#get-networkdefense-vac-traffic

**Status:** Stable production version  
**IAM actions:** `ip:apiovh:networkDefense/vac/traffic/get`

Returns the traffic dropped and passed by the VAC DDoS protection after a detection event. Request by subnet, IPv4 /32 or IPv6 /64 CIDR, in bits and packets per second, over a date range.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `after` | query | string (date-time) | yes | Query statistics after the given date |
| `before` | query | string (date-time) |  | Query statistics before the given date |
| `subnet` | query | ipBlock | yes | Query statistics for the given subnet (currently, only IPv4/32 or IPv6/64 are supported) |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | networkDefense.Vac.TrafficResponse | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `bps` | networkDefense.Vac.TrafficResponseData | read-only | Bits per seconds statistics |
| `bps.dropped` | string[] | read-only | Volume of traffic dropped by the VAC (DDoS protection) |
| `bps.passed` | string[] | read-only | Volume of traffic which was not dropped by the VAC (DDoS protection) |
| `pps` | networkDefense.Vac.TrafficResponseData | read-only | Packets per seconds statistics |
| `pps.dropped` | string[] | read-only | Volume of traffic dropped by the VAC (DDoS protection) |
| `pps.passed` | string[] | read-only | Volume of traffic which was not dropped by the VAC (DDoS protection) |
| `timestamps` | string (date-time)[] | read-only | Timestamps of the statistics points |

```json
{
  "bps": {
    "dropped": [
      "string"
    ],
    "passed": [
      "string"
    ]
  },
  "pps": {
    "dropped": [
      "string"
    ],
    "passed": [
      "string"
    ]
  },
  "timestamps": [
    "2024-01-01T12:00:00Z"
  ]
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/networkDefense/vac/traffic" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/networkDefense/vac/traffic")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/networkDefense/vac/traffic");

print_r($result);
?>
```
