Quick reference
How it works
1
Write a focused query
Request only the fields you need. Don’t fetch the entire loan when you only
need the stage.
2
Store the previous state
Cache the values you’re monitoring (e.g.,
currentStage, task IDs).3
Poll at your chosen interval
Fetch the data and compare against your cached state.
4
Emit events on change
When a difference is detected, trigger your business logic.
Implementation example
This TypeScript example polls for loan stage changes every 30 minutes and emits an event when a stage changes.- Quick Start
- GraphQL Query
- Full Implementation
Starter queries
Use these comprehensive queries as starting points. Trim them down to only the fields you need for your specific polling use case.Full loan
Full loan
Full loan data including stages, pricing, rate lock, and associated entities.
Borrower personal information
Borrower personal information
Identity and contact details.
Borrower financials (assets, income, properties)
Borrower financials (assets, income, properties)
Complete financial profile for underwriting.
Borrower liabilities
Borrower liabilities
Debts and obligations for DTI calculation.
Tasks
Tasks
Borrower and loan officer tasks for workflow management.
Best practices
Use focused queries
Don’t fetch the entire loan object when you only needcurrentStage. Smaller queries are faster, reduce bandwidth, and make change detection simpler.
Implement exponential backoff
If requests fail, wait progressively longer before retrying. This prevents overwhelming the API during outages and gives transient issues time to resolve.Store state efficiently
Only cache what you need for comparison. For stage monitoring, store aMap<loanId, stage> rather than full loan objects. This keeps memory usage low and simplifies the comparison logic.
Stagger requests for many loans
If monitoring hundreds of loans, don’t fire all requests simultaneously. Spread them over the polling interval to avoid rate limits and reduce peak load.Use pagination cursors for lists
For lists like tasks or documents, track cursors to efficiently detect new items rather than comparing entire arrays. Store the last cursor and fetch only items after it.Log polling activity
Keep logs of your polling activity for debugging. Include timestamps, loan IDs, and any detected changes. This helps diagnose issues when changes aren’t being detected as expected.Rate limiting
If you’re monitoring many loans:- Stagger requests rather than firing them simultaneously
- Use longer intervals for less time-sensitive data
- Implement circuit breakers to pause polling if you hit rate limits
- Log all poll activity for debugging