Updates a specific agent version by versionId. Supports updating nodes, edges, variables, and configuration.
http
PATCH https://services.leadconnectorhq.com/agent-studio/agent/versions/{versionId}Authorization
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
Authorization | string | Yes | Bearer token generated from the Leadway portal. See Authentication. | |
Version | string | Yes | 2021-07-28 | API version. |
Path parameters
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
versionId | string | Yes | v1a2b3c4d5e6f7g8h9i0 |
Query parameters
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
source | string | No | api |
Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
locationId | string | Yes | C2QujeCh8ZnC7al2InWR | Account ID for authorization |
versionName | string | No | Customer Support Agent v2 | Version name |
description | string | No | Updated version with improved customer handling logic | Description of the version |
nodes | object[] | No | Complete array of nodes for the agent workflow. Provide all nodes including unchanged ones. | |
edges | object[] | No | Complete array of edges connecting the nodes. Provide all edges including unchanged ones. | |
globalVariables | object[] | No | Global variables accessible throughout the agent workflow | |
inputVariables | object[] | No | Input variables required from user at execution time | |
runtimeVariables | object[] | No | Runtime variables generated during agent execution | |
globalConfig | object | No | Global configuration including prompts and settings | |
userId | string | No | usr_abc123def456 | User ID performing the update |
userName | string | No | John Doe | User name performing the update |
Responses
200 - Version updated successfully
success(boolean, required): Success status Example:Truemessage(string, required): Response message Example:Agent updated successfullydata(object, required): Updated agent or version data
json
{
"success": true,
"message": "Agent updated successfully",
"data": {
"agentId": "p1q2r3s4t5u6v7w8x9y0z1a2",
"versionId": "v1a2b3c4d5e6f7g8h9i0",
"name": "Updated Customer Support Agent",
"description": "Updated AI agent with enhanced customer support capabilities",
"status": "active",
"updatedAt": "2024-02-27T11:45:00.000Z"
}
}400 - Bad Request
json
{}404 - Version not found
422 - Unprocessable Entity
json
{}500 - Internal Server Error
statusCode(number): Example:500message(string): Example:Internal Server Error
json
{
"statusCode": 500,
"message": "Internal Server Error"
}Example
curl -X PATCH 'https://services.leadconnectorhq.com/agent-studio/agent/versions/YOUR_versionId' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"locationId": "C2QujeCh8ZnC7al2InWR",
"versionName": "Customer Support Agent v2",
"description": "Updated version with improved customer handling logic",
"nodes": [
{
"nodeId": "node_1",
"nodeName": "Start",
"type": "start",
"isStartNode": true
},
{
"nodeId": "node_2",
"nodeName": "LLM Node",
"type": "llm",
"nodeConfig": {
"prompt": "How can I help you?",
"llmProvider": "openai",
"llmModel": "gpt-4"
}
}
],
"edges": [
{
"startNode": "node_1",
"endNode": "node_2"
}
],
"globalVariables": [
{
"key": "apiKey",
"type": "string",
"value": "your-api-key"
}
],
"inputVariables": [
{
"key": "customerName",
"type": "string",
"description": "Customer name for personalization"
}
],
"runtimeVariables": [
{
"key": "sessionId",
"type": "string",
"description": "Current session identifier"
}
],
"globalConfig": {
"globalPrompt": {
"currentPrompt": "You are a helpful customer support assistant.",
"history": []
}
},
"userId": "usr_abc123def456",
"userName": "John Doe"
}'const response = await fetch('https://services.leadconnectorhq.com/agent-studio/agent/versions/YOUR_versionId', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"locationId": "C2QujeCh8ZnC7al2InWR", "versionName": "Customer Support Agent v2", "description": "Updated version with improved customer handling logic", "nodes": [{"nodeId": "node_1", "nodeName": "Start", "type": "start", "isStartNode": true}, {"nodeId": "node_2", "nodeName": "LLM Node", "type": "llm", "nodeConfig": {"prompt": "How can I help you?", "llmProvider": "openai", "llmModel": "gpt-4"}}], "edges": [{"startNode": "node_1", "endNode": "node_2"}], "globalVariables": [{"key": "apiKey", "type": "string", "value": "your-api-key"}], "inputVariables": [{"key": "customerName", "type": "string", "description": "Customer name for personalization"}], "runtimeVariables": [{"key": "sessionId", "type": "string", "description": "Current session identifier"}], "globalConfig": {"globalPrompt": {"currentPrompt": "You are a helpful customer support assistant.", "history": []}}, "userId": "usr_abc123def456", "userName": "John Doe"}),
});
const data = await response.json();import os, requests
response = requests.request(
'PATCH',
'https://services.leadconnectorhq.com/agent-studio/agent/versions/YOUR_versionId',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"locationId": "C2QujeCh8ZnC7al2InWR", "versionName": "Customer Support Agent v2", "description": "Updated version with improved customer handling logic", "nodes": [{"nodeId": "node_1", "nodeName": "Start", "type": "start", "isStartNode": true}, {"nodeId": "node_2", "nodeName": "LLM Node", "type": "llm", "nodeConfig": {"prompt": "How can I help you?", "llmProvider": "openai", "llmModel": "gpt-4"}}], "edges": [{"startNode": "node_1", "endNode": "node_2"}], "globalVariables": [{"key": "apiKey", "type": "string", "value": "your-api-key"}], "inputVariables": [{"key": "customerName", "type": "string", "description": "Customer name for personalization"}], "runtimeVariables": [{"key": "sessionId", "type": "string", "description": "Current session identifier"}], "globalConfig": {"globalPrompt": {"currentPrompt": "You are a helpful customer support assistant.", "history": []}}, "userId": "usr_abc123def456", "userName": "John Doe"},
)
data = response.json()<?php
$ch = curl_init('https://services.leadconnectorhq.com/agent-studio/agent/versions/YOUR_versionId');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
'Version: 2021-07-28',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({'locationId': 'C2QujeCh8ZnC7al2InWR', 'versionName': 'Customer Support Agent v2', 'description': 'Updated version with improved customer handling logic', 'nodes': [{'nodeId': 'node_1', 'nodeName': 'Start', 'type': 'start', 'isStartNode': true}, {'nodeId': 'node_2', 'nodeName': 'LLM Node', 'type': 'llm', 'nodeConfig': {'prompt': 'How can I help you?', 'llmProvider': 'openai', 'llmModel': 'gpt-4'}}], 'edges': [{'startNode': 'node_1', 'endNode': 'node_2'}], 'globalVariables': [{'key': 'apiKey', 'type': 'string', 'value': 'your-api-key'}], 'inputVariables': [{'key': 'customerName', 'type': 'string', 'description': 'Customer name for personalization'}], 'runtimeVariables': [{'key': 'sessionId', 'type': 'string', 'description': 'Current session identifier'}], 'globalConfig': {'globalPrompt': {'currentPrompt': 'You are a helpful customer support assistant.', 'history': []}}, 'userId': 'usr_abc123def456', 'userName': 'John Doe'}),
]);
$data = json_decode(curl_exec($ch), true);