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

> 5 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/zimbra/domains/

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

## Operations

- `GET /zimbra/platform/{platformId}/domain` — List domains
- `GET /zimbra/platform/{platformId}/domain/{domainId}` — Get a domain
- `POST /zimbra/platform/{platformId}/domain` — Create a domain
- `DELETE /zimbra/platform/{platformId}/domain/{domainId}` — Delete a domain
- `PUT /zimbra/platform/{platformId}/domain/{domainId}` — Update a domain

## List domains

`GET /v2/zimbra/platform/{platformId}/domain`

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

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

Returns the domains of the platform with their current state. Filter them by `organizationId`, `organizationLabel` or `domainName`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `domainName` | query | string |  | Filter by domain name |
| `organizationId` | query | string (uuid) |  | Filter by organization identifier |
| `organizationLabel` | query | string |  | Filter by organization label |
| `platformId` | path | string (uuid) | yes | Platform ID |

### Responses

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Checksum hash in MD5 representation |
| `currentState` | zimbra.DomainCurrentState | read-only | Object representing domain |
| `currentState.accountsStatistics` | zimbra.OfferStatistics[] | read-only | Statistics of accounts on the domain |
| `currentState.accountsStatistics[].availableAccountsCount` | integer | read-only | Total number of accounts on this offer that can be configured |
| `currentState.accountsStatistics[].configuredAccountsCount` | integer | read-only | Number of accounts on the offer that are configured |
| `currentState.accountsStatistics[].offer` | zimbra.OfferEnum | read-only | Commercial name of the offer — one of `PRO`, `STARTER` |
| `currentState.createdAt` | string (date-time) | read-only | Date of creation |
| `currentState.expectedDNSConfig` | zimbra.ExpectedDNSConfig | read-only | DNS configuration that should be applied |
| `currentState.expectedDNSConfig.autodiscover` | string | read-only | Recommended autodiscover value |
| `currentState.expectedDNSConfig.dkim` | zimbra.DKIMSelectors | read-only | Recommended DKIM selectors |
| `currentState.expectedDNSConfig.mx` | zimbra.MXRecord[] | read-only | Recommended MX records for efficient mail delivery |
| `currentState.expectedDNSConfig.ownership` | zimbra.DNSOwnership | read-only | DNS configuration to apply to verify ownership |
| `currentState.expectedDNSConfig.spf` | string | read-only | Recommended SPF value |
| `currentState.name` | string | read-only | Name of the domain |
| `currentState.organizationId` | string (uuid) | read-only | ID of the organization to which the domain belongs |
| `currentState.organizationLabel` | string | read-only | Label of the organization to which the domain belongs |
| `currentState.status` | zimbra.DomainStatusEnum | read-only | Current domain status — one of `READY` |
| `currentState.updatedAt` | string (date-time) | read-only | Last update date |
| `currentTasks` | common.CurrentTask[] | read-only | An array containing tasks responses pending on resource extends AsyncResourceBase object |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Resource identifier in UUID representation |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Current resource status — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | zimbra.DomainResponseTargetSpec | read-only | Object representing domain |
| `targetSpec.dkimEnabled` | boolean | read-only | Set to true to enable DKIM or false to disable |
| `targetSpec.organizationId` | string (uuid) | read-only | ID of the organization to which the domain belongs |

```json
[
  {
    "checksum": "string",
    "currentState": {
      "accountsStatistics": [
        {
          "availableAccountsCount": 0,
          "configuredAccountsCount": 0,
          "offer": "PRO"
        }
      ],
      "createdAt": "2024-01-01T12:00:00Z",
      "expectedDNSConfig": {
        "autodiscover": "string",
        "dkim": {
          "cnames": [
            {
              "name": null,
              "value": null
            }
          ]
        },
        "mx": [
          {
            "priority": 0,
            "target": "string"
          }
        ],
        "ownership": {
          "cname": "string"
        },
        "spf": "string"
      },
      "name": "string",
      "organizationId": "00000000-0000-0000-0000-000000000000",
      "organizationLabel": "string",
      "status": "READY",
      "updatedAt": "2024-01-01T12:00:00Z"
    },
    "currentTasks": [
      {
        "errors": [
          {
            "message": "string"
          }
        ],
        "id": "00000000-0000-0000-0000-000000000000",
        "link": "string",
        "status": "ERROR",
        "type": "string"
      }
    ],
    "id": "00000000-0000-0000-0000-000000000000",
    "resourceStatus": "CREATING",
    "targetSpec": {
      "dkimEnabled": true,
      "organizationId": "00000000-0000-0000-0000-000000000000"
    }
  }
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/zimbra/platform/{platformId}/domain" \
  -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/zimbra/platform/{platformId}/domain")

# 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/zimbra/platform/{platformId}/domain");

print_r($result);
?>
```

