---
title: "Add event action"
method: POST
path: "/eventactions"
tags: ["event manager"]
---

# Add event action

`POST /eventactions`

Adds a new event actions

## Query parameters

- `confidential_data` integer

## Request body

- BaseEventAction
  - `id` integer
  - `name` string — unique name
  - `description` string — optional description
  - `type` 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 — Supported event action types: * `1` - HTTP * `2` - Command * `3` - Email * `4` - Backup * `5` - User quota reset * `6` - Folder quota reset * `7` - Transfer quota reset * `8` - Data retention check * `9` - Filesystem * `11` - Password expiration check * `12` - User expiration check * `13` - Identity Provider account check * `14` - User inactivity check * `15` - Rotate log file
  - `options` BaseEventActionOptions
    - `http_config` EventActionHTTPConfig
      - `endpoint` string — HTTP endpoint
      - `username` string
      - `password` Secret — The secret is encrypted before saving, so to set a new secret you must provide a payload and set the status to "Plain". The encryption key and additional data will be generated automatically. If you set the status to "Redacted" the existing secret will be preserved
        - `status` 'Plain' | 'AES-256-GCM' | 'Secretbox' | 'GCP' | 'AWS' | 'VaultTransit' | 'AzureKeyVault' | 'Redacted' — Set to "Plain" to add or update an existing secret, set to "Redacted" to preserve the existing value
        - `payload` string
        - `key` string
        - `additional_data` string
        - `mode` integer — 1 means encrypted using a master key
      - `headers` KeyValue[] — headers to add
        - `key` string
        - `value` string
      - `timeout` integer — Ignored for multipart requests with files as attachments
      - `skip_tls_verify` boolean — if enabled the HTTP client accepts any TLS certificate presented by the server and any host name in that certificate. In this mode, TLS is susceptible to man-in-the-middle attacks. This should be used only for testing.
      - `method` 'GET' | 'POST' | 'PUT' | 'DELETE'
      - `query_parameters` KeyValue[]
        - `key` string
        - `value` string
      - `body` string — HTTP POST/PUT body
      - `parts` HTTPPart[] — Multipart requests allow to combine one or more sets of data into a single body. For each part, you can set a file path or a body as text. Placeholders are supported in file path, body, header values.
        - `name` string
        - `headers` KeyValue[] — Additional headers. Content-Disposition header is automatically set. Content-Type header is automatically detect for files to attach
          - `key` string
          - `value` string
        - `filepath` string — path to the file to be sent as an attachment
        - `body` string
    - `cmd_config` EventActionCommandConfig
      - `cmd` string — absolute path to the command to execute
      - `args` string[] — command line arguments
      - `timeout` integer
      - `env_vars` KeyValue[]
        - `key` string
        - `value` string
    - `email_config` EventActionEmailConfig
      - `recipients` string[]
      - `bcc` string[]
      - `subject` string
      - `body` string
      - `content_type` 0 | 1 — Content type: * `0` text/plain * `1` text/html
      - `attachments` string[] — list of file paths to attach. The total size is limited to 10 MB
    - `retention_config` EventActionDataRetentionConfig
      - `folders` FolderRetention[]
        - `path` string — virtual directory path as seen by users, if no other specific retention is defined, the retention applies for sub directories too. For example if retention is defined for the paths "/" and "/sub" then the retention for "/" is applied for any file outside the "/sub" directory
        - `retention` integer — retention time in hours. All the files with a modification time older than the defined value will be deleted. 0 means exclude this path
        - `delete_empty_dirs` boolean — if enabled, empty directories will be deleted
        - `ignore_user_permissions` boolean — if enabled, files will be deleted even if the user does not have the delete permission. The default is "false" which means that files will be skipped if the user does not have permission to delete them. File patterns filters will always be silently ignored
    - `fs_config` EventActionFilesystemConfig
      - `type` 1 | 2 | 3 | 4 | 5 | 6 — Supported filesystem action types: * `1` - Rename * `2` - Delete * `3` - Mkdis * `4` - Exist * `5` - Compress * `6` - Copy
      - `renames` KeyValue[]
        - `key` string
        - `value` string
      - `mkdirs` string[]
      - `deletes` string[]
      - `exist` string[]
      - `copy` KeyValue[]
        - `key` string
        - `value` string
      - `compress` EventActionFsCompress
        - `name` string — Full path to the (zip) archive to create. The parent dir must exist
        - `paths` string[] — paths to add the archive
    - `pwd_expiration_config` EventActionPasswordExpiration
      - `threshold` integer — An email notification will be generated for users whose password expires in a number of days less than or equal to this threshold
    - `user_inactivity_config` EventActionUserInactivity
      - `disable_threshold` integer — Inactivity threshold, in days, before disabling the account
      - `delete_threshold` integer — Inactivity threshold, in days, before deleting the account
    - `idp_config` EventActionIDPAccountCheck
      - `mode` 0 | 1 — Account check mode: * `0` Create or update the account * `1` Create the account if it doesn't exist
      - `template_user` string — SFTPGo user template in JSON format
      - `template_admin` string — SFTPGo admin template in JSON format
  - `rules` string[] — list of event rules names associated with this action

## Response `201`

successful operation

