Decision Trees
Build credit and eligibility rules visually in Rules Studio, version them with an approval step, and run them from applications or the API.
A decision tree is a set of yes/no rules that turns an applicant's data into a decision such as Approve, Decline, Review or Request Docs. You build decision trees on a canvas in Rules Studio, test them with sample values, and publish them as numbered versions. A tree can be attached to a page in Product Studio, used as a step in Flow Builder, chained to another tree, or run directly through the API.
Key concepts
- Rule node: a node that checks one or more conditions (for example,
credit_scoreis greater than or equal to 650). It has two branches: Yes when the conditions are met and No when they are not. - Action node: an end point of the tree. It sets the decision (Approve, Decline, Review or Request Docs) and points to an outcome and/or another decision tree. Action nodes cannot have child nodes.
- Rule block: the conditions inside a rule node. Conditions can be grouped and combined with AND/OR.
- Variable: a named data point the rules read, such as an application field, an integration result or a derived value. Each variable has an engine name (for example
credit_score) that the API uses.
- Outcome: a named result tied to an action, such as "Approved - Prime". See Outcomes and Offers.
- Chaining: pointing an action node at another decision tree so evaluation continues there.
- Version: a saved snapshot of the tree. Only one version is Live at a time.
- Parameters: the variables a specific version needs as input.
How a tree is evaluated
Evaluation starts at the Starting node and follows the Yes or No branch of each rule node until it reaches an action node. The action node decides the result.
flowchart TD
A[Starting node: credit_score >= 650?] -- Yes --> B[annual_income >= 40000?]
A -- No --> D[Action: Decline<br/>Outcome: Low score]
B -- Yes --> C[Action: Approve<br/>Outcome: Prime]
B -- No --> E[Action: Review<br/>Outcome: Manual income check]
When a tree runs for an application, LendAPI first calls any integration partners and runs the pricing engine attached to the tree (see Tree properties below), then evaluates the rules. If an action node chains to another tree, the next tree runs too. Evaluation stops at a Review or Request Docs action: the decision tree selected on that node is not run as part of the same evaluation.
What each action allows
| Action | Outcome | Next decision tree |
|---|---|---|
| Approve | Pick an outcome, a decision tree to chain to, or both | Optional |
| Decline | Required | Not allowed |
| Review | Required | Required |
| Request Docs | Required | Required |
An action node can also Update variable (set a variable to a fixed value) and Assign task (create a task from a task template for your agents) when it is reached.
Version statuses
- Draft: the tree has never been submitted. You can edit it freely.
- Pending Approval: a version was submitted and is waiting for someone to approve or decline it.
- Published: versions have been submitted and none is waiting for approval.
Each version in the Versions tab shows Pending, Approved or Declined. An approved version can be set Live. The Live version is the one applications and API calls use by default.
Build and publish a tree
Create a tree
- Go to Workflows → Rules Studio and click Add Rule.
- In New Rule, enter a rule name and a description, then click Add Rule.
- The canvas opens with a Starting node. Click the + on a node to add children. A rule node can have at most two children (Yes and No).
- Click a node to open Node properties:
- Set Type to Rule or Action.
- For a rule, build the Rule Block: choose a variable, an operator (for example Is greater than or equal to, Is equal to, Is null, Contains all) and a value. Use groups to combine conditions.
- For an action, choose Change Status To (Approve, Decline, Review or Request Docs), then pick the Outcome and/or Decision Tree. Choose Add new outcome to create one without leaving the canvas.
- Click Update to save the node.
- Use the canvas controls to zoom, pan, or Auto layout the tree.
Tree properties
The side panel holds settings for the whole tree:
| Section | Setting | What it does |
|---|---|---|
| ASSIGN | Tenants, Product | Which sub-tenants and product the tree belongs to. |
| INTEGRATION PARTNER | Providers | Integrations called before the rules run, so their data is available to the rules. |
| PRICING ENGINE | Pricing Engine | A pricing engine that runs before the rules, so its outputs can be used in rule conditions. |
| CONDITIONS | Run All Nodes | When the result is not Approve, also evaluate every node and return all the rules that failed, not just the first one. |
| HISTORY | Read only | Who requested, approved and set the current version live, and when. |
Test the tree
Open the test panel, enter a value for each INPUT variable, and run it. The OUTPUT shows the Action, the Outcome ID, and the Next Decision Tree ID (if the tree chains). If the tree is incomplete you see "Tree is not valid".
Submit, approve and set live
- Click Submit for approval. In Submit decision tree for approval, describe what changed. If nothing changed since the live version, LendAPI tells you no new changes were detected.
- Open the Versions tab. On the pending version, click Approve. In the dialog, add a description, optionally tick Set as live version, then click Approve or Decline.
- To switch versions later, click Set Live on any approved version and confirm. This replaces the current live version.
To start new work from an older version, use Copy Version to Draft. You must approve or decline any pending version first. To copy a whole tree into a new one, use Clone Rule on the tree in the Rules Studio list.
Use the tree in an application
- Product Studio: open the product, select a page, and in Page Settings → On Continue, choose the tree under Decision Tree.
- Flow Builder: add a Rule node and select the tree. See Flow Builder.
Run decisions via the API
Base URL: https://app.lendapi.com/api/v1/. Authenticate with Authorization: Bearer <your API key>. Keys that start with live_ read your Production environment; keys that start with test_ read your Sandbox. The tree id in these calls is the tree's UUID. The tree's API tab in Rules Studio shows a ready-to-copy run request with this ID and sample params for the live version.
| Action | Method & path | Notes |
|---|---|---|
| List decision trees | GET /decisions/ | Supports start and size paging. Reference |
| List versions | GET /decision/{id}/versions/ | Returns versions plus default_version (the live one). Reference |
| List parameters | GET /decision/{id}/{version}/params/ | The variables that version needs as input. Reference |
| Run a decision | POST /decision/{id}/run/ | Runs the live version unless you pass version. Reference |
Example: run a decision
curl -X POST "https://app.lendapi.com/api/v1/decision/5c13c1d7-1463-41dd-b243-3f5a6910d43e/run/" \
-H "Authorization: Bearer test_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"params": {
"credit_score": 712,
"annual_income": 58000
}
}'{
"object": "decision_run",
"url": "/v1/decision/:id/run/",
"result": {
"code": 1,
"data": {
"rule_id": 1024,
"app_id": 0,
"status": 1,
"chain": 0,
"action": "approve"
},
"msg": "..."
}
}action is one of approve, decline, review or resubmit (Request Docs). chain is the ID of the next tree, or 0 if there is none. When Run All Nodes is on and the result is not Approve, the response also includes failed_outcomes.
Send JSONThe request must use
Content-Type: application/json, andparamsmust be a JSON object. Call List parameters first to see which variables to send.
Access and best practices
Permissions
Access is controlled by the Rules Studio module. View access lets a user open trees and versions; Edit access is needed to create, submit, approve, decline and set versions live. See Roles and Permissions.
Best practices
- Test every branch before you submit. Enter values that reach each action node at least once.
- Write clear version descriptions. They are the audit trail for reviewers and for anyone setting a version live later.
- Keep trees small and chain them. A short identity tree that chains to a credit tree is easier to review than one large tree.
- Use Run All Nodes for adverse-action reasons. It returns every failed rule, which helps when you need all decline reasons.
- Test new versions in Labs before setting them live. See Labs Experiments.
- Don't edit a variable's meaning while trees depend on it. Create a new variable instead.
Related guides
Updated 12 minutes ago

