# Network › CDN › Cache 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

> 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/network/cdn/cache/

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

## Operations

- `GET /cdn/dedicated/{serviceName}/domains/{domain}/cacheRules` — List cache rules
- `POST /cdn/dedicated/{serviceName}/domains/{domain}/cacheRules` — Create a cache rule
- `GET /cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}` — Get a cache rule
- `DELETE /cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}` — Delete a cache rule
- `PUT /cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}` — Update a cache rule
- `POST /cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}/flush` — Flush the cache of a rule
- `POST /cdn/dedicated/{serviceName}/domains/{domain}/flush` — Flush the domain cache

## List cache rules

`GET /1.0/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules`

Link: https://developers.eu.ovhcloud.com/reference/network/cdn/cache/#get-cdn-dedicated-servicename-domains-domain-cacherules

**Status:** Stable production version  
**IAM actions:** `cdn:apiovh:domains/cacheRules/get`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domain` | path | string | yes | Domain of this object |
| `fileMatch` | query | string |  | Filter the value of fileMatch property (like) |
| `serviceName` | path | string | yes | The internal name of your CDN offer |

### Responses

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

```json
[
  0
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules" \
  -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("/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules")

# 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("/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules");

print_r($result);
?>
```

## Create a cache rule

`POST /1.0/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules`

Link: https://developers.eu.ovhcloud.com/reference/network/cdn/cache/#post-cdn-dedicated-servicename-domains-domain-cacherules

**Status:** Stable production version  
**IAM actions:** `cdn:apiovh:domains/cacheRules/create`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domain` | path | string | yes | Domain of this object |
| `serviceName` | path | string | yes | The internal name of your CDN offer |

### Request body (required)

Type: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `cacheType` | cdnanycast.CacheRuleCacheTypeEnum | yes | Type of cache rule to add to the domain — one of `forceCache`, `noCache` |
| `fileMatch` | string | yes | File match for cache rule to add to the domain |
| `fileType` | cdnanycast.CacheRuleFileTypeEnum | yes | File type for cache rule to add to the domain — one of `extension`, `file`, `folder` |
| `ttl` | integer | yes | ttl for cache rule to add to the domain |

```json
{
  "cacheType": "forceCache",
  "fileMatch": "string",
  "fileType": "extension",
  "ttl": 0
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | cdnanycast.CacheRule | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `cacheRuleId` | integer | read-only | Id for this cache rule |
| `cacheType` | cdnanycast.CacheRuleCacheTypeEnum | read-only | All type a cache can be in — one of `forceCache`, `noCache` |
| `domain` | string | read-only |  |
| `fileMatch` | string | read-only |  |
| `fileType` | cdnanycast.CacheRuleFileTypeEnum | read-only | All states an anycast pool can be in — one of `extension`, `file`, `folder` |
| `status` | cdnanycast.CacheRuleStatusEnum |  | All states a status can be in — one of `creating`, `deleting`, `error`, `off`, `on`, `updating` |
| `ttl` | integer |  |  |

```json
{
  "cacheRuleId": 0,
  "cacheType": "forceCache",
  "domain": "string",
  "fileMatch": "string",
  "fileType": "extension",
  "status": "creating",
  "ttl": 0
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules" \
  -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
)

result = client.post("/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules",
	cacheType = None, # Type of cache rule to add to the domain (type: cdnanycast.CacheRuleCacheTypeEnum)
	fileMatch = None, # File match for cache rule to add to the domain (type: string)
	fileType = None, # File type for cache rule to add to the domain (type: cdnanycast.CacheRuleFileTypeEnum)
	ttl = None, # ttl for cache rule to add to the domain (type: long)
)

# 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("/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules", array(
	cacheType => null, // Type of cache rule to add to the domain (type: cdnanycast.CacheRuleCacheTypeEnum)
	fileMatch => null, // File match for cache rule to add to the domain (type: string)
	fileType => null, // File type for cache rule to add to the domain (type: cdnanycast.CacheRuleFileTypeEnum)
	ttl => null, // ttl for cache rule to add to the domain (type: long)
));

print_r($result);
?>
```

## Get a cache rule

`GET /1.0/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}`

Link: https://developers.eu.ovhcloud.com/reference/network/cdn/cache/#get-cdn-dedicated-servicename-domains-domain-cacherules-cacheruleid

**Status:** Stable production version  
**IAM actions:** `cdn:apiovh:domains/cacheRules/get`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cacheRuleId` | path | integer | yes | Id for this cache rule |
| `domain` | path | string | yes | Domain of this object |
| `serviceName` | path | string | yes | The internal name of your CDN offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | cdnanycast.CacheRule | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `cacheRuleId` | integer | read-only | Id for this cache rule |
| `cacheType` | cdnanycast.CacheRuleCacheTypeEnum | read-only | All type a cache can be in — one of `forceCache`, `noCache` |
| `domain` | string | read-only |  |
| `fileMatch` | string | read-only |  |
| `fileType` | cdnanycast.CacheRuleFileTypeEnum | read-only | All states an anycast pool can be in — one of `extension`, `file`, `folder` |
| `status` | cdnanycast.CacheRuleStatusEnum |  | All states a status can be in — one of `creating`, `deleting`, `error`, `off`, `on`, `updating` |
| `ttl` | integer |  |  |

```json
{
  "cacheRuleId": 0,
  "cacheType": "forceCache",
  "domain": "string",
  "fileMatch": "string",
  "fileType": "extension",
  "status": "creating",
  "ttl": 0
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}" \
  -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("/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}")

# 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("/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}");

print_r($result);
?>
```