## Get a domain

`GET /v2/zimbra/platform/{platformId}/domain/{domainId}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/zimbra/domains/#get-zimbra-platform-platformid-domain-domainid

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

Returns the domain, its organization, its account statistics per offer and the DNS configuration to apply: ownership, MX, SPF, DKIM and autodiscover.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domainId` | path | string (uuid) | yes | Domain ID |
| `platformId` | path | string (uuid) | yes | Platform ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | zimbra.DomainResponse | successful operation |
| 404 | object | Error 404 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Checksum hash in MD5 representation |
| `currentState` | zimbra.DomainCurrentState | read-only | Object representing domain |
| `currentState.accountsStatistics` | zimbra.OfferStatistics[] | read-only | Statistics of accounts on the domain |
| `currentState.accountsStatistics[].availableAccountsCount` | integer | read-only | Total number of accounts on this offer that can be configured |
| `currentState.accountsStatistics[].configuredAccountsCount` | integer | read-only | Number of accounts on the offer that are configured |
| `currentState.accountsStatistics[].offer` | zimbra.OfferEnum | read-only | Commercial name of the offer — one of `PRO`, `STARTER` |
| `currentState.createdAt` | string (date-time) | read-only | Date of creation |
| `currentState.expectedDNSConfig` | zimbra.ExpectedDNSConfig | read-only | DNS configuration that should be applied |
| `currentState.expectedDNSConfig.autodiscover` | string | read-only | Recommended autodiscover value |
| `currentState.expectedDNSConfig.dkim` | zimbra.DKIMSelectors | read-only | Recommended DKIM selectors |
| `currentState.expectedDNSConfig.mx` | zimbra.MXRecord[] | read-only | Recommended MX records for efficient mail delivery |
| `currentState.expectedDNSConfig.ownership` | zimbra.DNSOwnership | read-only | DNS configuration to apply to verify ownership |
| `currentState.expectedDNSConfig.spf` | string | read-only | Recommended SPF value |
| `currentState.name` | string | read-only | Name of the domain |
| `currentState.organizationId` | string (uuid) | read-only | ID of the organization to which the domain belongs |
| `currentState.organizationLabel` | string | read-only | Label of the organization to which the domain belongs |
| `currentState.status` | zimbra.DomainStatusEnum | read-only | Current domain status — one of `READY` |
| `currentState.updatedAt` | string (date-time) | read-only | Last update date |
| `currentTasks` | common.CurrentTask[] | read-only | An array containing tasks responses pending on resource extends AsyncResourceBase object |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Resource identifier in UUID representation |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Current resource status — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | zimbra.DomainResponseTargetSpec | read-only | Object representing domain |
| `targetSpec.dkimEnabled` | boolean | read-only | Set to true to enable DKIM or false to disable |
| `targetSpec.organizationId` | string (uuid) | read-only | ID of the organization to which the domain belongs |

