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

# Install component

POST https://api/public/v1/components/install
Content-Type: application/json

Installs a plugin or theme from the wordpress.org repository on the selection: one `manager.install` Site Action per accepted site.\n\nBody parameters:\n- `type` (string, required): `plugin` | `theme`.\n- `from` (string, required): only `repository` is accepted on this surface (`url`/`upload` answer 422).\n- `value` (string, max 200, required): the wordpress.org slug, as in its URL (e.g. `woocommerce`).\n- `sites` (integer array, required): exact ids, 1 to 200.\n- `activate` (boolean `1`/`0`, default `0`): activate right after installing.\n- `overwrite` (boolean `1`/`0`, default `0`): reinstall over an existing copy instead of skipping the site.\n- `clean_cache` (boolean `1`/`0`, default `0`): clear each site's cache after installing.\n\n202 with the created `site-actions` documents and `meta.skipped`.\n\n- **422**: `sites` missing/empty/over 200/unknown id; `from` other than `repository`; `value` not a slug wordpress.org resolves.\n- **403**: a read-only token.

Reference: https://api.docs.modulards.com/modular-ds-public-api/components/install-component

## Authentication

- `Authorization` header (bearer token, required)

## Request

### Body (application/json)

- `from` (string, required)
- `type` (string, required)
- `sites` (list of integer, required)
- `value` (string, required)
- `activate` (integer, required)

## Response

### 200

Successful response

## Examples

**Request**

```json
{
  "from": "repository",
  "type": "plugin",
  "sites": [
    12,
    13
  ],
  "value": "woocommerce",
  "activate": 1
}
```

**Response**

```json
{}
```

**SDK Code**

```python Components_Install component_example
import requests

url = "https://https/api/public/v1/components/install"

payload = {
    "from": "repository",
    "type": "plugin",
    "sites": [12, 13],
    "value": "woocommerce",
    "activate": 1
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Components_Install component_example
const url = 'https://https/api/public/v1/components/install';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"from":"repository","type":"plugin","sites":[12,13],"value":"woocommerce","activate":1}'
};

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

```go Components_Install component_example
package main

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

func main() {

	url := "https://https/api/public/v1/components/install"

	payload := strings.NewReader("{\n  \"from\": \"repository\",\n  \"type\": \"plugin\",\n  \"sites\": [\n    12,\n    13\n  ],\n  \"value\": \"woocommerce\",\n  \"activate\": 1\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 Components_Install component_example
require 'uri'
require 'net/http'

url = URI("https://https/api/public/v1/components/install")

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  \"from\": \"repository\",\n  \"type\": \"plugin\",\n  \"sites\": [\n    12,\n    13\n  ],\n  \"value\": \"woocommerce\",\n  \"activate\": 1\n}"

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

```java Components_Install component_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://https/api/public/v1/components/install")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"from\": \"repository\",\n  \"type\": \"plugin\",\n  \"sites\": [\n    12,\n    13\n  ],\n  \"value\": \"woocommerce\",\n  \"activate\": 1\n}")
  .asString();
```

```php Components_Install component_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://https/api/public/v1/components/install', [
  'body' => '{
  "from": "repository",
  "type": "plugin",
  "sites": [
    12,
    13
  ],
  "value": "woocommerce",
  "activate": 1
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Components_Install component_example
using RestSharp;

var client = new RestClient("https://https/api/public/v1/components/install");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"from\": \"repository\",\n  \"type\": \"plugin\",\n  \"sites\": [\n    12,\n    13\n  ],\n  \"value\": \"woocommerce\",\n  \"activate\": 1\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Components_Install component_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "from": "repository",
  "type": "plugin",
  "sites": [12, 13],
  "value": "woocommerce",
  "activate": 1
] as [String : Any]

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

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