# Create plugin setting

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

Authentication: no security requirement declared for this operation.

Parameters:

- `pluginId` (path, string, uuid, required) - Plugin ID
  Type: string, uuid

Request body: application/json (required)

Type: object

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

- `pluginId` (required)
  Type: string
  
  Plugin ID

- `pluginTenantId` (optional)
  Type: string
  
  Plugin Tenant ID

- `key` (required)
  Type: string
  
  Setting key

- `value` (optional)
  Type: object
  
  Setting value

- `isRequired` (optional)
  Type: boolean
  
  Is setting required

- `isEncrypted` (optional)
  Type: boolean
  
  Is setting encrypted

- `description` (optional)
  Type: string
  
  Setting description

- `order` (optional)
  Type: number
  
  Setting order

- `validationRules` (optional)
  Type: object
  
  Validation rules

- `dataType` (optional)
  Type: string
  
  Data type
  
  enum: ["string","number","boolean","json","file"]

- `defaultValue` (optional)
  Type: object
  
  Default value

Responses:

- 201: Plugin setting created successfully

Content type: application/json

Type: object

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

- `deletedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `createdAt` (optional)
  Type: string, date-time
  
  The creation timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `updatedAt` (optional)
  Type: string, date-time
  
  The last update timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `id` (optional)
  Type: string

- `isActive` (optional)
  Type: boolean
  
  default: true

- `isArchived` (optional)
  Type: boolean
  
  default: false

- `archivedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `tenantId` (optional)
  Type: string

- `organizationId` (optional)
  Type: string

- `key` (required)
  Type: string
  
  Setting key/name

- `value` (required)
  Type: string
  
  Setting value string

- `isRequired` (required)
  Type: boolean
  
  Whether the setting is required

- `isEncrypted` (required)
  Type: boolean
  
  Whether the setting is encrypted/sensitive

- `description` (optional)
  Type: string
  
  Setting description/help text

- `order` (optional)
  Type: number
  
  Display order for UI

- `validationRules` (optional)
  Type: string
  
  Validation rules (JSON string)

- `dataType` (required)
  Type: string
  
  Data type of the setting
  
  enum: ["string","number","boolean","json","file"]

- `defaultValue` (optional)
  Type: string
  
  Default value for the setting

- `pluginId` (required)
  Type: string
  
  Plugin ID

- `plugin` (optional)
  Type: unknown
  
  Plugin
  
  allOf:
    Reference: [Plugin_1](https://sourcey-gauzy.pages.dev/api-reference/models/plugin-1/index.md); Type: object

- `pluginTenantId` (optional)
  Type: string
  
  Plugin tenant ID for tenant-specific settings

- `pluginTenant` (optional)
  Type: unknown
  
  Plugin tenant
  
  allOf:
    Reference: [PluginTenant_1](https://sourcey-gauzy.pages.dev/api-reference/models/plugintenant-1/index.md); Type: object

- `categoryId` (optional)
  Type: string
  
  Plugin category ID for default category settings

- `category` (optional)
  Type: unknown
  
  Plugin category
  
  allOf:
    Reference: [PluginCategory](https://sourcey-gauzy.pages.dev/api-reference/models/plugincategory/index.md); Type: object

- `updatedBy` (optional)
  Type: unknown
  
  User who last updated this setting
  
  allOf:
    Reference: [User](https://sourcey-gauzy.pages.dev/api-reference/models/user/index.md); Type: object

- `updatedById` (optional)
  Type: string
  
  ID of the user who last updated this setting

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/plugins/550e8400-e29b-41d4-a716-446655440000/settings' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "pluginId": "string",
  "pluginTenantId": "string",
  "key": "string",
  "value": {},
  "isRequired": true,
  "isEncrypted": true,
  "description": "string",
  "order": 0,
  "validationRules": {},
  "dataType": "string",
  "defaultValue": {}
}'
```

### JavaScript

```javascript
const body = `{
  "pluginId": "string",
  "pluginTenantId": "string",
  "key": "string",
  "value": {},
  "isRequired": true,
  "isEncrypted": true,
  "description": "string",
  "order": 0,
  "validationRules": {},
  "dataType": "string",
  "defaultValue": {}
}`;

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

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

### Python

```python
import requests

body = '''{
  "pluginId": "string",
  "pluginTenantId": "string",
  "key": "string",
  "value": {},
  "isRequired": true,
  "isEncrypted": true,
  "description": "string",
  "order": 0,
  "validationRules": {},
  "dataType": "string",
  "defaultValue": {}
}'''

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