# Public Cloud › Project Management › Alerting API

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

> 7 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/public-cloud/project-management/alerting/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/public-cloud/project-management/alerting.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/public-cloud/project-management/alerting.json?format=openapi3

## Operations

- `GET /cloud/project/{serviceName}/alerting` — List billing alerts
- `GET /cloud/project/{serviceName}/alerting/{id}` — Get a billing alert
- `POST /cloud/project/{serviceName}/alerting` — Create a billing alert
- `DELETE /cloud/project/{serviceName}/alerting/{id}` — Delete a billing alert
- `PUT /cloud/project/{serviceName}/alerting/{id}` — Update a billing alert
- `GET /cloud/project/{serviceName}/alerting/{id}/alert` — List sent alerts
- `GET /cloud/project/{serviceName}/alerting/{id}/alert/{alertId}` — Get a sent alert

## List billing alerts

`GET /1.0/cloud/project/{serviceName}/alerting`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/project-management/alerting/#getAlertingConfigurations

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:alerting/get`

Returns the IDs of the billing alerts configured on the project.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | string (uuid)[] | successful operation |

```json
[
  "00000000-0000-0000-0000-000000000000"
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/cloud/project/{serviceName}/alerting" \
  -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("/cloud/project/{serviceName}/alerting")

# 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("/cloud/project/{serviceName}/alerting");

print_r($result);
?>
```

## Get a billing alert

`GET /1.0/cloud/project/{serviceName}/alerting/{id}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/project-management/alerting/#getAlertingConfiguration

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:alerting/get`

Returns the configuration of the billing alert: threshold, service, receivers and status.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes | Id |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | cloud.alerting.Alerting | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `creationDate` | string (date-time) | read-only | Creation date |
| `delay` | integer | yes | Delay of the alert in seconds |
| `email` | string |  | Email. DEPRECATED: use emails |
| `emails` | string[] |  | Receiver of the alert |
| `formattedMonthlyThreshold` | order.Price | read-only | formatted monthly threshold |
| `formattedMonthlyThreshold.currencyCode` | order.CurrencyCodeEnum | read-only | Currency code — one of `AUD`, `CAD`, `CZK`, `EUR`, `GBP`, `INR`, `LTL`, `MAD`, `N/A`, `PLN`, `SGD`, `TND`, … |
| `formattedMonthlyThreshold.priceInUcents` | integer | read-only | Price in microcents |
| `formattedMonthlyThreshold.text` | string | read-only | Textual representation |
| `formattedMonthlyThreshold.value` | number | read-only | The effective price |
| `id` | string (uuid) | read-only | ID of the alert |
| `monthlyThreshold` | integer | yes | Monthly threshold |
| `name` | string |  | Name of the alert |
| `service` | cloud.alerting.ServiceEnum |  | Service of the alert — one of `ai_endpoint`, `all`, `block_storage`, `data_platform`, `instances`, `instances_gpu`, `instances_without_gpu`, `objet_storage`, `rancher`, `snapshot` |
| `status` | cloud.alerting.StatusEnum | read-only | Status of the alert — one of `deleted`, `disabled`, `ok` |

```json
{
  "creationDate": "2024-01-01T12:00:00Z",
  "delay": 0,
  "email": "string",
  "emails": [
    "string"
  ],
  "formattedMonthlyThreshold": {
    "currencyCode": "AUD",
    "priceInUcents": 0,
    "text": "string",
    "value": 0
  },
  "id": "00000000-0000-0000-0000-000000000000",
  "monthlyThreshold": 0,
  "name": "string",
  "service": "ai_endpoint",
  "status": "deleted"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/cloud/project/{serviceName}/alerting/{id}" \
  -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("/cloud/project/{serviceName}/alerting/{id}")

# 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("/cloud/project/{serviceName}/alerting/{id}");

print_r($result);
?>
```

## Create a billing alert

`POST /1.0/cloud/project/{serviceName}/alerting`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/project-management/alerting/#addAlerting

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:alerting/create`

Creates a billing alert with a monthly threshold, for one service or for all services. Sends an email to the receivers when the monthly spend on the service exceeds the threshold. Use `emails`, as `email` is deprecated.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | Service name |

### Request body (required)

Type: `cloud.alerting.Alerting`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `creationDate` | string (date-time) | read-only | Creation date |
| `delay` | integer | yes | Delay of the alert in seconds |
| `email` | string |  | Email. DEPRECATED: use emails |
| `emails` | string[] |  | Receiver of the alert |
| `formattedMonthlyThreshold` | order.Price | read-only | formatted monthly threshold |
| `formattedMonthlyThreshold.currencyCode` | order.CurrencyCodeEnum | read-only | Currency code — one of `AUD`, `CAD`, `CZK`, `EUR`, `GBP`, `INR`, `LTL`, `MAD`, `N/A`, `PLN`, `SGD`, `TND`, … |
| `formattedMonthlyThreshold.priceInUcents` | integer | read-only | Price in microcents |
| `formattedMonthlyThreshold.text` | string | read-only | Textual representation |
| `formattedMonthlyThreshold.value` | number | read-only | The effective price |
| `id` | string (uuid) | read-only | ID of the alert |
| `monthlyThreshold` | integer | yes | Monthly threshold |
| `name` | string |  | Name of the alert |
| `service` | cloud.alerting.ServiceEnum |  | Service of the alert — one of `ai_endpoint`, `all`, `block_storage`, `data_platform`, `instances`, `instances_gpu`, `instances_without_gpu`, `objet_storage`, `rancher`, `snapshot` |
| `status` | cloud.alerting.StatusEnum | read-only | Status of the alert — one of `deleted`, `disabled`, `ok` |

```json
{
  "delay": 0,
  "email": "string",
  "emails": [
    "string"
  ],
  "monthlyThreshold": 0,
  "name": "string",
  "service": "ai_endpoint"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | cloud.alerting.Alerting | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `creationDate` | string (date-time) | read-only | Creation date |
| `delay` | integer | yes | Delay of the alert in seconds |
| `email` | string |  | Email. DEPRECATED: use emails |
| `emails` | string[] |  | Receiver of the alert |
| `formattedMonthlyThreshold` | order.Price | read-only | formatted monthly threshold |
| `formattedMonthlyThreshold.currencyCode` | order.CurrencyCodeEnum | read-only | Currency code — one of `AUD`, `CAD`, `CZK`, `EUR`, `GBP`, `INR`, `LTL`, `MAD`, `N/A`, `PLN`, `SGD`, `TND`, … |
| `formattedMonthlyThreshold.priceInUcents` | integer | read-only | Price in microcents |
| `formattedMonthlyThreshold.text` | string | read-only | Textual representation |
| `formattedMonthlyThreshold.value` | number | read-only | The effective price |
| `id` | string (uuid) | read-only | ID of the alert |
| `monthlyThreshold` | integer | yes | Monthly threshold |
| `name` | string |  | Name of the alert |
| `service` | cloud.alerting.ServiceEnum |  | Service of the alert — one of `ai_endpoint`, `all`, `block_storage`, `data_platform`, `instances`, `instances_gpu`, `instances_without_gpu`, `objet_storage`, `rancher`, `snapshot` |
| `status` | cloud.alerting.StatusEnum | read-only | Status of the alert — one of `deleted`, `disabled`, `ok` |

```json
{
  "creationDate": "2024-01-01T12:00:00Z",
  "delay": 0,
  "email": "string",
  "emails": [
    "string"
  ],
  "formattedMonthlyThreshold": {
    "currencyCode": "AUD",
    "priceInUcents": 0,
    "text": "string",
    "value": 0
  },
  "id": "00000000-0000-0000-0000-000000000000",
  "monthlyThreshold": 0,
  "name": "string",
  "service": "ai_endpoint",
  "status": "deleted"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/cloud/project/{serviceName}/alerting" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```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
)

# Request body type: cloud.alerting.Alerting
result = client.post("/cloud/project/{serviceName}/alerting",
	delay = None, # Delay of the alert in seconds (type: integer)
	email = None, # Email. DEPRECATED: use emails (type: string)
	emails = None, # Receiver of the alert (type: array)
	monthlyThreshold = None, # Monthly threshold (type: integer)
	name = None, # Name of the alert (type: string)
	service = None, # Service of the alert (type: cloud.alerting.ServiceEnum)
)

# 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

// Request body type: cloud.alerting.Alerting
$result = $ovh->post("/cloud/project/{serviceName}/alerting", array(
	delay => null, // Delay of the alert in seconds (type: integer)
	email => null, // Email. DEPRECATED: use emails (type: string)
	emails => null, // Receiver of the alert (type: array)
	monthlyThreshold => null, // Monthly threshold (type: integer)
	name => null, // Name of the alert (type: string)
	service => null, // Service of the alert (type: cloud.alerting.ServiceEnum)
));

print_r($result);
?>
```

## Delete a billing alert

`DELETE /1.0/cloud/project/{serviceName}/alerting/{id}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/project-management/alerting/#deleteAlerting

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:alerting/delete`

Deletes the billing alert configuration.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes | Id |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | — | successful operation |

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/1.0/cloud/project/{serviceName}/alerting/{id}" \
  -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.delete("/cloud/project/{serviceName}/alerting/{id}")

# 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->delete("/cloud/project/{serviceName}/alerting/{id}");

print_r($result);
?>
```

## Update a billing alert

`PUT /1.0/cloud/project/{serviceName}/alerting/{id}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/project-management/alerting/#updateAlerting

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:alerting/edit`

Updates the threshold, service, receivers, delay or status of the billing alert. Use `emails`, as `email` is deprecated.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes | Id |
| `serviceName` | path | string | yes | Service name |

### Request body (required)

Type: `cloud.alerting.AlertingUpdate`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `delay` | integer |  | Delay of the alert in seconds |
| `email` | string |  | Email. DEPRECATED: use emails |
| `emails` | string[] |  | Receiver of the alert |
| `monthlyThreshold` | integer |  | Monthly threshold |
| `name` | string |  | Name of the alert |
| `service` | cloud.alerting.ServiceEnum |  | Service of the alert — one of `ai_endpoint`, `all`, `block_storage`, `data_platform`, `instances`, `instances_gpu`, `instances_without_gpu`, `objet_storage`, `rancher`, `snapshot` |
| `status` | cloud.alerting.StatusEnum |  | Status of the alert — one of `deleted`, `disabled`, `ok` |

```json
{
  "delay": 0,
  "email": "string",
  "emails": [
    "string"
  ],
  "monthlyThreshold": 0,
  "name": "string",
  "service": "ai_endpoint",
  "status": "deleted"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | — | successful operation |

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/1.0/cloud/project/{serviceName}/alerting/{id}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```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
)

# Request body type: cloud.alerting.AlertingUpdate
result = client.put("/cloud/project/{serviceName}/alerting/{id}",
	delay = None, # Delay of the alert in seconds (type: integer)
	email = None, # Email. DEPRECATED: use emails (type: string)
	emails = None, # Receiver of the alert (type: array)
	monthlyThreshold = None, # Monthly threshold (type: integer)
	name = None, # Name of the alert (type: string)
	service = None, # Service of the alert (type: cloud.alerting.ServiceEnum)
	status = None, # Status of the alert (type: cloud.alerting.StatusEnum)
)

# 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

// Request body type: cloud.alerting.AlertingUpdate
$result = $ovh->put("/cloud/project/{serviceName}/alerting/{id}", array(
	delay => null, // Delay of the alert in seconds (type: integer)
	email => null, // Email. DEPRECATED: use emails (type: string)
	emails => null, // Receiver of the alert (type: array)
	monthlyThreshold => null, // Monthly threshold (type: integer)
	name => null, // Name of the alert (type: string)
	service => null, // Service of the alert (type: cloud.alerting.ServiceEnum)
	status => null, // Status of the alert (type: cloud.alerting.StatusEnum)
));

print_r($result);
?>
```

## List sent alerts

`GET /1.0/cloud/project/{serviceName}/alerting/{id}/alert`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/project-management/alerting/#getAlerts

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:alerting/alert/get`

Returns the IDs of the alerts already sent for this billing alert.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes | Id |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | integer[] | successful operation |

```json
[
  0
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/cloud/project/{serviceName}/alerting/{id}/alert" \
  -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("/cloud/project/{serviceName}/alerting/{id}/alert")

# 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("/cloud/project/{serviceName}/alerting/{id}/alert");

print_r($result);
?>
```

## Get a sent alert

`GET /1.0/cloud/project/{serviceName}/alerting/{id}/alert/{alertId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/project-management/alerting/#getAlert

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:alerting/alert/get`

Returns when the alert was sent and to which email addresses.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `alertId` | path | integer | yes | Alert ID |
| `id` | path | string (uuid) | yes | Id |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | cloud.alerting.Alert | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `alertDate` | string (date-time) | read-only | Send date |
| `alertId` | integer | read-only | Alert ID |
| `emails` | string[] | read-only | Receivers of the alert |

```json
{
  "alertDate": "2024-01-01T12:00:00Z",
  "alertId": 0,
  "emails": [
    "string"
  ]
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/cloud/project/{serviceName}/alerting/{id}/alert/{alertId}" \
  -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("/cloud/project/{serviceName}/alerting/{id}/alert/{alertId}")

# 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("/cloud/project/{serviceName}/alerting/{id}/alert/{alertId}");

print_r($result);
?>
```
