# Network › DNS › Tasks 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

> 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/network/dns/tasks/

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

## Operations

- `GET /domain/zone/{zoneName}/task` — List tasks
- `GET /domain/zone/{zoneName}/task/{id}` — Get a task
- `POST /domain/zone/{zoneName}/task/{id}/accelerate` — Accelerate a task
- `POST /domain/zone/{zoneName}/task/{id}/relaunch` — Relaunch a task
- `POST /domain/zone/{zoneName}/task/{id}/cancel` — Cancel a task

## List tasks

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

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

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

Returns the identifiers of the zone tasks. Can be filtered by function and status.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `function` | query | domain.TaskFunctionEnum |  | All functions from a dns task — one of `DnsAnycastActivate`, `DnsAnycastDeactivate`, `DnssecDisable`, `DnssecEnable`, `DnssecResigning`, `DnssecRollKsk`, `DnssecRollZsk`, `ZoneCheck`, `ZoneCreate`, `ZoneCut`, `ZoneDelete`, `ZoneImport`, … |
| `status` | query | domain.TaskStatusEnum |  | All statuses from a dns task — one of `cancelled`, `doing`, `done`, `error`, `problem`, `todo` |
| `zoneName` | path | string | yes | Zone name |

### Responses

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

```json
[
  0
]
```

### Example

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

# 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}/task");

print_r($result);
?>
```

## Get a task

`GET /1.0/domain/zone/{zoneName}/task/{id}`

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

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

Returns a task: function, status, dates, and whether it can be accelerated, canceled or relaunched.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `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 GET \
  "https://api.eu.ovhcloud.com/1.0/domain/zone/{zoneName}/task/{id}" \
  -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}/task/{id}")

# 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}/task/{id}");

print_r($result);
?>
```

## Accelerate a task

`POST /1.0/domain/zone/{zoneName}/task/{id}/accelerate`

Link: https://developers.eu.ovhcloud.com/reference/network/dns/tasks/#post-domain-zone-zonename-task-id-accelerate

**Status:** Stable production version  
**IAM actions:** `dnsZone:apiovh:task/accelerate`

Accelerates a task. Only possible when `canAccelerate` is true on the task.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `zoneName` | path | string | yes | Zone name |

### Responses

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

### Example

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

# 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}/task/{id}/accelerate");

print_r($result);
?>
```

## Relaunch a task

`POST /1.0/domain/zone/{zoneName}/task/{id}/relaunch`

Link: https://developers.eu.ovhcloud.com/reference/network/dns/tasks/#post-domain-zone-zonename-task-id-relaunch

**Status:** Stable production version  
**IAM actions:** `dnsZone:apiovh:task/relaunch`

Relaunches a task. Only possible when `canRelaunch` is true on the task.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `zoneName` | path | string | yes | Zone name |

### Responses

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

### Example

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

# 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}/task/{id}/relaunch");

print_r($result);
?>
```

## Cancel a task

`POST /1.0/domain/zone/{zoneName}/task/{id}/cancel`

Link: https://developers.eu.ovhcloud.com/reference/network/dns/tasks/#post-domain-zone-zonename-task-id-cancel

**Status:** Stable production version  
**IAM actions:** `dnsZone:apiovh:task/cancel`

Cancels a task. Only possible when `canCancel` is true on the task.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `zoneName` | path | string | yes | Zone name |

### Responses

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

### Example

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

# 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}/task/{id}/cancel");

print_r($result);
?>
```
