Create Pathway Chat
curl --request POST \
--url https://us.api.bland.ai/v1/pathway/chat/create \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"pathway_id": "<string>",
"start_node_id": "<string>",
"request_data": {},
"use_candidate_model": true,
"pathway_version": 123
}
'import requests
url = "https://us.api.bland.ai/v1/pathway/chat/create"
payload = {
"pathway_id": "<string>",
"start_node_id": "<string>",
"request_data": {},
"use_candidate_model": True,
"pathway_version": 123
}
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
pathway_id: '<string>',
start_node_id: '<string>',
request_data: {},
use_candidate_model: true,
pathway_version: 123
})
};
fetch('https://us.api.bland.ai/v1/pathway/chat/create', 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://us.api.bland.ai/v1/pathway/chat/create",
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([
'pathway_id' => '<string>',
'start_node_id' => '<string>',
'request_data' => [
],
'use_candidate_model' => true,
'pathway_version' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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://us.api.bland.ai/v1/pathway/chat/create"
payload := strings.NewReader("{\n \"pathway_id\": \"<string>\",\n \"start_node_id\": \"<string>\",\n \"request_data\": {},\n \"use_candidate_model\": true,\n \"pathway_version\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
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://us.api.bland.ai/v1/pathway/chat/create")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"pathway_id\": \"<string>\",\n \"start_node_id\": \"<string>\",\n \"request_data\": {},\n \"use_candidate_model\": true,\n \"pathway_version\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.api.bland.ai/v1/pathway/chat/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"pathway_id\": \"<string>\",\n \"start_node_id\": \"<string>\",\n \"request_data\": {},\n \"use_candidate_model\": true,\n \"pathway_version\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {
"chat_id": "9f8e7d6c-5b4a-3c2d-1e0f-a1b2c3d4e5f6",
"message": "Chat instance created successfully",
"variables": {
"user_name": "John Doe",
"account_id": "12345",
"preference": "email"
}
},
"errors": null
}
Pathway Chat
Create Pathway Chat
Create an instance of a pathway chat, which can be used to send and receive messages to the pathway.
POST
/
v1
/
pathway
/
chat
/
create
Create Pathway Chat
curl --request POST \
--url https://us.api.bland.ai/v1/pathway/chat/create \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"pathway_id": "<string>",
"start_node_id": "<string>",
"request_data": {},
"use_candidate_model": true,
"pathway_version": 123
}
'import requests
url = "https://us.api.bland.ai/v1/pathway/chat/create"
payload = {
"pathway_id": "<string>",
"start_node_id": "<string>",
"request_data": {},
"use_candidate_model": True,
"pathway_version": 123
}
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
pathway_id: '<string>',
start_node_id: '<string>',
request_data: {},
use_candidate_model: true,
pathway_version: 123
})
};
fetch('https://us.api.bland.ai/v1/pathway/chat/create', 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://us.api.bland.ai/v1/pathway/chat/create",
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([
'pathway_id' => '<string>',
'start_node_id' => '<string>',
'request_data' => [
],
'use_candidate_model' => true,
'pathway_version' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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://us.api.bland.ai/v1/pathway/chat/create"
payload := strings.NewReader("{\n \"pathway_id\": \"<string>\",\n \"start_node_id\": \"<string>\",\n \"request_data\": {},\n \"use_candidate_model\": true,\n \"pathway_version\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
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://us.api.bland.ai/v1/pathway/chat/create")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"pathway_id\": \"<string>\",\n \"start_node_id\": \"<string>\",\n \"request_data\": {},\n \"use_candidate_model\": true,\n \"pathway_version\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.api.bland.ai/v1/pathway/chat/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"pathway_id\": \"<string>\",\n \"start_node_id\": \"<string>\",\n \"request_data\": {},\n \"use_candidate_model\": true,\n \"pathway_version\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {
"chat_id": "9f8e7d6c-5b4a-3c2d-1e0f-a1b2c3d4e5f6",
"message": "Chat instance created successfully",
"variables": {
"user_name": "John Doe",
"account_id": "12345",
"preference": "email"
}
},
"errors": null
}
Headers
string
required
Your API key for authentication.
Body
string
required
Pathway ID of the pathway to create a chat instance for.
string
The start node ID of the pathway. If not provided, the pathway will start from the node marked as the start node in the pathway configuration.
object
Custom key-value data to initialize the pathway chat with. This object will be stored as the pathway’s initial variables and can be referenced within pathway nodes. The
request_data must be a valid JSON object (not an array or null).This works the same as request_data in v1/calls where variables can be accessed using {{variable_name}} syntax within your pathway nodes.{
"user_name": "John Doe",
"account_id": "12345",
"preference": "email"
}
boolean
Whether to use the candidate model for this pathway chat. When enabled, the pathway will use an experimental model version for enhanced performance and capabilities.
number
The specific version number of the pathway to use for this chat instance. If not provided, the production version will be used.
Response
object
Contains the response data for the created pathway chat instance.
Show data properties
Show data properties
uuid
The ID of the chat instance created. This will be used to send and receive messages to the pathway via the
/v1/pathway/chat/:id endpoint.string
A confirmation message. Will say “Chat instance created successfully” on success.
object | null
The initial variables that were set for this pathway chat instance. This will contain the
request_data object if it was provided in the request, otherwise it will be null.null | array
Will be
null on success. Contains error details if the request failed.{
"data": {
"chat_id": "9f8e7d6c-5b4a-3c2d-1e0f-a1b2c3d4e5f6",
"message": "Chat instance created successfully",
"variables": {
"user_name": "John Doe",
"account_id": "12345",
"preference": "email"
}
},
"errors": null
}
Docs for agents: llms.txt
Was this page helpful?
⌘I