> 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/patch-protect/website-protection/switch-patch-protect-for-websites/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.docs.modulards.com/_mcp/server. # Switch Patch & Protect for websites POST https://api.modulards.com/api/public/v1/patchstack-services/bulk Content-Type: application/json Switches Patch & Protect on or off for the websites you list in `sites`. Use it to protect a group of websites, or to remove the protection from them. Every protected website is billed. The add-on is metered per website and per month, with no websites included in the plan, so enabling it here adds to the organization's invoice. Without the add-on subscribed the call is refused and the user enables it from the Modular DS dashboard, after which the same request goes through: an integration never buys it. Switching on installs the security plugin on WordPress; switching off removes it and leaves the website unprotected. Both take time: It creates one site action per website that passes the checks. The work finishes later: see [Writes and asynchronous operations](https://api.docs.modulards.com/writes-and-asynchronous-operations). Follow the site actions with "List site actions". Websites that cannot be processed are reported in `meta.skipped`, each with a `reason_code` and a message, and do not fail the call. A website is skipped when it is not connected (`SITE_UNREACHABLE`), when it is being restored or already has a switch running (`CONFLICT`), or when it is already in the state you asked for (`ALREADY_APPLIED`). Ids outside your reach come back as `PERMISSION_DENIED` (with a null `site_name`) instead of being dropped silently. **Body** - `sites` (array of integers, required): ids of the websites to act on, 1 to 50. - `status` (`enabled` or `disabled`, required): the state to set. **Errors** - **409**: the organization has no Patch & Protect subscription. The message reads "This organization has no Patch & Protect subscription. Enable the add-on from the Modular DS dashboard first." Reference: https://api.docs.modulards.com/modular-ds-public-api/patch-protect/website-protection/switch-patch-protect-for-websites ## Authentication - `Authorization` header (bearer token, required) — Personal access token created in the Modular DS dashboard; read-only tokens can only call GET endpoints. ## Request ### Body (application/json) This endpoint expects an object. - `sites` (list of double, optional) - `status` (string, optional) ## Response ### 202 202 - One website switched on, one skipped - `data` (list of ApiPublicV1PatchstackServicesBulkPostResponsesContentApplicationJsonSchemaDataItems, optional) - `jsonapi` (ApiPublicV1PatchstackServicesBulkPostResponsesContentApplicationJsonSchemaJsonapi, optional) - `meta` (ApiPublicV1PatchstackServicesBulkPostResponsesContentApplicationJsonSchemaMeta, optional) ## Types ### ApiPublicV1PatchstackServicesBulkPostResponsesContentApplicationJsonSchemaDataItems - `attributes` (ApiPublicV1PatchstackServicesBulkPostResponsesContentApplicationJsonSchemaDataItemsAttributes, optional) - `id` (string, optional) - `links` (ApiPublicV1PatchstackServicesBulkPostResponsesContentApplicationJsonSchemaDataItemsLinks, optional) - `type` (string, optional) ### ApiPublicV1PatchstackServicesBulkPostResponsesContentApplicationJsonSchemaJsonapi - `version` (string, optional) ### ApiPublicV1PatchstackServicesBulkPostResponsesContentApplicationJsonSchemaMeta - `skipped` (list of ApiPublicV1PatchstackServicesBulkPostResponsesContentApplicationJsonSchemaMetaSkippedItems, optional) ### ApiPublicV1PatchstackServicesBulkPostResponsesContentApplicationJsonSchemaDataItemsAttributes - `completed_at` (any, optional, nullable) - `created_at` (string, optional) - `created_by` (double, optional) - `origin` (string, optional) - `site_id` (double, optional) - `started_at` (any, optional, nullable) - `status` (string, optional) - `type` (string, optional) - `updated_at` (string, optional) ### ApiPublicV1PatchstackServicesBulkPostResponsesContentApplicationJsonSchemaDataItemsLinks - `self` (string, optional) ### ApiPublicV1PatchstackServicesBulkPostResponsesContentApplicationJsonSchemaMetaSkippedItems - `message` (string, optional) — Sentence explaining the reason. - `reason_code` (string, optional) — Why it was skipped, for example `PERMISSION_DENIED`. - `site_action_id` (integer, optional, nullable) — Always null for a skipped website: no site action was started. - `site_id` (integer, optional, nullable) — Id of the website that was skipped; null when the entry is not about a website. - `site_name` (string, optional, nullable) — Name of the skipped website, when known. ## Examples ### 202 - One website switched on, one skipped **Response** ```json { "data": [ { "attributes": { "completed_at": null, "created_at": "2026-09-24T15:00:58.000000Z", "created_by": 1, "origin": "agent", "site_id": 2, "started_at": null, "status": "pending", "type": "security.patchstack.create", "updated_at": "2026-09-24T15:00:58.000000Z" }, "id": "1", "links": { "self": "https://api.modulards.com/api/public/v1/site-actions/1" }, "type": "site-actions" } ], "jsonapi": { "version": "1.1" }, "meta": { "skipped": [ { "message": "This website is not connected; connect it first.", "reason_code": "SITE_UNREACHABLE", "site_action_id": null, "site_id": 3, "site_name": "old.example.com" } ] } } ``` **SDK Code** ```python 202 - One website switched on, one skipped import requests url = "https://api.modulards.com/api/public/v1/patchstack-services/bulk" headers = {"Authorization": "Bearer "} response = requests.post(url, headers=headers) print(response.json()) ``` ```javascript 202 - One website switched on, one skipped const url = 'https://api.modulards.com/api/public/v1/patchstack-services/bulk'; 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 202 - One website switched on, one skipped package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.modulards.com/api/public/v1/patchstack-services/bulk" 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 202 - One website switched on, one skipped require 'uri' require 'net/http' url = URI("https://api.modulards.com/api/public/v1/patchstack-services/bulk") 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 202 - One website switched on, one skipped import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.modulards.com/api/public/v1/patchstack-services/bulk") .header("Authorization", "Bearer ") .asString(); ``` ```php 202 - One website switched on, one skipped request('POST', 'https://api.modulards.com/api/public/v1/patchstack-services/bulk', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp 202 - One website switched on, one skipped using RestSharp; var client = new RestClient("https://api.modulards.com/api/public/v1/patchstack-services/bulk"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift 202 - One website switched on, one skipped import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.modulards.com/api/public/v1/patchstack-services/bulk")! 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() ``` ### Switch Patch & Protect for websites **Request** ```json { "sites": [ 2, 3 ], "status": "enabled" } ``` **Response** ```json { "data": [ { "attributes": { "completed_at": null, "created_at": "2026-09-24T15:00:58.000000Z", "created_by": 1, "origin": "agent", "site_id": 2, "started_at": null, "status": "pending", "type": "security.patchstack.create", "updated_at": "2026-09-24T15:00:58.000000Z" }, "id": "1", "links": { "self": "https://api.modulards.com/api/public/v1/site-actions/1" }, "type": "site-actions" } ], "jsonapi": { "version": "1.1" }, "meta": { "skipped": [ { "message": "This website is not connected; connect it first.", "reason_code": "SITE_UNREACHABLE", "site_action_id": null, "site_id": 3, "site_name": "old.example.com" } ] } } ``` **SDK Code** ```python Switch Patch & Protect for websites import requests url = "https://api.modulards.com/api/public/v1/patchstack-services/bulk" payload = { "sites": [2, 3], "status": "enabled" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Switch Patch & Protect for websites const url = 'https://api.modulards.com/api/public/v1/patchstack-services/bulk'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"sites":[2,3],"status":"enabled"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Switch Patch & Protect for websites package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.modulards.com/api/public/v1/patchstack-services/bulk" payload := strings.NewReader("{\n \"sites\": [\n 2,\n 3\n ],\n \"status\": \"enabled\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Switch Patch & Protect for websites require 'uri' require 'net/http' url = URI("https://api.modulards.com/api/public/v1/patchstack-services/bulk") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"sites\": [\n 2,\n 3\n ],\n \"status\": \"enabled\"\n}" response = http.request(request) puts response.read_body ``` ```java Switch Patch & Protect for websites import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.modulards.com/api/public/v1/patchstack-services/bulk") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"sites\": [\n 2,\n 3\n ],\n \"status\": \"enabled\"\n}") .asString(); ``` ```php Switch Patch & Protect for websites request('POST', 'https://api.modulards.com/api/public/v1/patchstack-services/bulk', [ 'body' => '{ "sites": [ 2, 3 ], "status": "enabled" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Switch Patch & Protect for websites using RestSharp; var client = new RestClient("https://api.modulards.com/api/public/v1/patchstack-services/bulk"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"sites\": [\n 2,\n 3\n ],\n \"status\": \"enabled\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Switch Patch & Protect for websites import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "sites": [2, 3], "status": "enabled" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.modulards.com/api/public/v1/patchstack-services/bulk")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data 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() ```