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

# Update a component on websites

POST https://api.modulards.com/api/public/v1/components/{component}/upgrade
Content-Type: application/json

Updates one plugin, theme or WordPress version to its newest version on the websites you list in `sites`. By default it is a safe update: Modular DS takes a backup, updates, compares the website visually before and after, and rolls back automatically if the comparison fails. A direct update skips those safeguards. Use "Approve or roll back a safe update" to give your verdict on a safe update that waits for you; if nobody decides within 7 days of the moment it starts waiting, Modular DS approves it automatically.

It creates one site action per website that passes the checks. The work finishes later: see [Writes and asynchronous operations](https://api.docs.modulards.com/writes-and-asynchronous-operations). Follow the site actions with "List site actions". 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 direct update, and a safe update with `is_manual`, also add a warning to the answer. A website is skipped when it is not connected, does not have the component, hides its update notice, is already up to date, is a multisite sub-site, already has an action on this item or too many pending or running actions, or, for a safe update of a plugin, when the plugin is not active.

**Body**
- `sites` (array of integers, required): ids of the websites to act on, 1 to 50.
- `action` (`safe_upgrade` or `upgrade`, optional): `safe_upgrade` for a safe update, or `upgrade` for a direct update with no rollback. Default `safe_upgrade`.
- `is_manual` (boolean, optional): only with `safe_upgrade`: when `true`, each website stops after the update and waits for your verdict instead of being validated automatically, and is approved automatically if nobody decides within 7 days. Default `false`.
- `clean_cache` (boolean, optional): clear each website's cache after updating. Default: the Updater setting of your organization.
- `scheduled_at` (date-time, optional): when to run the update. It must be in the future and at most 14 days ahead; omit it to run now.

**Errors**
- **404**: the component is not installed on any of your websites.
- **422**: `sites` is invalid, `scheduled_at` is not in the future or more than 14 days ahead, or `is_manual` is sent with `action` `upgrade`.

Reference: https://api.docs.modulards.com/modular-ds-public-api/updater/components/update-a-component-on-websites

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

- `component` (string, required)

### Body (application/json)

This endpoint expects an object.

- `action` (string, optional)
- `sites` (list of double, optional)

## Response

### 202

202 Accepted - one upgrade launched, one website skipped

- `data` (list of ApiPublicV1ComponentsComponentUpgradePostResponsesContentApplicationJsonSchemaDataItems, optional)
- `jsonapi` (ApiPublicV1ComponentsComponentUpgradePostResponsesContentApplicationJsonSchemaJsonapi, optional)
- `meta` (ApiPublicV1ComponentsComponentUpgradePostResponsesContentApplicationJsonSchemaMeta, optional)

## Types

### ApiPublicV1ComponentsComponentUpgradePostResponsesContentApplicationJsonSchemaDataItems

- `attributes` (ApiPublicV1ComponentsComponentUpgradePostResponsesContentApplicationJsonSchemaDataItemsAttributes, optional)
- `id` (string, optional)
- `links` (ApiPublicV1ComponentsComponentUpgradePostResponsesContentApplicationJsonSchemaDataItemsLinks, optional)
- `type` (string, optional)

### ApiPublicV1ComponentsComponentUpgradePostResponsesContentApplicationJsonSchemaJsonapi

- `version` (string, optional)

### ApiPublicV1ComponentsComponentUpgradePostResponsesContentApplicationJsonSchemaMeta

- `skipped` (list of ApiPublicV1ComponentsComponentUpgradePostResponsesContentApplicationJsonSchemaMetaSkippedItems, optional)
- `warnings` (list of string, optional) — Caveat about the request: a direct update has no rollback, and a safe update with is_manual waits for your verdict. Present only when there is one.

### ApiPublicV1ComponentsComponentUpgradePostResponsesContentApplicationJsonSchemaDataItemsAttributes

- `completed_at` (any, optional, nullable)
- `created_at` (string, optional)
- `created_by` (double, optional)
- `origin` (string, optional)
- `site_id` (double, optional)
- `started_at` (any, optional, nullable)
- `status` (string, optional)
- `type` (string, optional)
- `updated_at` (string, optional)

### ApiPublicV1ComponentsComponentUpgradePostResponsesContentApplicationJsonSchemaDataItemsLinks

- `self` (string, optional)

### ApiPublicV1ComponentsComponentUpgradePostResponsesContentApplicationJsonSchemaMetaSkippedItems

- `message` (string, optional) — Human-readable explanation of the reason.
- `reason_code` (string, optional) — Why the website was skipped, for example SITE_UNREACHABLE, UNSUPPORTED, NOT_FOUND, PERMISSION_DENIED, CONFLICT or ALREADY_APPLIED.
- `site_action_id` (any, optional, nullable) — Always null: no site action was created for a skipped website.
- `site_id` (integer, optional) — Id of the website that was skipped.
- `site_name` (string, optional, nullable) — Name of the website that was skipped; null when you have no access to it.

## Examples

### 202 Accepted - one upgrade launched, one website skipped

**Response**

```json
{
  "data": [
    {
      "attributes": {
        "completed_at": null,
        "created_at": "2026-09-21T09:00:00.000000Z",
        "created_by": 501,
        "origin": "agent",
        "site_id": 12,
        "started_at": null,
        "status": "pending",
        "type": "manager.upgrade",
        "updated_at": "2026-09-21T09:00:00.000000Z"
      },
      "id": "5011",
      "links": {
        "self": "{{base_url}}/api/public/v1/site-actions/5011"
      },
      "type": "site-actions"
    }
  ],
  "jsonapi": {
    "version": "1.1"
  },
  "meta": {
    "skipped": [
      {
        "message": "This website is not connected; connect it first.",
        "reason_code": "SITE_UNREACHABLE",
        "site_action_id": null,
        "site_id": 13,
        "site_name": "Blog"
      }
    ],
    "warnings": [
      "A direct update has no rollback: a failed update leaves each website as the update left it. Take a backup first if the website matters."
    ]
  }
}
```

**SDK Code**

```python 202 Accepted - one upgrade launched, one website skipped
import requests

url = "https://api.modulards.com/api/public/v1/components/component/upgrade"

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

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

print(response.json())
```

```javascript 202 Accepted - one upgrade launched, one website skipped
const url = 'https://api.modulards.com/api/public/v1/components/component/upgrade';
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 202 Accepted - one upgrade launched, one website skipped
package main

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

func main() {

	url := "https://api.modulards.com/api/public/v1/components/component/upgrade"

	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 202 Accepted - one upgrade launched, one website skipped
require 'uri'
require 'net/http'

url = URI("https://api.modulards.com/api/public/v1/components/component/upgrade")

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 202 Accepted - one upgrade launched, one website 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/components/component/upgrade")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php 202 Accepted - one upgrade launched, one website skipped
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

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

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

```csharp 202 Accepted - one upgrade launched, one website skipped
using RestSharp;

var client = new RestClient("https://api.modulards.com/api/public/v1/components/component/upgrade");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift 202 Accepted - one upgrade launched, one website skipped
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.modulards.com/api/public/v1/components/component/upgrade")! 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()
```

### Update a component on websites

**Request**

```json
{
  "action": "upgrade",
  "sites": [
    12
  ]
}
```

**Response**

```json
{
  "data": [
    {
      "attributes": {
        "completed_at": null,
        "created_at": "2026-09-21T09:00:00.000000Z",
        "created_by": 501,
        "origin": "agent",
        "site_id": 12,
        "started_at": null,
        "status": "pending",
        "type": "manager.upgrade",
        "updated_at": "2026-09-21T09:00:00.000000Z"
      },
      "id": "5011",
      "links": {
        "self": "{{base_url}}/api/public/v1/site-actions/5011"
      },
      "type": "site-actions"
    }
  ],
  "jsonapi": {
    "version": "1.1"
  },
  "meta": {
    "skipped": [
      {
        "message": "This website is not connected; connect it first.",
        "reason_code": "SITE_UNREACHABLE",
        "site_action_id": null,
        "site_id": 13,
        "site_name": "Blog"
      }
    ],
    "warnings": [
      "A direct update has no rollback: a failed update leaves each website as the update left it. Take a backup first if the website matters."
    ]
  }
}
```

**SDK Code**

```python Update a component on websites
import requests

url = "https://api.modulards.com/api/public/v1/components/component/upgrade"

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

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

print(response.json())
```

```javascript Update a component on websites
const url = 'https://api.modulards.com/api/public/v1/components/component/upgrade';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"action":"upgrade","sites":[12]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Update a component on websites
package main

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

func main() {

	url := "https://api.modulards.com/api/public/v1/components/component/upgrade"

	payload := strings.NewReader("{\n  \"action\": \"upgrade\",\n  \"sites\": [\n    12\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 Update a component on websites
require 'uri'
require 'net/http'

url = URI("https://api.modulards.com/api/public/v1/components/component/upgrade")

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  \"action\": \"upgrade\",\n  \"sites\": [\n    12\n  ]\n}"

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

```java Update a component on websites
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

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

```php Update a component on websites
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.modulards.com/api/public/v1/components/component/upgrade', [
  'body' => '{
  "action": "upgrade",
  "sites": [
    12
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Update a component on websites
using RestSharp;

var client = new RestClient("https://api.modulards.com/api/public/v1/components/component/upgrade");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"action\": \"upgrade\",\n  \"sites\": [\n    12\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Update a component on websites
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.modulards.com/api/public/v1/components/component/upgrade")! 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()
```