```json
{
  "checksum": "string",
  "currentState": {
    "accountsStatistics": [
      {
        "availableAccountsCount": 0,
        "configuredAccountsCount": 0,
        "offer": "PRO"
      }
    ],
    "createdAt": "2024-01-01T12:00:00Z",
    "expectedDNSConfig": {
      "autodiscover": "string",
      "dkim": {
        "cnames": [
          {
            "name": "string",
            "value": "string"
          }
        ]
      },
      "mx": [
        {
          "priority": 0,
          "target": "string"
        }
      ],
      "ownership": {
        "cname": "string"
      },
      "spf": "string"
    },
    "name": "string",
    "organizationId": "00000000-0000-0000-0000-000000000000",
    "organizationLabel": "string",
    "status": "READY",
    "updatedAt": "2024-01-01T12:00:00Z"
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "dkimEnabled": true,
    "organizationId": "00000000-0000-0000-0000-000000000000"
  }
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/zimbra/platform/{platformId}/domain/{domainId}" \
  -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/zimbra/platform/{platformId}/domain/{domainId}")

# 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/zimbra/platform/{platformId}/domain/{domainId}");

print_r($result);
?>
```

## Create a domain

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

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

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

Adds a domain to an organization from its `name` and `organizationId`. When the DNS zone is hosted by OVHcloud, `autoConfigureMX`, `autoConfigureSPF`, `autoConfigureDKIM` and `autoConfigureAutodiscover` configure the matching records automatically. Creation is asynchronous: follow `resourceStatus` and `currentTasks`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `platformId` | path | string (uuid) | yes | Platform ID |

### Request body (required)

Type: `zimbra.DomainPostPayload`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `targetSpec` | zimbra.DomainPostTargetSpec | yes | Target organization specification |
| `targetSpec.autoConfigureAutodiscover` | boolean |  | Whether to automatically configure autodiscover if the DNS zone is hosted by OVH |
| `targetSpec.autoConfigureDKIM` | boolean | yes | Whether to automatically configure DKIM if the DNS zone is hosted by OVH. Even if false, will pre-configure (external and internal domain). |
| `targetSpec.autoConfigureMX` | boolean | yes | Whether to automatically configure MX if the DNS zone is hosted by OVH |
| `targetSpec.autoConfigureSPF` | boolean | yes | Whether to automatically configure SPF if the DNS zone is hosted by OVH |
| `targetSpec.name` | string | yes | Name of the domain |
| `targetSpec.organizationId` | string (uuid) | yes | Organization in which domain is |

