> 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/notification-configurations/configuration-websites/add-websites-to-a-notification-configuration/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.docs.modulards.com/_mcp/server. # Add websites to a notification configuration POST https://api.modulards.com/api/public/v1/alerts/{alert_id}/sites/sync Content-Type: application/json Adds the websites you list in `sites` to a notification configuration. It only adds: websites already in the configuration stay, and none is ever removed. Use it to bring new websites under an existing configuration. The answer arrives at once, with nothing to follow. `meta.status` is `applied` when at least one website was added and `skipped` when none was. 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 as `ALREADY_APPLIED` when it is already in the configuration, and as `PERMISSION_DENIED` (with a null `site_name`) when your token cannot reach it. **Body** - `sites` (array of integers, required): ids of the websites to add, 1 to 50. Each must be an existing website. **Errors** - **422**: `sites` is missing, empty, has more than 50 ids or contains an id that is not a website. The body is checked before the configuration, so a configuration of another organization answers 404 only when the body is valid. Reference: https://api.docs.modulards.com/modular-ds-public-api/notification-configurations/configuration-websites/add-websites-to-a-notification-configuration ## 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 - `alert_id` (string, required) ### Body (application/json) This endpoint expects an object. - `sites` (list of double, optional) ## Response ### 200 200 - Websites added, one skipped - `jsonapi` (ApiPublicV1AlertsAlertIdSitesSyncPostResponsesContentApplicationJsonSchemaJsonapi, optional) - `meta` (ApiPublicV1AlertsAlertIdSitesSyncPostResponsesContentApplicationJsonSchemaMeta, optional) ## Errors ### 422 Unprocessable Entity Error 422 - Sites over the 50 limit - `errors` (list of ApiPublicV1AlertsAlertIdSitesSyncPostResponsesContentApplicationJsonSchemaErrorsItems, optional) - `jsonapi` (ApiPublicV1AlertsAlertIdSitesSyncPostResponsesContentApplicationJsonSchemaJsonapi, optional) ## Types ### ApiPublicV1AlertsAlertIdSitesSyncPostResponsesContentApplicationJsonSchemaJsonapi - `version` (string, optional) ### ApiPublicV1AlertsAlertIdSitesSyncPostResponsesContentApplicationJsonSchemaMeta - `skipped` (list of ApiPublicV1AlertsAlertIdSitesSyncPostResponsesContentApplicationJsonSchemaMetaSkippedItems, optional) - `status` (enum, optional) — `applied` when at least one entry changed, `skipped` when none did. - Allowed values: `applied`, `skipped` - `updated` (list of ApiPublicV1AlertsAlertIdSitesSyncPostResponsesContentApplicationJsonSchemaMetaUpdatedItems, optional) ### ApiPublicV1AlertsAlertIdSitesSyncPostResponsesContentApplicationJsonSchemaErrorsItems - `detail` (string, optional) - `source` (ApiPublicV1AlertsAlertIdSitesSyncPostResponsesContentApplicationJsonSchemaErrorsItemsSource, optional) - `status` (string, optional) - `title` (string, optional) ### ApiPublicV1AlertsAlertIdSitesSyncPostResponsesContentApplicationJsonSchemaMetaSkippedItems - `alert_id` (integer, optional, nullable) — Id of the notification configuration; null when the website is outside your reach. - `message` (string, optional) — Sentence explaining the reason. - `reason_code` (string, optional) — `ALREADY_APPLIED` or `PERMISSION_DENIED`. - `site_id` (integer, optional, nullable) — Id of the website that was skipped. - `site_name` (string, optional, nullable) — Name of the skipped website; null when it is outside your reach. ### ApiPublicV1AlertsAlertIdSitesSyncPostResponsesContentApplicationJsonSchemaMetaUpdatedItems - `alert_id` (integer, optional) — Id of the notification configuration. - `site_id` (integer, optional, nullable) — Id of the website that changed. - `site_name` (string, optional, nullable) — Name of the website that changed. ### ApiPublicV1AlertsAlertIdSitesSyncPostResponsesContentApplicationJsonSchemaErrorsItemsSource - `parameter` (string, optional) ## Examples ### 200 - Websites added, one skipped **Response** ```json { "jsonapi": { "version": "1.1" }, "meta": { "skipped": [ { "alert_id": 12, "message": "This website already uses this notification configuration.", "reason_code": "ALREADY_APPLIED", "site_id": 12, "site_name": "Already there" } ], "status": "applied", "updated": [ { "alert_id": 12, "site_id": 34, "site_name": "New shop" } ] } } ``` **SDK Code** ```python 200 - Websites added, one skipped import requests url = "https://api.modulards.com/api/public/v1/alerts/alert_id/sites/sync" headers = {"Authorization": "Bearer "} response = requests.post(url, headers=headers) print(response.json()) ``` ```javascript 200 - Websites added, one skipped const url = 'https://api.modulards.com/api/public/v1/alerts/alert_id/sites/sync'; 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 - Websites added, one skipped package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.modulards.com/api/public/v1/alerts/alert_id/sites/sync" 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 - Websites added, one skipped require 'uri' require 'net/http' url = URI("https://api.modulards.com/api/public/v1/alerts/alert_id/sites/sync") 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 - Websites added, 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/alerts/alert_id/sites/sync") .header("Authorization", "Bearer ") .asString(); ``` ```php 200 - Websites added, one skipped request('POST', 'https://api.modulards.com/api/public/v1/alerts/alert_id/sites/sync', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp 200 - Websites added, one skipped using RestSharp; var client = new RestClient("https://api.modulards.com/api/public/v1/alerts/alert_id/sites/sync"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift 200 - Websites added, one skipped import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.modulards.com/api/public/v1/alerts/alert_id/sites/sync")! 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() ``` ### Add websites to a notification configuration **Request** ```json { "sites": [ 12, 34 ] } ``` **Response** ```json { "jsonapi": { "version": "1.1" }, "meta": { "skipped": [ { "alert_id": 12, "message": "This website already uses this notification configuration.", "reason_code": "ALREADY_APPLIED", "site_id": 12, "site_name": "Already there" } ], "status": "applied", "updated": [ { "alert_id": 12, "site_id": 34, "site_name": "New shop" } ] } } ``` **SDK Code** ```python Add websites to a notification configuration import requests url = "https://api.modulards.com/api/public/v1/alerts/alert_id/sites/sync" payload = { "sites": [12, 34] } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Add websites to a notification configuration const url = 'https://api.modulards.com/api/public/v1/alerts/alert_id/sites/sync'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"sites":[12,34]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Add websites to a notification configuration package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.modulards.com/api/public/v1/alerts/alert_id/sites/sync" payload := strings.NewReader("{\n \"sites\": [\n 12,\n 34\n ]\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 Add websites to a notification configuration require 'uri' require 'net/http' url = URI("https://api.modulards.com/api/public/v1/alerts/alert_id/sites/sync") 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 12,\n 34\n ]\n}" response = http.request(request) puts response.read_body ``` ```java Add websites to a notification configuration import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.modulards.com/api/public/v1/alerts/alert_id/sites/sync") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"sites\": [\n 12,\n 34\n ]\n}") .asString(); ``` ```php Add websites to a notification configuration request('POST', 'https://api.modulards.com/api/public/v1/alerts/alert_id/sites/sync', [ 'body' => '{ "sites": [ 12, 34 ] }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Add websites to a notification configuration using RestSharp; var client = new RestClient("https://api.modulards.com/api/public/v1/alerts/alert_id/sites/sync"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"sites\": [\n 12,\n 34\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Add websites to a notification configuration import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["sites": [12, 34]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.modulards.com/api/public/v1/alerts/alert_id/sites/sync")! 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() ```