Publish an agent
curl --request POST \
--url https://api.squawkvoice.ai/api/v1/assistants/{assistantId}/publish \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"version_name": "November pricing update"
}
'import requests
url = "https://api.squawkvoice.ai/api/v1/assistants/{assistantId}/publish"
payload = { "version_name": "November pricing update" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({version_name: 'November pricing update'})
};
fetch('https://api.squawkvoice.ai/api/v1/assistants/{assistantId}/publish', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"success": true,
"data": {
"job_id": "0c4f8e2a-6b1d-4a39-9e57-2f8d1c3b6a90",
"poll_url": "https://api.squawkvoice.ai/api/v1/assistants/3c7e1a52-8d4f-4b9a-a0e6-5f2d9c8b1e74/publish-jobs/0c4f8e2a-6b1d-4a39-9e57-2f8d1c3b6a90",
"status": "publishing",
"version": {
"version_id": "a71d3e95-2c8b-4f04-8d6a-9b1e5c7f2d38",
"version_number": 4,
"name": "November pricing update"
}
}
}
Agents
Publish an agent
Put an agent’s draft live as a new version, the same as Publish in Studio
POST
/
api
/
v1
/
assistants
/
{assistantId}
/
publish
Publish an agent
curl --request POST \
--url https://api.squawkvoice.ai/api/v1/assistants/{assistantId}/publish \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"version_name": "November pricing update"
}
'import requests
url = "https://api.squawkvoice.ai/api/v1/assistants/{assistantId}/publish"
payload = { "version_name": "November pricing update" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({version_name: 'November pricing update'})
};
fetch('https://api.squawkvoice.ai/api/v1/assistants/{assistantId}/publish', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"success": true,
"data": {
"job_id": "0c4f8e2a-6b1d-4a39-9e57-2f8d1c3b6a90",
"poll_url": "https://api.squawkvoice.ai/api/v1/assistants/3c7e1a52-8d4f-4b9a-a0e6-5f2d9c8b1e74/publish-jobs/0c4f8e2a-6b1d-4a39-9e57-2f8d1c3b6a90",
"status": "publishing",
"version": {
"version_id": "a71d3e95-2c8b-4f04-8d6a-9b1e5c7f2d38",
"version_number": 4,
"name": "November pricing update"
}
}
}
A publish puts the whole draft live, not only the guidelines. Any unpublished change made in Studio goes live with it. If other people edit the agent, check Review Changes in Studio, or
needs_publish from Get guidelines, before you publish.Update and Publish Guidelines
1
Replace the guidelines
Send the new text with Replace guidelines. It saves to the draft.
2
Publish
Call this endpoint. It answers
202 straight away with the new version’s version_id and number, and a poll_url.3
Wait for it to finish
Call the
poll_url every few seconds until status is published or failed. A publish that makes no progress for about 15 minutes is ended and reads failed. See Get publish status.4
Check what's live
Once it is
published, new phone calls, website chats and emails use the new version, and each of them records its version_id in interaction.AGENT_VERSION_ID. Get live version tells you which version is live.- Nothing to publish. If the draft is the same as the live version, you get a
400naming the live version, and no version is created. - One publish at a time. A publish started while another is running gets a
409with the running one’spoll_url. Wait for that publish to finish, then call this endpoint again: a publish includes only what was saved before it started, so a change saved while it ran is still waiting. If nothing is left to publish, you get the400. - A failed publish changes nothing. What was live stays live, the new version is never created and its number is skipped.
- It’s recorded. The publish appears in Audit Logs with the key’s creator as the Actor, and the new version appears in Version History in Studio.
- Going back is in Studio. To put an earlier version live again, use Make this version active in Studio.
Authorizations
An API key from Manage → API Keys in Studio. See Authentication.
Path Parameters
The agent's ID. Open the agent in Studio and select Copy ID in its header.
Body
application/json
A name for the version this publish creates, shown in Version History, up to 120 characters once spaces at the start and end are removed. Leave it out, or send null, an empty string or only spaces, and Studio shows Version N. This is the only field accepted; any other field returns a 400.
Maximum string length:
120Was this page helpful?