Voiceflow bearer token
Functions
Run custom code through your agent.
See Authentication for credentials and permissions.
Returns every function in the environment. A function is custom JavaScript that runs in Voiceflow’s sandbox and returns through a named path. The call takes no paging parameters, so one request yields the whole set.
Authentication
Query parameters
The ID of the project to operate on.
The alias of the environment to operate on (e.g. main).
Response
Returns every function saved in the project's environment, each with its name, description, settings, and full JavaScript source code.
Adds a function to the environment, custom JavaScript that runs in Voiceflow’s sandbox and returns through a named path. The response carries the ID that later calls address it by.
Authentication
Voiceflow bearer token
Query parameters
The ID of the project to operate on.
The alias of the environment to operate on (e.g. main).
Request body
The JavaScript source code executed when the function runs.
A human-readable description of what the function does.
Response
Creates the function and returns it in full, including its new ID and the JavaScript source stored for it.
Adds several functions to the environment in one request, each taking the fields the single-create call takes. The response carries the created functions in the same shape the list call returns.
Authentication
Voiceflow bearer token
Query parameters
The ID of the project to operate on.
The alias of the environment to operate on (e.g. main).
Request body
Response
Creates every function in the request and returns them all, each with its own ID, stored JavaScript source, and exit path order.
Returns a single function by ID, with the fields that define it. A function is custom JavaScript that runs in Voiceflow’s sandbox and returns through a named path.
Authentication
Voiceflow bearer token
Path parameters
The ID of the function to operate on.
Query parameters
The ID of the project to operate on.
The alias of the environment to operate on (e.g. main).
Response
Returns a single function, including the JavaScript source that runs when it is called and the ordered list of path IDs that controls the display order of its exit paths.
Changes an existing function in place. The response carries only a confirmation message, so refetch the function to read its new values.
Authentication
Voiceflow bearer token
Path parameters
The ID of the function to operate on.
Query parameters
The ID of the project to operate on.
The alias of the environment to operate on (e.g. main).
Request body
The JavaScript source code executed when the function runs.
An ordered list of path IDs controlling the display order of the function's exit paths.
A human-readable description of what the function does.
Response
Confirms the function was updated. Only a message is returned, not the revised function, so fetch the function again to read back its saved code.
A human-readable message confirming the update.
Deletes a single function by ID. A function is custom JavaScript that runs in Voiceflow’s sandbox and returns through a named path. The response carries only a confirmation message, so refetch the functions to see what is left.
Authentication
Voiceflow bearer token
Path parameters
The ID of the function to operate on.
Query parameters
The ID of the project to operate on.
The alias of the environment to operate on (e.g. main).
Response
Confirms the function was deleted. The response is a message, not the removed function, so its JavaScript source is not recoverable from this call.
A human-readable message confirming the deletion.
Returns what a function takes and gives back: its input variables, its output variables, and its exit paths, read from the environment's draft. Call it before executing to learn the input names.
Authentication
Voiceflow bearer token
Path parameters
The ID of the function whose schema to read.
Query parameters
The ID of the project to operate on.
The alias of the environment to operate on (e.g. main).
Response
Returns the function's inputs, output variables, and exit path names.
The inputs execute takes, one per input variable, sorted by name. Every one is a required string.
The output variables the function may return, sorted by name.
The exit path names the function may return with next: { path }, in path order.
Runs the saved draft of a function once with the inputs in the body, without compiling the agent or starting a conversation. The run stops at the function's timeout or 18 seconds, whichever is shorter, and nothing is saved.
Authentication
Voiceflow bearer token
Path parameters
The ID of the function to execute.
Query parameters
The ID of the project to operate on.
The alias of the environment to operate on (e.g. main).
Request body
A value for each of the function's input variables, keyed by input name. Every declared input needs a value, and a name the function does not declare is refused. List them with get_schema.
Response
Returns the function's output variables, the exit path it chose, and the traces it emitted, with success, latencyMs, and error fields.
Whether the tool ran and reported no error.
How long the run took, in milliseconds, measured by this API around the call.
Why the run failed when success is false, otherwise null. Secret values read [secret].
Whether a returned payload was over 64 KB and was cut to its first 64 KB of JSON text, which then arrives as a string.
What the function returned, on failure too. Null only when general-runtime did not answer in time.
Run a function's saved code on test cases and compare the results.
Authentication
Voiceflow bearer token
Path parameters
Query parameters
The ID of the project to operate on.
The alias of the environment to operate on (e.g. main).