Development Document

Purge Download PDF Document


Request URL: cache/refresh (POST)

Endpoint Domain Name:
Endpoint Version: v2

Endpoint Description

Use this API to purge cached content on the BaishanCloud CDN network.

Notice: Each user account can purge up to 10,000 URLs and 1,000 directories per day. Each purge request processes and finishes within seconds. The request rate limit is specified in the X-Ratelimit response headers, see details in the Response Header section below.
Notice: Historical purge statuses will only be kept for a month. Please make sure to track or record the statuses within the timeline.

API Parameters

Notice: Please request the API token from your account team.

Request Parameters (POST)

Supported request data formats: form-data, x-www-form-urlencoded, and json.

ParameterData TypeRequirementDescription
urlsarrayRequiredList of URLs or directories that need to be purged. 500 URLs maximum.
typestringRequiredThe URL type that used above. Directory: dir; URL: url.

Sample Request:

curl -X POST ""\
    -H "Content-Type: application/json"\
    -d '{"urls":["http:\/\/\/resources\/abc\/images\/logo.png","http:\/\/\/theme\/bsc1.7\/images\/username-caret.png","http:\/\/\/resources\/dfas\/images\/bsc-icons.png","http:\/\/\/resources\/rew\/images\/body-bg.jpg"],"type":"url"}'

Sample Response

Json format.

    "code": 0,  //code means success
    "data": {
        "task_id": "2400003",//The task ID of this purge request, required for url/dir purge status lookup
        "count": 4 //The number of URLs successfully submitted
        //err_urls: //err_urls: indicates one of the errors below:

        //1. Misformatted URL
        //2. URL contains a hostname that’s not yours
        //3. The target domain or config is no longer active

Response Header

HTTP/1.0 200 OK
Api-Id:                  70944777
Content-Type:            application/json; charset=utf-8
X-Ratelimit-Grad:      minute  //API Rate limit time unit (minute/hour/day)
X-Ratelimit-Limit:     150  //Maximum number of URLs per time unit
X-Ratelimit-Remaining: 99  //Remaining number of URLs in this time unit
X-Retry-After:         14  // The rate limit resets in xx seconds
X-Refresh-Url-Remaining: 9996 // Number of url/dir purge requests per day (When purging urls =X-Refresh-Url-Remaining, directories = X-Refresh-Dir-Remaining)

HTTP Status Codes

Error CodeDescription
404Bad request URLs.
401Authorization Error: Invalid token or lack of access.
400Bad request parameters.
5xxPlease contact your account team.
CopyRight © 2015-2022 BaishanCloud . All Rights Reserved.