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

> 3 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/mx-plan/zimbra-platform/domains/

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

## Operations

- `GET /email/mxplan/{service}/domain` — List domains
- `GET /email/mxplan/{service}/domain/{domainName}` — Get a domain
- `PUT /email/mxplan/{service}/domain/{domainName}` — Update a domain

## List domains

`GET /1.0/email/mxplan/{service}/domain`

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

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

List domains. Returns the names of the domains attached to the service. Filter them by `state`, such as ok or suspended.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `service` | path | string | yes | The internal name of your mxplan organization |
| `state` | query | email.pro.ObjectStateEnum |  | Filter the value of state property (=) — one of `creating`, `deleting`, `ok`, `reopening`, `suspended`, `suspending`, `unknown` |

### Responses

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

```json
[
  "string"
]
```

### Example

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

print_r($result);
?>
```

## Get a domain

`GET /1.0/email/mxplan/{service}/domain/{domainName}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/mx-plan/zimbra-platform/domains/#get-email-mxplan-service-domain-domainname

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

Get a domain. Returns the type and state of the domain, its MX and SRV records with their validation status, the expected MX records, its MX relay and its aliases.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domainName` | path | string | yes | Domain name |
| `service` | path | string | yes | The internal name of your mxplan organization |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | email.mxplan.Domain | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `cnameToCheck` | string | read-only | Cname that will be checked to prove the domain ownership |
| `domainAliases` | string[] | read-only | List of aliases for this domain |
| `domainValidated` | boolean | read-only | Domain validation status |
| `expectedMX` | string[] | read-only | Expected MX record(s) on this domain |
| `isAliasDomain` | boolean | read-only | Indicate if this domain is an alias for another domain |
| `mxIsValid` | boolean | read-only | If true your dns mx configuration is valid |
| `mxRecord` | string[] | read-only | Domain MX record configured in DNS |
| `mxRelay` | string |  | If specified, emails to not existing address will be redirected to that domain |
| `name` | string | read-only | Domain name |
| `srvIsValid` | boolean | read-only | If true your dns srv record is valid |
| `srvRecord` | string[] | read-only | Domain SRV record configured in DNS |
| `state` | email.pro.ObjectStateEnum | read-only | Domain state — one of `creating`, `deleting`, `ok`, `reopening`, `suspended`, `suspending`, `unknown` |
| `taskPendingId` | integer | read-only | Pending taks id |
| `type` | email.pro.DomainTypeEnum |  | Domain type — one of `authoritative`, `nonAuthoritative` |

```json
{
  "cnameToCheck": "string",
  "domainAliases": [
    "string"
  ],
  "domainValidated": true,
  "expectedMX": [
    "string"
  ],
  "isAliasDomain": true,
  "mxIsValid": true,
  "mxRecord": [
    "string"
  ],
  "mxRelay": "string",
  "name": "string",
  "srvIsValid": true,
  "srvRecord": [
    "string"
  ],
  "state": "creating",
  "taskPendingId": 0,
  "type": "authoritative"
}
```

### Example

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

# 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/mxplan/{service}/domain/{domainName}");

print_r($result);
?>
```

## Update a domain

`PUT /1.0/email/mxplan/{service}/domain/{domainName}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/mx-plan/zimbra-platform/domains/#put-email-mxplan-service-domain-domainname

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

Update a domain. Updates the `type` of the domain, authoritative or nonAuthoritative, and its `mxRelay`, the domain that receives the emails sent to addresses that do not exist.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domainName` | path | string | yes | Domain name |
| `service` | path | string | yes | The internal name of your mxplan organization |

### Request body (required)

Type: `email.mxplan.Domain`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `cnameToCheck` | string | read-only | Cname that will be checked to prove the domain ownership |
| `domainAliases` | string[] | read-only | List of aliases for this domain |
| `domainValidated` | boolean | read-only | Domain validation status |
| `expectedMX` | string[] | read-only | Expected MX record(s) on this domain |
| `isAliasDomain` | boolean | read-only | Indicate if this domain is an alias for another domain |
| `mxIsValid` | boolean | read-only | If true your dns mx configuration is valid |
| `mxRecord` | string[] | read-only | Domain MX record configured in DNS |
| `mxRelay` | string |  | If specified, emails to not existing address will be redirected to that domain |
| `name` | string | read-only | Domain name |
| `srvIsValid` | boolean | read-only | If true your dns srv record is valid |
| `srvRecord` | string[] | read-only | Domain SRV record configured in DNS |
| `state` | email.pro.ObjectStateEnum | read-only | Domain state — one of `creating`, `deleting`, `ok`, `reopening`, `suspended`, `suspending`, `unknown` |
| `taskPendingId` | integer | read-only | Pending taks id |
| `type` | email.pro.DomainTypeEnum |  | Domain type — one of `authoritative`, `nonAuthoritative` |

```json
{
  "mxRelay": "string",
  "type": "authoritative"
}
```

### Responses

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

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/1.0/email/mxplan/{service}/domain/{domainName}" \
  -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: email.mxplan.Domain
result = client.put("/email/mxplan/{service}/domain/{domainName}",
	mxRelay = None, # If specified, emails to not existing address will be redirected to that domain (type: string, nullable)
	type = None, # Domain type (type: email.pro.DomainTypeEnum)
)

# 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: email.mxplan.Domain
$result = $ovh->put("/email/mxplan/{service}/domain/{domainName}", array(
	mxRelay => null, // If specified, emails to not existing address will be redirected to that domain (type: string, nullable)
	type => null, // Domain type (type: email.pro.DomainTypeEnum)
));

print_r($result);
?>
```
