Promotes a draft version to production.
http
POST https://services.leadconnectorhq.com/agent-studio/agent/versions/{versionId}/publishAuthorization
| 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 |
userId | string | No | usr_abc123def456 | User ID performing the promotion action |
userName | string | No | John Doe | User name performing the promotion action |
userEmail | string | No | john.doe@example.com | User email performing the promotion action |
Responses
200 - Version promoted and published successfully
success(boolean, required): Success status Example:Truemessage(string, required): Response message Example:Draft published to production successfully. New draft version created for future edits.data(object, required): Result data with production and new draft version details
json
{
"success": true,
"message": "Draft published to production successfully. New draft version created for future edits.",
"data": {
"productionVersion": {
"versionId": "v1a2b3c4d5e6f7g8h9i0",
"agentId": "p1q2r3s4t5u6v7w8x9y0z1a2",
"versionName": "Customer Support Agent v2",
"state": "prod",
"isPublished": true,
"version": 2,
"publishedAt": "2024-02-27T12:00:00.000Z",
"publishedBy": "usr_abc123def456",
"publishedByName": "John Doe",
"publishedByEmail": "john.doe@example.com"
},
"newDraftVersion": {
"versionId": "v2b3c4d5e6f7g8h9i0j1",
"agentId": "p1q2r3s4t5u6v7w8x9y0z1a2",
"versionName": "Customer Support Agent v3",
"state": "draft",
"isPublished": false,
"version": 3,
"createdAt": "2024-02-27T12:00:00.000Z"
}
}
}400 - Bad Request - Only draft versions can be promoted
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 POST 'https://services.leadconnectorhq.com/agent-studio/agent/versions/YOUR_versionId/publish' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"locationId": "C2QujeCh8ZnC7al2InWR",
"userId": "usr_abc123def456",
"userName": "John Doe",
"userEmail": "john.doe@example.com"
}'const response = await fetch('https://services.leadconnectorhq.com/agent-studio/agent/versions/YOUR_versionId/publish', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"locationId": "C2QujeCh8ZnC7al2InWR", "userId": "usr_abc123def456", "userName": "John Doe", "userEmail": "john.doe@example.com"}),
});
const data = await response.json();import os, requests
response = requests.request(
'POST',
'https://services.leadconnectorhq.com/agent-studio/agent/versions/YOUR_versionId/publish',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"locationId": "C2QujeCh8ZnC7al2InWR", "userId": "usr_abc123def456", "userName": "John Doe", "userEmail": "john.doe@example.com"},
)
data = response.json()<?php
$ch = curl_init('https://services.leadconnectorhq.com/agent-studio/agent/versions/YOUR_versionId/publish');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
'Version: 2021-07-28',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({'locationId': 'C2QujeCh8ZnC7al2InWR', 'userId': 'usr_abc123def456', 'userName': 'John Doe', 'userEmail': 'john.doe@example.com'}),
]);
$data = json_decode(curl_exec($ch), true);