> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://api.docs.modulards.com/modular-ds-public-api/websites/maintenance/clear-a-website-s-cache/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.docs.modulards.com/_mcp/server. # Clear a website's cache POST https://api.modulards.com/api/public/v1/sites/{site}/cache-clear Asks WordPress to clear the website's cache. Use it after changes that visitors do not see yet. The request is queued and answered at once: it does not confirm that the cache was cleared, and it does not check the connection first. Repeating it is safe. There is no request body. Reference: https://api.docs.modulards.com/modular-ds-public-api/websites/maintenance/clear-a-website-s-cache ## Authentication - `Authorization` header (bearer token, required) — Personal access token created in the Modular DS dashboard; read-only tokens can only call GET endpoints. ## Request ### Path parameters - `site` (string, required) ## Response ### 200 200 - Cache clear requested - `jsonapi` (ApiPublicV1SitesSiteCacheClearPostResponsesContentApplicationJsonSchemaJsonapi, optional) - `meta` (ApiPublicV1SitesSiteCacheClearPostResponsesContentApplicationJsonSchemaMeta, optional) ## Types ### ApiPublicV1SitesSiteCacheClearPostResponsesContentApplicationJsonSchemaJsonapi - `version` (string, optional) ### ApiPublicV1SitesSiteCacheClearPostResponsesContentApplicationJsonSchemaMeta - `status` (enum, optional) — Always requested: the cache clear was queued, not confirmed. - Allowed values: `requested` ## Examples **Response** ```json { "jsonapi": { "version": "1.1" }, "meta": { "status": "requested" } } ``` **SDK Code** ```python 200 - Cache clear requested import requests url = "https://api.modulards.com/api/public/v1/sites/site/cache-clear" headers = {"Authorization": "Bearer "} response = requests.post(url, headers=headers) print(response.json()) ``` ```javascript 200 - Cache clear requested const url = 'https://api.modulards.com/api/public/v1/sites/site/cache-clear'; const options = {method: 'POST', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go 200 - Cache clear requested package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.modulards.com/api/public/v1/sites/site/cache-clear" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby 200 - Cache clear requested require 'uri' require 'net/http' url = URI("https://api.modulards.com/api/public/v1/sites/site/cache-clear") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` ```java 200 - Cache clear requested import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.modulards.com/api/public/v1/sites/site/cache-clear") .header("Authorization", "Bearer ") .asString(); ``` ```php 200 - Cache clear requested request('POST', 'https://api.modulards.com/api/public/v1/sites/site/cache-clear', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp 200 - Cache clear requested using RestSharp; var client = new RestClient("https://api.modulards.com/api/public/v1/sites/site/cache-clear"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift 200 - Cache clear requested import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.modulards.com/api/public/v1/sites/site/cache-clear")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```