curl --request POST \
--url 'https://api-prod.usefini.com/v2/hc-rules/4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3/versions/rule-version-3/test-paths/run/public' \
--header 'Authorization: Bearer fini_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"pathId": "vip-refund-escalation",
"expectedTerminalNodeId": "reply_escalate",
"inputContext": {
"message": {
"text": "I am a VIP customer and need a refund."
},
"user": {
"plan": "VIP"
}
},
"runtimeContext": {
"source": "zendesk",
"channel": "email"
},
"interactionHistory": [
{
"role": "user",
"type": "message",
"content": "I need a refund."
}
],
"mockTextExtraction": true
}'
const ruleId = "4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3";
const versionId = "rule-version-3";
const response = await fetch(
`https://api-prod.usefini.com/v2/hc-rules/${ruleId}/versions/${versionId}/test-paths/run/public`,
{
method: "POST",
headers: {
Authorization: "Bearer fini_your_api_key",
"Content-Type": "application/json",
},
body: JSON.stringify({
pathId: "vip-refund-escalation",
expectedTerminalNodeId: "reply_escalate",
inputContext: {
message: { text: "I am a VIP customer and need a refund." },
user: { plan: "VIP" },
},
runtimeContext: {
source: "zendesk",
channel: "email",
},
interactionHistory: [
{
role: "user",
type: "message",
content: "I need a refund.",
},
],
mockTextExtraction: true,
}),
}
);
const result = await response.json();
import requests
rule_id = "4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3"
version_id = "rule-version-3"
response = requests.post(
f"https://api-prod.usefini.com/v2/hc-rules/{rule_id}/versions/{version_id}/test-paths/run/public",
headers={
"Authorization": "Bearer fini_your_api_key",
"Content-Type": "application/json",
},
json={
"pathId": "vip-refund-escalation",
"expectedTerminalNodeId": "reply_escalate",
"inputContext": {
"message": {"text": "I am a VIP customer and need a refund."},
"user": {"plan": "VIP"},
},
"runtimeContext": {"source": "zendesk", "channel": "email"},
"interactionHistory": [
{
"role": "user",
"type": "message",
"content": "I need a refund.",
}
],
"mockTextExtraction": True,
},
)
result = response.json()
{
"results": [
{
"id": "root",
"name": "Refund workflow",
"type": "SEQUENCE",
"success": true
},
{
"id": "reply_escalate",
"name": "Escalate refund",
"type": "ACTION",
"subType": "SEND_MESSAGE",
"success": true,
"terminate": true,
"result": {
"message": "Escalate refund request with order context."
}
}
],
"testContext": {
"inputContext": {
"message": {
"text": "I am a VIP customer and need a refund."
},
"user": {
"plan": "VIP"
}
},
"runtimeContext": {
"source": "zendesk",
"channel": "email"
},
"notes": ["Set user.plan to VIP so the VIP branch matches."]
},
"expectedTerminalNodeId": "reply_escalate",
"actualTerminalNodeId": "reply_escalate",
"matchedExpectedPath": true,
"message": "Matched expected terminal node reply_escalate."
}
Intent Rules
Run rule version test path
Run one generated test path against a saved intent-rule version.
POST
/
v2
/
hc-rules
/
{id}
/
versions
/
{versionId}
/
test-paths
/
run
/
public
curl --request POST \
--url 'https://api-prod.usefini.com/v2/hc-rules/4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3/versions/rule-version-3/test-paths/run/public' \
--header 'Authorization: Bearer fini_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"pathId": "vip-refund-escalation",
"expectedTerminalNodeId": "reply_escalate",
"inputContext": {
"message": {
"text": "I am a VIP customer and need a refund."
},
"user": {
"plan": "VIP"
}
},
"runtimeContext": {
"source": "zendesk",
"channel": "email"
},
"interactionHistory": [
{
"role": "user",
"type": "message",
"content": "I need a refund."
}
],
"mockTextExtraction": true
}'
const ruleId = "4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3";
const versionId = "rule-version-3";
const response = await fetch(
`https://api-prod.usefini.com/v2/hc-rules/${ruleId}/versions/${versionId}/test-paths/run/public`,
{
method: "POST",
headers: {
Authorization: "Bearer fini_your_api_key",
"Content-Type": "application/json",
},
body: JSON.stringify({
pathId: "vip-refund-escalation",
expectedTerminalNodeId: "reply_escalate",
inputContext: {
message: { text: "I am a VIP customer and need a refund." },
user: { plan: "VIP" },
},
runtimeContext: {
source: "zendesk",
channel: "email",
},
interactionHistory: [
{
role: "user",
type: "message",
content: "I need a refund.",
},
],
mockTextExtraction: true,
}),
}
);
const result = await response.json();
import requests
rule_id = "4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3"
version_id = "rule-version-3"
response = requests.post(
f"https://api-prod.usefini.com/v2/hc-rules/{rule_id}/versions/{version_id}/test-paths/run/public",
headers={
"Authorization": "Bearer fini_your_api_key",
"Content-Type": "application/json",
},
json={
"pathId": "vip-refund-escalation",
"expectedTerminalNodeId": "reply_escalate",
"inputContext": {
"message": {"text": "I am a VIP customer and need a refund."},
"user": {"plan": "VIP"},
},
"runtimeContext": {"source": "zendesk", "channel": "email"},
"interactionHistory": [
{
"role": "user",
"type": "message",
"content": "I need a refund.",
}
],
"mockTextExtraction": True,
},
)
result = response.json()
{
"results": [
{
"id": "root",
"name": "Refund workflow",
"type": "SEQUENCE",
"success": true
},
{
"id": "reply_escalate",
"name": "Escalate refund",
"type": "ACTION",
"subType": "SEND_MESSAGE",
"success": true,
"terminate": true,
"result": {
"message": "Escalate refund request with order context."
}
}
],
"testContext": {
"inputContext": {
"message": {
"text": "I am a VIP customer and need a refund."
},
"user": {
"plan": "VIP"
}
},
"runtimeContext": {
"source": "zendesk",
"channel": "email"
},
"notes": ["Set user.plan to VIP so the VIP branch matches."]
},
"expectedTerminalNodeId": "reply_escalate",
"actualTerminalNodeId": "reply_escalate",
"matchedExpectedPath": true,
"message": "Matched expected terminal node reply_escalate."
}
Runs a simulated Rulebook evaluation for one saved intent-rule version. Use this
after generating paths to verify that a selected path reaches the expected
terminal node.
Headers
Bearer token containing your Fini workspace API key. Format:
Bearer fini_...
The key needs read scope.Path parameters
Body parameters
Optional simulated conversation history. Each item can include
role, type,
content, event_id, and metadata.content.Response
Returns a rule test path run result.curl --request POST \
--url 'https://api-prod.usefini.com/v2/hc-rules/4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3/versions/rule-version-3/test-paths/run/public' \
--header 'Authorization: Bearer fini_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"pathId": "vip-refund-escalation",
"expectedTerminalNodeId": "reply_escalate",
"inputContext": {
"message": {
"text": "I am a VIP customer and need a refund."
},
"user": {
"plan": "VIP"
}
},
"runtimeContext": {
"source": "zendesk",
"channel": "email"
},
"interactionHistory": [
{
"role": "user",
"type": "message",
"content": "I need a refund."
}
],
"mockTextExtraction": true
}'
const ruleId = "4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3";
const versionId = "rule-version-3";
const response = await fetch(
`https://api-prod.usefini.com/v2/hc-rules/${ruleId}/versions/${versionId}/test-paths/run/public`,
{
method: "POST",
headers: {
Authorization: "Bearer fini_your_api_key",
"Content-Type": "application/json",
},
body: JSON.stringify({
pathId: "vip-refund-escalation",
expectedTerminalNodeId: "reply_escalate",
inputContext: {
message: { text: "I am a VIP customer and need a refund." },
user: { plan: "VIP" },
},
runtimeContext: {
source: "zendesk",
channel: "email",
},
interactionHistory: [
{
role: "user",
type: "message",
content: "I need a refund.",
},
],
mockTextExtraction: true,
}),
}
);
const result = await response.json();
import requests
rule_id = "4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3"
version_id = "rule-version-3"
response = requests.post(
f"https://api-prod.usefini.com/v2/hc-rules/{rule_id}/versions/{version_id}/test-paths/run/public",
headers={
"Authorization": "Bearer fini_your_api_key",
"Content-Type": "application/json",
},
json={
"pathId": "vip-refund-escalation",
"expectedTerminalNodeId": "reply_escalate",
"inputContext": {
"message": {"text": "I am a VIP customer and need a refund."},
"user": {"plan": "VIP"},
},
"runtimeContext": {"source": "zendesk", "channel": "email"},
"interactionHistory": [
{
"role": "user",
"type": "message",
"content": "I need a refund.",
}
],
"mockTextExtraction": True,
},
)
result = response.json()
{
"results": [
{
"id": "root",
"name": "Refund workflow",
"type": "SEQUENCE",
"success": true
},
{
"id": "reply_escalate",
"name": "Escalate refund",
"type": "ACTION",
"subType": "SEND_MESSAGE",
"success": true,
"terminate": true,
"result": {
"message": "Escalate refund request with order context."
}
}
],
"testContext": {
"inputContext": {
"message": {
"text": "I am a VIP customer and need a refund."
},
"user": {
"plan": "VIP"
}
},
"runtimeContext": {
"source": "zendesk",
"channel": "email"
},
"notes": ["Set user.plan to VIP so the VIP branch matches."]
},
"expectedTerminalNodeId": "reply_escalate",
"actualTerminalNodeId": "reply_escalate",
"matchedExpectedPath": true,
"message": "Matched expected terminal node reply_escalate."
}
Was this page helpful?