```json
{
  "targetSpec": {
    "autoConfigureAutodiscover": true,
    "autoConfigureDKIM": true,
    "autoConfigureMX": true,
    "autoConfigureSPF": true,
    "name": "string",
    "organizationId": "00000000-0000-0000-0000-000000000000"
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | zimbra.DomainResponse | successful operation |
| 400 | object | Error 400 response |
| 404 | object | Error 404 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Checksum hash in MD5 representation |
| `currentState` | zimbra.DomainCurrentState | read-only | Object representing domain |
| `currentState.accountsStatistics` | zimbra.OfferStatistics[] | read-only | Statistics of accounts on the domain |
| `currentState.accountsStatistics[].availableAccountsCount` | integer | read-only | Total number of accounts on this offer that can be configured |
| `currentState.accountsStatistics[].configuredAccountsCount` | integer | read-only | Number of accounts on the offer that are configured |
| `currentState.accountsStatistics[].offer` | zimbra.OfferEnum | read-only | Commercial name of the offer — one of `PRO`, `STARTER` |
| `currentState.createdAt` | string (date-time) | read-only | Date of creation |
| `currentState.expectedDNSConfig` | zimbra.ExpectedDNSConfig | read-only | DNS configuration that should be applied |
| `currentState.expectedDNSConfig.autodiscover` | string | read-only | Recommended autodiscover value |
| `currentState.expectedDNSConfig.dkim` | zimbra.DKIMSelectors | read-only | Recommended DKIM selectors |
| `currentState.expectedDNSConfig.mx` | zimbra.MXRecord[] | read-only | Recommended MX records for efficient mail delivery |
| `currentState.expectedDNSConfig.ownership` | zimbra.DNSOwnership | read-only | DNS configuration to apply to verify ownership |
| `currentState.expectedDNSConfig.spf` | string | read-only | Recommended SPF value |
| `currentState.name` | string | read-only | Name of the domain |
| `currentState.organizationId` | string (uuid) | read-only | ID of the organization to which the domain belongs |
| `currentState.organizationLabel` | string | read-only | Label of the organization to which the domain belongs |
| `currentState.status` | zimbra.DomainStatusEnum | read-only | Current domain status — one of `READY` |
| `currentState.updatedAt` | string (date-time) | read-only | Last update date |
| `currentTasks` | common.CurrentTask[] | read-only | An array containing tasks responses pending on resource extends AsyncResourceBase object |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Resource identifier in UUID representation |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Current resource status — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | zimbra.DomainResponseTargetSpec | read-only | Object representing domain |
| `targetSpec.dkimEnabled` | boolean | read-only | Set to true to enable DKIM or false to disable |
| `targetSpec.organizationId` | string (uuid) | read-only | ID of the organization to which the domain belongs |

```json
{
  "checksum": "string",
  "currentState": {
    "accountsStatistics": [
      {
        "availableAccountsCount": 0,
        "configuredAccountsCount": 0,
        "offer": "PRO"
      }
    ],
    "createdAt": "2024-01-01T12:00:00Z",
    "expectedDNSConfig": {
      "autodiscover": "string",
      "dkim": {
        "cnames": [
          {
            "name": "string",
            "value": "string"
          }
        ]
      },
      "mx": [
        {
          "priority": 0,
          "target": "string"
        }
      ],
      "ownership": {
        "cname": "string"
      },
      "spf": "string"
    },
    "name": "string",
    "organizationId": "00000000-0000-0000-0000-000000000000",
    "organizationLabel": "string",
    "status": "READY",
    "updatedAt": "2024-01-01T12:00:00Z"
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "dkimEnabled": true,
    "organizationId": "00000000-0000-0000-0000-000000000000"
  }
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/zimbra/platform/{platformId}/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.DomainPostPayload
result = client.post("/v2/zimbra/platform/{platformId}/domain",
	targetSpec = None, # Target organization specification (type: zimbra.DomainPostTargetSpec)
)

# 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.DomainPostPayload
$result = $ovh->post("/v2/zimbra/platform/{platformId}/domain", array(
	targetSpec => null, // Target organization specification (type: zimbra.DomainPostTargetSpec)
));

print_r($result);
?>
```

## Delete a domain

`DELETE /v2/zimbra/platform/{platformId}/domain/{domainId}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/zimbra/domains/#delete-zimbra-platform-platformid-domain-domainid

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

Deletes the domain from its organization.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domainId` | path | string (uuid) | yes | Domain ID |
| `platformId` | path | string (uuid) | yes | Platform ID |

### Responses

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

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/v2/zimbra/platform/{platformId}/domain/{domainId}" \
  -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("/v2/zimbra/platform/{platformId}/domain/{domainId}")

# 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("/v2/zimbra/platform/{platformId}/domain/{domainId}");

print_r($result);
?>
```

## Update a domain

`PUT /v2/zimbra/platform/{platformId}/domain/{domainId}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/zimbra/domains/#put-zimbra-platform-platformid-domain-domainid

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

Enables or disables DKIM with `dkimEnabled`, or moves the domain, with its email accounts, to another organization with `organizationId`. When set, `checksum` must match the current checksum of the domain, otherwise the update is rejected.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domainId` | path | string (uuid) | yes | Domain ID |
| `platformId` | path | string (uuid) | yes | Platform ID |

### Request body (required)

Type: `zimbra.DomainPutPayload`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string |  | Known checksum of the resource, allowing to prevent unwanted side effects |
| `targetSpec` | zimbra.DomainPutTargetSpec | yes | Target domain specification |
| `targetSpec.dkimEnabled` | boolean |  | Set to true to enable DKIM or false to disable |
| `targetSpec.organizationId` | string (uuid) |  | ID of the organization to which the domain belongs |
| `targetSpec.validateOwnership` | boolean |  | Set to true to start the domain ownership check, using the DNS record in `currentState.expectedDNSConfig.ownership` |

```json
{
  "checksum": "string",
  "targetSpec": {
    "dkimEnabled": true,
    "organizationId": "00000000-0000-0000-0000-000000000000",
    "validateOwnership": true
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | zimbra.DomainResponse | successful operation |
| 404 | object | Error 404 response |
| 412 | object | Error 412 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Checksum hash in MD5 representation |
| `currentState` | zimbra.DomainCurrentState | read-only | Object representing domain |
| `currentState.accountsStatistics` | zimbra.OfferStatistics[] | read-only | Statistics of accounts on the domain |
| `currentState.accountsStatistics[].availableAccountsCount` | integer | read-only | Total number of accounts on this offer that can be configured |
| `currentState.accountsStatistics[].configuredAccountsCount` | integer | read-only | Number of accounts on the offer that are configured |
| `currentState.accountsStatistics[].offer` | zimbra.OfferEnum | read-only | Commercial name of the offer — one of `PRO`, `STARTER` |
| `currentState.createdAt` | string (date-time) | read-only | Date of creation |
| `currentState.expectedDNSConfig` | zimbra.ExpectedDNSConfig | read-only | DNS configuration that should be applied |
| `currentState.expectedDNSConfig.autodiscover` | string | read-only | Recommended autodiscover value |
| `currentState.expectedDNSConfig.dkim` | zimbra.DKIMSelectors | read-only | Recommended DKIM selectors |
| `currentState.expectedDNSConfig.mx` | zimbra.MXRecord[] | read-only | Recommended MX records for efficient mail delivery |
| `currentState.expectedDNSConfig.ownership` | zimbra.DNSOwnership | read-only | DNS configuration to apply to verify ownership |
| `currentState.expectedDNSConfig.spf` | string | read-only | Recommended SPF value |
| `currentState.name` | string | read-only | Name of the domain |
| `currentState.organizationId` | string (uuid) | read-only | ID of the organization to which the domain belongs |
| `currentState.organizationLabel` | string | read-only | Label of the organization to which the domain belongs |
| `currentState.status` | zimbra.DomainStatusEnum | read-only | Current domain status — one of `READY` |
| `currentState.updatedAt` | string (date-time) | read-only | Last update date |
| `currentTasks` | common.CurrentTask[] | read-only | An array containing tasks responses pending on resource extends AsyncResourceBase object |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Resource identifier in UUID representation |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Current resource status — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | zimbra.DomainResponseTargetSpec | read-only | Object representing domain |
| `targetSpec.dkimEnabled` | boolean | read-only | Set to true to enable DKIM or false to disable |
| `targetSpec.organizationId` | string (uuid) | read-only | ID of the organization to which the domain belongs |

```json
{
  "checksum": "string",
  "currentState": {
    "accountsStatistics": [
      {
        "availableAccountsCount": 0,
        "configuredAccountsCount": 0,
        "offer": "PRO"
      }
    ],
    "createdAt": "2024-01-01T12:00:00Z",
    "expectedDNSConfig": {
      "autodiscover": "string",
      "dkim": {
        "cnames": [
          {
            "name": "string",
            "value": "string"
          }
        ]
      },
      "mx": [
        {
          "priority": 0,
          "target": "string"
        }
      ],
      "ownership": {
        "cname": "string"
      },
      "spf": "string"
    },
    "name": "string",
    "organizationId": "00000000-0000-0000-0000-000000000000",
    "organizationLabel": "string",
    "status": "READY",
    "updatedAt": "2024-01-01T12:00:00Z"
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "dkimEnabled": true,
    "organizationId": "00000000-0000-0000-0000-000000000000"
  }
}
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/v2/zimbra/platform/{platformId}/domain/{domainId}" \
  -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.DomainPutPayload
result = client.put("/v2/zimbra/platform/{platformId}/domain/{domainId}",
	checksum = None, # Known checksum of the resource, allowing to prevent unwanted side effects (type: string)
	targetSpec = None, # Target domain specification (type: zimbra.DomainPutTargetSpec)
)

# 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.DomainPutPayload
$result = $ovh->put("/v2/zimbra/platform/{platformId}/domain/{domainId}", array(
	checksum => null, // Known checksum of the resource, allowing to prevent unwanted side effects (type: string)
	targetSpec => null, // Target domain specification (type: zimbra.DomainPutTargetSpec)
));

print_r($result);
?>
```
