POST
/
settings
/
user-defined-function
curl --request POST \
  --url https://demo.enneo.ai/api/mind/settings/user-defined-function \
  --header 'Content-Type: application/json' \
  --data '{
  "id": 1,
  "type": "tool",
  "data": {
    "udfExecutor": {
      "id": 1,
      "code": "<?php\n\n// Load enneo SDK. Input is made available through $in\nuse EnneoSDK\\Api;\nuse EnneoSDK\\ApiEnneo;\nrequire(getenv()['\''SDK'\'']);\n\nfunction exampleApiCall(string $method, string $api, array|object|string|false $params = false, $attempt = 1): stdClass|array\n{\n    // load token\n    $token = ApiEnneo::executeUdf('\''fetchToken'\'', [])->token;\n\n    // make request\n    $res = Api::call(\n        method: $method,\n        url: sprintf('\''urlExampleHere'\'', $api),\n        headers: [\n            sprintf('\''Authorization: Bearer %s'\'', $token),\n            '\''x-api-key: tokenExampleHere'\'',\n            '\''Accept: application/json'\''\n        ],\n        params: $params\n    );\n\n    return $res;\n}\n\necho json_encode(exampleApiCall($in->method, $in->api, $in->params));",
      "type": "sourceCode",
      "language": "php82",
      "packages": "",
      "parameters": {}
    }
  },
  "name": "exampleApiCall"
}'
{
  "success": true,
  "id": 12345
}

Authorizations

connect.sid
string
cookie
required

Cookie-based authentication

Body

application/json
The new User Defined Function that should be created. The ID does not need to be included in the payload, as it will be generated automatically.
id
integer
Example:

1

type
enum<string>
Available options:
tool,
udf
data
object
name
string
Example:

"exampleApiCall"

Response

200
application/json
User Defined Function added successfully
success
boolean

Indicates if the operation was successful

Example:

true

id
integer

The ID of the added User Defined Function

Example:

12345