> 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 Malware Scanner global configuration

POST https://api.modulards.com/api/public/v1/preset-malware-scans/{preset_malware_scan}/sites/sync
Content-Type: application/json

Assigns the websites you list in `sites` to one Malware Scanner 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 Malware Scanner configuration gets this one, and the scanning provider registers it in the background. A website that used another one moves to this one and takes its tier (the premium tier is metered per website and per month, with no websites included in the plan); if it was already registered, its plan is updated with the provider.
- Every assigned website is left with scanning enabled, even if it was paused. To change the configuration of one website and keep it paused, use "Update a website's Malware Scanner 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_malware_scan_id`, the id that "Retrieve a website's Malware Scanner settings" and "Update a website's Malware Scanner settings" take.

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

**Errors**
- **403**: the configuration is premium and the organization has not subscribed the add-on. The same gate guards creating or updating one directly.
- **422**: an id that is not a website.

Reference: https://api.docs.modulards.com/modular-ds-public-api/malware-scanner/malware-scanner-global-configurations/assign-websites-to-a-malware-scanner-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_malware_scan` (string, required)

### Body (application/json)

This endpoint expects an object.

- `sites` (list of double, optional)

## Response

### 200

200 - Websites assigned, one skipped

- `jsonapi` (ApiPublicV1PresetMalwareScansPresetMalwareScanSitesSyncPostResponsesContentApplicationJsonSchemaJsonapi, optional)
- `meta` (ApiPublicV1PresetMalwareScansPresetMalwareScanSitesSyncPostResponsesContentApplicationJsonSchemaMeta, optional)

## Types

### ApiPublicV1PresetMalwareScansPresetMalwareScanSitesSyncPostResponsesContentApplicationJsonSchemaJsonapi

- `version` (string, optional)

### ApiPublicV1PresetMalwareScansPresetMalwareScanSitesSyncPostResponsesContentApplicationJsonSchemaMeta

- `skipped` (list of ApiPublicV1PresetMalwareScansPresetMalwareScanSitesSyncPostResponsesContentApplicationJsonSchemaMetaSkippedItems, 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 ApiPublicV1PresetMalwareScansPresetMalwareScanSitesSyncPostResponsesContentApplicationJsonSchemaMetaUpdatedItems, optional)

### ApiPublicV1PresetMalwareScansPresetMalwareScanSitesSyncPostResponsesContentApplicationJsonSchemaMetaSkippedItems

- `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_malware_scan_id` (integer, optional, nullable) — The website's settings id when it has one; null otherwise.

### ApiPublicV1PresetMalwareScansPresetMalwareScanSitesSyncPostResponsesContentApplicationJsonSchemaMetaUpdatedItems

- `site_id` (integer, optional) — Id of a website that changed.
- `site_name` (string, optional) — Name of that website.
- `site_preset_malware_scan_id` (integer, optional) — Id of the website's Malware Scanner settings, the id "Retrieve a website's Malware Scanner settings" takes.

## Examples

### 200 - Websites assigned, one skipped

**Response**

```json
{
  "jsonapi": {
    "version": "1.1"
  },
  "meta": {
    "skipped": [
      {
        "message": "This website already uses this Malware Scanner global configuration.",
        "reason_code": "ALREADY_APPLIED",
        "site_id": 102,
        "site_name": "Acme Blog",
        "site_preset_malware_scan_id": 731
      }
    ],
    "status": "applied",
    "updated": [
      {
        "site_id": 101,
        "site_name": "Acme Shop",
        "site_preset_malware_scan_id": 845
      }
    ]
  }
}
```

**SDK Code**

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

url = "https://api.modulards.com/api/public/v1/preset-malware-scans/preset_malware_scan/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-malware-scans/preset_malware_scan/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-malware-scans/preset_malware_scan/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-malware-scans/preset_malware_scan/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-malware-scans/preset_malware_scan/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-malware-scans/preset_malware_scan/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-malware-scans/preset_malware_scan/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-malware-scans/preset_malware_scan/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 Malware Scanner global configuration

**Request**

```json
{
  "sites": [
    101,
    102
  ]
}
```

**Response**

```json
{
  "jsonapi": {
    "version": "1.1"
  },
  "meta": {
    "skipped": [
      {
        "message": "This website already uses this Malware Scanner global configuration.",
        "reason_code": "ALREADY_APPLIED",
        "site_id": 102,
        "site_name": "Acme Blog",
        "site_preset_malware_scan_id": 731
      }
    ],
    "status": "applied",
    "updated": [
      {
        "site_id": 101,
        "site_name": "Acme Shop",
        "site_preset_malware_scan_id": 845
      }
    ]
  }
}
```

**SDK Code**

```python Assign websites to a Malware Scanner global configuration
import requests

url = "https://api.modulards.com/api/public/v1/preset-malware-scans/preset_malware_scan/sites/sync"

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

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

print(response.json())
```

```javascript Assign websites to a Malware Scanner global configuration
const url = 'https://api.modulards.com/api/public/v1/preset-malware-scans/preset_malware_scan/sites/sync';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"sites":[101,102]}'
};

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 Malware Scanner global configuration
package main

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

func main() {

	url := "https://api.modulards.com/api/public/v1/preset-malware-scans/preset_malware_scan/sites/sync"

	payload := strings.NewReader("{\n  \"sites\": [\n    101,\n    102\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 Malware Scanner global configuration
require 'uri'
require 'net/http'

url = URI("https://api.modulards.com/api/public/v1/preset-malware-scans/preset_malware_scan/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    101,\n    102\n  ]\n}"

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

```java Assign websites to a Malware Scanner 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-malware-scans/preset_malware_scan/sites/sync")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"sites\": [\n    101,\n    102\n  ]\n}")
  .asString();
```

```php Assign websites to a Malware Scanner global configuration
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

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

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

```csharp Assign websites to a Malware Scanner global configuration
using RestSharp;

var client = new RestClient("https://api.modulards.com/api/public/v1/preset-malware-scans/preset_malware_scan/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    101,\n    102\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Assign websites to a Malware Scanner global configuration
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["sites": [101, 102]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

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