curl --request POST \
--url 'https://api-prod.usefini.com/v2/hc-rules/generate-tests/public' \
--header 'Authorization: Bearer fini_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"description": "Refund-policy conversations to re-check before prompt changes.",
"flowConfig": {
"name": "Example",
"value": "message"
},
"existingSuite": {
"name": "Example",
"value": "message"
},
"instructions": "Create a draft rule that escalates refund requests with order context."
}'
const response = await fetch('https://api-prod.usefini.com/v2/hc-rules/generate-tests/public', {
method: 'POST',
headers: {
Authorization: 'Bearer fini_your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'description': 'Refund-policy conversations to re-check before prompt changes.',
'flowConfig': {
'name': 'Example',
'value': 'message'
},
'existingSuite': {
'name': 'Example',
'value': 'message'
},
'instructions': 'Create a draft rule that escalates refund requests with order context.'
}
)
});
const data = await response.json();
import requests
response = requests.post(
"https://api-prod.usefini.com/v2/hc-rules/generate-tests/public",
headers={"Authorization": "Bearer fini_your_api_key", "Content-Type": "application/json"},
json={
"description": "Refund-policy conversations to re-check before prompt changes.",
"flowConfig": {
"name": "Example",
"value": "message"
},
"existingSuite": {
"name": "Example",
"value": "message"
},
"instructions": "Create a draft rule that escalates refund requests with order context."
},
)
data = response.json()
{
"name": "Refund escalation",
"description": "Escalate refund requests with order context.",
"flowConfig": {
"type": "reply",
"message": "Escalate refund requests with order context."
}
}
Rules
Generate Rulebook tests
Generate suggested Rulebook test cases from a rule description, flow config, existing suite, and optional instructions.
POST
/
v2
/
hc-rules
/
generate-tests
/
public
curl --request POST \
--url 'https://api-prod.usefini.com/v2/hc-rules/generate-tests/public' \
--header 'Authorization: Bearer fini_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"description": "Refund-policy conversations to re-check before prompt changes.",
"flowConfig": {
"name": "Example",
"value": "message"
},
"existingSuite": {
"name": "Example",
"value": "message"
},
"instructions": "Create a draft rule that escalates refund requests with order context."
}'
const response = await fetch('https://api-prod.usefini.com/v2/hc-rules/generate-tests/public', {
method: 'POST',
headers: {
Authorization: 'Bearer fini_your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'description': 'Refund-policy conversations to re-check before prompt changes.',
'flowConfig': {
'name': 'Example',
'value': 'message'
},
'existingSuite': {
'name': 'Example',
'value': 'message'
},
'instructions': 'Create a draft rule that escalates refund requests with order context.'
}
)
});
const data = await response.json();
import requests
response = requests.post(
"https://api-prod.usefini.com/v2/hc-rules/generate-tests/public",
headers={"Authorization": "Bearer fini_your_api_key", "Content-Type": "application/json"},
json={
"description": "Refund-policy conversations to re-check before prompt changes.",
"flowConfig": {
"name": "Example",
"value": "message"
},
"existingSuite": {
"name": "Example",
"value": "message"
},
"instructions": "Create a draft rule that escalates refund requests with order context."
},
)
data = response.json()
{
"name": "Refund escalation",
"description": "Escalate refund requests with order context.",
"flowConfig": {
"type": "reply",
"message": "Escalate refund requests with order context."
}
}
Generates suggested tests for a Rulebook flow. Use this as a draft helper when building coverage for a new or changed rule.
Headers
string
required
Bearer token containing your Fini workspace API key. Format:
Bearer fini_... The key needs write scope.string
required
application/jsonBody parameters
string
required
Description of the behavior the generated tests should cover.
object
required
Rulebook flow configuration to generate tests against.
object
Existing test suite context to avoid duplicate coverage.
string
Additional instructions for the generator.
Response
Returns generated test-case suggestions for the supplied Rulebook flow.curl --request POST \
--url 'https://api-prod.usefini.com/v2/hc-rules/generate-tests/public' \
--header 'Authorization: Bearer fini_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"description": "Refund-policy conversations to re-check before prompt changes.",
"flowConfig": {
"name": "Example",
"value": "message"
},
"existingSuite": {
"name": "Example",
"value": "message"
},
"instructions": "Create a draft rule that escalates refund requests with order context."
}'
const response = await fetch('https://api-prod.usefini.com/v2/hc-rules/generate-tests/public', {
method: 'POST',
headers: {
Authorization: 'Bearer fini_your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'description': 'Refund-policy conversations to re-check before prompt changes.',
'flowConfig': {
'name': 'Example',
'value': 'message'
},
'existingSuite': {
'name': 'Example',
'value': 'message'
},
'instructions': 'Create a draft rule that escalates refund requests with order context.'
}
)
});
const data = await response.json();
import requests
response = requests.post(
"https://api-prod.usefini.com/v2/hc-rules/generate-tests/public",
headers={"Authorization": "Bearer fini_your_api_key", "Content-Type": "application/json"},
json={
"description": "Refund-policy conversations to re-check before prompt changes.",
"flowConfig": {
"name": "Example",
"value": "message"
},
"existingSuite": {
"name": "Example",
"value": "message"
},
"instructions": "Create a draft rule that escalates refund requests with order context."
},
)
data = response.json()
{
"name": "Refund escalation",
"description": "Escalate refund requests with order context.",
"flowConfig": {
"type": "reply",
"message": "Escalate refund requests with order context."
}
}
Generated tests are suggestions. Review them before adding them to a production regression suite.
Was this page helpful?
⌘I