## Delete a cache rule

`DELETE /1.0/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}`

Link: https://developers.eu.ovhcloud.com/reference/network/cdn/cache/#delete-cdn-dedicated-servicename-domains-domain-cacherules-cacheruleid

**Status:** Stable production version  
**IAM actions:** `cdn:apiovh:domains/cacheRules/delete`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cacheRuleId` | path | integer | yes | Id for this cache rule |
| `domain` | path | string | yes | Domain of this object |
| `serviceName` | path | string | yes | The internal name of your CDN offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | cdnanycast.Task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `comment` | string | read-only |  |
| `function` | cdnanycast.TaskFunctionEnum | read-only | All function CDN task can be — one of `flush`, `flushAll`, `generateSsl`, `installSsl`, `reinstallSsl`, `removeDomain`, `uninstallSsl`, `updateCacheRule` |
| `status` | cdnanycast.TaskStateEnum | read-only | All states a CDN task can be in — one of `cancelled`, `doing`, `done`, `error`, `todo` |
| `taskId` | integer | read-only |  |

```json
{
  "comment": "string",
  "function": "flush",
  "status": "cancelled",
  "taskId": 0
}
```

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/1.0/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}" \
  -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("/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}")

# 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("/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}");

print_r($result);
?>
```

## Update a cache rule

`PUT /1.0/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}`

Link: https://developers.eu.ovhcloud.com/reference/network/cdn/cache/#put-cdn-dedicated-servicename-domains-domain-cacherules-cacheruleid

**Status:** Stable production version  
**IAM actions:** `cdn:apiovh:domains/cacheRules/edit`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cacheRuleId` | path | integer | yes | Id for this cache rule |
| `domain` | path | string | yes | Domain of this object |
| `serviceName` | path | string | yes | The internal name of your CDN offer |

### Request body (required)

Type: `cdnanycast.CacheRule`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `cacheRuleId` | integer | read-only | Id for this cache rule |
| `cacheType` | cdnanycast.CacheRuleCacheTypeEnum | read-only | All type a cache can be in — one of `forceCache`, `noCache` |
| `domain` | string | read-only |  |
| `fileMatch` | string | read-only |  |
| `fileType` | cdnanycast.CacheRuleFileTypeEnum | read-only | All states an anycast pool can be in — one of `extension`, `file`, `folder` |
| `status` | cdnanycast.CacheRuleStatusEnum |  | All states a status can be in — one of `creating`, `deleting`, `error`, `off`, `on`, `updating` |
| `ttl` | integer |  |  |

```json
{
  "status": "creating",
  "ttl": 0
}
```

### Responses

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

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/1.0/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}" \
  -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: cdnanycast.CacheRule
result = client.put("/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}",
	status = None, #  (type: )
	ttl = None, #  (type: integer)
)

# 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: cdnanycast.CacheRule
$result = $ovh->put("/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}", array(
	status => null, //  (type: )
	ttl => null, //  (type: integer)
));

print_r($result);
?>
```

## Flush the cache of a rule

`POST /1.0/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}/flush`

Link: https://developers.eu.ovhcloud.com/reference/network/cdn/cache/#post-cdn-dedicated-servicename-domains-domain-cacherules-cacheruleid-flush

**Status:** Stable production version  
**IAM actions:** `cdn:apiovh:domains/cacheRules/flush`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cacheRuleId` | path | integer | yes | Id for this cache rule |
| `domain` | path | string | yes | Domain of this object |
| `serviceName` | path | string | yes | The internal name of your CDN offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | cdnanycast.Task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `comment` | string | read-only |  |
| `function` | cdnanycast.TaskFunctionEnum | read-only | All function CDN task can be — one of `flush`, `flushAll`, `generateSsl`, `installSsl`, `reinstallSsl`, `removeDomain`, `uninstallSsl`, `updateCacheRule` |
| `status` | cdnanycast.TaskStateEnum | read-only | All states a CDN task can be in — one of `cancelled`, `doing`, `done`, `error`, `todo` |
| `taskId` | integer | read-only |  |

```json
{
  "comment": "string",
  "function": "flush",
  "status": "cancelled",
  "taskId": 0
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}/flush" \
  -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("/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}/flush")

# 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("/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}/flush");

print_r($result);
?>
```

## Flush the domain cache

`POST /1.0/cdn/dedicated/{serviceName}/domains/{domain}/flush`

Link: https://developers.eu.ovhcloud.com/reference/network/cdn/cache/#post-cdn-dedicated-servicename-domains-domain-flush

**Status:** Stable production version  
**IAM actions:** `cdn:apiovh:domains/flush`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domain` | path | string | yes | Domain of this object |
| `serviceName` | path | string | yes | The internal name of your CDN offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | cdnanycast.Task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `comment` | string | read-only |  |
| `function` | cdnanycast.TaskFunctionEnum | read-only | All function CDN task can be — one of `flush`, `flushAll`, `generateSsl`, `installSsl`, `reinstallSsl`, `removeDomain`, `uninstallSsl`, `updateCacheRule` |
| `status` | cdnanycast.TaskStateEnum | read-only | All states a CDN task can be in — one of `cancelled`, `doing`, `done`, `error`, `todo` |
| `taskId` | integer | read-only |  |

```json
{
  "comment": "string",
  "function": "flush",
  "status": "cancelled",
  "taskId": 0
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/cdn/dedicated/{serviceName}/domains/{domain}/flush" \
  -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("/cdn/dedicated/{serviceName}/domains/{domain}/flush")

# 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("/cdn/dedicated/{serviceName}/domains/{domain}/flush");

print_r($result);
?>
```
