> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api.docs.modulards.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.docs.modulards.com/_mcp/server.

# Sync contacts

POST https://api.modulards.com/api/public/v1/alerts/{alert_id}/contacts/sync

Associates an explicit selection of Contacts with the configuration; adds to the existing selection, never removes one. Answers **200** with `meta.status`, `meta.updated` and `meta.skipped`, the same shape as \"Sync websites\" but the rows carry `contact_id` and no website (`site_id`/`site_name` are `null`).\n\n**Body** (JSON):\n- `contacts` (array of Contact ids, required, 1 to 50), validated for existence only - a Client id fails, exactly like the dashboard's replacement.\n\nA Contact already associated is answered in `meta.skipped` with `reason_code` `ALREADY_APPLIED`.\n\nRequires a full-access token (read-only tokens answer 403). Body validation runs before authorization: a foreign configuration with an invalid body (e.g. missing `contacts`) answers 422; only a foreign configuration with a valid body answers 404.

Reference: https://api.docs.modulards.com/modular-ds-public-api/notification-configurations/sync-contacts

## 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)

## 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 any, optional)
- `status` (string, optional)
- `updated` (list of ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaMetaUpdatedItems, optional)

### ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaErrorsItems

- `detail` (string, optional)
- `source` (ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaErrorsItemsSource, optional)
- `status` (string, optional)
- `title` (string, optional)

### ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaMetaUpdatedItems

- `contact_id` (double, optional)
- `site_id` (any, optional, nullable)
- `site_name` (any, optional, nullable)

### ApiPublicV1AlertsAlertIdContactsSyncPostResponsesContentApplicationJsonSchemaErrorsItemsSource

- `parameter` (string, optional)

## Examples

**Response**

```json
{
  "jsonapi": {
    "version": "1.1"
  },
  "meta": {
    "skipped": [],
    "status": "applied",
    "updated": [
      {
        "contact_id": 7,
        "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 <token>"}

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 <token>'}};

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 <token>")

	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 <token>'

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<String> response = Unirest.post("https://api.modulards.com/api/public/v1/alerts/alert_id/contacts/sync")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php 200 - Contact added, one skipped
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.modulards.com/api/public/v1/alerts/alert_id/contacts/sync', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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 <token>");
IRestResponse response = client.Execute(request);
```

```swift 200 - Contact added, one skipped
import Foundation

let headers = ["Authorization": "Bearer <token>"]

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()
```