> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lendflow.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Widgets for Existing Deals

## Widgets for Existing Deals

Use this guide when the applicant already started in **your** product. For example, you captured their information on your form, including declined or turndown deals, and you want them to continue in a Lendflow widget on your page. That includes the consent widget, bank statements, DocuSign, and other widgets you attach after the deal already exists in Lendflow.

A **deal** is the application record in the Lendflow Dashboard. An **application ID** (`application_id` or `uuid`) identifies that deal. An **owner ID** identifies the person who should sign consent or complete DocuSign.

This flow is different from a first-time widget on your website, where the applicant begins the full application in Lendflow. For that flow, log in to Lendflow, open the **Integrations** tab in the left-side menu, then open **Widget Integration**, and follow [Embedding The Application Widget](/lendflow-external/docs/embedding-the-application-widget).

In this guide you will:

1. Create the application in Lendflow, or look up an application that already exists, so Lendflow has the deal.
2. Attach a widget to that deal by using the application ID and, for some widget types, the owner ID.
3. Place the widget on your page so the applicant can finish consent, a bank connection, or other remaining screens without starting the application over.

You can generate the snippet in the Lendflow Dashboard: open the **Integrations** tab in the left-side menu, then open **Widget Integration**, copy the snippet, and append the IDs. You can also generate a consent widget through the API.

## Create the application and find IDs

Submit the application with [Create Application Using Workflow Builder](/api-reference/workflow-management/create-application-using-workflow-builder) (`POST /api/applications/workflow`). Use the workflow template that matches how you process this deal. A full walkthrough is [Submit A New Application Via The API](/api-docs/docs/submit-a-new-application-via-the-api).

A successful request returns **200 OK** with the created application under `data`. Use `data.id` as the application ID when you generate links or attach a widget to the application. The response does not use a top-level `application_id` field.

Some widgets also need the owner ID:

| When | Primary owner | Additional owners |
| - | - | - |
| New application (`200 OK` response) | Read the primary owner's ID from the application returned under `data`. | Read each additional owner's ID from the application returned under `data`. |
| Existing application | `personal_information.id` on [Get Application](/api-reference/workflow-management/get-application) | `business.other_owners.id` |

After you have those IDs, either append them to a snippet that you generated on the **Integrations** tab in the left-side menu, then **Widget Integration**, or generate a consent widget through the API.

## Attach a UI-generated widget

Use this path when you configure the widget in the Lendflow Dashboard and then attach it to a deal that already exists. This is the same page you open from the **Integrations** tab in the left-side menu, then **Widget Integration**, to embed a new widget. You configure the widget type, workflow, branding, and redirect, copy the snippet, and then add this application’s IDs so the widget updates the existing deal instead of creating a new one.

1. Log in to Lendflow. In the left-side menu, open the **Integrations** tab, then open **Widget Integration**.
2. Configure the widget and copy the snippet by following Steps 1–8 in [Embedding The Application Widget](/lendflow-external/docs/embedding-the-application-widget). Choose **Embedded** or **Pop-out** in Step 8.
3. Not every setting is available in the dashboard for every widget type. After you copy the snippet, append the parameters your widget requires.

| Widget | Additional parameters |
| - | - |
| Bank Statements | Application id: `uuid` |
| DocuSign; DocuSign and Bank Statements | Application id: `uuid`; Owner id: `owner_id` |
| Consent; Consent and Bank Statements; Tax Details, Consent, and Bank Statements | Application id: `uuid`; Owner id: `owner_id`; Consent template id: `consentTemplateId` |

| Setting | Parameter |
| - | - |
| Branding ID | `branding_id={brandingId}` |
| Email branding | `email_branding_id={emailCustomizationId}` |
| Redirect | `destination[mode]=bp` (Borrower Platform), `destination[mode]=redirect&destination[url]=YOUR_URL`, or `destination[mode]=none` (success screen, no redirect) |

`destination[mode]=bp` is recommended so applicants can track the application in the Borrower Platform after they finish. See [Borrower Platform](/lendflow-external/docs/borrower-platform).

