> ## Documentation Index
> Fetch the complete documentation index at: https://support.fortanix.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a new plugin.

> Create a new plugin.

## OpenAPI

````json POST /sys/v1/plugins
{
  "openapi": "3.0.0",
  "info": {
    "title": "Fortanix DSM REST API",
    "description": "This is a set of REST APIs for accessing the Fortanix Data Security Manager. This includes APIs for managing accounts, and for performing cryptographic and key management operations. \n\n **Note:** \n- All binary input should be base64-encoded. These fields are marked with `format: byte`. \n- For forward compatibility, any API client is expected to ignore any fields in the response not explicitly mentioned in the documentation. We reserve the right to add new fields at any time to provide new functionality without affecting existing API clients.",
    "termsOfService": "https://www.fortanix.com/legal/terms/",
    "contact": {
      "name": "Fortanix Support",
      "url": "https://support.fortanix.com/",
      "email": "support@fortanix.com"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "version": "0.1.0-20260526"
  },
  "servers": [
    {
      "url": "https://amer.smartkey.io"
    }
  ],
  "paths": {
    "/sys/v1/plugins": {
      "post": {
        "operationId": "CreatePlugin",
        "tags": [
          "Plugins"
        ],
        "security": [
          {
            "bearerToken": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "summary": "Create a new plugin.",
        "description": "Create a new plugin.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PluginRequest"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Success result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plugin"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PluginRequest": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "default_group": {
                "type": "string",
                "format": "uuid",
                "nullable": true,
                "description": "The default group a plugin belongs to."
              },
              "description": {
                "type": "string",
                "nullable": true,
                "description": "Description of the plugin."
              },
              "enabled": {
                "type": "boolean",
                "nullable": true,
                "description": "Is plugin enabled."
              },
              "name": {
                "type": "string",
                "maxLength": 4096,
                "pattern": "^[^\\n]*[^\\s\\n][^\\n]*$",
                "nullable": true,
                "description": "Name of the plugin, which must be unique within an account."
              },
              "plugin_type": {
                "$ref": "#/components/schemas/PluginType"
              },
              "signature": {
                "type": "string",
                "nullable": true,
                "description": "A detached OpenPGP signature over the plugin source code.\n\nThe signature packet must be armored. If the account has a plugin code signing\npolicy, the signature is required in the following cases:\n- when creating a new plugin\n- when updating the plugin code"
              },
              "source": {
                "$ref": "#/components/schemas/PluginSourceRequest"
              },
              "add_groups": {
                "type": "array",
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "format": "uuid"
                },
                "nullable": true,
                "description": "Set of all the groups that plugin is part of."
              },
              "del_groups": {
                "type": "array",
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "format": "uuid"
                },
                "nullable": true,
                "description": "Set of all the groups that plugin is part of."
              },
              "mod_groups": {
                "type": "array",
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "format": "uuid"
                },
                "nullable": true,
                "description": "Set of all the groups that plugin is part of."
              }
            }
          }
        ]
      },
      "Plugin": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "acct_id": {
                "type": "string",
                "format": "uuid",
                "description": "The id of the Account that the plugin belongs to."
              },
              "created_at": {
                "type": "string",
                "pattern": "^\\d{4}\\d{2}\\d{2}T\\d{2}\\d{2}\\d{2}Z$",
                "example": "20170509T070912Z",
                "description": "Timestamp when the plugin was created."
              },
              "creator": {
                "$ref": "#/components/schemas/Principal"
              },
              "default_group": {
                "type": "string",
                "format": "uuid",
                "description": "The default group a plugin belongs to."
              },
              "description": {
                "type": "string",
                "nullable": true,
                "description": "Description of the plugin."
              },
              "enabled": {
                "type": "boolean",
                "description": "Is plugin enabled."
              },
              "lastrun_at": {
                "type": "string",
                "pattern": "^\\d{4}\\d{2}\\d{2}T\\d{2}\\d{2}\\d{2}Z$",
                "example": "20170509T070912Z",
                "description": "Timestamp when the plugin was most recently used."
              },
              "lastupdated_at": {
                "type": "string",
                "pattern": "^\\d{4}\\d{2}\\d{2}T\\d{2}\\d{2}\\d{2}Z$",
                "example": "20170509T070912Z",
                "description": "Timestamp when the plugin was most recently updated."
              },
              "legacy_access": {
                "type": "boolean",
                "description": "If a requester is updating/using a Plugin they must have the relevant\npermissions in all Groups that Plugin has access to. But for legacy Plugins,\nthe requester is required to have relevant permissions in any one of the groups\nthat Plugin has access to."
              },
              "name": {
                "type": "string",
                "maxLength": 4096,
                "pattern": "^[^\\n]*[^\\s\\n][^\\n]*$",
                "description": "Name of the plugin, which must be unique within an account."
              },
              "plugin_id": {
                "type": "string",
                "format": "uuid",
                "description": "Unique id to identify a plugin."
              },
              "plugin_type": {
                "$ref": "#/components/schemas/PluginType"
              },
              "source": {
                "$ref": "#/components/schemas/PluginSource"
              },
              "groups": {
                "type": "array",
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "format": "uuid"
                },
                "description": "Set of all the groups that plugin is part of."
              }
            },
            "required": [
              "acct_id",
              "created_at",
              "creator",
              "default_group",
              "enabled",
              "lastupdated_at",
              "legacy_access",
              "name",
              "plugin_id",
              "plugin_type",
              "source",
              "groups"
            ]
          }
        ]
      },
      "PluginType": {
        "description": "Type of a plugin.",
        "type": "string",
        "enum": [
          "STANDARD",
          "IMPERSONATING",
          "CUSTOMALGORITHM"
        ]
      },
      "PluginSourceRequest": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/PluginSourceRequestFromRepo"
          },
          {
            "$ref": "#/components/schemas/PluginSourceRequestInline"
          }
        ]
      },
      "Principal": {
        "description": "A security principal.",
        "oneOf": [
          {
            "title": "PrincipalVariantApp",
            "type": "object",
            "properties": {
              "app": {
                "type": "string",
                "format": "uuid"
              }
            },
            "required": [
              "app"
            ]
          },
          {
            "title": "PrincipalVariantUser",
            "type": "object",
            "properties": {
              "user": {
                "type": "string",
                "format": "uuid"
              }
            },
            "required": [
              "user"
            ]
          },
          {
            "title": "PrincipalVariantPlugin",
            "type": "object",
            "properties": {
              "plugin": {
                "type": "string",
                "format": "uuid"
              }
            },
            "required": [
              "plugin"
            ]
          },
          {
            "title": "PrincipalVariantUserViaApp",
            "type": "object",
            "properties": {
              "userviaapp": {
                "$ref": "#/components/schemas/PrincipalUserViaApp"
              }
            },
            "required": [
              "userviaapp"
            ]
          },
          {
            "title": "PrincipalVariantSystem",
            "type": "string",
            "enum": [
              "system"
            ]
          },
          {
            "title": "PrincipalVariantUnregisteredUser",
            "type": "string",
            "enum": [
              "unregistereduser"
            ]
          }
        ]
      },
      "PluginSource": {
        "description": "Plugin code that will be executed inside SGX enclave.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/PluginSourceFromRepo"
          },
          {
            "$ref": "#/components/schemas/PluginSourceInline"
          }
        ]
      },
      "PluginSourceRequestFromRepo": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "repo_url": {
                "type": "string"
              },
              "plugin_name": {
                "type": "string"
              },
              "version": {
                "$ref": "#/components/schemas/PluginVersion"
              }
            },
            "required": [
              "repo_url",
              "plugin_name",
              "version"
            ]
          }
        ]
      },
      "PluginSourceRequestInline": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "language": {
                "$ref": "#/components/schemas/Language"
              },
              "code": {
                "type": "string"
              }
            },
            "required": [
              "language",
              "code"
            ]
          }
        ]
      },
      "PrincipalUserViaApp": {
        "allOf": [
          {
            "type": "object",
            "description": "UserViaApp signifies a user authorizing some app to act on its behalf through OAuth.",
            "properties": {
              "user_id": {
                "type": "string",
                "format": "uuid"
              },
              "scopes": {
                "type": "array",
                "uniqueItems": true,
                "items": {
                  "$ref": "#/components/schemas/OauthScope"
                }
              }
            },
            "required": [
              "user_id",
              "scopes"
            ]
          }
        ]
      },
      "PluginSourceFromRepo": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "repo_url": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "$ref": "#/components/schemas/PluginVersion"
              },
              "language": {
                "$ref": "#/components/schemas/Language"
              },
              "code": {
                "type": "string"
              }
            },
            "required": [
              "repo_url",
              "name",
              "version",
              "language",
              "code"
            ]
          }
        ]
      },
      "PluginSourceInline": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "language": {
                "$ref": "#/components/schemas/Language"
              },
              "code": {
                "type": "string"
              }
            },
            "required": [
              "language",
              "code"
            ]
          }
        ]
      },
      "PluginVersion": {
        "type": "string",
        "pattern": "^\\d+.\\d+$"
      },
      "Language": {
        "description": "Language of plugin code.",
        "type": "string",
        "enum": [
          "LUA"
        ]
      },
      "OauthScope": {
        "description": "OAuth scope.",
        "type": "string",
        "enum": [
          "app",
          "openid",
          "email",
          "profile"
        ]
      }
    }
  }
}
````

