Voice agents
Update agent workflow Save an agent's pre-call or post-call workflow.
PUT https://api.tried.com.au /agents/{agent_id}/workflows/{stage}
Creates or replaces one workflow stage of an agent. The body is the whole stage: fields you leave out take their defaults, so send enabled, budget_ms and every step each time. Steps are checked when you save. See Workflows for how a run works and which variables each stage gets.
Request#
Path parameters#
Parameter
Type
Required
Description
agent_id
string
Yes
The agent.
stage
string
Yes
pre_call or post_call.
Body#
Field
Type
Required
Description
enabled
boolean
No
Run this stage. Default true.
budget_ms
integer
No
Time budget for the whole stage, 200 to 300000. Default 3000. At run time it is capped at 60000 for inbound and web pre-call runs and 300000 for outbound pre-call and post-call runs.
steps
array
No
Up to 20 steps. Default []. A stage with no steps does not run.
Step fields#
Field
Type
Required
Description
id
string
Yes
1 to 40 letters, numbers, - and _. Unique in the stage.
name
string
Yes
1 to 80 characters.
type
string
Yes
http, set_variables, code, send_sms or integration_app.
url
string
For http
Must start with http:// or https://. Accepts {{variable}} templates.
method
string
No
GET, POST, PUT or PATCH. Default POST.
headers
object
No
Header name to template. Default {}.
body
string
No
Request body template. When empty, all variables are sent as JSON. Not sent on GET.
values
object
No
Variable name to template. For set_variables, and on http to set variables after the response. Default {}.
code
string
For code
JavaScript, up to 20000 characters. Runs in the sandbox with args and dv.
arguments
object
No
Arguments for code and integration_app. String values are templates. Default {}.
app_id
string
For integration_app
The integration app.
action
string
For integration_app
The app action.
to_number
string
No
send_sms recipient template. Default: the user's number (from_number on inbound calls, to_number otherwise).
content
string
For send_sms
Message template, up to 1600 characters.
depends_on
string[]
No
Step ids that must finish first. Default [].
condition
string
No
Skip the step when this is false. See Conditions .
outputs
object
No
Variable name to a dotted path in the response or result, for example data.customer.tier. Default {}.
timeout_ms
integer
No
100 to 300000. Default 2000.
Example request#
curl -X PUT "https://api.tried.com.au/agents/agent_3f9a1c0b2d4e5f6a7b8c9d0e/workflows/pre_call" \
-H "Authorization: Bearer $TRIED_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"enabled": true,
"budget_ms": 3000,
"steps": [
{
"id": "lookup",
"name": "CRM lookup",
"type": "http",
"method": "GET",
"url": "https://crm.example.com/customers?phone={{to_number}}",
"outputs": { "customer_name": "data.name", "tier": "data.tier" }
}
]
}' const res = await fetch ( "https://api.tried.com.au/agents/agent_3f9a1c0b2d4e5f6a7b8c9d0e/workflows/pre_call" , {
method: "PUT" ,
headers: {
Authorization: `Bearer ${ process . env . TRIED_API_KEY }` ,
"Content-Type" : "application/json" ,
},
body: JSON . stringify ({
enabled: true ,
budget_ms: 3000 ,
steps: [
{
id: "lookup" ,
name: "CRM lookup" ,
type: "http" ,
method: "GET" ,
url: "https://crm.example.com/customers?phone={{to_number}}" ,
outputs: { customer_name: "data.name" , tier: "data.tier" },
},
],
}),
});
const workflow = await res. json (); import os, requests
res = requests.put(
"https://api.tried.com.au/agents/agent_3f9a1c0b2d4e5f6a7b8c9d0e/workflows/pre_call" ,
headers = { "Authorization" : f "Bearer { os.environ[ 'TRIED_API_KEY' ] } " },
json = {
"enabled" : True ,
"budget_ms" : 3000 ,
"steps" : [
{
"id" : "lookup" ,
"name" : "CRM lookup" ,
"type" : "http" ,
"method" : "GET" ,
"url" : "https://crm.example.com/customers?phone= {{ to_number }} " ,
"outputs" : { "customer_name" : "data.name" , "tier" : "data.tier" },
}
],
},
)
workflow = res.json()
Response#
200 OK with the saved workflow object . Steps come back with every default filled in.
{
"agent_id" : "agent_3f9a1c0b2d4e5f6a7b8c9d0e" ,
"stage" : "pre_call" ,
"enabled" : true ,
"budget_ms" : 3000 ,
"steps" : [
{
"id" : "lookup" ,
"name" : "CRM lookup" ,
"type" : "http" ,
"url" : "https://crm.example.com/customers?phone={{to_number}}" ,
"method" : "GET" ,
"headers" : {},
"values" : {},
"arguments" : {},
"depends_on" : [],
"outputs" : { "customer_name" : "data.name" , "tier" : "data.tier" },
"timeout_ms" : 2000
}
],
"last_modification_timestamp" : 1792310400000
}
Errors#
Status
When
400
Validation failed, for example an unknown stage, more than 20 steps or a bad step id. Also: Step ids must be unique, Step <id> depends on unknown step <id>, Workflow has a cycle at step <id>, Step <id> needs an http(s) URL, Step <id> needs code, Step <id> needs content, Step <id> needs app_id and action, or Step <id>: send_sms runs only in post-call workflows.
401
Missing or invalid API key.
403
The key's IP allowlist or scopes reject the request. This route needs the agents scope.
404
Agent <agent_id> not found.
429
Rate limit exceeded. See Rate limits .
See Errors for the body format.
Previous
List workflows
Next
Test workflow