# Network › DNS › History API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Network product's sections: https://developers.eu.ovhcloud.com/reference/network/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/network/dns/history/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/network/dns/history.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/network/dns/history.json?format=openapi3

## Operations

- `GET /domain/zone/{zoneName}/history` — List restore points
- `GET /domain/zone/{zoneName}/history/{creationDate}` — Get a restore point
- `POST /domain/zone/{zoneName}/history/{creationDate}/restore` — Restore the zone

## List restore points

`GET /1.0/domain/zone/{zoneName}/history`

Link: https://developers.eu.ovhcloud.com/reference/network/dns/history/#get-domain-zone-zonename-history

**Status:** Stable production version  
**IAM actions:** `dnsZone:apiovh:history/get`

Returns the creation dates of the zone restore points. Can be filtered by a creation date range.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `creationDate.from` | query | string (date-time) |  | Filter using the value of creationDate property (>=) |
| `creationDate.to` | query | string (date-time) |  | Filter using the value of creationDate property (<=) |
| `zoneName` | path | string | yes | Zone name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | string (date-time)[] | successful operation |

```json
[
  "2024-01-01T12:00:00Z"
]
```

### Example

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

# 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("/domain/zone/{zoneName}/history");

print_r($result);
?>
```

## Get a restore point

`GET /1.0/domain/zone/{zoneName}/history/{creationDate}`

Link: https://developers.eu.ovhcloud.com/reference/network/dns/history/#get-domain-zone-zonename-history-creationdate

**Status:** Stable production version  
**IAM actions:** `dnsZone:apiovh:history/get`

Returns a restore point: its creation date and the URL of the saved zone file.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `creationDate` | path | string (date-time) | yes | Creation date |
| `zoneName` | path | string | yes | Zone name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | domain.zone.ZoneRestorePoint | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `creationDate` | string (date-time) | read-only | The date of backup creation |
| `zoneFileUrl` | string | read-only | The URL of the saved zone at this date |

```json
{
  "creationDate": "2024-01-01T12:00:00Z",
  "zoneFileUrl": "string"
}
```

### Example

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

# 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("/domain/zone/{zoneName}/history/{creationDate}");

print_r($result);
?>
```

## Restore the zone

`POST /1.0/domain/zone/{zoneName}/history/{creationDate}/restore`

Link: https://developers.eu.ovhcloud.com/reference/network/dns/history/#post-domain-zone-zonename-history-creationdate-restore

**Status:** Stable production version  
**IAM actions:** `dnsZone:apiovh:history/restore`

Restores the zone to the selected restore point and returns the task.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `creationDate` | path | string (date-time) | yes | Creation date |
| `zoneName` | path | string | yes | Zone name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | domain.zone.Task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `canAccelerate` | boolean | read-only | Can accelerate the task |
| `canCancel` | boolean | read-only | Can cancel the task |
| `canRelaunch` | boolean | read-only | Can relaunch the task |
| `comment` | string | read-only | Comment about the task |
| `creationDate` | string (date-time) | read-only | Creation date of the task |
| `doneDate` | string (date-time) | read-only | Done date of the task |
| `function` | domain.TaskFunctionEnum | read-only | Function of the task — one of `DnsAnycastActivate`, `DnsAnycastDeactivate`, `DnssecDisable`, `DnssecEnable`, `DnssecResigning`, `DnssecRollKsk`, `DnssecRollZsk`, `ZoneCheck`, `ZoneCreate`, `ZoneCut`, `ZoneDelete`, `ZoneImport`, … |
| `id` | integer | read-only | Id of the task |
| `lastUpdate` | string (date-time) | read-only | Last update date of the task |
| `status` | domain.TaskStatusEnum | read-only | Status of the task — one of `cancelled`, `doing`, `done`, `error`, `problem`, `todo` |
| `todoDate` | string (date-time) | read-only | Todo date of the task |

```json
{
  "canAccelerate": true,
  "canCancel": true,
  "canRelaunch": true,
  "comment": "string",
  "creationDate": "2024-01-01T12:00:00Z",
  "doneDate": "2024-01-01T12:00:00Z",
  "function": "DnsAnycastActivate",
  "id": 0,
  "lastUpdate": "2024-01-01T12:00:00Z",
  "status": "cancelled",
  "todoDate": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/domain/zone/{zoneName}/history/{creationDate}/restore" \
  -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.post("/domain/zone/{zoneName}/history/{creationDate}/restore")

# 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->post("/domain/zone/{zoneName}/history/{creationDate}/restore");

print_r($result);
?>
```
