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

# Functions

> Define an HTTP request once, then call it from any point in a flow to fetch or send data mid-call.

Use functions to check stock, pull an order from your CRM, look up a customer, or update another system while the caller is on the line. Functions are available on [flow agents](/guides/flow-agents).

## 1. Define the function

Open the agent's settings and go to the **Functions** section. Add a function and fill in:

| Field | What to enter |
| - | - |
| Name | A unique name within the agent. It's the label you'll pick in the flow. |
| URL and method | `GET`, `POST`, `PUT`, `PATCH` or `DELETE`. Use `{placeholder}` segments in the URL for path variables, for example `https://api.example.co.il/orders/{order_id}`. |
| Headers | Key-value pairs, for example an [API key](/authentication) header. |
| Path Variables | One entry for each `{placeholder}` in the URL. Every placeholder must be declared, and every declared variable must appear in the URL. |
| Query Parameters | Values added to the URL's query string. |
| Body | For `POST`, `PUT` and `PATCH`: fields with a name, description, type and a Required flag. Fields can be nested objects and arrays. |
| Return Value | The shape of the JSON response. The whole response is stored in one variable, and you can read nested fields by dotted path, for example `[order.status]`. |
| Timeout | How long to wait for a response, from 1 to 60 seconds. The default is 10. |

Click **Test** to send a real request with sample values before any node uses the function.

<Warning>
  Editing a function changes every node that uses it.
</Warning>

## 2. Call it from a Function Call node

<Steps>
  <Step title="Add the node">
    Add a **Function Call** node to the flow and choose the function.
  </Step>

  <Step title="Fill in the inputs">
    For each parameter, enter a fixed value or a `[variable]` collected earlier in the call.
  </Step>

  <Step title="Save response fields">
    Under **Store Return Values**, map response fields to variables for later nodes. Leave a field unset to skip it. See [Variables](/guides/variables).
  </Step>

  <Step title="Connect both branches">
    Route **Success** and **Error** to the right next steps.
  </Step>
</Steps>

You can use the same function in as many nodes as you like.

## Success and error

**Success** means a 2xx response. The node takes **Error** on a 3xx, 4xx or 5xx response, a timeout, a network failure, a 2xx response that isn't valid JSON, or a response field that doesn't match its declared type. Always connect the Error branch to something the caller hears, such as an apology or a transfer.

## In the transcript

Each call to a function adds two system rows. The request row shows the method, URL and body. The result row shows the status, response, extracted variables and duration, plus an [error code](/error-handling) if it failed. Expand them to debug an integration without reading server logs.

## Security

* Common secret headers (such as `Authorization` and `X-Api-Key`) and secret-looking query parameters are shown as `[REDACTED]` in transcripts and the API. The real values are still sent to your endpoint.
* Header values are stored as plain text in the agent's configuration, not encrypted. Use a dedicated key with the smallest permissions your endpoint allows, and rotate it if needed.
* Requests to private or internal network addresses are blocked. Responses are capped at 1 MB.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.