Skip to content

Deployments

Deployments in Voker represent saved configurations that you can execute via the API.

The simplest way to run a deployment is by using its unique deployment ID, which is generated when you create a deployment. When you create a deployment through the Voker UI, you will receive a cURL command along with equivalent commands in Python and JavaScript. These commands will include the Deployment ID and placeholders for any required inputs.

example.bash
API_TOKEN="..."
DEPLOYMENT_ID="..."
curl https://api.voker.ai/api/v1/deployments/$DEPLOYMENT_ID/run \
--request POST \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $API_TOKEN" \
--data '{
"input": {
"message": "Hello, this is a test message."
}
}'

You can designate a deployment as Live in the Voker UI, making it the default version. This means that any request to run a deployment without specifying an ID or name will execute the live version. Use the following cURL command to run the currently live deployment:

example.bash
API_TOKEN="..."
VOKER_ID="..."
curl https://api.voker.ai/api/v1/graphs/$VOKER_ID/run \
--request POST \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $API_TOKEN" \
--data '{
"input": {
"message": "Hello, this is a test message"
}
}'

Under your created deployment you will see a “live toggle”

Deployment can set live

When clicked you will see a label next to the deployment indicating that it is live.

Live deployment

Alternatively, you can run a deployment using its name. The deployment name is set when you create it and can be changed at any time.

example.bash
API_TOKEN="..."
VOKER_ID="..."
DEPLOYMENT_NAME="..."
curl https://api.voker.ai/api/v1/graphs/$VOKER_ID/run?v=$DEPLOYMENT_NAME \
--request POST \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $API_TOKEN" \
--data '{
"input": {
"message": "Hello, this is a test message."
}
}'

Changing the live deployment will automatically update which version is executed when making this request.

To maintain context across multiple Voker calls—such as in a chat—you can use the conversation_id parameter.

A successful Voker response includes a conversation_id for follow-up requests:

{
"result": ... // the result of the Voker call in the format you requested
"conversation_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" // the conversation ID to use in follow up calls
}

Include this conversation_id in subsequent requests to maintain conversation context.

Example Request With Conversation ID

a11y.sectionLink Example Request With Conversation ID
example.bash
API_TOKEN="..."
DEPLOYMENT_ID="..."
CONV_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
curl https://api.voker.ai/api/v1/deployments/$DEPLOYMENT_ID/run \
--request POST \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $API_TOKEN" \
--data '{
"input": {
"message": "Hello, this is a test message."
},
"conversation_id": "'"$CONV_ID"'"
}'
example.py
import requests
API_TOKEN = "..."
DEPLOYMENT_ID = "..."
# Initial request (no conversation ID)
response1 = requests.post(
f"https://api.voker.ai/api/v1/deployments/{DEPLOYMENT_ID}/run",
headers={"Authorization": f"Bearer {API_TOKEN}"},
json={
"input": {
"message": "What are some good restaurants in the area?",
},
},
)
response1_data = response1.json()
conversation_id = response1_data["conversation_id"]
print(response1_data["result"])
# Follow-up request with conversation ID
response2 = requests.post(
f"https://api.voker.ai/api/v1/deployments/{DEPLOYMENT_ID}/run",
headers={"Authorization": f"Bearer {API_TOKEN}"},
json={
"input": {
"message": "Can you suggest some budget-friendly options?",
},
"conversation_id": conversation_id,
},
)
response2_data = response2.json()
print(response2_data["result"])

The following examples show how to call a Voker with an image input (called img) in Javascript, Python and using cURL.

example.bash
API_TOKEN="..."
FILE_PATH="..."
DEPLOYMENT_ID="..."
PNG_ENCODED=$(base64 $FILE_PATH | tr -d '\n')
curl https://api.voker.ai/api/v1/deployments/$DEPLOYMENT_ID/run \
--request POST \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $API_TOKEN" \
--data '{
"input": {
"img": "data:image/png;base64,'"$PNG_ENCODED"'"
}
}'
example.py
import base64
import requests
API_TOKEN = "..."
FILE_PATH = "..."
DEPLOYMENT_ID = "..."
with open(FILE_PATH, "rb") as image_file:
png_encoded = base64.b64encode(image_file.read()).decode("utf-8")
response = requests.post(
f"https://api.voker.ai/api/v1/deployments/{DEPLOYMENT_ID}/run",
headers={
"Authorization": f"Bearer {API_TOKEN}",
},
json={
"input": {
"img": f"data:image/png;base64,{png_encoded}",
},
},
)
print(response.json()["result"])
example.js
import * as fs from 'fs';
const API_TOKEN = '...';
const FILE_PATH = '...';
const DEPLOYMENT_ID = '...';
const pngEncoded = fs.readFileSync(FILE_PATH, { encoding: 'base64' });
fetch(
`https://api.voker.ai/api/v1/deployments/${DEPLOYMENT_ID}/run`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${API_TOKEN}`,
},
body: JSON.stringify({
input: {
img: `data:image/png;base64,${pngEncoded}`,
},
}),
},
)
.then((response) => response.json())
.then((data) => console.log(data.result));
example.bash
API_TOKEN="..."
FILE_PATH="..."
DEPLOYMENT_ID="..."
JPG_ENCODED=$(base64 $FILE_PATH | tr -d '\n')
curl https://api.voker.ai/api/v1/deployments/$DEPLOYMENT_ID/run \
--request POST \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $API_TOKEN" \
--data '{
"input": {
"img": "data:image/jpg;base64,'"$JPG_ENCODED"'"
}
}'
example.py
import base64
import requests
API_TOKEN = "..."
FILE_PATH = "..."
DEPLOYMENT_ID = "..."
with open(FILE_PATH, "rb") as image_file:
jpg_encoded = base64.b64encode(image_file.read()).decode("utf-8")
response = requests.post(
f"https://api.voker.ai/api/v1/deployments/{DEPLOYMENT_ID}/run",
headers={
"Authorization": f"Bearer {API_TOKEN}",
},
json={
"input": {
"img": f"data:image/jpg;base64,{jpg_encoded}",
},
},
)
print(response.json()["result"])
example.js
import * as fs from 'fs';
const API_TOKEN = '...';
const FILE_PATH = '...';
const DEPLOYMENT_ID = '...';
const jpgEncoded = fs.readFileSync(FILE_PATH, { encoding: 'base64' });
fetch(
`https://api.voker.ai/api/v1/deployments/${DEPLOYMENT_ID}/run`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${API_TOKEN}`,
},
body: JSON.stringify({
input: {
img: `data:image/jpg;base64,${jpgEncoded}`,
},
}),
},
)
.then((response) => response.json())
.then((data) => console.log(data.result));