4. Place the container `div` where the widget should appear on your page. Paste the `script` before the closing `</head>` or `</body>` tag. The recommended container size is **550px** wide by **500px** high. A live sample page is [LF - Embedded Widget](https://codepen.io/Adam_Orlov/pen/NWQNreO). If the widget is already embedded on your website, generate the snippet again and update the widget links or scripts where they are embedded.

## Consent widget

Use the consent widget when you already captured applicant information in your product, including declined deals, created the application through the API, and need the applicant to sign consent on your landing page. Do not use the consent widget when the applicant should complete a full lending widget.

Generate the consent widget **after** the application exists. Through the API, only these widgets can be generated:

* Consent
* Consent, Bank Statements
* Tax Details, Consent, and Bank Statements

1. Call [Create Temporary Application Links](/api-reference/workflow-management/create-temporary-application-links) (`POST /api/applications/{application_id}/temporary_links`) after the application exists. In the JSON request body, identify the applicable owner and set the temporary link type you need, such as `consent`, `consent_bank_statements`, or `tax_details_consent_bank_statements`, to `true`.

| Request field | What it does |
| - | - |
| `owner` | Identifies the owner who should sign consent. |
| `consent: true` | Requests a consent link. |
| `consent_bank_statements: true` | Requests the combined consent and bank-statements flow. |
| `tax_details_consent_bank_statements: true` | Requests the combined tax-details, consent, and bank-statements flow. |
| `link_params` | Supplies supported parameters for the generated link, such as the destination or embedded-widget settings. |

Example request body:

```json theme={"system"}
{
  "owner": "OWNER_ID",
  "consent": true,
  "link_params": {
    "target_id": "container"
  }
}
```

2. A successful request returns **200 OK** with the generated links under `data`. The current OpenAPI response shape is an object such as:

```json theme={"system"}
{
  "data": {
    "personal_information_link": "https://example.com",
    "docusign_link": "https://example.com"
  }
}
```

Only requested and available links are returned. Use the API Reference for the current request fields and response schema instead of depending on the former `consent_script_link` response.

3. If the generated value is an embeddable script, paste it into your HTML before the closing `</head>` or `</body>` tag and use a container whose `id` matches `link_params.target_id`. If the operation returns a URL, send or redirect the applicant to that URL.

<Frame>
  <iframe width="1000" height="500" src="https://www.loom.com/embed/4e9b56fa0da84b758eb22e828c0e0515?sid=b2b7786b-3625-41f2-b505-39a8a2d024b0" title="Generate a widget link via API and embed it" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />
</Frame>

## FAQ

<AccordionGroup>
  <Accordion title="How do I generate Plaid, DocuSign, Codat, or resume links for an application?">
    These are temporary links for an application that already exists. They collect additional data, for example Plaid or DocuSign, and attach that data to that deal. You can generate them whether the applicant started in the widget or through the API.

    Use [Create Temporary Application Links](/api-reference/workflow-management/create-temporary-application-links) (`POST /api/applications/{application_id}/temporary_links`).

    1. Send your API bearer token. Get a login token from [Get Bearer Token](/api-reference/authentication/get-bearer-token). For a long-lived token, open your profile in Lendflow, select **Integration Tokens**, and create a token. See [Integration Tokens](/lendflow-external/docs/integration-tokens).
    2. Send the Lendflow application UUID so the links belong to the correct deal. If you submitted the application through the API, use `data.id` from the create response. You can also find it with [List Applications](/api-reference/workflow-management/list-applications) (`GET /api/applications`). If the application started in the widget, you can find the UUID on the **Deals** tab in the left-side menu.
    3. In the body, set the links you want to `true`. The following example returns DocuSign and Plaid:

    ```json theme={"system"}
    {
      "docusign": true,
      "plaid": true
    }
    ```

    Read the requested links from the response's `data` object. Copy the applicable link and send it to the applicant, or open it in the browser.
  </Accordion>

  <Accordion title="When should I use Get Application Links?">
    Use [Get Application Links](/api-reference/workflow-management/get-application-links) (`GET /api/applications/{application_id}/links`) for application service links and tokens such as Plaid, DocuSign, Codat, Rutter, resume, and bank statements. Use Create Temporary Application Links when the applicant needs a short-lived action or widget link.
  </Accordion>

  <Accordion title="When do I use the consent widget instead of the lending widget?">
    Use the **lending widget** when applicants should complete the full application in Lendflow. Use the **consent widget** when you already captured applicant information in your product, including declined deals, created the application through the API, and need the applicant to sign consent on your page.
  </Accordion>

  <Accordion title="Where should applicants go after they finish the widget?">
    Redirecting to the **Borrower Platform** is recommended. Applicants can track the application and find information relevant to it there. You can also redirect to a URL that you specify. If you set the redirect to none (`destination[mode]=none`), the applicant sees a success screen and is not redirected.
  </Accordion>
</AccordionGroup>

## Next steps

<Card title="Embedding The Application Widget" icon="window-restore" href="/lendflow-external/docs/embedding-the-application-widget" horizontal>
  In the left-side menu, open the Integrations tab, then open Widget Integration, and add Embedded or Pop-out to your website.
</Card>

<Card title="Deal Progress" icon="diagram-project" href="/lendflow-external/docs/viewing-different-stages" horizontal>
  Open a deal from the Deals tab in the left-side menu to see workflow stages in Deal Progress.
</Card>
