# Web Cloud › Email and Collaborative Solutions › Microsoft Exchange › Email Pro › Diagnostics API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Web Cloud product's sections: https://developers.eu.ovhcloud.com/reference/web-cloud/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/web-cloud/email-and-collaborative-solutions/microsoft-exchange/email-pro/diagnostics/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/web-cloud/email-and-collaborative-solutions/microsoft-exchange/email-pro/diagnostics.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/web-cloud/email-and-collaborative-solutions/microsoft-exchange/email-pro/diagnostics.json?format=openapi3

## Operations

- `GET /email/pro/{service}/account/{email}/diagnostics` — Get the account diagnosis
- `POST /email/pro/{service}/account/{email}/diagnostics` — Run an account diagnosis

## Get the account diagnosis

`GET /1.0/email/pro/{service}/account/{email}/diagnostics`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-exchange/email-pro/diagnostics/#get-email-pro-service-account-email-diagnostics

**Status:** Alpha version  
**IAM actions:** `emailPro:apiovh:account/diagnostics/get`

Returns the results of the last diagnosis of the email account: account locked, suspended or flagged as spammer, login with its credentials, MX and SRV records, and sending and receiving of emails.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `email` | path | string | yes | Email |
| `service` | path | string | yes | Service |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | email.pro.AccountDiagnosis | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `canReceiveEmail` | boolean | read-only | Determines if ingoing message has been received |
| `canSendEmail` | boolean | read-only | Determines if outgoing message has been delivered |
| `connectiveWebmail` | boolean | read-only | Determines if possible to authenticate with credentials |
| `isLocked` | boolean | read-only | Determines if account is locked |
| `isMxValid` | boolean | read-only | Determines if MX record for account's domain is properly set |
| `isSpammer` | boolean | read-only | Determines if account is flagged as spammer |
| `isSrvValid` | boolean | read-only | Determines if SRV (autodiscovery) record for account's domain is properly set |
| `isSuspended` | boolean | read-only | Determines if account is suspended |
| `lastCheck` | string (date-time) | read-only | Last performed diagnostics date |

```json
{
  "canReceiveEmail": true,
  "canSendEmail": true,
  "connectiveWebmail": true,
  "isLocked": true,
  "isMxValid": true,
  "isSpammer": true,
  "isSrvValid": true,
  "isSuspended": true,
  "lastCheck": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/email/pro/{service}/account/{email}/diagnostics" \
  -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("/email/pro/{service}/account/{email}/diagnostics")

# 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("/email/pro/{service}/account/{email}/diagnostics");

print_r($result);
?>
```

## Run an account diagnosis

`POST /1.0/email/pro/{service}/account/{email}/diagnostics`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-exchange/email-pro/diagnostics/#post-email-pro-service-account-email-diagnostics

**Status:** Stable production version  
**IAM actions:** `emailPro:apiovh:account/diagnostics/create`

Run an account diagnosis. Starts a diagnosis of the email account, which requires the account `password`, and returns the task.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `email` | path | string | yes | Default email for this mailbox |
| `service` | path | string | yes | The internal name of your pro organization |

### Request body (required)

Type: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `password` | string | yes | Account password |

```json
{
  "password": "string"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | email.pro.Task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `finishDate` | string (date-time) | read-only | Completion date |
| `function` | email.pro.TaskFunctionEnum | read-only | Function name — one of `addAccount`, `addAlias`, `addDomain`, `addDomainDKIM`, `addDomainDisclaimer`, `addExternalContact`, `addFullAccess`, `addSendAs`, `addSendOnBehalfTo`, `addServiceAuthorizedIp`, `changeHostname`, `changePassword`, … |
| `id` | integer | read-only | Task id |
| `status` | email.pro.TaskStatusEnum | read-only | Task status — one of `cancelled`, `doing`, `done`, `error`, `todo` |
| `todoDate` | string (date-time) | read-only | Creation date |

```json
{
  "finishDate": "2024-01-01T12:00:00Z",
  "function": "addAccount",
  "id": 0,
  "status": "cancelled",
  "todoDate": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/email/pro/{service}/account/{email}/diagnostics" \
  -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: string
result = client.post("/email/pro/{service}/account/{email}/diagnostics",
	password = None, # Account password (type: string)
)

# 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: string
$result = $ovh->post("/email/pro/{service}/account/{email}/diagnostics", array(
	password => null, // Account password (type: string)
));

print_r($result);
?>
```
