# Web Cloud › Email and Collaborative Solutions › Zimbra › 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

> 1 operation 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/zimbra/diagnostics/

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

## Operations

- `POST /zimbra/platform/{platformId}/diagnostic/domain` — Diagnose domains

## Diagnose domains

`POST /v2/zimbra/platform/{platformId}/diagnostic/domain`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/zimbra/diagnostics/#post-zimbra-platform-platformid-diagnostic-domain

**Status:** Stable production version  
**IAM actions:** `zimbra:apiovh:platform/diagnostic/domain/get`

Checks the MX, SPF, DKIM and autodiscover DNS records of the domains listed in `domains`. Returns, for each domain, the status and errors of each test, the records found and the expected DNS configuration.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `platformId` | path | string (uuid) | yes | Platform ID |

### Request body (required)

Type: `zimbra.DomainDiagnosisPostPayload`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `domains` | string (uuid)[] | yes | List of domains to diagnose |

```json
{
  "domains": [
    "00000000-0000-0000-0000-000000000000"
  ]
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | zimbra.DomainDiagnosisResponse[] | successful operation |
| 404 | object | Error 404 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `domainId` | string (uuid) | read-only | Identifier of the domain |
| `domainName` | string | read-only | Name of the domain |
| `error` | zimbra.DomainDiagnosisError | read-only | List of errors when doing diagnostics |
| `error.code` | zimbra.DomainDiagnosisErrorCodeEnum | read-only | Status of performed diagnostic process for given domain — one of `BAD_CONFIGURATION`, `DOMAIN_IN_TRANSIENT_STATE`, `DOMAIN_NOT_FOUND`, `DOMAIN_NOT_VALIDATED`, `INTERNAL_ERROR` |
| `error.message` | string | read-only | Diagnosis message |
| `isExternal` | boolean | read-only | Whether domain is not managed by OVHcloud, it allows autoconfiguration of the domain |
| `recommendations` | zimbra.DomainDiagnosisRecommendations | read-only | Recommendations on how to configure a domain |
| `recommendations.expectedDNSConfig` | zimbra.ExpectedDNSConfig | read-only | Expected configuration of a domain |
| `recommendations.expectedDNSConfig.autodiscover` | string | read-only | Recommended autodiscover value |
| `recommendations.expectedDNSConfig.dkim` | zimbra.DKIMSelectors | read-only | Recommended DKIM selectors |
| `recommendations.expectedDNSConfig.mx` | zimbra.MXRecord[] | read-only | Recommended MX records for efficient mail delivery |
| `recommendations.expectedDNSConfig.ownership` | zimbra.DNSOwnership | read-only | DNS configuration to apply to verify ownership |
| `recommendations.expectedDNSConfig.spf` | string | read-only | Recommended SPF value |
| `result` | zimbra.DomainDiagnosisResult | read-only | Result of the diagnosis |
| `result.autodiscover` | zimbra.DomainDiagnosisTestAutodiscoverResult | read-only | The result of the Autodiscover diagnosis |
| `result.autodiscover.errors` | zimbra.DomainDiagnosisTestAutodiscoverError[] | read-only | List of errors during Autodiscover diagnosis |
| `result.autodiscover.recordsFound` | string[] | read-only | Found Autodiscover record |
| `result.autodiscover.status` | zimbra.DomainDiagnosisTestStatusEnum | read-only | Status of performed diagnostic process for Autodiscover test — one of `ERROR`, `OK`, `WARNING` |
| `result.dkim` | zimbra.DomainDiagnosisTestDKIMResult | read-only | The result of the DKIM diagnosis |
| `result.dkim.errors` | zimbra.DomainDiagnosisTestDKIMError[] | read-only | List of error during DKIM diagnosis |
| `result.dkim.recordsFound` | zimbra.CName[] | read-only | Found DKIM records |
| `result.dkim.status` | zimbra.DomainDiagnosisTestStatusEnum | read-only | Status of performed diagnostic process for DKIM test — one of `ERROR`, `OK`, `WARNING` |
| `result.mx` | zimbra.DomainDiagnosisTestMXResult | read-only | The result of the MX diagnosis |
| `result.mx.errors` | zimbra.DomainDiagnosisTestMXError[] | read-only | List of errors during MX diagnosis |
| `result.mx.recordsFound` | zimbra.MXRecord[] | read-only | Found MX records |
| `result.mx.status` | zimbra.DomainDiagnosisTestStatusEnum | read-only | Status of performed diagnostic process for MX test — one of `ERROR`, `OK`, `WARNING` |
| `result.spf` | zimbra.DomainDiagnosisTestSPFResult | read-only | The result of the SPF diagnosis |
| `result.spf.errors` | zimbra.DomainDiagnosisTestSPFError[] | read-only | List of errors during SPF diagnosis |
| `result.spf.recordsFound` | string[] | read-only | Found SPF record |
| `result.spf.status` | zimbra.DomainDiagnosisTestStatusEnum | read-only | Status of performed diagnostic process for SPF test — one of `ERROR`, `OK`, `WARNING` |
| `status` | zimbra.DomainDiagnosisStatusEnum | read-only | Status of the diagnosis — one of `ERROR`, `OK`, `PARTIAL` |

```json
[
  {
    "domainId": "00000000-0000-0000-0000-000000000000",
    "domainName": "string",
    "error": {
      "code": "BAD_CONFIGURATION",
      "message": "string"
    },
    "isExternal": true,
    "recommendations": {
      "expectedDNSConfig": {
        "autodiscover": "string",
        "dkim": {
          "cnames": [
            {
              "name": null,
              "value": null
            }
          ]
        },
        "mx": [
          {
            "priority": 0,
            "target": "string"
          }
        ],
        "ownership": {
          "cname": "string"
        },
        "spf": "string"
      }
    },
    "result": {
      "autodiscover": {
        "errors": [
          {
            "code": "INCORRECT_SRV_RECORD",
            "message": "string"
          }
        ],
        "recordsFound": [
          "string"
        ],
        "status": "ERROR"
      },
      "dkim": {
        "errors": [
          {
            "code": "DKIM_DISABLED",
            "message": "string"
          }
        ],
        "recordsFound": [
          {
            "name": "string",
            "value": "string"
          }
        ],
        "status": "ERROR"
      },
      "mx": {
        "errors": [
          {
            "code": "EXTERNAL_MX_RECORD",
            "message": "string"
          }
        ],
        "recordsFound": [
          {
            "priority": 0,
            "target": "string"
          }
        ],
        "status": "ERROR"
      },
      "spf": {
        "errors": [
          {
            "code": "DANGEROUS_SPF_POLICY",
  …
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/zimbra/platform/{platformId}/diagnostic/domain" \
  -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: zimbra.DomainDiagnosisPostPayload
result = client.post("/v2/zimbra/platform/{platformId}/diagnostic/domain",
	domains = None, # List of domains to diagnose (type: array)
)

# 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: zimbra.DomainDiagnosisPostPayload
$result = $ovh->post("/v2/zimbra/platform/{platformId}/diagnostic/domain", array(
	domains => null, // List of domains to diagnose (type: array)
));

print_r($result);
?>
```
