Test a condition
curl --request POST \
--url https://sandbox.voice.miraiminds.co/v2/agents/{agent_id}/conditions/test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"condition": {
"all": [
{
"field": "vars.customer_id",
"op": "exists"
},
{
"field": "vars.do_not_call",
"op": "is_false"
},
{
"field": "now.hour",
"op": "gte",
"value": 10
},
{
"field": "now.hour",
"op": "lt",
"value": 19
}
]
}
}
'import requests
url = "https://sandbox.voice.miraiminds.co/v2/agents/{agent_id}/conditions/test"
payload = { "condition": { "all": [
{
"field": "vars.customer_id",
"op": "exists"
},
{
"field": "vars.do_not_call",
"op": "is_false"
},
{
"field": "now.hour",
"op": "gte",
"value": 10
},
{
"field": "now.hour",
"op": "lt",
"value": 19
}
] } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const url = 'https://sandbox.voice.miraiminds.co/v2/agents/{agent_id}/conditions/test';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
condition: {
all: [
{field: 'vars.customer_id', op: 'exists'},
{field: 'vars.do_not_call', op: 'is_false'},
{field: 'now.hour', op: 'gte', value: 10},
{field: 'now.hour', op: 'lt', value: 19}
]
}
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));{
"result": true,
"failed_leaf": "",
"condition": {
"all": [
{
"field": "vars.customer_id",
"op": "exists"
},
{
"field": "vars.do_not_call",
"op": "is_false"
},
{
"field": "now.hour",
"op": "gte",
"value": 10
},
{
"field": "now.hour",
"op": "lt",
"value": 19
}
]
},
"now": {
"iso": "2026-10-09T14:30:00+05:30",
"date": "2026-10-09",
"time": "14:30",
"hour": 14,
"minute": 30,
"weekday": "Friday",
"weekday_num": 5,
"is_weekend": false,
"month": 10,
"year": 2026,
"epoch": 1791536400,
"timezone": "Asia/Kolkata",
"greeting": "Good afternoon"
}
}Tools and secrets
Test a condition
Checks a condition against values you supply and calls nothing. Use it while writing a tool’s condition.
Combine leaves with all, any and not (up to 8 levels, 64 comparisons). A leaf compares a dotted field from vars, call, now, tools, args or analysis using op; see the catalog for every operator. Leave scope.now out and it is filled in from the current time in Asia/Kolkata, as this example relies on. When the result is false, failed_leaf names the comparison that decided it.
POST
/
v2
/
agents
/
{agent_id}
/
conditions
/
test
Test a condition
curl --request POST \
--url https://sandbox.voice.miraiminds.co/v2/agents/{agent_id}/conditions/test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"condition": {
"all": [
{
"field": "vars.customer_id",
"op": "exists"
},
{
"field": "vars.do_not_call",
"op": "is_false"
},
{
"field": "now.hour",
"op": "gte",
"value": 10
},
{
"field": "now.hour",
"op": "lt",
"value": 19
}
]
}
}
'import requests
url = "https://sandbox.voice.miraiminds.co/v2/agents/{agent_id}/conditions/test"
payload = { "condition": { "all": [
{
"field": "vars.customer_id",
"op": "exists"
},
{
"field": "vars.do_not_call",
"op": "is_false"
},
{
"field": "now.hour",
"op": "gte",
"value": 10
},
{
"field": "now.hour",
"op": "lt",
"value": 19
}
] } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const url = 'https://sandbox.voice.miraiminds.co/v2/agents/{agent_id}/conditions/test';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
condition: {
all: [
{field: 'vars.customer_id', op: 'exists'},
{field: 'vars.do_not_call', op: 'is_false'},
{field: 'now.hour', op: 'gte', value: 10},
{field: 'now.hour', op: 'lt', value: 19}
]
}
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));{
"result": true,
"failed_leaf": "",
"condition": {
"all": [
{
"field": "vars.customer_id",
"op": "exists"
},
{
"field": "vars.do_not_call",
"op": "is_false"
},
{
"field": "now.hour",
"op": "gte",
"value": 10
},
{
"field": "now.hour",
"op": "lt",
"value": 19
}
]
},
"now": {
"iso": "2026-10-09T14:30:00+05:30",
"date": "2026-10-09",
"time": "14:30",
"hour": 14,
"minute": 30,
"weekday": "Friday",
"weekday_num": 5,
"is_weekend": false,
"month": 10,
"year": 2026,
"epoch": 1791536400,
"timezone": "Asia/Kolkata",
"greeting": "Good afternoon"
}
}Authorizations
Your workspace secret key, sk_live_ followed by 32 hex characters. Create one in the console under Developers.
Path Parameters
The agent's id (agt_…).
Response
True: inside calling hours
⌘I