# Install a plugin with a specific version

`POST /api/plugins/{pluginId}/installations`

Creates a new plugin installation for the current tenant. Requires a valid subscription for the plugin.

Authentication: no security requirement declared for this operation.

Parameters:

- `pluginId` (path, string, required) - Unique identifier of the plugin
  Type: string
  
  Example:
  
  ```json
  "550e8400-e29b-41d4-a716-446655440000"
  ```

Request body: application/json (required)

Type: object

Schema: [InstallPluginDTO](https://sourcey-gauzy.pages.dev/api-reference/models/installplugindto/index.md)

- `pluginId` (required)
  Type: string
  
  Unique identifier of the plugin
  
  Example:
  
  ```json
  "550e8400-e29b-41d4-a716-446655440000"
  ```

- `versionId` (required)
  Type: string
  
  Unique identifier of the version to install
  
  Example:
  
  ```json
  "550e8400-e29b-41d4-a716-446655440000"
  ```

Responses:

- 201: Plugin installation created successfully

- 400: Invalid plugin ID or version ID

- 403: Valid subscription required or insufficient permissions

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/plugins/550e8400-e29b-41d4-a716-446655440000/installations' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "pluginId": "550e8400-e29b-41d4-a716-446655440000",
  "versionId": "550e8400-e29b-41d4-a716-446655440000"
}'
```

### JavaScript

```javascript
const body = `{
  "pluginId": "550e8400-e29b-41d4-a716-446655440000",
  "versionId": "550e8400-e29b-41d4-a716-446655440000"
}`;

const response = await fetch('http://localhost:3000/api/plugins/550e8400-e29b-41d4-a716-446655440000/installations', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "pluginId": "550e8400-e29b-41d4-a716-446655440000",
  "versionId": "550e8400-e29b-41d4-a716-446655440000"
}'''

response = requests.post(
    'http://localhost:3000/api/plugins/550e8400-e29b-41d4-a716-446655440000/installations',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
