> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/cn/cdn/purge/purgeobjectcaches.md).

# PurgeObjectCaches

## 1. 接口描述

调用本接口用于刷新节点上的文件内容。被刷新的文件缓存将立即失效，新的请求将回源获取最新的文件，支持URL批量刷新。

## 2. 请求参数

以下请求参数列表仅列出了接口中需要的请求参数

| 参数名称        | 必选 | 类型              | 描述                                                                                               |
| ----------- | -- | --------------- | ------------------------------------------------------------------------------------------------ |
| objectType  | 否  | String          | [刷新任务类型](https://docs.console.zenlayer.com/api-reference/cn/cdn/datastructure.md#purgetypevalue) |
| objectPaths | 是  | Array of String | 需要刷新的文件或目录。                                                                                      |

## 3. 响应结果

| 参数名称      | 类型     | 描述                                         |
| --------- | ------ | ------------------------------------------ |
| requestId | String | 唯一请求 ID，每次请求都会返回。定位问题时需要提供该次请求的 requestId。 |
| taskId    | String | 刷新任务Id                                     |

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}

1. **缓存刷新**

```json
POST / HTTP/1.1
Host: console.zenlayer.com/api/v2/cdn
Content-Type: application/json
X-ZC-Action: PurgeObjectCaches
<Common Request Params>

Request:
{
  "objectType": "URL",
  "objectPaths": ["http://cdntest.zenlayer.com/dir/1.jpg", "http://cdntest.zenlayer.com/dir/2.jpg"]
}

Response:
{
  "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
  "response": {
    "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
    "taskId": "taskId-xxxxxx"
  }
}
```

{% endtab %}
{% endtabs %}

## 5. 错误码

下面包含业务逻辑中遇到的错误码，其他错误码见[公共错误码](https://docs.console.zenlayer.com/api-reference/cn/api-introduction/instruction/commonerrorcode.md)
