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

> 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/web-cloud/email-and-collaborative-solutions/mx-plan/roundcube-platform/dns/

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

## Operations

- `GET /email/domain/{domain}/dkim` — Get the DKIM configuration
- `PUT /email/domain/{domain}/dkim/disable` — Disable DKIM
- `PUT /email/domain/{domain}/dkim/enable` — Enable DKIM
- `GET /email/domain/{domain}/dnsMXFilter` — Get the MX filter
- `GET /email/domain/{domain}/dnsMXRecords` — List MX records
- `GET /email/domain/{domain}/recommendedDNSRecords` — List recommended DNS records
- `POST /email/domain/{domain}/changeDnsMXFilter` — Change MX filter

## Get the DKIM configuration

`GET /1.0/email/domain/{domain}/dkim`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/mx-plan/roundcube-platform/dns/#get-email-domain-domain-dkim

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

Get the DKIM configuration. Returns the DKIM status, the active selector, the selectors with their CNAME records, and whether the DNS CNAME configuration is valid.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domain` | path | string | yes | Name of your domain name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | email.domain.dkim_simplified | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `activeSelector` | string | read-only | activeSelector |
| `autoconfig` | boolean | read-only | If true your DNS CNAME configuration is valid |
| `selectors` | email.domain.DKIMSelector[] | read-only | DKIM status |
| `selectors[].cname` | string |  | CNAME record |
| `selectors[].selectorName` | string |  | Internal name of selector |
| `selectors[].status` | email.domain.DKIMSelectorStatusEnum |  | Status of selector — one of `set`, `toFix`, `toSet` |
| `status` | email.domain.DKIMStatusEnum | read-only | DKIM status — one of `disabled`, `enabled`, `error`, `modifying`, `toConfigure` |

```json
{
  "activeSelector": "string",
  "autoconfig": true,
  "selectors": [
    {
      "cname": "string",
      "selectorName": "string",
      "status": "set"
    }
  ],
  "status": "disabled"
}
```

### Example

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

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

print_r($result);
?>
```

## Disable DKIM

`PUT /1.0/email/domain/{domain}/dkim/disable`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/mx-plan/roundcube-platform/dns/#put-email-domain-domain-dkim-disable

**Status:** Stable production version  
**IAM actions:** `emailDomain:apiovh:domain/dkim/disable`

Disable DKIM. Stops signing the emails sent from the domain with DKIM, and returns the task. Read the result with `GET dkim`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domain` | path | string | yes | Name of your domain name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | email.domain.task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `domain` | string | read-only | Domain name of the task |
| `function` | string | read-only | Function of the task |
| `id` | integer | read-only | Id of the task |
| `status` | email.domain.TaskStatusEnum | read-only | Status of the task — one of `cancelled`, `customerError`, `doing`, `done`, `init`, `ovhError`, `todo` |

```json
{
  "domain": "string",
  "function": "string",
  "id": 0,
  "status": "cancelled"
}
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/1.0/email/domain/{domain}/dkim/disable" \
  -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.put("/email/domain/{domain}/dkim/disable")

# 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->put("/email/domain/{domain}/dkim/disable");

print_r($result);
?>
```

## Enable DKIM

`PUT /1.0/email/domain/{domain}/dkim/enable`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/mx-plan/roundcube-platform/dns/#put-email-domain-domain-dkim-enable

**Status:** Stable production version  
**IAM actions:** `emailDomain:apiovh:domain/dkim/enable`

Enable DKIM. Starts signing the emails sent from the domain with DKIM, and returns the task. Read the result with `GET dkim`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domain` | path | string | yes | Name of your domain name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | email.domain.task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `domain` | string | read-only | Domain name of the task |
| `function` | string | read-only | Function of the task |
| `id` | integer | read-only | Id of the task |
| `status` | email.domain.TaskStatusEnum | read-only | Status of the task — one of `cancelled`, `customerError`, `doing`, `done`, `init`, `ovhError`, `todo` |

```json
{
  "domain": "string",
  "function": "string",
  "id": 0,
  "status": "cancelled"
}
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/1.0/email/domain/{domain}/dkim/enable" \
  -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.put("/email/domain/{domain}/dkim/enable")

# 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->put("/email/domain/{domain}/dkim/enable");

print_r($result);
?>
```

