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

# Custom function calls: Complete guide for Bolna voice AI

> Build custom function tools with Bolna Voice agents using OpenAI standards. Complete guide with schema examples, code snippets & implementation best practices.

## What are custom functions?

Custom functions let your Voice AI agent call your own APIs during live conversations. Check order status, update a CRM, book appointments, or integrate with any system - all while on a call.

> [!NOTE]
>
> Bolna custom functions follow the [OpenAI function calling specification](https://platform.openai.com/docs/guides/function-calling). If you've used OpenAI function calling before, you'll feel right at home.

![Bolna custom function configuration modal with dark code editor showing JSON schema with name test, description, pre\_call\_message, parameters with startTime and endTime, key custom\_task, and value with method GET, url, api\_token, and headers](https://mintcdn.com/bolna-54a2d4fe/K8nkTcLHvQdEi_0R/images/tool-calling/custom-function-config.png?fit=max\&auto=format\&n=K8nkTcLHvQdEi_0R\&q=85\&s=a8974154d74c11bd8861c5679c5821bf)

Custom function JSON editor showing a function schema with name, description, pre\_call\_message, parameters, and API configuration

***

## How custom functions work

**1. LLM Reads Function Definition**

The LLM sees your function's `name` and `description` to understand what the function does

**2. Decides When to Call**

Based on conversation context, the LLM decides if this function should be triggered

**3. Extracts Parameters**

The LLM collects required parameter values from the conversation with the caller

**4. Bolna Executes API Call**

Bolna makes the HTTP request to your API endpoint with the extracted parameters

**5. Response Feeds Back**

The API response is returned to the LLM, which continues the conversation naturally

> [!TIP]
>
> **The description is everything.** The LLM relies heavily on your description to know when to call the function. A vague description = unreliable triggering.

***

## Creating a custom function

You can create a custom function in two ways from the [Tools Tab](https://www.bolna.ai/docs/agent-setup/tools-tab.md):

![Bolna Add a Custom Tool section with Custom Function card showing Write manually button and Generate from cURL button side by side](https://mintcdn.com/bolna-54a2d4fe/vlPn4lzPQ372t9yX/images/tool-calling/custom-tool-section.png?fit=max\&auto=format\&n=vlPn4lzPQ372t9yX\&q=85\&s=e0e9fec7d255b5e34d65cfc77155c999)

Add a Custom Tool section showing the Write manually and Generate from cURL options

> [tab] Write Manually
>
> Click **Write manually** to open the JSON editor and define the function schema from scratch. This gives you full control over every field.
>
> ![Bolna custom function configuration modal with dark code editor, JSON schema with name test, description, pre\_call\_message, parameters, key custom\_task, and value object with method, url, api\_token, and headers](https://mintcdn.com/bolna-54a2d4fe/K8nkTcLHvQdEi_0R/images/tool-calling/custom-function-config.png?fit=max\&auto=format\&n=K8nkTcLHvQdEi_0R\&q=85\&s=a8974154d74c11bd8861c5679c5821bf)
>
> Custom function JSON editor with a sample schema showing name, description, pre\_call\_message, parameters, key, and API configuration
>
> > [!NOTE]
> >
> > The fields `name`, `description`, `key`, and `method` are mandatory. The `key` must always be set to `"custom_task"`.

> [tab] Generate from cURL
>
> If you already have a working API request in `curl`, click **Generate from cURL** to auto-generate a function schema instead of building it manually.
>
> ### How to use it
>
> **1. Click Generate from cURL**
>
> In the Tools Tab, click the **Generate from cURL** button under Add a Custom Tool.
>
> **2. Paste your cURL command**
>
> Paste the full cURL request into the text area. Bolna will parse the URL, method, headers, and body.
>
> ![Bolna Generate function from cURL modal with text area containing a sample curl GET request to api.bolna.ai with Authorization Bearer header, Cancel button and Generate function button](https://mintcdn.com/bolna-54a2d4fe/K8nkTcLHvQdEi_0R/images/tool-calling/curl-to-custom-function.png?fit=max\&auto=format\&n=K8nkTcLHvQdEi_0R\&q=85\&s=6c70848b4f9217bf710d739738673481)
>
> Generate function from cURL dialog where you paste a cURL command to auto-generate a custom function
>
> **1. Review the generated schema**
>
> Bolna generates a function configuration with auto-populated name, description, method, URL, and auth. Review all fields carefully.
>
> **2. Refine and submit**
>
> Update the function name, improve the description for better LLM triggering, confirm parameters, and click **Submit**.
>
> ![Bolna generated custom function showing name get\_agent, description Called when user asks to get agent details by agent ID, pre\_call\_message, parameters, key custom\_task, method GET, url api.bolna.ai, api\_token, and headers](https://mintcdn.com/bolna-54a2d4fe/Vch3BdKvmDByoJ44/images/tool-calling/curl-generated-result.png?fit=max\&auto=format\&n=Vch3BdKvmDByoJ44\&q=85\&s=59e968597199064f79159ffc8ca89035)
>
> Generated function configuration from a cURL command with auto-populated name, description, URL, and authentication
>
> > [!WARNING]
> >
> > The import is a starting point, not a final configuration. Always verify authentication, parameter names, required fields, and the API URL before using the function in production.
>
> ### After generating, always check
>
> > [card] Function name
> >
> > Make it clear and use `snake_case` (e.g., `get_order_status`)
>
> > [card] Description
> >
> > Describe *when* the model should call the function, not just what the API does
>
> > [card] Parameters
> >
> > Remove anything the caller will never provide; mark only essential fields as required
>
> > [card] Auth & headers
> >
> > Confirm secrets, tokens, and custom headers are correct for your environment
>
> > [card] Pre-call message
> >
> > Add a short spoken message so callers know the agent is checking something
>
> > [card] Context variables
> >
> > Combine with [context variables](https://www.bolna.ai/docs/prompting/using-context.md) to avoid asking for data you already have

***

## Go deeper

> [card] [Schema reference](https://www.bolna.ai/docs/tool-calling/custom-function-schema.md)
>
> Every field in the function definition and API configuration, plus `%(name)s` format specifiers.

> [card] [Examples](https://www.bolna.ai/docs/tool-calling/custom-function-examples.md)
>
> Complete GET and POST request schemas you can copy and adapt.

> [card] [Variables & context](https://www.bolna.ai/docs/tool-calling/custom-function-variables.md)
>
> Use prompt variables and auto-injected call data so the agent never asks for what it already knows.

> [card] [Pre-call webhooks](https://www.bolna.ai/docs/tool-calling/pre-call-webhooks.md)
>
> Notify your system before the tool's main API call runs, for example with a transfer reason.

***

## Source IP whitelist

Bolna calls your endpoint from a fixed set of source IPs. If your API sits behind a firewall or an IP allowlist, permit all three or the tool call will fail and the agent will have nothing to say back to the caller:

```
13.203.39.153
13.126.9.249
13.202.133.53
```

The same IPs apply to pre-call webhooks and to [post-call webhooks](https://www.bolna.ai/docs/post-call/polling-call-status-webhooks#ip-whitelist).

***

## Best practices

> [card] Write detailed descriptions
>
> Include synonyms and variations: *"Use when customer asks about order status, shipping, delivery, or tracking"*

> [card] Always add pre-call message
>
> Set a friendly message like *"Let me check that for you"* so callers know to wait

> [card] Use required fields wisely
>
> Only mark parameters as required if the function truly cannot work without them

> [card] Test APIs first
>
> Verify your API works with tools like curl or Postman before adding to Bolna

> [card] Leverage auto-injection
>
> Put known data in the agent prompt to avoid asking callers for information you already have

> [card] Match names exactly
>
> Parameter names in `properties` and `param` must be identical (case-sensitive)

***

## Troubleshooting

> [accordion] Function not being triggered
>
> **Cause:** Description doesn't match what the caller is saying.
>
> **Fix:** Make your description more comprehensive. Include synonyms and example phrases.

> [accordion] API returns error
>
> **Cause:** Incorrect URL, authentication, or headers.
>
> **Fix:** Test your API with curl or Postman first. Verify `api_token` format and required headers.

> [accordion] Parameters not being passed correctly
>
> **Cause:** Typo or format specifier mismatch.
>
> **Fix:** Ensure parameter names match exactly between `properties` and `param`. Use `%(name)s` format.

> [accordion] Variables not being substituted
>
> **Cause:** Variable not defined in agent prompt.
>
> **Fix:** Add the variable to your agent prompt using `{variable_name}` syntax.

***

## Next steps

> [card] [Context variables](https://www.bolna.ai/docs/prompting/using-context.md)
>
> Learn about dynamic variable injection

> [card] [Transfer calls](https://www.bolna.ai/docs/tool-calling/transfer-calls.md)
>
> Route calls to human agents

> [card] [Calendar integration](https://www.bolna.ai/docs/tool-calling/book-calendar-slots.md)
>
> Book appointments via Cal.com

> [card] [Using webhooks](https://www.bolna.ai/docs/post-call/polling-call-status-webhooks)
>
> Receive execution data, including pre-call webhooks

> [card] [Agent API](https://www.bolna.ai/docs/api-reference/agent/v2/create.md)
>
> Programmatic function configuration


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