> 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-contacts/add-contacts-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 contacts to a notification configuration POST https://api.modulards.com/api/public/v1/alerts/{alert_id}/contacts/sync Content-Type: application/json Adds the contacts you list in `contacts` to a notification configuration, so they receive its notifications. It only adds: contacts already in the configuration stay, and none is ever removed. The answer arrives at once, in the same form as "Add websites to a notification configuration" but with contacts in place of websites. A contact already in the configuration is reported in `meta.skipped` with the `reason_code` `ALREADY_APPLIED`. **Body** - `contacts` (array of integers, required): ids of the contacts to add, 1 to 50. Each must be an existing contact; a client id is refused. **Errors** - **422**: `contacts` is missing, empty, has more than 50 ids or contains an id that is not a contact. 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-contacts/add-contacts-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. - `contacts` (list of double, optional) ## Response ### 200 200 - Contact added, one skipped - `jsonapi` (ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaJsonapi, optional) - `meta` (ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaMeta, optional) ## Errors ### 422 Unprocessable Entity Error 422 - Contacts over the 50 limit - `errors` (list of ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaErrorsItems, optional) - `jsonapi` (ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaJsonapi, optional) ## Types ### ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaJsonapi - `version` (string, optional) ### ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaMeta - `skipped` (list of ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaMetaSkippedItems, optional) - `status` (enum, optional) — `applied` when at least one entry changed, `skipped` when none did. - Allowed values: `applied`, `skipped` - `updated` (list of ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaMetaUpdatedItems, optional) ### ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaErrorsItems - `detail` (string, optional) - `source` (ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaErrorsItemsSource, optional) - `status` (string, optional) - `title` (string, optional) ### ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaMetaSkippedItems - `contact_id` (integer, optional, nullable) — Id of the contact that was skipped. - `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. Always null here. - `site_name` (string, optional, nullable) — Always null here. ### ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaMetaUpdatedItems - `contact_id` (integer, optional) — Id of the contact that changed. - `site_id` (integer, optional, nullable) — Id of the website that changed. Always null here. - `site_name` (string, optional, nullable) — Name of the website that changed. Always null here. ### ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaErrorsItemsSource - `parameter` (string, optional) ## Examples ### 200 - Contact added, one skipped **Response** ```json { "jsonapi": { "version": "1.1" }, "meta": { "skipped": [ { "contact_id": 7, "message": "This contact already receives this notification configuration.", "reason_code": "ALREADY_APPLIED", "site_id": null, "site_name": null } ], "status": "applied", "updated": [ { "contact_id": 8, "site_id": null, "site_name": null } ] } } ``` **SDK Code** ```python 200 - Contact added, one skipped import requests url = "https://api.modulards.com/api/public/v1/alerts/alert_id/contacts/sync" headers = {"Authorization": "Bearer "} response = requests.post(url, headers=headers) print(response.json()) ``` ```javascript 200 - Contact added, one skipped const url = 'https://api.modulards.com/api/public/v1/alerts/alert_id/contacts/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 - Contact added, one skipped package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.modulards.com/api/public/v1/alerts/alert_id/contacts/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 - Contact added, one skipped require 'uri' require 'net/http' url = URI("https://api.modulards.com/api/public/v1/alerts/alert_id/contacts/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 - Contact 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/contacts/sync") .header("Authorization", "Bearer ") .asString(); ``` ```php 200 - Contact added, one skipped request('POST', 'https://api.modulards.com/api/public/v1/alerts/alert_id/contacts/sync', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp 200 - Contact added, one skipped using RestSharp; var client = new RestClient("https://api.modulards.com/api/public/v1/alerts/alert_id/contacts/sync"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift 200 - Contact 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/contacts/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 contacts to a notification configuration **Request** ```json { "contacts": [ 7, 8 ] } ``` **Response** ```json { "jsonapi": { "version": "1.1" }, "meta": { "skipped": [ { "contact_id": 7, "message": "This contact already receives this notification configuration.", "reason_code": "ALREADY_APPLIED", "site_id": null, "site_name": null } ], "status": "applied", "updated": [ { "contact_id": 8, "site_id": null, "site_name": null } ] } } ``` **SDK Code** ```python Add contacts to a notification configuration import requests url = "https://api.modulards.com/api/public/v1/alerts/alert_id/contacts/sync" payload = { "contacts": [7, 8] } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Add contacts to a notification configuration const url = 'https://api.modulards.com/api/public/v1/alerts/alert_id/contacts/sync'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"contacts":[7,8]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Add contacts 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/contacts/sync" payload := strings.NewReader("{\n \"contacts\": [\n 7,\n 8\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 contacts to a notification configuration require 'uri' require 'net/http' url = URI("https://api.modulards.com/api/public/v1/alerts/alert_id/contacts/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 \"contacts\": [\n 7,\n 8\n ]\n}" response = http.request(request) puts response.read_body ``` ```java Add contacts 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/contacts/sync") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"contacts\": [\n 7,\n 8\n ]\n}") .asString(); ``` ```php Add contacts to a notification configuration request('POST', 'https://api.modulards.com/api/public/v1/alerts/alert_id/contacts/sync', [ 'body' => '{ "contacts": [ 7, 8 ] }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Add contacts to a notification configuration using RestSharp; var client = new RestClient("https://api.modulards.com/api/public/v1/alerts/alert_id/contacts/sync"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"contacts\": [\n 7,\n 8\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Add contacts to a notification configuration import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["contacts": [7, 8]] 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/contacts/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() ```