curl --request POST \
--url 'https://api-prod.usefini.com/v2/hc-rules/generate/public' \
--header 'Authorization: Bearer fini_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"instructions": "Create a draft rule that escalates refund requests with order context.",
"name": "Refund policy",
"description": "Refund-policy conversations to re-check before prompt changes.",
"currentFlowConfig": {
"type": "reply",
"message": "Escalate refund requests with order context."
}
}'
const response = await fetch('https://api-prod.usefini.com/v2/hc-rules/generate/public', {
method: 'POST',
headers: {
Authorization: 'Bearer fini_your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'instructions': 'Create a draft rule that escalates refund requests with order context.',
'name': 'Refund policy',
'description': 'Refund-policy conversations to re-check before prompt changes.',
'currentFlowConfig': {
'type': 'reply',
'message': 'Escalate refund requests with order context.'
}
}
)
});
const data = await response.json();
import requests
response = requests.post(
"https://api-prod.usefini.com/v2/hc-rules/generate/public",
headers={"Authorization": "Bearer fini_your_api_key", "Content-Type": "application/json"},
json={
"instructions": "Create a draft rule that escalates refund requests with order context.",
"name": "Refund policy",
"description": "Refund-policy conversations to re-check before prompt changes.",
"currentFlowConfig": {
"type": "reply",
"message": "Escalate 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."
}
}
Intent Rules
Generate intent-rule draft with AI
Generate or refine intent-rule draft content with natural-language instructions and an LLM.
POST
/
v2
/
hc-rules
/
generate
/
public
curl --request POST \
--url 'https://api-prod.usefini.com/v2/hc-rules/generate/public' \
--header 'Authorization: Bearer fini_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"instructions": "Create a draft rule that escalates refund requests with order context.",
"name": "Refund policy",
"description": "Refund-policy conversations to re-check before prompt changes.",
"currentFlowConfig": {
"type": "reply",
"message": "Escalate refund requests with order context."
}
}'
const response = await fetch('https://api-prod.usefini.com/v2/hc-rules/generate/public', {
method: 'POST',
headers: {
Authorization: 'Bearer fini_your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'instructions': 'Create a draft rule that escalates refund requests with order context.',
'name': 'Refund policy',
'description': 'Refund-policy conversations to re-check before prompt changes.',
'currentFlowConfig': {
'type': 'reply',
'message': 'Escalate refund requests with order context.'
}
}
)
});
const data = await response.json();
import requests
response = requests.post(
"https://api-prod.usefini.com/v2/hc-rules/generate/public",
headers={"Authorization": "Bearer fini_your_api_key", "Content-Type": "application/json"},
json={
"instructions": "Create a draft rule that escalates refund requests with order context.",
"name": "Refund policy",
"description": "Refund-policy conversations to re-check before prompt changes.",
"currentFlowConfig": {
"type": "reply",
"message": "Escalate 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 intent-rule draft content from natural-language instructions and the workspace’s current fields context. The LLM returns a draft name, description, and rule tree.
This endpoint supports intent rules only. It generates against the intent-rule fields context.
The generated draft is not saved automatically. Persist the returned content with Create intent rule or Update intent rule, using
status: "DRAFT".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
Natural-language instructions describing the rule to create or the changes to make. The value cannot be empty.
string
Current rule name. Used as context when refining
currentFlowConfig.string
Current rule description. Used as context when refining
currentFlowConfig.RuleNodeConfig
Existing rule tree to refine. Omit it to generate a new draft from scratch.
Response
object
Generated draft content with
name, description, and flowConfig.curl --request POST \
--url 'https://api-prod.usefini.com/v2/hc-rules/generate/public' \
--header 'Authorization: Bearer fini_your_api_key' \
--header 'Content-Type: application/json' \
--data '{
"instructions": "Create a draft rule that escalates refund requests with order context.",
"name": "Refund policy",
"description": "Refund-policy conversations to re-check before prompt changes.",
"currentFlowConfig": {
"type": "reply",
"message": "Escalate refund requests with order context."
}
}'
const response = await fetch('https://api-prod.usefini.com/v2/hc-rules/generate/public', {
method: 'POST',
headers: {
Authorization: 'Bearer fini_your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'instructions': 'Create a draft rule that escalates refund requests with order context.',
'name': 'Refund policy',
'description': 'Refund-policy conversations to re-check before prompt changes.',
'currentFlowConfig': {
'type': 'reply',
'message': 'Escalate refund requests with order context.'
}
}
)
});
const data = await response.json();
import requests
response = requests.post(
"https://api-prod.usefini.com/v2/hc-rules/generate/public",
headers={"Authorization": "Bearer fini_your_api_key", "Content-Type": "application/json"},
json={
"instructions": "Create a draft rule that escalates refund requests with order context.",
"name": "Refund policy",
"description": "Refund-policy conversations to re-check before prompt changes.",
"currentFlowConfig": {
"type": "reply",
"message": "Escalate 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."
}
}
Errors
400 Bad Request
400 Bad Request
instructions is empty, or currentFlowConfig is invalid.401 Unauthorized
401 Unauthorized
The API key is missing, malformed, revoked, or invalid.
403 Forbidden
403 Forbidden
The API key does not include the
write scope required for this route.500 Internal Server Error
500 Internal Server Error
Fini could not generate the draft content.
Was this page helpful?

