Agent Functions
Create Agent Function
deprecated
Create a custom function for one agent version.
POST
/
agent-functions
/
{agentId}
/
{versionNumber}
Create a new agent function
curl --request POST \
--url https://api.dialnexa.com/agent-functions/{agentId}/{versionNumber} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"type": "end_call",
"displayName": "End Call Function",
"description": "This function ends the call",
"config": {
"timeout": 30,
"message": "Goodbye!"
}
}
'import requests
url = "https://api.dialnexa.com/agent-functions/{agentId}/{versionNumber}"
payload = {
"type": "end_call",
"displayName": "End Call Function",
"description": "This function ends the call",
"config": {
"timeout": 30,
"message": "Goodbye!"
}
}
headers = {
"x-organization-id": "<x-organization-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-organization-id': '<x-organization-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
type: 'end_call',
displayName: 'End Call Function',
description: 'This function ends the call',
config: {timeout: 30, message: 'Goodbye!'}
})
};
fetch('https://api.dialnexa.com/agent-functions/{agentId}/{versionNumber}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dialnexa.com/agent-functions/{agentId}/{versionNumber}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'end_call',
'displayName' => 'End Call Function',
'description' => 'This function ends the call',
'config' => [
'timeout' => 30,
'message' => 'Goodbye!'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-organization-id: <x-organization-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dialnexa.com/agent-functions/{agentId}/{versionNumber}"
payload := strings.NewReader("{\n \"type\": \"end_call\",\n \"displayName\": \"End Call Function\",\n \"description\": \"This function ends the call\",\n \"config\": {\n \"timeout\": 30,\n \"message\": \"Goodbye!\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-organization-id", "<x-organization-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dialnexa.com/agent-functions/{agentId}/{versionNumber}")
.header("x-organization-id", "<x-organization-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"end_call\",\n \"displayName\": \"End Call Function\",\n \"description\": \"This function ends the call\",\n \"config\": {\n \"timeout\": 30,\n \"message\": \"Goodbye!\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dialnexa.com/agent-functions/{agentId}/{versionNumber}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-organization-id"] = '<x-organization-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"end_call\",\n \"displayName\": \"End Call Function\",\n \"description\": \"This function ends the call\",\n \"config\": {\n \"timeout\": 30,\n \"message\": \"Goodbye!\"\n }\n}"
response = http.request(request)
puts response.read_bodyLegacy endpoint - deprecated. Unversioned endpoints are scheduled for removal on July 31, 2026. A public v1 replacement is not currently listed in the v1 reference. This endpoint remains available for existing integrations until then.
agent-functions route.
Path parameters
| Parameter | Description |
|---|---|
agentId | Agent ID. |
versionNumber | Agent version number. |
Related endpoints
- List Agent Functions: list functions for an agent version.
- Custom Functions: configure function behavior in the dashboard.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
RSA encrypted organization ID (base64 format)
Example:
"BASE64_ENCRYPTED_ORG_ID_HERE"
Path Parameters
ID of the agent
Version number of the agent
Body
application/json
Type of the function
Available options:
end_call, call_transfer, custom, check_calendar_availability, book_calendar, integration Example:
"end_call"
Display name of the function (max 35 characters)
Maximum string length:
35Example:
"End Call Function"
Description of the function
Example:
"This function ends the call"
Configuration object for the function
Example:
{ "timeout": 30, "message": "Goodbye!" }
Response
The agent function has been successfully created.
Was this page helpful?
⌘I
Create a new agent function
curl --request POST \
--url https://api.dialnexa.com/agent-functions/{agentId}/{versionNumber} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"type": "end_call",
"displayName": "End Call Function",
"description": "This function ends the call",
"config": {
"timeout": 30,
"message": "Goodbye!"
}
}
'import requests
url = "https://api.dialnexa.com/agent-functions/{agentId}/{versionNumber}"
payload = {
"type": "end_call",
"displayName": "End Call Function",
"description": "This function ends the call",
"config": {
"timeout": 30,
"message": "Goodbye!"
}
}
headers = {
"x-organization-id": "<x-organization-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-organization-id': '<x-organization-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
type: 'end_call',
displayName: 'End Call Function',
description: 'This function ends the call',
config: {timeout: 30, message: 'Goodbye!'}
})
};
fetch('https://api.dialnexa.com/agent-functions/{agentId}/{versionNumber}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dialnexa.com/agent-functions/{agentId}/{versionNumber}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'end_call',
'displayName' => 'End Call Function',
'description' => 'This function ends the call',
'config' => [
'timeout' => 30,
'message' => 'Goodbye!'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-organization-id: <x-organization-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dialnexa.com/agent-functions/{agentId}/{versionNumber}"
payload := strings.NewReader("{\n \"type\": \"end_call\",\n \"displayName\": \"End Call Function\",\n \"description\": \"This function ends the call\",\n \"config\": {\n \"timeout\": 30,\n \"message\": \"Goodbye!\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-organization-id", "<x-organization-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dialnexa.com/agent-functions/{agentId}/{versionNumber}")
.header("x-organization-id", "<x-organization-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"end_call\",\n \"displayName\": \"End Call Function\",\n \"description\": \"This function ends the call\",\n \"config\": {\n \"timeout\": 30,\n \"message\": \"Goodbye!\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dialnexa.com/agent-functions/{agentId}/{versionNumber}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-organization-id"] = '<x-organization-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"end_call\",\n \"displayName\": \"End Call Function\",\n \"description\": \"This function ends the call\",\n \"config\": {\n \"timeout\": 30,\n \"message\": \"Goodbye!\"\n }\n}"
response = http.request(request)
puts response.read_body