Skip to content

Create Function

Endpoint used to create a custom function.

Terminal window
curl --request POST \
--url https://chat.api.toolzz.com.br/api/v1/functions/ \
--header 'Authorization: Bearer TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '
{
"name": "string",
"description": "string",
"code": "string",
"iconFileId": "uuid",
"iconFile": "string",
"userId": "uuid",
"outputs": [
{
"property": "string",
"type": "string",
"description": "string",
"required": false,
"creating": false
}
],
"unityId": "uuid"
}
'
{
"id": "uuid",
"institutionId": "uuid",
"userId": "uuid",
"unityId": "uuid",
"code": "string",
"description": "string",
"iconFileId": "uuid",
"status": true,
"name": "string",
"pluginIcon": {
"id": "uuid",
"institutionId": "uuid",
"type": "string",
"fileName": "string",
"internalStorageUrl": "string",
"url": "string",
"maskName": "string",
"createdAt": "date",
"updatedAt": "date",
"extension": "string",
"size": 123,
"numberWords": null
},
"color": "string",
"outputs": [
{
"required": false,
"id": "uuid",
"type": "string",
"description": "string",
"customFunctionId": "uuid",
"property": "string"
},
{
"required": false,
"id": "uuid",
"type": "string",
"description": "string",
"customFunctionId": "uuid",
"property": "string"
}
],
"isActivated": true,
"type": null,
"googleCalendarPlugin": [],
"discordPlugin": [],
"telegramPlugin": []
}
ParameterTypeDescriptionRequired
AuthorizationStringAccess token (“Bearer” must be before the token)Yes
ParameterTypeDescriptionRequired
nameStringIdentification name for the custom function.Yes
descriptionStringText describing what the function does and when it should be called.Yes
codeStringThe JavaScript (asynchronous) code that will be executed by the engine.Yes
iconFileIdUUIDUnique identifier of the icon file already existing in the system.No
iconFileStringURL or reference path for the icon file.No
userIdUUIDIdentifier of the user creating the function.Yes
unityIdUUIDIdentifier of the organizational unit to which the function belongs.Yes
outputsArrayList of objects that define the input/output parameters of the function.No
outputs[].propertyStringName of the variable that will be accessed via args in the code.Yes*
outputs[].typeStringExpected data type (e.g., number, string).Yes*
outputs[].descriptionStringBrief explanation about the parameter.No
outputs[].requiredBooleanDefines if the parameter is mandatory in the function execution.No
outputs[].creatingBooleanInternal flag for state control during creation.No
KeyTypeDescription
idUUIDUnique identifier of the main record.
institutionIdUUIDOwner institution identifier.
userIdUUIDCreating user identifier.
unityIdUUIDOrganizational unit identifier.
codeStringScript or source code of the custom function.
descriptionStringPurpose description of the plugin/function.
iconFileIdUUIDReference to the icon file ID.
statusBooleanDefines if the record is active in the system.
nameStringFunction identification name.
colorStringColor reference for visual interface.
isActivatedBooleanIndicates if the plugin is enabled for immediate use.
typeNullReserved field for future typing.
pluginIconObjectObject with icon metadata (contains: id, url, size, createdAt, etc.).
pluginIcon.urlStringPublic link for viewing the icon image.
pluginIcon.extensionStringFile extension (e.g., “jpeg”, “png”).
pluginIcon.sizeNumberIcon file size in bytes.
outputsArrayList of objects defining the output variables.
outputs[].idUUIDUnique identifier of the output parameter.
outputs[].propertyStringName of the variable used in the code.
outputs[].typeStringExpected data type (e.g., “number”, “string”).
outputs[].requiredBooleanDefines if filling this field is mandatory.
googleCalendarPluginArrayList of settings for Google Calendar integration.
discordPluginArrayList of settings for Discord integration.
telegramPluginArrayList of settings for Telegram integration.

To access this endpoint, it is necessary to send a valid access token through the authorization header (Authorization) of the request. Additionally, the API is protected by other security measures to safeguard user data.

To access your access token, follow these steps:

  1. Log in to the ToolzzAI platform
  2. Click on “Settings”
  3. Click on “Access Token”
  4. Copy the access token

Access token page