Guide: Build a product
From nothing to a product applicants can use: a small personal loan with three pages (applicant
info, income, and a review page for approved applicants), routed by a decision tree, themed,
published, made live, and wired to an email, a pricing engine and a contract.
The through-line is draft first, live last. Pages and routing are written to a draft and reach
nobody until a version is published and set live. Settings, themes and scripts are different:
they take effect immediately. Every result tells you which (takes_effect), whether the product is
live (is_live), and which environment you wrote to (environment).
Before you start
- A Live connection. Variables, outcomes and decision trees can only be authored on Live
today. The Product Studio tools also work on Sandbox; when a product needs no new decision tree,
build it there first. - Product Studio access on your connection, with edit rights.
- A published pricing engine and contract template to attach in Step 13 (see Price an
approved application and Set up a loan
agreement), and an email template for the welcome email. - Skim the Product Studio ground rules.
The prompts below are what you type. The tool noted underneath each is what your assistant runs.
The ids in the examples (product 314, pages 501 to 503, outcomes 41 and 42, tree 88, theme 7) are
what this walkthrough got; yours will differ.
Step 1 — Create the variables
The pages collect six values. Most tenants already have an email variable; use it rather than
creating your own. LendAPI recognises an email address by the variable's display type, which a new
simple variable does not carry, and email triggers need a page that collects one. The same goes for
a phone number shown with phone formatting and for a date of birth: variables_create_simple
makes numeric, string, boolean and list variables only, with the regular display type, so reuse
the tenant's existing phone and date variables (or create them in the portal).
Check that we have an
applicant_first_name,
string), "Last name" (applicant_last_name, string), "Annual income" (annual_income, numeric),
"Loan amount" (loan_amount, numeric) and "Credit check consent" (credit_check_consent,
boolean).
Tools: variables_list, then variables_create_simple five times
| Variable | type | Used for |
|---|---|---|
applicant_first_name, applicant_last_name | 2 string | Two fields side by side |
email | existing | The applicant's address |
annual_income | 1 numeric | A number field, and the decision tree's rule |
loan_amount | 1 numeric | A slider; sliders need a numeric variable |
credit_check_consent | 3 boolean | A checkbox control; checkboxes need a boolean |
Step 2 — Create the outcomes
Create two outcomes: "PL Approve" as an Approve outcome and "PL Decline" as a Decline outcome.
Tool: outcomes_create twice, outcome_type=1 then outcome_type=2
Note both ids (here 41 and 42). They become the keys of the income page's routing in Step 7.
Step 3 — Build the decision tree
This is Build a decision workflow in short: one rule, two actions.
Create a decision tree called "PL Income Screen". Add two action nodes and connect the root to
the first on the yes branch and to the second on the no branch. Make the root a rule:
annual_incomegreater than 50000. Point the yes action at PL Approve and the no action at PL
Decline.
Tools: decision_trees_create, decision_trees_add_node twice (node_type="2"),
decision_trees_connect_nodes twice, decision_trees_update_rule_node,
decision_trees_update_action_node twice (action_id=1, assignment_id=41; action_id=2, assignment_id=42)
Do not submit a version yet. The tree is attached to the product first, in Step 5.
Step 4 — Create the product
Create a Personal Loan product called "Northwind Personal Loan" for individual applicants.
Tool: products_create with name, product_type=2, borrower_type=1
{
"object": "product",
"result": {"id": 314, "name": "Northwind Personal Loan", "product_type": 2, "borrower_type": 1},
"takes_effect": "on_publish",
"environment": "live",
"is_live": false,
"warnings": [],
"next_steps": ["products_pages_list to see the pages the product type seeded.", "..."],
"ground_rules": ["1. Settings, custom scripts and theme assignment take effect immediately; ...", "..."]
}is_live: false: nothing is published, so no applicant can start the product yet. LendAPI seeded
draft pages from the product type; Step 7 rewrites them. Every Product Studio write ends with the
same six ground_rules; they are what this guide follows.
Step 5 — Attach the tree and publish it
Assign "PL Income Screen" to product 314, then submit it as version 1 and make that version the
default.
Tools: decision_trees_save_metadata with assigned_product_id=314,
decision_trees_submit_version, decision_trees_set_default_version
A tree attaches only to an active product. If the first call answers Assigned product not found,
the product is closed: open it with products_set_active (active=true) and retry. With nothing
published it still takes no applications.
The default version matters later: a page that routes on a tree with no default version gets a
warning, because the tree cannot run, and its outcomes are not known yet.
A version submitted this way waits for approval in Rules Studio ("Pending"). You can build and
route pages against it (the routing result carries the warning decision_tree_unpublished), but
products_validate and products_publish report decision_tree_unapproved and nothing is
published until a person with Rules Studio access approves the version (Rules Studio, the tree's
Versions tab, Approve). The agent cannot approve it: ask early, so the approval is done by the time
the pages are. Until then the portal's page editor does not list the tree either.
Step 6 — See what the pages can use
What can product 314's pages use? Show me the widgets and the decision trees.
Tool: products_get_catalog with include=["widgets", "decision_trees"]
{
"object": "product_catalog",
"result": {
"widgets": [
{"engine_name": "email_otp_widget", "available": true, "reason": null},
{"engine_name": "plaid_auth", "available": false, "reason": "Plaid is not enabled for this tenant"}
],
"decision_trees": [
{"workflow_id": 88, "title": "PL Income Screen", "published": true, "default_version": 1,
"outcomes": [{"assignment_id": 41, "name": "PL Approve", "action": "Approve"},
{"assignment_id": 42, "name": "PL Decline", "action": "Decline"}]}
]
}
}Routing takes the tree's numeric workflow_id (88), not the session UUID the decision-tree tools
use, and each assignment_id is a key of the routing map. This product places no widget; when
yours does, pick one that is available.
Step 7 — Write the three pages
List product 314's pages.
Tool: products_pages_list
The Personal Loan type seeded some pages. This build keeps the first-step page (here tab 501) and
rewrites it, and adds the other two.
Rewrite tab 501 as "Applicant info", with first and last name side by side and email below. Add
an "Income" page with annual income, a loan-amount slider from 1,000 to 25,000 in steps of 500,
and a required credit-check consent. Add a review page, "Review and submit". Applicant info goes
to Income. Income runs PL Income Screen: approve goes to Review and submit, decline completes the
application. Check it first without writing anything.
Tool: products_pages_apply with dry_run=true, then again with dry_run=false
The tabs your assistant sends:
[
{
"key": "applicant", "tab_id": 501, "title": "Applicant info", "first_step": true, // the seeded page
"page": {
"title": "Applicant info",
"header": {"text": "Tell us about yourself", "description": "It takes about two minutes."},
"rows": [
{"elements": [
{"kind": "field", "variable": "applicant_first_name", "label": "First name", "required": true},
{"kind": "field", "variable": "applicant_last_name", "label": "Last name", "required": true}
]},
{"elements": [
{"kind": "field", "variable": "email", "label": "Email", "required": true,
"placeholder": "[email protected]"}
]}
]
},
"routing": {"next_step": {"type": "tab", "tab_key": "income"}}
},
{
"key": "income", "title": "Income",
"page": {
"title": "Income",
"rows": [
{"elements": [
{"kind": "field", "variable": "annual_income", "label": "Annual income", "required": true,
"helper_text": "Before tax, in US dollars.", "input": {"style": "text", "min": 0}}
]},
{"elements": [
{"kind": "field", "variable": "loan_amount", "label": "How much would you like to borrow?",
"required": true,
"input": {"style": "slider", "min": 1000, "max": 25000, "step": 500,
"left_label": "$1,000", "right_label": "$25,000"}}
]},
{"elements": [
{"kind": "control", "control": "checkbox", "variable": "credit_check_consent",
"text": "I agree to a soft credit check.", "required": true, "checkbox_type": "checkbox"}
]}
]
},
"routing": {
"decision_tree_id": 88,
"next_step": {"type": "by_outcome", "map": {"41": {"tab_key": "review"}, "42": 0}}
}
},
{
"key": "review", "title": "Review and submit",
"page": {
"title": "Review and submit", "role": "review",
"header": {"text": "Check your application"},
"buttons": {"continue_text": "Submit application", "show_back": true},
"rows": [
{"elements": [
{"kind": "control", "control": "banner", "alert_type": "success",
"text": "Good news: you qualify. Check your details, then submit."}
]},
{"elements": [
{"kind": "control", "control": "label", "font_size": 14, "alignment": "left",
"text": "You can go back and change anything before you submit."}
]}
]
}
}
]What to notice:
- Two fields in one row. A row holds up to three fields. A control (the checkbox, the banner,
the label) or a widget always takes a row of its own, and a page holds one widget at most. - Types are checked before anything is sent. The slider needs a numeric variable and the
checkbox a boolean; your assistant looks each variable up by name first, so a wrong type or a
misspelt name comes back as a refusal you can act on, with nothing written. - Forward references. Income does not exist yet when Applicant info names it, so the routing
usestab_key: thekeyof a page in the same call."page:Income"works too; it is resolved
the same way. - Routing by outcome. When the applicant continues from Income, tree 88 runs and the map picks
the next step by outcome: 41 (approve) goes to the review page, 42 (decline) is0, which
completes the application. An outcome missing from the map would leave applicants stuck on the
page, and the result would warn you. - The review page has no routing. A review page has no tree, integrations or next step, and is
never the first step. - All or nothing. The set is written in one transaction or not at all, and
dry_run=trueruns
every check without writing.
The result says takes_effect: on_publish: applicants see none of this yet. If the product type
seeded pages you no longer use, remove them now (products_pages_remove); a removed page is
deactivated, not deleted, and pages that still route to it are reported (reroute_to rewrites
those routes).
Step 8 — Read a page back
Show me the Income page as LendAPI stored it.
Tool: products_pages_get with tab_id=502
You get the page in the shape you wrote (input and validation show only the settings that
differ from their defaults), its tab (including label, which Step 13 needs) and its routing
with the tab_key resolved to a page id:
"routing": {
"first_step": false, "role": "regular", "decision_tree_id": 88,
"providers": [], "next_providers": [],
"next_step": {"type": "by_outcome", "map": {"41": 503, "42": 0}}
}To change a page later, start here: edit what you read and send the whole page back with
products_pages_update. It replaces the page's whole content, so anything you leave out is
removed.
Step 9 — Validate
Can product 314's draft be published?
Tool: products_validate
{"object": "product_validation", "product_id": 314, "valid": true, "error_count": 0,
"warning_count": 0, "errors": [], "warnings": [], "has_unpublished_changes": true}Each error carries the tab_id of the page to fix. Publishing runs the same check and refuses on
any error, so a clean validation means the publish goes through.
Step 10 — Give it a look
Create a theme called "Northwind" with accent and button colour #1F6FEB, white button text and
the Instrument Sans font, and use it on product 314.
Tools: themes_create, then themes_assign with product_id=314, theme_id=7
{"name": "Northwind",
"theme": {"primary_accent_color": "#1F6FEB", "button_bg": "#1F6FEB",
"button_text_color": "#FFFFFF", "font_family": "Instrument Sans"}}A named theme holds colours and the font; layout and spacing belong to the tenant's Default
theme. Both calls take effect immediately (themes have no publish), but this product is not live
(is_live: false), so no applicant sees it yet. Changing a theme that other products use asks for
confirmation first.
The page title and other settings work the same way: products_update_settings, immediate.
Step 11 — Add a script, and leave it off
Add our analytics tag to the head of product 314's applicant pages:
<script async src="https://analytics.northwind.example/tag.js"></script>.
Tool: products_scripts_upsert with script={"name": "Analytics tag", "placement": "head_end", "code": "<script async src=\"https://analytics.northwind.example/tag.js\"></script>"}
The script is saved disabled (takes_effect: when_enabled), and this guide leaves it that
way. An enabled script runs on the live applicant page at once, with no publish and no version to
roll back to, so turning it on is a separate, confirmed step for someone who has read the code. Ask
to enable it, and the first answer changes nothing:
{
"object": "confirmation_required",
"requires_confirmation": true,
"message": "Enabling runs this script on the live applicant pages immediately.",
"impact": {"placement": "head_end", "code_sha256": "9b74c9897bac770ffc029102a200c5de..."},
"next_steps": ["Show the user the impact and re-run with confirm=true only after they agree."]
}When you see requires_confirmation, stop. Check the impact (here, where the script goes and a
hash of exactly the code that would run), and say yes only if it is right; only then does your
assistant re-run products_scripts_enable with confirm=true. Every guarded write works this way:
publishing or setting a version live while applications are in flight, changing a shared theme,
removing a page others route to, closing a product with applications in flight.
Step 12 — Publish, set live, open
Publish product 314 as "Initial build: applicant info, income, review".
Tool: products_publish with description, is_default=false
{
"object": "product_version",
"result": {"version_published": 1, "version_live_before": null, "version_live_after": 1,
"is_default": true, "in_flight_applications": 0, "warnings": []},
"takes_effect": "immediately",
"environment": "live",
"is_live": true
}A product's first version is live as soon as it is published. A product that was never
published already points at version 1, so is_default=false makes no difference here: the result
says is_default: true and version_live_after: 1, and the next steps say so. The product was
created open (active), so anyone with its link can start it from now on. If the pages are not
ready for applicants, close it first with products_set_active (active=false) and open it when
they are.
Every later publish is different: publishing alone is not live. The new version exists and
applicants keep running the live one. That gap is useful. Read the version back
(products_pages_get with version=2), compare it (products_compare_versions), and choose the
moment.
Make version 2 live.
Tool: products_set_live_version with version=2
The result shows version_live_after: 2 and takes_effect: immediately. Had applications been in
flight on an older version, or the draft changed since the publish, it would have come back as
requires_confirmation first. Setting an older version live is also how you roll back.
Open product 314 to applicants.
Tool: products_set_active with active=true
active is explicit, not a toggle: on a product that is already open it changes nothing. With a
live version and active true the result says is_live: true. From here on, settings and theme
changes reach applicants immediately.
Step 13 — Wire the approve outcome
Pricing, contracts and email triggers are not set on pages. They attach to the product and an
outcome in their own tools. This product is new and nobody has its link yet, so wiring it now is
safe; on a product that already takes applications, wire a new outcome before you set the version
that produces it live. (A pricing engine also attaches only to an active product.)
Send our "Application started" email when an applicant completes the Applicant info page of
product 314.
Tools: comms_update_template with email_type=11, config={"product": 314, "trigger_when": 2, "tab_labels": ["Applicantinfo"]}, to_emails={"engine_name": ["email"]}; then
comms_publish_template
tab_labels takes page labels, not titles. A label is the title without spaces; products_pages_get
shows it as tab.label. trigger_when 2 means the page is completed. The template sends nothing
new until it is published.
Attach the "Personal Loan Pricing" engine to product 314 for PL Approve, and publish it.
Tools: pricing_engines_get, pricing_engines_save_metadata with product_ids and
assignment_ids (41 added), pricing_engines_publish with set_default=true
Attach the "Personal Loan Agreement" contract to product 314 and PL Approve, and publish it.
Tools: contracts_get, contracts_update with product_ids and assignment_ids (41 added),
contracts_publish with set_default=true
Both lists replace what is there, so your assistant reads the engine and the contract first and
sends their current products and outcomes plus the new ones. A contract publish is refused if
another published template already covers this product and outcome.
Step 14 — Check the whole map
Show me product 314 end to end.
Tool: products_get_overview
Each page with what it collects and where it goes, and under Income the tree with what each
outcome triggers:
{
"product_name": "Northwind Personal Loan",
"tabs": [
{"tab_id": 501, "title": "Applicant info", "is_first_step": true,
"email_triggers": [/* Application started */]},
{"tab_id": 502, "title": "Income",
"decision_tree": {"workflow_id": 88, "title": "PL Income Screen", "default_version": 1,
"outcomes": [
{"assignment_id": 41, "name": "PL Approve",
"pricing_tables": [{"title": "Personal Loan Pricing"}],
"contracts": [{"title": "Personal Loan Agreement"}], "emails": []},
{"assignment_id": 42, "name": "PL Decline", "pricing_tables": [], "contracts": [], "emails": []}
]},
"next_step": {"type": "by_outcome", "map": {/* 41 -> review page, 42 -> complete */}}},
{"tab_id": 503, "title": "Review and submit", "is_review_tab": true}
],
"warning_count": 0
}Read it back as a sentence: applicant info, then income; the income screen approves into pricing,
a contract and the review page, or declines and completes. In claude.ai and Claude Desktop the same
result is drawn as a flow map. warning_count should be 0; if it is not, work through Audit a
product before publishing.
Changing it later
| To | Do |
|---|---|
| Change a page | products_pages_get, products_pages_update, products_validate, products_publish, products_set_live_version |
| Change where a page goes | products_pages_set_routing with only the keys to change (null clears one) |
| Roll back | products_set_live_version with the earlier version |
| Start the draft over from a version | products_restore_draft (asks first if the draft has unpublished changes) |
| Copy a version, or the whole product | products_clone_version, products_clone |
| Close the product | products_set_active with active=false (asks first if applications are in flight) |
What LendMCP will not do
- Hard-delete a page. Removing one deactivates it.
- Unmask a variable. A page save may mask one, never unmask it.
- Rewrite a list variable's options, or delete a theme or a product.
- Enable a script, publish over in-flight applications or change a shared theme without your
confirmation. - Enable an integration partner or enter its credentials; do that in the portal, then its widget
showsavailablein the catalog.
See also
Updated about 14 hours ago