## Get the MX filter

`GET /1.0/email/domain/{domain}/dnsMXFilter`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/mx-plan/roundcube-platform/dns/#get-email-domain-domain-dnsmxfilter

**Status:** Stable production version  
**IAM actions:** `emailDomain:apiovh:dnsMXFilter/get`

Get the MX filter. Returns the MX filter of the domain, or of `subDomain`: CUSTOM, FULL_FILTERING, NO_FILTERING, REDIRECT or SIMPLE_FILTERING.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domain` | path | string | yes | Name of your domain name |
| `subDomain` | query | string |  | Sub domain |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | domain.DomainMXFilterEnum | successful operation |

```json
"CUSTOM"
```

### Example

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

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

print_r($result);
?>
```

## List MX records

`GET /1.0/email/domain/{domain}/dnsMXRecords`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/mx-plan/roundcube-platform/dns/#get-email-domain-domain-dnsmxrecords

**Status:** Stable production version  
**IAM actions:** `emailDomain:apiovh:dnsMXRecords/get`

List MX records. Returns the MX records currently published for the domain. Set `subDomain` to read those of a subdomain.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domain` | path | string | yes | Name of your domain name |
| `subDomain` | query | string |  | Sub domain |

### Responses

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

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

### Example

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

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

print_r($result);
?>
```

## List recommended DNS records

`GET /1.0/email/domain/{domain}/recommendedDNSRecords`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/mx-plan/roundcube-platform/dns/#get-email-domain-domain-recommendeddnsrecords

**Status:** Stable production version  
**IAM actions:** `emailDomain:apiovh:recommendedDNSRecords/get`

List recommended DNS records. Returns the DNS records recommended for the email domain, with their type, subdomain, target, TTL and zone.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domain` | path | string | yes | Name of your domain name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | email.domain.Record[] | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `fieldType` | email.domain.DnsRecordTypeEnum | read-only | Type of DNS record — one of `A`, `AAAA`, `CAA`, `CNAME`, `DKIM`, `DMARC`, `DNAME`, `LOC`, `MX`, `NAPTR`, `NS`, `PTR`, … |
| `id` | integer | read-only | Id of record |
| `subDomain` | string | read-only | subdomain of record |
| `target` | string | read-only | Target of DNS record |
| `ttl` | integer | read-only | TTL of record |
| `zone` | string | read-only | Name of DNS zone |

```json
[
  {
    "fieldType": "A",
    "id": 0,
    "subDomain": "string",
    "target": "string",
    "ttl": 0,
    "zone": "string"
  }
]
```

### Example

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

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

print_r($result);
?>
```

## Change MX filter

`POST /1.0/email/domain/{domain}/changeDnsMXFilter`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/mx-plan/roundcube-platform/dns/#post-email-domain-domain-changednsmxfilter

**Status:** Stable production version  
**IAM actions:** `emailDomain:apiovh:changeDnsMXFilter`

Change MX filter. Changes the MX DNS records of the domain, or of `subDomain`, to apply the `mxFilter` filter. With CUSTOM, `customTarget` gives the target server.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domain` | path | string | yes | Name of your domain name |

### Request body (required)

Type: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `customTarget` | string |  | Target server for custom MX |
| `mxFilter` | domain.DomainMXFilterEnum | yes | New MX filter — one of `CUSTOM`, `FULL_FILTERING`, `NO_FILTERING`, `REDIRECT`, `SIMPLE_FILTERING` |
| `subDomain` | string |  | Sub domain |

```json
{
  "customTarget": "string",
  "mxFilter": "CUSTOM",
  "subDomain": "string"
}
```

### Responses

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

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/email/domain/{domain}/changeDnsMXFilter" \
  -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/domain/{domain}/changeDnsMXFilter",
	customTarget = None, # Target server for custom MX (type: string, nullable)
	mxFilter = None, # New MX filter (type: domain.DomainMXFilterEnum)
	subDomain = None, # Sub domain (type: string, nullable)
)

# 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/domain/{domain}/changeDnsMXFilter", array(
	customTarget => null, // Target server for custom MX (type: string, nullable)
	mxFilter => null, // New MX filter (type: domain.DomainMXFilterEnum)
	subDomain => null, // Sub domain (type: string, nullable)
));

print_r($result);
?>
```
