1. Prerequisites
Before adding the Element you need:- Authentication — A backend endpoint that returns a Pylon authorization lease. The Element calls this endpoint when it needs to talk to the Pylon API; your route should create or retrieve a Contributor, create a lease, and return the full lease object to the frontend. If you haven’t set this up yet, follow Handling authentication first.
- A submitted loan — The Borrower Dashboard Element displays a single loan that has already been submitted (
submitted: true). Use the Loan Application Element for in-progress applications; once the loan is submitted, switch to the Borrower Dashboard with that loan’s ID. See Loading loans for how to choose between the two. - Environment details — Your Pylon customer ID and environment (
testorprod) for Content Security Policy and any GraphQL calls (e.g. fetching loans or updating data). - Package installed:
2. Add the Element
Import the Element and pass an auth lease callback and a loan ID. The auth callback is a function that fetches a fresh lease from your backend; the Element calls it when it initializes and when it needs to re-authenticate. It must return aPromise<AuthLease> (the exact JSON from your auth route)—do not modify or filter the lease. The loanId is the ID of the submitted loan you want to display; the dashboard will not load for in-progress (unsubmitted) loans.
"/auth/pylon" if it’s different. At this point the Element is working: it will load the loan and show the borrower dashboard (tasks, documents, loan status, etc.) for that loan.
Behavior:
- Both
authLeaseCallbackandloanIdare required. The dashboard is always tied to one loan. - The Element renders in an iframe and uses the lease to communicate with the Pylon API. Ensure your auth endpoint is only accessible to logged-in users.
- The
user_id(or equivalent) in your auth handshake must match the user associated with the loan, or the Element will not load the loan.
3. Where to get the loan ID
You need the ID of a submitted loan. Common sources:- Your API or database — After a loan is submitted (via the Loan Application Element or your backend), store the
loan.idand pass it when the user opens “My loan” or “Dashboard.” - GraphQL: loans for the current user — Use the
borrowerUserquery to list loans for the authenticated user, then filter bysubmitted: trueand use the chosen loan’sid:
- URL or app state — When the user clicks a loan from a list, pass the
loanIdas a route param or state so your page can render<BorrowerDashboardElement loanId={loanId} ... />.
4. Updating data via the GraphQL API
The Borrower Dashboard Element always displays the latest data from the Pylon API. Any time you add or update loan data via the GraphQL API—borrower info, income, assets, documents, tasks, or other fields—the Element reflects those changes. You don’t need to refresh the page or remount the Element; it fetches current data as the borrower navigates and when data changes. Why this matters:- Update data on behalf of borrowers — Your backend or an internal tool can push income, assets, or other information via the API; the borrower sees it in the dashboard without re-entering it.
- Sync with your systems — Keep loan data in sync with your CRM, LOS, or other systems by writing updates through the GraphQL API; the dashboard stays up to date.
- Custom workflows — Collect information in your own UI (e.g. a pre-qual form or intake), write it to the loan via the API, and the borrower sees it in the dashboard and can complete remaining tasks.
How it works
- Loan exists and is submitted — The Borrower Dashboard only shows submitted loans. Data updates apply to the same loan the Element is displaying.
- You call the GraphQL API — Use the appropriate mutations to create or update borrowers, income, assets, subject property, documents, or other entities tied to the loan. See the GraphQL API Reference and the complete integration guide for mutations and input types.
- The Element shows the latest data — The dashboard fetches current data from the API. Changes you make via the API are visible in the Element; no extra step is required on the frontend.
The Borrower Dashboard Element does not cache data indefinitely. It reflects the latest state from the API, so updates you make via the GraphQL API (from your backend, a job, or another part of your app) will appear in the dashboard as the user navigates or when the Element refetches.
Example: Update borrower info via API, then open the dashboard
Below, your backend (or another part of your app) updates the loan’s borrower phone number via the GraphQL API. When the user opens the Borrower Dashboard, they see the updated information. ReplaceaccessToken, loanId, and the GraphQL endpoint with your own values.
updateBorrowerPhone (or other mutations) from your server when data changes in your systems, or when an admin updates the loan. The important part: any data you write to the loan via the GraphQL API is what the borrower sees in the dashboard. For the full set of mutations and types, see the GraphQL API Reference and the complete integration guide.
5. Content Security Policy
If your app uses a Content Security Policy, the Element needs the following directives to load and communicate with the Pylon API:{customer-id} with your Pylon customer ID and {env} with test or prod. Without these, the iframe or scripts may be blocked and the Element will not render.
6. Optional: theme
Pass atheme prop to customize fonts, colors, and layout so the dashboard matches your brand. The theme is a nested object with Global, Component, and Page sections. See Theming and the Theme reference for the full API and examples.
7. Complete example
This example fetches the current user’s submitted loans via GraphQL, lets the user pick a loan (or uses the first one), and renders the Borrower Dashboard with theme and error handling. ReplaceYOUR_ACCESS_TOKEN and your GraphQL endpoint with your own values.
YOUR_ACCESS_TOKEN and userId with your app’s auth (e.g. from session or context). For polling loan stage, tasks, or documents, see Polling for updates.
Next steps
- Polling for updates — Monitor loan stage, tasks, and other status changes in your app
- Theming — Deep dive on theme structure and options for the dashboard
- Loading loans — When to use Loan Application vs Borrower Dashboard and how to retrieve loans for a user
- Complete integration guide — Full flow from deal and loan creation through underwriting and closing