# Submitting & Tracking Leads Source: https://docs.myperch.io/api-reference/submitting-and-tracking-leads Complete walkthrough of using the Perch API to submit leads and monitor their progress through the mortgage application lifecycle ## Overview Perch created its public API to provide our partners with an easy-to-use, leading as a service (LaaS) offering. Using the Perch API, partners can programmatically drive mortgage seekers towards securing mortgage products through Perch's online ecosystem (purchase, renewal, refinance, etc.). This guide provides detailed steps and examples on how your company can integrate our Leads submission and monitoring functionality into your internal systems to keep track of Leads and monitor their progress once they've joined Perch. ## Requirements To use this guide you will need the following pieces of data (all of which are provided to you by Perch): 1. **`x-api-key`**: A UUID V4 which grants you access to the Perch API 2. **`Firm.id`**: The unique identifier of your firm 3. **`ReferralCode.id`**: The unique identifier of your firm's referral code ## 1. Creating a Lead Leads is a group of highly flexible endpoints which enable the submission of customer data to Perch (refer to the Leads API Spec) and retrieval of Lead and associated Plan data. ### Using the Perch API partners can: 1. Remove much of the overhead in the client's application process by proactively populating a client profile prior to that client's registration with Perch 2. Track the status of the submitted Lead (i.e. have they completed registration with Perch, have they started a mortgage application, have they received a pre-approval, etc.) To implement such functionality, you may consider creating a **lead submission form** within the client profile page of your CRM. Your account managers can use this form to create a Lead in Perch after identifying the client is a good fit for Perch's product offering. You could design the form to accept custom parameters like notes and the deal purpose to better define the engagement opportunity for Perch's Customer Success Team. The more detail provided when creating a Lead, the simpler the application process for the client as they will not need to re-enter these details when they enter into the Perch ecosystem. Instead, when a client completes account registration, all Lead data will automatically be populated on their Client's profile. Rest assured, Perch has prioritized the security of your data. Perch employs robust encryption measures to safeguard all Lead data, both at rest and in transit, ensuring your clients' sensitive information remains protected. ### Upon submitting a Lead to Perch you can expect: * The Lead will be populated in Perch's database and made accessible via `GET` and update via `PATCH` * Perch will immediately send a personalized, co-branded welcome message to the email address provided in the Lead request. The email will provide a brief overview of Perch and invite the user to sign up. Please note that this email can be ***disabled*** if you wish to send your own automated communication when submitting Leads to Perch * Perch's customer experience team will automatically be deployed to help assist in onboarding the Lead * When the client signs up for Perch their Lead data will be converted into a client profile (we call this "conversion"). The `lead` object will be updated with a **`convertedAt`** date, a **`deletedAt`** date (the lead is automatically archived upon conversion) and if `Plan` data was included in the `lead`'s `clientData` object then the plan(s) will be created and the lead will be updated with the related `plan_ids` so that you can either join the `Plans` on the leads (with an optional param: `includes=Plans`) or look them up directly **Important**: to automatically populate the client's profile with the submitted **`Lead`** data, the client must sign up using the **same email address** that was used to create the **`Lead`**. To create a Lead, make a `POST` request to the endpoint [/firms//leads](/partner/api-documentation#tag/Lead/operation/post-leads-for-firm). Upon successful creation of a Lead we recommend storing the Lead.id primary key in your own system so that you can periodically check for updates on the Lead's conversion (i.e. did they actually sign up, where are they at in their process, etc.). ### Example Request ```bash theme={null} curl -X POST 'https://api.partner.myperch.io/v1/firms/{firm_id}/leads' \ -H 'x-api-key: your_api_key' \ -H 'Content-Type: application/json' \ -d '{ "email": "elliot91@yahoo.com", "firstName": "Elliot", "lastName": "Lynch", "phone": { "number": "0788243632", "extension": "402" }, "clientData": { "prefix": "Ms.", "citizenship": "Permanent Legal Resident (PR)", "dateOfBirth": "1968-09-25", "maritalStatus": "Single", "isFirstTimeHomeBuyer": false, "notes": "Lorem ipsum..." } }' ``` ### Example Response ```json theme={null} { "data": { "id": "cXzT1EtA", "createdAt": "2023-12-12T00:31:42.155Z", "updatedAt": "2023-12-12T00:31:42.155Z", "email": "elliot91@yahoo.com", "firstName": "Elliot", "lastName": "Lynch", "phone": { "number": "0788243632", "extension": "402" }, "clientData": { "prefix": "Ms.", "citizenship": "Permanent Legal Resident (PR)", "dateOfBirth": "1968-09-25", "maritalStatus": "Single", "isFirstTimeHomeBuyer": false, "notes": "Lorem ipsum..." }, "resourceType": "Firm", "resourceId": "mctTVsRB", "deletedAt": null, "convertedAt": null } } ``` This request will create a new **`Lead`** associated with your firm, with details like email, name, and client data. **`Firms`** is the resource used to denote partner organizations. In this case the **`:id`** will be your firm's unique **`Firm.id`** value which will be provided by your Perch account representative. ## 2. Monitoring the Conversion Status of a Lead You can monitor the status of a **`Lead`** by making a GET request to [/leads/](/partner/api-documentation#tag/Lead/operation/get-lead). The **`convertedAt`** parameter in the response indicates if/when the lead was converted for a **`ClientProfile`**. Please make sure you use **`?scope=withDeleted`** to ensure that the endpoint returns even deleted **`Leads`**. ### Example Request ```bash theme={null} curl -X GET 'https://api.partner.myperch.io/v1/leads/{lead_id}?scope=withDeleted' \ -H 'x-api-key: your_api_key' ``` ### Example Response ```json theme={null} { "data": { "id": "cXzT1EtA", "createdAt": "2023-12-12T00:31:42.155Z", "updatedAt": "2023-12-12T00:31:42.155Z", "email": "elliot91@yahoo.com", "firstName": "Elliot", "lastName": "Lynch", "phone": { "number": "0788243632", "extension": "402" }, "clientData": { "prefix": "Ms.", "citizenship": "Permanent Legal Resident (PR)", "dateOfBirth": "1968-09-25T10:36:49.352Z", "maritalStatus": "Single", "isFirstTimeHomeBuyer": false }, "resourceType": "Firm", "resourceId": "mctTVsRB", "deletedAt": "2023-12-12T00:31:42.370Z", "convertedAt": "2023-12-12T00:31:42.350Z" } } ``` The **`convertedAt`** datetime value denotes the time at which the **`Lead`** was promoted from a **`Lead`** to a **`ClientProfile`**. In most cases, this is when the client completes the Perch registration process. The **`deletedAt`** datetime value is set at the same time as **`convertedAt`** to automatically archive the lead record by setting the **`deletedAt`** value. If a Perch Representative archives a **`Lead`** the **`deletedAt`** value will be populated, but the **`convertedAt`** value will not. ### When a lead converts, you can expect the following: * The **`Lead`** record will receive a one time update in which the **`convertedAt`** and **`deletedAt`** value will be set * All **`Firm Member`** owners associated with the **`Firm`**, who have an active Perch Notification subscription will receive an email alert letting them know the lead has converted. Your Perch Account Manager can help you set this up * If `Plans` were included in the `ClientData` of the `Lead`, a `planId` will also be set in the Plan object response. You can extend your GET request to fetch Leads to include Plan data or use this `plan_id` to access the `Plan` details via the Plan endpoint. You can learn more about including `Plan` data in your `Lead` in section 4 below ## 3. Retrieve all Leads for a Given Firm In the event that you would like to see all the leads you've created for your firm you can use the GET [firms/:id/leads](/partner/api-documentation#tag/Lead/operation/get-leads-for-firm) endpoint. ### Example Request ```bash theme={null} curl -X GET 'https://api.partner.myperch.io/v1/firms/{firm_id}/leads?scope=withDeleted' \ -H 'x-api-key: your_api_key' ``` The response will contain an array of **`Leads`** created by the provided **`Firm`**. See [Pagination and query parameters](/getting-started/pagination) for details on `limit`, `offset`, and other query params. ## 4. Creating a Lead with Plan Data When you provide **`Plan`** data as part of your **`Lead`** submission, we will automatically make you an owner of that plan upon conversion which means you'll be able to access the Plan via API should you wish to monitor the Client's application progress. You'll also be subscribed to email updates for Plans where you are an owner. To protect Client privacy, **`Plans`** created by a client after registration will not automatically be accessible by the **`Lead`** owner. It is possible to provide you with access to a plan retroactively, but requires manual intervention by Perch's Customer Experience team. Please speak with your Perch Account Manager if you need assistance linking converted Leads to Plans. Including **`Plan`** data when creating a lead is simple as seen in the example below. Notice the inclusion of **`Plans`** array in the clientData object in request body. In this case we are including one plan with the deal purpose of **`Buying`** (Please make note of the various Plan **`types`** in our full API documentation). **`Plans`** is an array and can accept one or more values (e.g. the client is looking to Buy and Renew an existing mortgage). ### Example Request ```bash theme={null} curl -X POST 'https://api.partner.myperch.io/v1/firms/{firm_id}/leads' \ -H 'x-api-key: your_api_key' \ -H 'Content-Type: application/json' \ -d '{ "email": "elliot91@yahoo.com", "firstName": "Elliot", "lastName": "Lynch", "phone": { "number": "0788243632", "extension": "402" }, "clientData": { "prefix": "Ms.", "citizenship": "Permanent Legal Resident (PR)", "dateOfBirth": "1968-09-25T10:36:49.352Z", "maritalStatus": "Single", "isFirstTimeHomeBuyer": false, "notes": "Lorem ipsum", "Plans": [ { "type": "Buying" } ] } }' ``` ### Example Response ```json theme={null} { "data": { "id": "cXzT1EtA", "createdAt": "2023-12-12T00:31:42.155Z", "updatedAt": "2023-12-12T00:31:42.155Z", "email": "elliot91@yahoo.com", "firstName": "Elliot", "lastName": "Lynch", "phone": { "number": "0788243632", "extension": "402" }, "clientData": { "Plans": [ { "type": "Buying" } ] }, "resourceType": "Firm", "resourceId": "mctTVsRB", "deletedAt": null, "convertedAt": null } } ``` In the event where the lead has converted, you can expect the `Plan` object to contain a `plan.id` value which you can use to retrieve that plan's details. The plan is automatically created during the lead conversion workflow (i.e. when the lead accepts the invitation and signs up for Perch). ## 5. Retrieving Plans ### 5.1 Get Plans where you are the Lead Owner When you create a **`Lead`** with one or more **`Plans`**, you are automatically granted access to those plans ***THROUGH*** your ownership of the Lead. The simplest way to access those Plans is to simply join the **`Plans`** data onto a **`GET`** **`Leads`** request as seen below. Include the **withDeleted** scope to ensure that both **converted** and **unconverted** Leads are returned in your response. ### Example Request ```bash theme={null} curl -X GET 'https://api.partner.myperch.io/v1/firms/{firm_id}/leads?scope=withDeleted&include=Plans' \ -H 'x-api-key: your_api_key' ``` This request fetches all Leads and associated Plans for the provided **`firmId`**. This response provides a snapshot of the current mortgage applications that you are able to access. The response will contain an array of **`Leads`** owned by the provided **`firmId`** and any associated **`Plans`**. See [Pagination and query parameters](/getting-started/pagination) for details on `limit`, `offset`, and other query params. ## 6. Updating a Lead You can continue to update a **`Lead`** with additional details up until the point where the lead has converted (as denoted by the **`convertedAt`** and **`deletedAt`** datetime value being set). Updating a **`Lead`** after conversion is not advantageous as the conversion process whereby lead data populates the client's profile will have already taken place. You can update a lead through the PATCH [/leads/](/partner/api-documentation#tag/Lead/operation/patch-Lead). ### Example Request ```bash theme={null} curl -X PATCH 'https://api.partner.myperch.io/v1/leads/{lead_id}' \ -H 'x-api-key: your_api_key' ``` ## 7. Disabling Perch's Default Outreach Automation As discussed above, when a [Lead](/partner/api-documentation) is created in Perch, we automatically send a welcome message to the email address in the submitted **`Lead`**. To disable this default messaging when creating a **`Lead`**, you can use the **`disableClientOutreach`** parameter in your POST [/firms//leads/](/partner/api-documentation#tag/Lead/operation/post-leads-for-firm). You may wish to apply this flag if you want to manage your own automated lead outreach messaging strategy. ### Example Request ```bash theme={null} curl -X POST 'https://api.partner.myperch.io/v1/firms/{firm_id}/leads?disableClientOutreach=true' \ -H 'x-api-key: your_api_key' \ -H 'Content-Type: application/json' \ -d '{ "email": "client1@yahoo.com", "firstName": "Billy", "lastName": "Bob", "phone": { "number": "2223334444" } }' ``` ## 8. Retrieving all Leads (Including Deleted Leads) To get all leads for your firm, including those that have been deleted, use the **`withDeleted`** scope in your GET [/firms//leads](/partner/api-documentation#tag/Lead/operation/get-leads-for-firm): ### Example Request ```bash theme={null} curl -X GET 'https://api.partner.myperch.io/v1/firms/{firm_id}/leads?scope=withDeleted' \ -H 'x-api-key: your_api_key' ``` This request will return both active and deleted lead records, providing a comprehensive view of all leads associated with your firm. ## Next Steps * Review the [Partner API Overview](/api-reference/overview) for conceptual understanding * Explore the full [Partner API documentation](/partner/api-documentation) for detailed endpoint specifications * Set up [Postman](/getting-started/postman-setup) for API testing * Contact [partnersupport@myperch.io](mailto:partnersupport@myperch.io) for implementation assistance # Leads and Plans Source: https://docs.myperch.io/core-concepts/leads-and-plans The two foundational objects that play a critical role in the Core API Understanding how leads and plans work is essential to integrating with the Perch Developer Platform. These are the two foundational objects that represent the lifecycle of a mortgage application — from initial client handoff to final mortgage funding. ## The real-world analogy Think of a **lead** as a warm introduction — you or your product has identified someone who needs mortgage support, and you're handing them off to Perch to help with their financing needs. Once that lead is accepted and the client agrees to move forward, it becomes a **plan** — the actual mortgage application that our team opens, works on, and helps complete. These two stages mirror the real-world journey of a client: 1. **Lead submission** → You identify a client who needs mortgage financing 2. **Lead conversion** → Client signs up with Perch using the same email address 3. **Plan creation** → Active mortgage application(s) are opened and tracked 4. **Plan progression** → Application moves through pre-approval, approval, and funding stages ### Why we modeled it this way Mortgage applications are complex, dynamic, and timeline-sensitive. We've structured the lead and plan models to reflect how mortgage brokering happens in the real world: 1. **Separation of lead vs plan** helps partners track both pipeline and active applications 2. **Status-driven lifecycles** allow for clear communication and automation 3. **Granular types and transitions** give you transparency and actionable insights throughout the mortgage journey ## Leads A **lead** is your way of introducing a potential client to Perch. It contains basic information about the client, their financing needs, and any contextual details. Once a lead is submitted, our customer experience team attempts to contact the client, confirm application details, and help them get started with Perch. Right now, Perch supports accepting leads for different mortgage scenarios: 1. **Buying** - a purchase where your client is the buyer 2. **Renewal** - a mortgage renewal for an existing client 3. **Refinancing** - a refinance where your client wants to restructure their mortgage 4. **Switch** - moving from one lender to another ### Lead lifecycle A lead has a straightforward lifecycle: 1. **Submitted** - The lead has been received and is awaiting contact or qualification 2. **Converted** - The lead was successful — the client has signed up and plan(s) have been created 3. **Archived** - The lead is closed without conversion (client chose another provider, transaction cancelled, etc.) Every lead object returned in the API includes: * `convertedAt` - timestamp when the lead converted to a client profile * `deletedAt` - timestamp when the lead was archived (set automatically upon conversion) * `planIds` - array of plan IDs created when the lead converted (if plan data was included) For a lead to automatically populate the client's profile, the client must sign up using the **same email address** that was used to create the lead. ## Plans A plan represents an active mortgage application. This is where real mortgage work happens: income verification, credit checks, pre-approvals, and final approvals. Each plan is handled by our mortgage specialists and tracked within the Perch platform. Perch supports the same types of plans as lead types, because leads feed into plans: * **Buying** - purchase mortgage applications * **Renewal** - mortgage renewal applications * **Refinancing** - refinance applications * **Switch** - lender transfer applications ### Plan lifecycle All plans follow a similar progression through the mortgage application process: 1. **New** - Plan has been created but client hasn't completed their profile 2. **Profiles Completed** - Client information is complete, ready for application 3. **Ready for Pre-approval** - Application submitted and ready for initial approval 4. **Pre-approved** - Initial approval received, property search can begin 5. **Application in Progress** - Full application submitted to lenders 6. **Lender Approved** - Final approval received from lender 7. **Ready to Fund** - All conditions met, ready for funding 8. **Completed** - Mortgage has been funded successfully 9. **Closed** - Application was cancelled or fell through To protect client privacy, plans created by a client after registration will not automatically be accessible unless you were the original lead owner. ## The connection The relationship between leads and plans is straightforward: 1. **You submit a lead** with client details and optional plan information 2. **Perch contacts the client** to confirm details and help them sign up 3. **Client registers** using the same email address from the lead 4. **Lead converts automatically** and plan(s) are created if included in the original lead 5. **You gain access** to track the plan(s) through their lifecycle as the referring partner ### Benefits of this approach * **Streamlined onboarding**: Client data is pre-populated, reducing friction * **Automatic attribution**: Plans are automatically linked to the referring partner * **Real-time tracking**: Monitor progress from lead submission to mortgage funding * **Email notifications**: Get alerts when leads convert and plans reach key milestones ## Ready to go! By understanding leads and plans, you're equipped to guide your clients through every step of the mortgage journey, while keeping your systems in sync with the work being done by Perch behind the scenes. Ready to start? Check out our guide on [submitting and tracking leads](/api-reference/submitting-and-tracking-leads) to see these concepts in action. # Authenticated Embeds Source: https://docs.myperch.io/embeds/authenticated-embeds User-authenticated embeds with customizable widgets for partner workflows and client management **Authenticated embeds unlock secure, user-specific functionality that can't be offered in public widgets due to security and privacy requirements.** *** ## About Authenticated Embeds Authenticated embeds provide a ready-made UI alternative to API integration. While our public widgets offer general tools like mortgage calculators and rate displays, authenticated embeds access sensitive data and personalized functionality that requires secure user login—things like client information, lead tracking, and firm-specific workflows. **Features:** * User authentication with role-based access * Custom widget combinations * Branded experience * Public URLs or embedded deployment * No development required (alternative to API integration) We recognize that not every team has the technical resources for Public API integration. That's why we're developing embedded versions of our tools—to expand accessibility and support diverse workflows. Have a use case in mind? Contact [partnersupport@myperch.io](mailto:partnersupport@myperch.io). *** ## Available Authenticated Embeds ### Lead Management Our first authenticated embed combining lead submission and review widgets for mortgage professionals. Available as both static widgets (predefined configurations) and custom configurations. **Included widgets:** * **Lead Submission Widget** - Submit client referrals * **Lead Review Widget** - Track progress from referral to funding [Learn more about Lead Management →](/embeds/lead-management) *** ## Custom Configurations For most authenticated embeds, we create custom configurations with any widget combination for your workflow. **Available widgets:** Lead management, mortgage calculators, progress tracking, document upload, custom forms **To request:** Contact your Perch representative with your requirements # Customization Source: https://docs.myperch.io/embeds/customization Learn how to customize Perch's embeddable tools with pre-filled data and styling options Perch's embeddable tools can be customized to pre-fill certain pieces of information and modify their appearance, which can significantly improve their usability and integration with your website. ## Overview Embeds support two types of customization: **pre-filling data** to reduce user friction, and **styling** to match your brand. For example, if you run a property listing website you can pre-fill the property price so the mortgage calculator loads with the right value already set — no manual input required. ## Pre-filling data Use our predefined data attributes directly in the embed `div` to pass values in. Set them using your CMS or templating language. ### Static values ```html theme={null}
Loading...
``` ### Dynamic values ```html theme={null}
Loading...
``` ## Multi-widget embeds Perch supports both single and multi-widget embeds. Multi-widget embeds include a navigation bar to help users navigate between different calculators. ### Variables are global Data attributes are applied **globally** across all widgets in the embed, which means: * Set them once on the embed code * All widgets contained in the embed will receive the provided variables * User-inputted values (e.g. income, down payment amount) are cached * If the user loads the same calculator again or on another page, the embed will remember their values ## Supported variables Each widget has its own set of supported variables based on functionality. Here are the current supported global variables: ### Financial data | Variable | Type | Description | | -------------------------------- | ------ | ----------------------------------------------------------------------------------------- | | `widget-property-value` | Number | Property purchase price or current value | | `widget-property-type` | String | Type of property: `Detached`, `Condo/Apartment`, `Townhouse`, `Semi-Detached`, or `Other` | | `widget-annual-property-taxes` | Number | Annual property tax amount | | `widget-monthly-maintenance-fee` | Number | Monthly maintenance or HOA fees | | `widget-down-payment` | Number | Down payment amount in dollars | | `widget-down-payment-percent` | Number | Down payment as a percentage | | `widget-annual-income` | Number | Annual household income | | `widget-referral-code` | String | Partner referral code for lead attribution | | `widget-advisor-profile-id` | String | Specific advisor profile ID for attribution | ### Styling options | Variable | Type | Description | | ------------------------ | ------------ | ------------------------------------- | | `widget-primary-color` | String (hex) | Primary brand color (e.g., "#327766") | | `widget-secondary-color` | String (hex) | Secondary accent color | | `widget-hide-titles` | Boolean | Whether to hide widget titles | ### Localization | Variable | Type | Description | | --------------- | ------ | --------------------------------------- | | `widget-locale` | String | Language/locale code (e.g., "en", "fr") | ### UTM tracking parameters | Variable | Type | Description | | --------------------- | ------ | ---------------------------------------- | | `widget-utm-id` | String | Unique identifier for the embed instance | | `widget-utm-campaign` | String | Campaign name for tracking | | `widget-utm-medium` | String | Marketing medium (defaults to "embed") | | `widget-utm-source` | String | Traffic source identifier | ## Examples ### Property listing ```html theme={null}
Loading calculator...
``` ### Custom branding ```html theme={null}
Loading...
``` ### CMS integration ```php theme={null}
Loading...
``` ## Best practices * Pre-fill as many relevant values as possible to reduce friction * Ensure pre-filled values make sense in context — a property price should match the listing it appears alongside * Use your referral code to ensure leads are properly attributed * Match your brand colors and test on both light and dark backgrounds * Use `widget-hide-titles` if widget headings conflict with your page layout ## Need help? Contact your Perch representative for assistance with customization or implementation questions. # Implementation Guide Source: https://docs.myperch.io/embeds/implementation Step-by-step instructions for implementing Perch embeddable tools across different platforms and frameworks This guide walks through the process of implementing Perch embeddable tools on various Content Management Systems (CMS) and technical platforms. ## Basic embed code structure All Perch widgets use the same simple two-line integration. The widget ID will either be provided by your Perch representative (for custom configurations) or you can use one of the predefined static widget IDs for Lead Management: ```html theme={null}
Loading...
``` **Widget ID Options:** * **Custom widgets**: Your Perch representative provides a specific widget ID (e.g., `ABC123`) * **Static Lead Management widgets**: Use predefined IDs following `static-{portal}-{parent}` format (see [Widget Embedding](/embeds/lead-management#widget-embedding) for all available IDs) The Perch widget script is only 1KB in size, ensuring minimal impact on your page load performance. ### Custom loading indicator To improve the client user experience, we've added a feature to provide a custom loading indicator. You can use the inner `
` with the class `.perch-widget-loading-indicator` to insert a plain text loader (e.g. 'Loading...') that will be visible while the tool is being downloaded and rendered. You can replace the contents of this `
` with a custom message or a loading indicator of your choice to better match your branding: ```html theme={null}
Loading mortgage calculator...
``` Be sure that you retain the `.perch-widget-loading-indicator` class as this is what our script looks for when removing the loading indicator upon successful initialization of your widget. *** ## CMS-specific instructions **Important**: In most cases, the CMS editor will not execute JavaScript and therefore the tool will not render in the editor. Instead you will see the "Loading..." text. To view the rendered tool, select your CMS's "preview" option to see the live version. ### WordPress + Elementor