> 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.

# Assign websites to a Broken Links Checker global configuration

POST https://api.modulards.com/api/public/v1/preset-broken-links/{preset_broken_link}/sites/sync
Content-Type: application/json

Assigns the websites you list in `sites` to one Broken Links Checker global configuration. The change is immediate: the answer lists the websites that changed and the ones left out, so there is nothing to follow up.

What happens to each website:
- A website with no configuration gets this one. A website that used another one moves to this one and takes its schedule.
- Every assigned website is left with automatic scans enabled and its next scan scheduled, even if it was paused. To change the configuration of one website and keep it paused, use "Update a website's Broken Links Checker settings" instead.
- Websites you do not list are never unassigned: a website leaves a configuration by moving to another one.
- A website that already uses this configuration (`ALREADY_APPLIED`), or that your token cannot reach (`PERMISSION_DENIED`, with a null `site_name`), is reported in `meta.skipped` with a `reason_code` and a message instead of failing the call.

Each website in `meta.updated` carries `site_preset_broken_link_id`, the id that "Retrieve a website's Broken Links Checker settings" and "Update a website's Broken Links Checker settings" take.

**Body**
- `sites` (array of integers, required): ids of the websites to act on, 1 to 50.

**Errors**
- **422**: an id that is not a website.

Reference: https://api.docs.modulards.com/modular-ds-public-api/broken-links-checker/broken-links-global-configurations/assign-websites-to-a-broken-links-checker-global-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

- `preset_broken_link` (string, required)

### Body (application/json)

This endpoint expects an object.

- `sites` (list of double, optional)

## Response

### 200

200 - Websites assigned, one skipped

- `jsonapi` (ApiPublicV1PresetBrokenLinksPresetBrokenLinkSitesSyncPostResponsesContentApplicationJsonSchemaJsonapi, optional)
- `meta` (ApiPublicV1PresetBrokenLinksPresetBrokenLinkSitesSyncPostResponsesContentApplicationJsonSchemaMeta, optional)

## Types

### ApiPublicV1PresetBrokenLinksPresetBrokenLinkSitesSyncPostResponsesContentApplicationJsonSchemaJsonapi

- `version` (string, optional)

### ApiPublicV1PresetBrokenLinksPresetBrokenLinkSitesSyncPostResponsesContentApplicationJsonSchemaMeta

- `skipped` (list of ApiPublicV1PresetBrokenLinksPresetBrokenLinkSitesSyncPostResponsesContentApplicationJsonSchemaMetaSkippedItems, optional)
- `status` (enum, optional) — Outcome of the call: applied when at least one website changed, skipped when none did.
  - Allowed values: `applied`, `skipped`
- `updated` (list of ApiPublicV1PresetBrokenLinksPresetBrokenLinkSitesSyncPostResponsesContentApplicationJsonSchemaMetaUpdatedItems, optional)

### ApiPublicV1PresetBrokenLinksPresetBrokenLinkSitesSyncPostResponsesContentApplicationJsonSchemaMetaSkippedItems

- `message` (string, optional) — Human-readable explanation.
- `reason_code` (enum, optional) — Why it was left out: ALREADY_APPLIED or PERMISSION_DENIED.
  - Allowed values: `ALREADY_APPLIED`, `PERMISSION_DENIED`
- `site_id` (integer, optional) — Id of a website left out.
- `site_name` (string, optional, nullable) — Name of that website; null when the id is outside your token's reach.
- `site_preset_broken_link_id` (integer, optional, nullable) — The website's settings id when it has one; null otherwise.

### ApiPublicV1PresetBrokenLinksPresetBrokenLinkSitesSyncPostResponsesContentApplicationJsonSchemaMetaUpdatedItems

- `site_id` (integer, optional) — Id of a website that changed.
- `site_name` (string, optional) — Name of that website.
- `site_preset_broken_link_id` (integer, optional) — Id of the website's Broken Links Checker settings, the id "Retrieve a website's Broken Links Checker settings" takes.

## Examples

### 200 - Websites assigned, one skipped