- BaseEventAction
  - `id` integer
  - `name` string — unique name
  - `description` string — optional description
  - `type` 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 — Supported event action types: * `1` - HTTP * `2` - Command * `3` - Email * `4` - Backup * `5` - User quota reset * `6` - Folder quota reset * `7` - Transfer quota reset * `8` - Data retention check * `9` - Filesystem * `11` - Password expiration check * `12` - User expiration check * `13` - Identity Provider account check * `14` - User inactivity check * `15` - Rotate log file
  - `options` BaseEventActionOptions
    - `http_config` EventActionHTTPConfig
      - `endpoint` string — HTTP endpoint
      - `username` string
      - `password` Secret — The secret is encrypted before saving, so to set a new secret you must provide a payload and set the status to "Plain". The encryption key and additional data will be generated automatically. If you set the status to "Redacted" the existing secret will be preserved
        - `status` 'Plain' | 'AES-256-GCM' | 'Secretbox' | 'GCP' | 'AWS' | 'VaultTransit' | 'AzureKeyVault' | 'Redacted' — Set to "Plain" to add or update an existing secret, set to "Redacted" to preserve the existing value
        - `payload` string
        - `key` string
        - `additional_data` string
        - `mode` integer — 1 means encrypted using a master key
      - `headers` KeyValue[] — headers to add
        - `key` string
        - `value` string
      - `timeout` integer — Ignored for multipart requests with files as attachments
      - `skip_tls_verify` boolean — if enabled the HTTP client accepts any TLS certificate presented by the server and any host name in that certificate. In this mode, TLS is susceptible to man-in-the-middle attacks. This should be used only for testing.
      - `method` 'GET' | 'POST' | 'PUT' | 'DELETE'
      - `query_parameters` KeyValue[]
        - `key` string
        - `value` string
      - `body` string — HTTP POST/PUT body
      - `parts` HTTPPart[] — Multipart requests allow to combine one or more sets of data into a single body. For each part, you can set a file path or a body as text. Placeholders are supported in file path, body, header values.
        - `name` string
        - `headers` KeyValue[] — Additional headers. Content-Disposition header is automatically set. Content-Type header is automatically detect for files to attach
          - `key` string
          - `value` string
        - `filepath` string — path to the file to be sent as an attachment
        - `body` string
    - `cmd_config` EventActionCommandConfig
      - `cmd` string — absolute path to the command to execute
      - `args` string[] — command line arguments
      - `timeout` integer
      - `env_vars` KeyValue[]
        - `key` string
        - `value` string
    - `email_config` EventActionEmailConfig
      - `recipients` string[]
      - `bcc` string[]
      - `subject` string
      - `body` string
      - `content_type` 0 | 1 — Content type: * `0` text/plain * `1` text/html
      - `attachments` string[] — list of file paths to attach. The total size is limited to 10 MB
    - `retention_config` EventActionDataRetentionConfig
      - `folders` FolderRetention[]
        - `path` string — virtual directory path as seen by users, if no other specific retention is defined, the retention applies for sub directories too. For example if retention is defined for the paths "/" and "/sub" then the retention for "/" is applied for any file outside the "/sub" directory
        - `retention` integer — retention time in hours. All the files with a modification time older than the defined value will be deleted. 0 means exclude this path
        - `delete_empty_dirs` boolean — if enabled, empty directories will be deleted
        - `ignore_user_permissions` boolean — if enabled, files will be deleted even if the user does not have the delete permission. The default is "false" which means that files will be skipped if the user does not have permission to delete them. File patterns filters will always be silently ignored
    - `fs_config` EventActionFilesystemConfig
      - `type` 1 | 2 | 3 | 4 | 5 | 6 — Supported filesystem action types: * `1` - Rename * `2` - Delete * `3` - Mkdis * `4` - Exist * `5` - Compress * `6` - Copy
      - `renames` KeyValue[]
        - `key` string
        - `value` string
      - `mkdirs` string[]
      - `deletes` string[]
      - `exist` string[]
      - `copy` KeyValue[]
        - `key` string
        - `value` string
      - `compress` EventActionFsCompress
        - `name` string — Full path to the (zip) archive to create. The parent dir must exist
        - `paths` string[] — paths to add the archive
    - `pwd_expiration_config` EventActionPasswordExpiration
      - `threshold` integer — An email notification will be generated for users whose password expires in a number of days less than or equal to this threshold
    - `user_inactivity_config` EventActionUserInactivity
      - `disable_threshold` integer — Inactivity threshold, in days, before disabling the account
      - `delete_threshold` integer — Inactivity threshold, in days, before deleting the account
    - `idp_config` EventActionIDPAccountCheck
      - `mode` 0 | 1 — Account check mode: * `0` Create or update the account * `1` Create the account if it doesn't exist
      - `template_user` string — SFTPGo user template in JSON format
      - `template_admin` string — SFTPGo admin template in JSON format
  - `rules` string[] — list of event rules names associated with this action

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `500` — Internal Server Error
- `default` — Unexpected Error

---

[API](https://skmtc.net/kanton-bern/apis/sftpgo.md) · [All operations](https://skmtc.net/kanton-bern/apis/sftpgo/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/kanton-bern/sftpgo/versions/d8d616a479b0/schema)