**Response**

```json
{
  "jsonapi": {
    "version": "1.1"
  },
  "meta": {
    "skipped": [
      {
        "message": "This website already uses this Broken Links Checker global configuration.",
        "reason_code": "ALREADY_APPLIED",
        "site_id": 12,
        "site_name": "Already there",
        "site_preset_broken_link_id": 880
      }
    ],
    "status": "applied",
    "updated": [
      {
        "site_id": 34,
        "site_name": "New shop",
        "site_preset_broken_link_id": 901
      }
    ]
  }
}
```

**SDK Code**

```python 200 - Websites assigned, one skipped
import requests

url = "https://api.modulards.com/api/public/v1/preset-broken-links/preset_broken_link/sites/sync"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript 200 - Websites assigned, one skipped
const url = 'https://api.modulards.com/api/public/v1/preset-broken-links/preset_broken_link/sites/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 - Websites assigned, one skipped
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.modulards.com/api/public/v1/preset-broken-links/preset_broken_link/sites/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 - Websites assigned, one skipped
require 'uri'
require 'net/http'

url = URI("https://api.modulards.com/api/public/v1/preset-broken-links/preset_broken_link/sites/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 - Websites assigned, 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/preset-broken-links/preset_broken_link/sites/sync")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.modulards.com/api/public/v1/preset-broken-links/preset_broken_link/sites/sync', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp 200 - Websites assigned, one skipped
using RestSharp;

var client = new RestClient("https://api.modulards.com/api/public/v1/preset-broken-links/preset_broken_link/sites/sync");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift 200 - Websites assigned, one skipped
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.modulards.com/api/public/v1/preset-broken-links/preset_broken_link/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()
```

### Assign websites to a Broken Links Checker global configuration

**Request**

```json
{
  "sites": [
    12,
    34
  ]
}
```

**Response**

```json
{
  "jsonapi": {
    "version": "1.1"
  },
  "meta": {
    "skipped": [
      {
        "message": "This website already uses this Broken Links Checker global configuration.",
        "reason_code": "ALREADY_APPLIED",
        "site_id": 12,
        "site_name": "Already there",
        "site_preset_broken_link_id": 880
      }
    ],
    "status": "applied",
    "updated": [
      {
        "site_id": 34,
        "site_name": "New shop",
        "site_preset_broken_link_id": 901
      }
    ]
  }
}
```

**SDK Code**

```python Assign websites to a Broken Links Checker global configuration
import requests

url = "https://api.modulards.com/api/public/v1/preset-broken-links/preset_broken_link/sites/sync"

payload = { "sites": [12, 34] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Assign websites to a Broken Links Checker global configuration
const url = 'https://api.modulards.com/api/public/v1/preset-broken-links/preset_broken_link/sites/sync';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', '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 Assign websites to a Broken Links Checker global configuration
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.modulards.com/api/public/v1/preset-broken-links/preset_broken_link/sites/sync"

	payload := strings.NewReader("{\n  \"sites\": [\n    12,\n    34\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	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 Assign websites to a Broken Links Checker global configuration
require 'uri'
require 'net/http'

url = URI("https://api.modulards.com/api/public/v1/preset-broken-links/preset_broken_link/sites/sync")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"sites\": [\n    12,\n    34\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Assign websites to a Broken Links Checker global configuration
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.modulards.com/api/public/v1/preset-broken-links/preset_broken_link/sites/sync")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"sites\": [\n    12,\n    34\n  ]\n}")
  .asString();
```

```php Assign websites to a Broken Links Checker global configuration
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.modulards.com/api/public/v1/preset-broken-links/preset_broken_link/sites/sync', [
  'body' => '{
  "sites": [
    12,
    34
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Assign websites to a Broken Links Checker global configuration
using RestSharp;

var client = new RestClient("https://api.modulards.com/api/public/v1/preset-broken-links/preset_broken_link/sites/sync");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
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 Assign websites to a Broken Links Checker global configuration
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "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/preset-broken-links/preset_broken_link/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()
```