# Quantum Partner API: Full Documentation > Generated 2026-10-16 from the partner documentation guides and the OpenAPI spec (https://docs.quantumlends.com/merged-api.json). > For the compact index version see https://docs.quantumlends.com/llms.txt. ## Table of Contents - Quantum Partner API Documentation - Getting Started - Prefill Applications - Bank & Financial Data - Offers - Embedded Contract Signing - Sandbox Environment - Submit Application API Migration Guide - Mutual TLS Channel Authentication - Webhook Notifications Overview - Webhook Integration Guide - API Reference (structured summary) --- # Quantum Partner API Documentation The Quantum Partner API is a RESTful API that enables you to integrate lending capabilities into your platform. The API provides: - **Application Lifecycle Management:** Submit loan applications, upload supporting documents, retrieve and accept offers, and track applications through underwriting to funding - **Account Management:** Manage booked accounts including requesting draws from lines of credit, processing payments, and viewing transaction history - **Webhooks:** Receive real-time notifications when application status changes, documents are processed, offers are created, and more - **[Getting Started](/getting-started.html):** Learn how to integrate with the Quantum API, from authentication to your first application - **[Sandbox Environment](/sandbox-environment.html):** Use magic values to trigger specific outcomes and test your integration end-to-end - **[Prefill Applications](/prefill-applications.html):** Pre-populate loan applications with known data to streamline the applicant experience - **[Webhooks Overview](/webhooks-overview.html):** Understand webhook concepts, event types, and the application lifecycle - **[Webhooks Integration Guide](/webhooks-guide.html):** Technical guide for implementing webhooks with code examples and API reference - **[Migration Guide](/migration-guide.html):** Upgrade from v2 to v3 of the Quantum Partner API with minimal disruption --- # Getting Started Follow these steps to integrate with the Quantum Partner API: ## Authentication Authentication is handled by a Bearer token. The token is passed in the `Authorization` header as a Bearer token. ```bash Authorization: Bearer ``` ### Obtain API Credentials 1. Contact your Quantum representative 2. You'll receive a unique Bearer token for your organization 3. Include this token in all API requests > **Warning:** Keep your API token secure! Never expose it in client-side code or public repositories. Enterprise partners with mutual-authentication requirements can additionally enroll in [mutual TLS](/mtls.html) for transport-layer authentication on top of the Bearer token. This is optional and most integrations do not need it. ## Submit an Application Use the `POST /api/v3/applications/submit` endpoint to submit a loan application on behalf of your customer. ### Required Fields **Business Information (`business`)** - `legal_name` - The legal business name - `address` - Business address (street, city, state, zip_code) - `phone_number` - Business phone number - `entity_type` - Business structure (e.g., `sole_proprietor`, `partnership`, `limited_liability_company`, `s_corporation`, `c_corporation`) - `start_date` - When the business was established (YYYY-MM-DD) - `naics_code` - Industry classification code - `doing_business_as` - The name the business operates under (its DBA). Required. If the business has no separate DBA, repeat the legal business name here. - `tax_identification` - The business's tax identification number: its Federal Tax ID (EIN) for most entities, or the owner's SSN for a sole proprietor. Optional but recommended. Accepts an EIN in `XX-XXXXXXX` format (e.g. `12-3456789`), or an SSN as `XXX-XX-XXXX` or `XXXXXXXXX`. **Loan Request (`loan_request`)** - `amount` - Requested loan amount in dollars - `purpose` - Loan purpose (e.g., `working_capital`, `equipment_purchase`, `inventory_purchase`, `business_expansion`) - `authorization` - Must be `true` to authorize the credit check **Owner Information (`owners`)** At least one owner is required. Total ownership must equal 100%. - `first_name`, `last_name` - Owner's legal name - `email`, `phone_number` - Contact information - `date_of_birth` - Date of birth (YYYY-MM-DD) - `ssn` - Social Security Number - `ownership_percent` - Percentage of business owned - `is_applicant` - Set to `true` for the primary applicant - `address` - Owner's home address **Additional Questions (`additional_questions`)** - `annual_sales` - Business annual revenue in dollars > **Note:** **No DBA?** `doing_business_as` is required and cannot be `null`. If the business does not operate under a separate "doing business as" name, send the legal business name in both `legal_name` and `doing_business_as`. > **Note:** **Sending a Federal Tax ID?** Yes. The API accepts the business's tax identification number via the `business.tax_identification` field shown above. It is optional. Provide an EIN (Federal Tax ID) in `XX-XXXXXXX` format (e.g. `12-3456789`), or, for a sole proprietor whose tax ID is their SSN, `XXX-XX-XXXX` or `XXXXXXXXX`. Note that the owner's SSN under `owners[].ssn` is a separate field. ### Example Request ```javascript const response = await fetch('https://api.quantum.com/api/v3/applications/submit', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ business: { legal_name: "Acme Inc LLC", doing_business_as: "Widgets Are Us", address: { street: "22 Acacia Ave", city: "Los Angeles", state: "CA", zip_code: "90025" }, phone_number: "650-555-6124", entity_type: "limited_liability_company", naics_code: "312234", start_date: "2008-03-27", tax_identification: "12-3456789" }, loan_request: { amount: 50000, purpose: "working_capital", authorization: true }, owners: [{ first_name: "John", last_name: "Doe", email: "john@acmeinc.com", phone_number: "650-555-2134", date_of_birth: "1981-03-17", is_applicant: true, ownership_percent: 100, ssn: "123-45-6789", address: { street: "123 Main St", city: "Los Angeles", state: "CA", zip_code: "90025" } }], additional_questions: { annual_sales: 250000 } }) }); const application = await response.json(); console.log('Application ID:', application.id); ``` > **Note:** Save the `application.id` from the response. You'll need it for uploading documents, checking status, and all subsequent operations. For the complete schema and all available fields, see the [API Reference](/api-reference.html). ## Upload Documents After submitting an application, upload supporting documents using `POST /api/v3/applications/{app_id}/documents`. ### Example Request ```javascript const applicationId = 'your-application-id'; // File objects from an element or other source const bankStatementFile1 = fileInput.files[0]; const bankStatementFile2 = fileInput.files[1]; const driversLicenseFile = photoIdInput.files[0]; // Create FormData with documents const formData = new FormData(); formData.append('bank_statements', bankStatementFile1); formData.append('bank_statements', bankStatementFile2); // Multiple files supported formData.append('photo_id', driversLicenseFile); const uploadResponse = await fetch(`https://api.quantum.com/api/v3/applications/${applicationId}/documents`, { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_TOKEN' // Note: Don't set Content-Type header - browser sets it automatically with boundary }, body: formData }); const documents = await uploadResponse.json(); console.log('Uploaded documents:', documents); ``` > **Note:** You can upload multiple files of the same type by appending them with the same field name. At least one file must be provided. > **Warning:** **File size limits:** Individual files must be under 20MB, and the total request size must not exceed 40MB. > **Note:** **Sending a Plaid Asset Report?** If you submit the applicant's Plaid Asset Report to the [transactions endpoint](/bank-data.html), don't also upload `bank_statements` PDFs (from Plaid or directly from the bank). The asset report covers cash flow analysis, and sending both slows down processing. **Document Types:** | Type | Description | |------|-------------| | `bank_statements` | Bank statements for the primary business operating account | | `business_tax_return` | Business tax returns (typically last 2 years) | | `personal_tax_return` | Personal tax returns for business owners | | `ytd_financials` | Year-to-date financial statements | | `ye_financials` | Year-end financial statements | | `debt_schedule` | Schedule of existing business debts and obligations | | `photo_id` | Government-issued photo identification (driver's license, passport, etc.) | | `utility_bill` | Utility bill for address verification | | `lease_agreement` | Commercial lease or rental agreement | | `business_license` | Business license or permit | | `sos_record` | Secretary of State registration documents | | `lien_release` | Lien release documentation | | `lien_filing` | Lien filing documentation (e.g., UCC financing statements) | | `proof_of_payoff` | Proof of payoff for an existing loan or debt | | `ssn_card` | Social Security card | | `void_check` | Voided check for bank account verification | | `insurance_document` | Business insurance documentation | | `mortgage_document` | Mortgage or property documentation | | `personal_document` | Other personal documentation | | `formation_documents` | Business formation documents (articles of incorporation, operating agreement, etc.) | | `application_submission` | Submitted loan application document | | `unknown` | Other/miscellaneous documents | ## Add Bank Accounts Bank accounts can be provided during the initial application submission (in the `bank_accounts` field of the `/submit` payload) or added afterward using the dedicated endpoint. There are two types of bank accounts: - **Aggregator accounts** (Plaid/MX): Used for bank statement analysis. Connected via a bank aggregation provider. - **Direct-from-customer accounts:** Used for loan disbursement. The customer provides their account and routing numbers directly. ### Add Bank Accounts After Submission Use `POST /api/v3/applications/{app_id}/bank-accounts` to add bank accounts to an existing application. #### Example: Aggregator Account (Plaid) ```javascript const applicationId = 'your-application-id'; const response = await fetch(`https://api.quantum.com/api/v3/applications/${applicationId}/bank-accounts`, { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify([ { source: "plaid_link", aggregator: { provider: "plaid", access_token: "access-sandbox-xxx", primary_account_id: "account-123", transactions: true, balances: true, identities: true } } ]) }); ``` #### Example: Direct-from-Customer Account ```javascript const response = await fetch(`https://api.quantum.com/api/v3/applications/${applicationId}/bank-accounts`, { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify([ { source: "direct_from_customer", direct_from_customer: { account_number: "1234567890", routing_number: "021000021" } } ]) }); ``` > **Note:** You can include both account types in a single request. Aggregator accounts are used for bank statement analysis, while direct-from-customer accounts are used for loan disbursement. > **Warning:** Only one `direct_from_customer` account is allowed per request. The `account_number` must be 4–17 digits and the `routing_number` must be exactly 9 digits. ### Include Bank Accounts at Submission You can also include bank accounts in the initial `POST /api/v3/applications/submit` request by adding a `bank_accounts` array to the payload. The format is the same as shown above. For the complete schema and all available fields, see the [API Reference](/api-reference.html). ## Monitor Application Status Use `GET /api/v3/applications/{app_id}/status` to check the application status as it moves through underwriting. This lightweight endpoint returns only the status, timestamps, and reference ID, which makes it ideal for polling without fetching the full application payload. ### Example Request ```javascript const applicationId = 'your-application-id'; const statusResponse = await fetch(`https://api.quantum.com/api/v3/applications/${applicationId}/status`, { headers: { 'Authorization': 'Bearer YOUR_API_TOKEN' } }); const status = await statusResponse.json(); console.log('Status:', status.status); console.log('Last modified:', status.modified); ``` ### Example Response ```json { "id": "550e8400-e29b-41d4-a716-446655440001", "status": "Under Credit Review", "reference_id": "your-internal-id-12345", "created": "2024-01-15T10:30:00Z", "modified": "2024-01-16T14:45:00Z" } ``` > **Note:** Instead of polling, you can receive real-time status updates via webhooks. See the [Webhooks Overview](/webhooks-overview.html) to get started. > **Note:** Need the full application details including decision data? Use `GET /api/v3/applications/{app_id}` instead. ### Application Lifecycle Understanding the application status flow: 1. **submitted** → Application received 2. **In Processing** → Initial processing 3. **Under Credit Review** → Underwriting review 4. **Approved** → Credit decision made 5. **Awaiting Offer Acceptance** → Customer needs to accept offer 6. **Preparing Loan Documents** → Documents being prepared 7. **Awaiting Document Execution** → Customer needs to sign 8. **Awaiting Funding** → Funding in progress 9. **Booked** → Loan is active **Alternative outcomes:** - **Declined** - Application did not meet credit criteria - **Offer Declined** - Customer declined the offer - **Withdrawn** - Application withdrawn ## Review and Accept Offers When approved, retrieve offers using `GET /api/v3/applications/{app_id}/offers` and accept the best offer with `POST /api/v3/applications/{app_id}/offer/{offer_id}/accept`. See the [Offers guide](/offers.html) for the fields each product type returns and the New York & California requirement to download the disclosure before accepting. ## Service the Account Once booked, use the Accounts API to manage draws and payments. --- ## Common Workflows ### Requesting a Draw from a Line of Credit Once a line of credit account is active, you can request draws: ```javascript const drawResponse = await fetch(`https://api.quantum.com/api/v3/accounts/${accountId}/draw-requests`, { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ draw_amount_in_cents: 1000000, // $10,000 reference_id: "partner-draw-12345" }) }); const drawRequest = await drawResponse.json(); // Draw is processed asynchronously - check status or wait for webhook ``` > **Note:** Draw and payment requests are processed asynchronously. You'll receive webhook notifications when the status changes. ### Making a Payment Submit payments for loan repayment or payoff: ```javascript const paymentResponse = await fetch(`https://api.quantum.com/api/v3/accounts/${accountId}/payment-requests`, { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ payment_amount_in_cents: 500000, // $5,000 request_type: "Payment Request", reference_id: "partner-payment-456" }) }); ``` --- ## Error Handling The API uses standard HTTP status codes to indicate success or failure: | Status Code | Description | |-------------|-------------| | 200 | OK - Request succeeded | | 201 | Created - Resource created successfully | | 400 | Bad Request - Invalid request parameters | | 403 | Forbidden - Insufficient permissions | | 404 | Not Found - Resource not found | | 412 | Precondition Failed - A required prior step is missing. For NY/CA offers, the disclosure must be downloaded before the offer can be accepted (`error.code` is `PRECONDITION_FAILED`; branch on the 412 status) | | 422 | Unprocessable Entity - Validation error | | 500 | Internal Server Error | | 503 | Service Unavailable | **Error Response Format:** ```json { "error": { "code": "VALIDATION_ERROR", "message": "Some fields are missing or invalid.", "details": [ { "field": "application.business.legal_name", "message": "This field is required." } ] } } ``` > **Warning:** Always check the `error.details` array for field-specific validation errors when you receive a 422 response. --- ## Best Practices ### Use Reference IDs Include your own `reference_id` in applications, draw requests, and payment requests to track operations in your system: ```json { "reference_id": "your-internal-id-12345" } ``` ### Handle Asynchronous Operations Draw requests and payment requests are processed asynchronously. Implement webhook handlers to receive status updates rather than polling. ### Validate Before Submitting Ensure all required fields are present and properly formatted before submitting applications to avoid validation errors. ### Store Application IDs Save the `application.id` returned from the submit endpoint - you'll need it for all subsequent operations (uploading documents, checking status, etc.). --- ## Querying These Docs With AI Assistants If you're using an AI assistant (Claude, Cursor, ChatGPT with browsing, etc.) to integrate with the Quantum Partner API, point your tool at one of these machine-readable entry points instead of crawling the HTML site: - **`https://docs.quantumlends.com/llms.txt`:** Compact index following the [llms.txt convention](https://llmstxt.org/). Lists every doc and the canonical API spec with absolute URLs the assistant can follow. - **`https://docs.quantumlends.com/llms-full.txt`:** Single file containing the full body of every guide plus a structured summary of the OpenAPI spec. Useful when you want one fetch to cover the whole integration surface. - **`https://docs.quantumlends.com/merged-api.json`:** Raw OpenAPI 3.1 spec, suitable for codegen or tool definitions. Each guide page also exposes its source markdown via ``, so an assistant that lands on a guide page can fetch the source directly. The API reference page uses an `application/json` alternate that points at the OpenAPI spec. --- ## Next Steps - Review the [complete API Reference](/api-reference.html) for detailed endpoint documentation - Contact your Quantum representative for API credentials and sandbox access - Test your integration in the sandbox environment before going live --- # Prefill Applications The Prefill API allows you to start a loan application on behalf of an applicant by submitting partial data upfront. Rather than requiring the applicant to fill out the entire application from scratch, you prefill known information (such as the applicant's name, email, and business details) and provide them with a link to complete the rest. ## Table of Contents - [How It Works](#how-it-works) - [Creating a Prefilled Application](#creating-a-prefilled-application) - [The Prefill URL](#the-prefill-url) - [Token Expiration](#token-expiration) - [Retrieving a New Prefill Token](#retrieving-a-new-prefill-token) - [Webhook Events](#webhook-events) - [Error Handling](#error-handling) - [Best Practices](#best-practices) --- ## How It Works The prefill flow has four main steps: ![Diagram showing the four-step prefill API flow](/images/prefill-flow-diagram.png) ``` 1. YOU CALL THE PREFILL API └─→ POST /api/v3/applications/prefill └─→ Response includes prefill_url and prefill_token 2. APPLICANT RECEIVES LINK ├─→ You send the prefill_url to the applicant directly └─→ OR an email is automatically sent (if email communication is not suppressed) 3. APPLICANT COMPLETES APPLICATION └─→ Applicant opens the prefill_url └─→ Pre-populated fields are already filled in └─→ Applicant completes remaining fields and submits 4. IF TOKEN EXPIRES (applicant didn't complete in time) └─→ prefill_application.token_expired webhook fires └─→ GET /api/v3/applications/{app_id}/prefill to get a new token and deliver the new prefill_url to the applicant └─→ OR an email is automatically sent (if email communication is not suppressed) ``` > **Note:** Whether the applicant receives the link via an automatic email or directly from you depends on your affiliate configuration. If your affiliate is configured to suppress email communication, you are responsible for delivering the `prefill_url` to the applicant. --- ## Creating a Prefilled Application **POST /api/v3/applications/prefill** Send a `POST` request with the applicant and (optionally) business and loan details. Only the owner's `first_name`, `last_name`, and `email` are required; everything else is optional. ### Request Body **Owner Information (`owners`):** Required, at least one owner. | Field | Type | Required | Description | |-------|------|----------|-------------| | `first_name` | string | Yes | Owner's first name (max 100 chars) | | `last_name` | string | Yes | Owner's last name (max 100 chars) | | `email` | string | Yes | Owner's email address | | `middle_name` | string | No | Owner's middle name | | `name_suffix` | string | No | Name suffix (e.g., "III") | | `job_title` | string | No | Owner's job title | | `phone_number` | string | No | Phone number (format: `XXX-XXX-XXXX`) | | `date_of_birth` | string | No | Date of birth (format: `YYYY-MM-DD`, must be in the past) | | `is_applicant` | boolean | No | Whether this owner is the primary applicant | | `ownership_percent` | integer | No | Ownership percentage (1–100) | | `ssn` | string | No | Social Security Number (`XXXXXXXXX` or `XXX-XX-XXXX`) | | `address` | object | No | Owner's home address | **Business Information (`business`):** Optional. | Field | Type | Description | |-------|------|-------------| | `legal_name` | string | Legal business name (max 100 chars) | | `doing_business_as` | string | DBA name (max 100 chars) | | `entity_type` | string | Business structure (e.g., `limited_liability_company`, `sole_proprietor`, `partnership`, `s_corporation`, `c_corporation`, `other`) | | `phone_number` | string | Business phone (format: `XXX-XXX-XXXX`) | | `naics_code` | string | NAICS industry code (exactly 6 digits) | | `start_date` | string | Business start date (format: `YYYY-MM-DD`) | | `non_profit` | boolean | Whether the business is a non-profit | | `tax_identification` | string | Business tax identification number: an EIN (Federal Tax ID) in `XX-XXXXXXX` format (e.g. `12-3456789`), or a sole proprietor's SSN as `XXX-XX-XXXX` or `XXXXXXXXX` | | `address` | object | Business address | **Loan Request (`loan_request`):** Optional. | Field | Type | Description | |-------|------|-------------| | `amount` | integer | Requested loan amount ($10,000–$500,000) | | `purpose` | string | Loan purpose (e.g., `working_capital`, `equipment_purchase`, `business_expansion`, `debt_refinancing`, `inventory_purchase`) | | `authorization` | boolean | Credit check authorization | **Other Fields** | Field | Type | Description | |-------|------|-------------| | `reference_id` | string | Your internal reference ID for this application (max 100 chars) | ### Example Request ```javascript const response = await fetch('https://api.quantum.com/api/v3/applications/prefill', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ owners: [{ first_name: "Jane", last_name: "Smith", email: "jane@smithenterprises.com", phone_number: "415-555-0198", date_of_birth: "1985-06-15", is_applicant: true, ownership_percent: 100 }], business: { legal_name: "Smith Enterprises LLC", entity_type: "limited_liability_company", phone_number: "415-555-0100", naics_code: "541511", start_date: "2018-01-15" }, loan_request: { amount: 75000, purpose: "working_capital" }, reference_id: "PARTNER-REF-20250001" }) }); const prefillApp = await response.json(); console.log('Prefill URL:', prefillApp.prefill_url); ``` ### Example Response (201 Created) ```json { "id": "c9cefb5c-447b-433f-a4b7-16ce14a80eac", "prefill_url": "https://quantumlends.com/ui/apply/sp/c9cefb5c-447b-433f-a4b7-16ce14a80eac?token=nHzIm8OvrkAD6Lt9NLwHjcxn4jIfUFWFJ52bXKaEwB0", "prefill_token": "nHzIm8OvrkAD6Lt9NLwHjcxn4jIfUFWFJ52bXKaEwB0", "owners": [ { "first_name": "Jane", "last_name": "Smith", "email": "jane@smithenterprises.com", "phone_number": "415-555-0198", "date_of_birth": "1985-06-15", "is_applicant": true, "ownership_percent": 100 } ], "business": { "legal_name": "Smith Enterprises LLC", "entity_type": "limited_liability_company", "phone_number": "415-555-0100", "naics_code": "541511", "start_date": "2018-01-15" }, "loan_request": { "amount": 75000, "purpose": "working_capital" }, "created": "2025-06-15 14:30:00", "modified": "2025-06-15 14:30:01", "reference_id": "PARTNER-REF-20250001" } ``` > **Note:** Save the `prefill_url` from the response. This is the link the applicant will use to continue their application. If your affiliate suppresses email communication, you are responsible for delivering this URL to the applicant. > **Note:** The response only includes fields that have values. Null or empty fields are omitted. ### Minimal Request Example Only the owner's name and email are strictly required: ```javascript const response = await fetch('https://api.quantum.com/api/v3/applications/prefill', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ owners: [{ first_name: "Jane", last_name: "Smith", email: "jane@smithenterprises.com" }] }) }); ``` --- ## The Prefill URL The `prefill_url` returned in the response is a one-time-use link that takes the applicant directly to a pre-populated application form. The URL contains an authentication token so the applicant does not need to log in. ``` https://quantumlends.com/ui/apply/sp/{application_id}?token={prefill_token} ``` ### How the Link Reaches the Applicant The delivery method depends on your affiliate configuration: | Configuration | Behavior | |---------------|----------| | **Emails not suppressed** (default) | An email is automatically sent to the applicant's email address with the prefill URL. | | **Emails suppressed** | No email is sent. You are responsible for delivering the `prefill_url` to the applicant through your own channels (email, SMS, in-app notification, etc.). | > **Warning:** If your affiliate configuration suppresses emails, make sure your integration delivers the `prefill_url` to the applicant promptly. The token embedded in the URL will expire after a period of time. --- ## Token Expiration The `prefill_token` embedded in the prefill URL has an expiration time. If the applicant attempts to open the link after the token has expired, they will not be able to access the prefilled application. When an expired token is used, a `prefill_application.token_expired` webhook event is fired regardless of your email configuration. Additionally, the system handles link renewal based on your email settings: | Configuration | What Happens on Expiration | |---------------|---------------------------| | **Emails not suppressed** | A new email is automatically sent to the applicant with a fresh link containing a new token. The `prefill_application.token_expired` webhook is also fired. | | **Emails suppressed** | The `prefill_application.token_expired` webhook is fired. No email is sent, so you must retrieve a new token and deliver the updated link to the applicant. | > **Note:** The `prefill_application.token_expired` webhook is particularly important if your affiliate suppresses emails, since it is the only way to know when the applicant needs a new link. However, you can subscribe to this event for visibility into token expirations. --- ## Retrieving a New Prefill Token **GET /api/v3/applications/{app_id}/prefill** When you receive a `prefill_application.token_expired` webhook event, use this endpoint to retrieve a new `prefill_token` and `prefill_url` for the application. This is the recommended way to get a fresh link after token expiration, especially if your affiliate configuration suppresses emails. ### Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `app_id` | string (UUID) | Yes | The application ID from the original prefill response or the webhook event payload | ### Example Request ```javascript const appId = 'c9cefb5c-447b-433f-a4b7-16ce14a80eac'; const response = await fetch(`https://api.quantum.com/api/v3/applications/${appId}/prefill`, { method: 'GET', headers: { 'Authorization': 'Bearer YOUR_API_TOKEN' } }); const prefillData = await response.json(); console.log('New Prefill URL:', prefillData.prefill_url); ``` ### Example Response (200 OK) ```json { "id": "c9cefb5c-447b-433f-a4b7-16ce14a80eac", "prefill_url": "https://quantumlends.com/ui/apply/sp/c9cefb5c-447b-433f-a4b7-16ce14a80eac?token=xR7kP2mQvL9wN3jYhT6sA1cBfD4eG8iK0oU5rW2xZ9q", "prefill_token": "xR7kP2mQvL9wN3jYhT6sA1cBfD4eG8iK0oU5rW2xZ9q" } ``` > **Note:** Each call to this endpoint generates a new token. Any previously issued tokens for the application are invalidated. Make sure to deliver the latest `prefill_url` to the applicant. ### Handling Token Expiration Flow Here's the recommended flow for handling token expiration: ``` 1. WEBHOOK RECEIVED └─→ prefill_application.token_expired event fires 2. RETRIEVE NEW TOKEN └─→ GET /api/v3/applications/{app_id}/prefill └─→ Response includes new prefill_url and prefill_token 3. DELIVER NEW LINK └─→ Send the updated prefill_url to the applicant ``` --- ## Webhook Events The Prefill API introduces two webhook event types. Subscribe to these events to track prefilled application activity. > **Note:** To subscribe to these events, see the [Webhooks Integration Guide](/webhooks-guide.html). Add `prefill_application.created` and `prefill_application.token_expired` to your subscription's event list. ### `prefill_application.created` Fired when a prefilled application is successfully created. **Payload:** | Field | Description | |-------|-------------| | `id` | The UUID of the created application | | `affiliate_id` | The affiliate ID associated with your account | | `partner_reference_id` | The `reference_id` provided in your prefill request (if any) | ### `prefill_application.token_expired` Fired when an applicant attempts to access a prefill link with an expired token. This is especially useful if your affiliate suppresses emails, since you need to know when to resend the link. **Payload:** | Field | Description | |-------|-------------| | `id` | The UUID of the application | | `affiliate_id` | The affiliate ID associated with your account | | `partner_reference_id` | The `reference_id` provided in your prefill request (if any) | > **Note:** This webhook is deduplicated: you will receive at most one notification per token within a 24-hour window, even if the applicant clicks the expired link multiple times. --- ## Error Handling ### POST /api/v3/applications/prefill | Status Code | Cause | Description | |-------------|-------|-------------| | **201** | Success | Application created. Response contains `prefill_url` and application data. | | **400** | Not configured | Your account does not have an affiliate configured for prefill. Contact your Quantum representative. | | **403** | Unauthorized | Your API credentials do not have permission for this operation. | | **422** | Validation error | One or more fields are missing or invalid. Check the `error.details` array for specifics. | ### GET /api/v3/applications/{app_id}/prefill | Status Code | Cause | Description | |-------------|-------|-------------| | **200** | Success | New token generated. Response contains `prefill_url` and `prefill_token`. | | **403** | Unauthorized | Your API credentials do not have permission for this operation. | | **404** | Not found | The application ID does not exist or does not belong to your account. | ### Example: Validation Error Response ```json { "error": { "code": "VALIDATION_ERROR", "message": "Some fields are missing or invalid", "details": [ { "field": "body.owners.0.email", "message": "value is not a valid email address" } ] } } ``` > **Warning:** If you receive a `400` error indicating that prefill is not configured, contact your Quantum representative to enable it for your account. --- ## Best Practices ### Provide As Much Data As Possible While only `first_name`, `last_name`, and `email` are required, prefilling additional fields reduces friction for the applicant and increases the likelihood of application completion. At minimum, consider including: - Owner's phone number and date of birth - Business legal name and entity type - Loan request amount and purpose ### Use Reference IDs Include a `reference_id` to correlate prefilled applications with records in your system. This ID is returned in webhook payloads and API responses, making it easy to track applications across systems. ```json { "reference_id": "YOUR-INTERNAL-ID-12345" } ``` ### Handle Token Expiration If your affiliate suppresses emails, implement a handler for the `prefill_application.token_expired` webhook event. When received, call `GET /api/v3/applications/{app_id}/prefill` to retrieve a fresh token and deliver the new prefill link to the applicant promptly to avoid drop-off. ### Monitor Webhook Events Subscribe to both `prefill_application.created` and `prefill_application.token_expired` events to maintain visibility into the prefill pipeline. --- ## Next Steps - Review the [API Reference](/api-reference.html) for the complete prefill endpoint schema - Set up [Webhook Subscriptions](/webhooks-guide.html) for prefill events - Contact your Quantum representative to enable prefill for your account --- # Bank & Financial Data Partners with an existing Plaid or Stripe Financial Connections integration can forward the applicant's bank data directly to Quantum for cash flow analysis. You submit the vendor's own objects, wrapped in a small envelope that names the source. Quantum handles normalization, sign conversion, and field mapping internally. ## Table of Contents - [Overview](#overview) - [Plaid Asset Report](#plaid-asset-report) - [Stripe Financial Connections](#stripe-financial-connections) - [Response](#response) --- ## Overview **POST /api/v3/applications/{app_id}/transactions** - `app_id` (string (UUID), required) **Authentication:** Bearer token in the `Authorization` header. The request body is an envelope with two fields. `type` names the source, and `data` carries the vendor data for that source: ```json { "type": "plaid_asset_report", "data": { "...": "vendor data" } } ``` | `type` | Source | What goes in `data` | |--------|--------|---------------------| | `plaid_asset_report` | Plaid [Asset Report](https://plaid.com/docs/api/products/assets/) | The `report` object from Plaid's `/asset_report/get` response | | `stripe_financial_connections` | [Stripe Financial Connections](https://docs.stripe.com/financial-connections) | `{ "accounts": [...] }`: every connected account, each carrying its complete transaction list | `type` is required. A request without it, or with a value not listed above, is rejected with `422`. > **Note:** Send the vendor's response as-is. Fields beyond those documented here are accepted, so there is nothing to strip or reshape. Values must be valid JSON; `NaN` and `Infinity` are rejected. > **Note:** **Don't also upload bank statement PDFs.** If you submit a Plaid Asset Report here, there's no need to upload bank statement PDFs (from Plaid or directly from the bank) to the documents endpoint (`POST /api/v3/applications/{app_id}/documents`). The asset report covers cash flow analysis, and sending both slows down processing. #### History requirement > **Warning:** **Cash flow analysis is built on roughly three months of transaction history.** Submit at least 90 days of transactions for every account; 6–12 months is ideal where the institution provides it. Data covering less than 90 days may produce an incomplete or failed analysis. --- ## Plaid Asset Report **Use this type** when your integration uses Plaid's [Asset Reports](https://plaid.com/docs/api/products/assets/) product. #### Data requirements - Set `days_requested` to at least 90 when creating the report via Plaid's `/asset_report/create` (see [History requirement](#history-requirement)). - The report must contain at least one item, and at least one account across its items. An empty report is rejected with `422`. - `asset_report_id`, `date_generated`, and `items` are required. Within each item, `item_id` and `accounts` are required. Each transaction needs `transaction_id`, `account_id`, `amount`, and `date`. Plaid always populates these. #### Sign convention Plaid's standard convention applies: **positive amount = money leaving the account** (debit), negative amount = money entering the account (credit). Pass values exactly as Plaid returns them. Quantum normalizes internally. #### How to submit Pass the `report` object from Plaid's `/asset_report/get` response as `data`: specifically `response.report`, not the full API response wrapper. ```javascript // 1. Fetch the asset report from Plaid (you may already have this from a webhook) const plaidResponse = await plaidClient.assetReportGet({ asset_report_token: assetReportToken }); // 2. Forward the report object to Quantum const response = await fetch( `https://api.quantum.com/api/v3/applications/${applicationId}/transactions`, { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ type: 'plaid_asset_report', data: plaidResponse.data.report // the raw report object, unchanged }) } ); ``` > **Warning:** Each asset report can be ingested once. Submitting a report whose `asset_report_id` has already been ingested (for this application or any other) returns `409 Conflict`. Create a fresh asset report for each application rather than reusing one. #### Example payload ```json { "type": "plaid_asset_report", "data": { "asset_report_id": "4d74e6a8-4d74-4e6a-8c4d-74e6a84d74e6", "client_report_id": "app-12345", "date_generated": "2026-06-29T12:00:00Z", "days_requested": 180, "items": [ { "item_id": "eVBnVMp7zdTJLkRNr33Rs6zr7KRqjBduiatePb", "institution_id": "ins_3", "institution_name": "Chase", "date_last_updated": "2026-06-29T11:58:00Z", "accounts": [ { "account_id": "BxBXxLj1m4HMXBm9WZJyUg9XLd4rKEhw8Pb1J", "mask": "4321", "name": "Business Checking", "official_name": "CHASE BUSINESS COMPLETE CHECKING", "subtype": "checking", "type": "depository", "days_available": 180, "balances": { "available": 43821.06, "current": 43821.06, "iso_currency_code": "USD", "limit": null }, "historical_balances": [ { "date": "2026-06-28", "current": 41250.00, "iso_currency_code": "USD" }, { "date": "2026-06-27", "current": 38900.50, "iso_currency_code": "USD" }, { "date": "2026-06-26", "current": 44120.75, "iso_currency_code": "USD" } ], "transactions": [ { "transaction_id": "lPNjeW1nR6CDn5okmGQ6hEpMo4lLNoSrzqDje", "account_id": "BxBXxLj1m4HMXBm9WZJyUg9XLd4rKEhw8Pb1J", "amount": -2307.21, "iso_currency_code": "USD", "date": "2026-06-17", "original_description": "STRIPE PAYOUT ST-ABCD1234EFGH5678", "pending": false }, { "transaction_id": "PPKaXNobm1uRPQNfqbFcsk3JNbKp1qJLXbDrE", "account_id": "BxBXxLj1m4HMXBm9WZJyUg9XLd4rKEhw8Pb1J", "amount": 450.00, "iso_currency_code": "USD", "date": "2026-06-14", "original_description": "COMCAST BUSINESS 800-391-3000 IL", "pending": false } ] } ] } ], "user": { "client_user_id": "user-12345", "first_name": "Jane", "last_name": "Smith", "email": "jane@acmecorp.com" } } } ``` --- ## Stripe Financial Connections **Use this type** when your integration uses [Stripe Financial Connections](https://docs.stripe.com/financial-connections). Stripe has no report object. A Plaid asset report is complete by construction (one artifact, one id), but Stripe exposes an account, a balance, and a paginated transaction list, each refreshed on its own schedule. Assembling them into one submission is your job. This section describes exactly what Quantum expects, because a payload assembled by hand is easy to get subtly wrong: the result is either rejected or, worse, analysed with an incomplete picture of the applicant. #### Payload shape `data` has a single field, `accounts`: an array with one entry per connected account. Each entry is Stripe's [Account object](https://docs.stripe.com/api/financial_connections/accounts/object), exactly as `GET /v1/financial_connections/accounts/{id}` returns it, with one field added: `transactions`, holding Stripe's transaction **list object** for that account with every page concatenated into `data`. ```json { "type": "stripe_financial_connections", "data": { "accounts": [ { "id": "fca_...", "object": "financial_connections.account", "balance": { "as_of": 1787087640, "current": { "usd": 2927625 }, "...": "..." }, "transactions": { "object": "list", "has_more": false, "data": [ { "id": "fctxn_...", "amount": 289000, "currency": "usd", "status": "posted", "...": "..." } ] }, "...": "every other Account field, untouched" } ] } } ``` Three parts of this shape are routinely lost when exporting by hand, and each one is checked: - **Keep the list wrapper on `transactions`.** A bare array is rejected. Unwrapping it loses `has_more`, the only completeness signal Stripe gives. - **`has_more` must be `false`.** Page the account's transactions until Stripe reports `has_more: false`, concatenate the pages, and set `has_more: false` on the assembled list. A single page submitted as a whole history produces a confident wrong analysis rather than an error. - **`balance.current` is a map, not a number.** Stripe keys balances by lowercase ISO currency code: `{ "usd": 2927625 }`. Leave it that way. Do not otherwise reshape the account: do not hoist `balance` or `owners` to the top level, do not add annotations of your own, and leave amounts and timestamps exactly as Stripe returned them. Fields Quantum does not use (`ownership`, `permissions`, `livemode`, `balance_refresh`, `transaction_refresh`, `account_holder`, `subscriptions`, and so on) are accepted and ignored, so there is nothing to strip. #### All accounts in one submission > **Important:** **One submission must carry every account the applicant connected, and Quantum cannot check that it does.** Quantum has no way to know how many accounts the applicant connected in your Stripe session. A submission containing one valid account from a multi-account session is accepted with `200` and analysed as if it were the applicant's complete financial picture. No error, then or later, will tell you it was incomplete. The only symptom is a lending decision made on partial data. Collect every account from the session before you submit. Because Stripe has no report id, Quantum identifies a submission by a content hash over its accounts. Re-sending an identical submission for the same application returns `409 Conflict`, because it carries nothing new. Re-pull the accounts and resubmit once a balance or transaction has changed. A submission with a *different* set of accounts is not a duplicate. It is accepted and produces a separate analysis, so sending accounts one at a time, or adding a forgotten account in a follow-up request, does not merge them into one picture. Each request stands alone. #### Balance is required, and the `balances` permission does not populate it > **Warning:** **Every account must carry a populated `balance` with a non-empty `balance.current`.** Being granted the `balances` permission does not fill it in. Balance and transaction refreshes are independent, and `subscriptions` covers transactions only. An account that is subscribed to transactions and has `permissions: ["balances", "transactions"]` can still have `balance: null` indefinitely. Before submitting, either include `balances` in `prefetch` when you create the Financial Connections session, or call `POST /v1/financial_connections/accounts/{id}/refresh` with `features[]=balances` and wait until `balance_refresh.status` is `succeeded`. Quantum anchors the running-balance walk in cash flow analysis on the current balance, so an account without one cannot be analysed. Rather than checking permissions, Quantum checks that the data is actually present. #### Sign convention and units Stripe amounts are **integers in the smallest currency unit** (cents for USD) and use the **opposite sign to Plaid**. Stripe's Account object documents the orientation for its balance maps: *"A positive amount indicates money owed to the account holder. A negative amount indicates money owed by the account holder."* Transactions follow the same account-holder perspective: **positive = money coming into the account**, negative = money leaving it. Pass values exactly as Stripe returns them: do not convert to decimal currency units and do not invert the sign. Quantum normalizes internally. #### Transaction statuses Every transaction's `status` must be one of Stripe's three values: `posted`, `pending`, or `void`. Each account must have at least one `posted` transaction. `void` rows are accepted and then dropped; `pending` rows are ingested and flagged as pending. `status_transitions.posted_at` is used as the transaction date when present, falling back to `transacted_at`. #### Validation Quantum validates the whole submission before anything is stored, and validation is all-or-nothing: one unusable account rejects the entire submission with `422`. The response lists every problem found, so a single round trip tells you everything to fix. Accounts and transactions are identified by their position in the arrays you submitted, never by id. These rules check each account you submit. Nothing checks that you submitted all of them; completeness is your responsibility (see [All accounts in one submission](#all-accounts-in-one-submission)). | Rule | Message when violated | |------|-----------------------| | Every account has a `balance` | `accounts[2]: carries no balance` | | `balance.current` has at least one currency entry | `accounts[2]: carries a balance with no amount in it` | | `transactions.has_more` is `false` | `accounts[2]: reports has_more=true, so this is a page not the whole history` | | At least one `posted` transaction per account | `accounts[2]: has no posted transactions` | | Every `status` is `posted`, `pending`, or `void` | `accounts[2]: has transactions with an unrecognised status (transactions.data[7])` | | One currency per account, across balance and non-void transactions | `accounts[2]: mixes currencies` | | One currency across the whole submission | `submission spans currencies` | | No account appears twice | `accounts[3]: is the same account as accounts[0]` | A rejected submission looks like this: ```json { "error": { "code": "VALIDATION_ERROR", "message": "Some fields are missing or invalid.", "details": [ { "field": "data.accounts", "message": "accounts[1]: carries no balance" }, { "field": "data.accounts", "message": "accounts[1]: reports has_more=true, so this is a page not the whole history" } ] } } ``` #### How to submit ```javascript const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY); // Poll until the account's balance refresh has completed. Balances are only // populated by a balance refresh; a transactions subscription never fills them. async function ensureBalance(accountId) { let account = await stripe.financialConnections.accounts.retrieve(accountId); if (account.balance) return account; await stripe.financialConnections.accounts.refresh(accountId, { features: ['balances'] }); do { await new Promise((r) => setTimeout(r, 2000)); account = await stripe.financialConnections.accounts.retrieve(accountId); } while (account.balance_refresh?.status === 'pending'); if (!account.balance) { throw new Error(`Balance refresh failed for ${accountId}: ${account.balance_refresh?.status}`); } return account; } // Page through every transaction for the account and rebuild Stripe's list object. async function fetchAllTransactions(accountId) { const data = []; let startingAfter; let hasMore = true; while (hasMore) { const page = await stripe.financialConnections.transactions.list({ account: accountId, limit: 100, ...(startingAfter && { starting_after: startingAfter }) }); data.push(...page.data); hasMore = page.has_more; if (hasMore) startingAfter = page.data[page.data.length - 1].id; } return { object: 'list', url: '/v1/financial_connections/transactions', has_more: false, // every page has been fetched data }; } // 1. Collect every account the applicant connected in the Financial Connections session const session = await stripe.financialConnections.sessions.retrieve(sessionId); const accountIds = session.accounts.data.map((a) => a.id); // 2. For each account: confirm the balance is populated, then attach its full transaction list const accounts = []; for (const accountId of accountIds) { const account = await ensureBalance(accountId); account.transactions = await fetchAllTransactions(accountId); accounts.push(account); // the raw Account object plus `transactions`, nothing else changed } // 3. Submit all accounts together in one request const response = await fetch( `https://api.quantum.com/api/v3/applications/${applicationId}/transactions`, { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ type: 'stripe_financial_connections', data: { accounts } }) } ); ``` > **Note:** If you request `prefetch: ['balances', 'transactions']` when creating the Financial Connections session, the balance is already populated when the applicant finishes connecting and the refresh step above is a no-op. #### Example payload Two accounts at one institution. The transaction lists are truncated for readability. A real submission carries the account's full history (see [History requirement](#history-requirement)). ```json { "type": "stripe_financial_connections", "data": { "accounts": [ { "id": "fca_1UaQ7k2RIoLNqLiBqTvE83Kd", "object": "financial_connections.account", "account_holder": { "customer": "cus_UaQ7kR2VtMbNqL", "type": "customer" }, "balance": { "as_of": 1787087640, "type": "cash", "current": { "usd": 2927625 }, "cash": { "available": { "usd": 2740125 } } }, "balance_refresh": { "last_attempted_at": 1787087640, "next_refresh_available_at": 1787109240, "status": "succeeded" }, "category": "cash", "subcategory": "checking", "display_name": "Business Complete Checking", "institution_name": "Cedar Ridge Bank", "last4": "7742", "livemode": true, "permissions": ["balances", "ownership", "transactions"], "status": "active", "subscriptions": ["transactions"], "transaction_refresh": { "id": "fctxnref_1UaQ7j2RIoLNqLiBz3Kd8vTq", "last_attempted_at": 1787562720, "next_refresh_available_at": 1787584320, "status": "succeeded" }, "transactions": { "object": "list", "url": "/v1/financial_connections/transactions", "has_more": false, "data": [ { "id": "fctxn_1UUh65UgPwHp7FUOmFg7WBS3", "object": "financial_connections.transaction", "account": "fca_1UaQ7k2RIoLNqLiBqTvE83Kd", "amount": 187500, "currency": "usd", "description": "ACH CREDIT CUSTOMER DEPOSIT", "status": "pending", "status_transitions": { "posted_at": null, "void_at": null }, "transacted_at": 1787511900, "transaction_refresh": "fctxnref_1UaQ7j2RIoLNqLiBz3Kd8vTq", "livemode": true, "updated": 1787512000 }, { "id": "fctxn_1UmQwpOp6LhYpt0a30Fk5eno", "object": "financial_connections.transaction", "account": "fca_1UaQ7k2RIoLNqLiBqTvE83Kd", "amount": -167500, "currency": "usd", "description": "NORTHSIDE PACKAGING ACH DEBIT", "status": "posted", "status_transitions": { "posted_at": 1787409000, "void_at": null }, "transacted_at": 1787339100, "transaction_refresh": "fctxnref_1UaQ7j2RIoLNqLiBz3Kd8vTq", "livemode": true, "updated": 1787409100 }, { "id": "fctxn_1UDpChirA7V0f8aMemDaYJsz", "object": "financial_connections.transaction", "account": "fca_1UaQ7k2RIoLNqLiBqTvE83Kd", "amount": -98000, "currency": "usd", "description": "CARD REFUND REVERSED", "status": "void", "status_transitions": { "posted_at": null, "void_at": 1787236200 }, "transacted_at": 1787166300, "transaction_refresh": "fctxnref_1UaQ7j2RIoLNqLiBz3Kd8vTq", "livemode": true, "updated": 1787236300 }, { "id": "fctxn_1UPRhwLxKJWNpaIgjOFNIjiq", "object": "financial_connections.transaction", "account": "fca_1UaQ7k2RIoLNqLiBqTvE83Kd", "amount": 289000, "currency": "usd", "description": "ACH CREDIT CUSTOMER DEPOSIT", "status": "posted", "status_transitions": { "posted_at": 1787149800, "void_at": null }, "transacted_at": 1787079900, "transaction_refresh": "fctxnref_1UaQ7j2RIoLNqLiBz3Kd8vTq", "livemode": true, "updated": 1787149900 }, { "id": "fctxn_1UAq3xPz9RkLmn2cD4Ef7gHj", "object": "financial_connections.transaction", "account": "fca_1UaQ7k2RIoLNqLiBqTvE83Kd", "amount": -45000, "currency": "usd", "description": "COMCAST BUSINESS 800-391-3000", "status": "posted", "status_transitions": { "posted_at": 1778086800, "void_at": null }, "transacted_at": 1778000400, "transaction_refresh": "fctxnref_1UaQ7j2RIoLNqLiBz3Kd8vTq", "livemode": true, "updated": 1778086900 } ] } }, { "id": "fca_1UbR8m2RIoLNqLiBwXyF94Le", "object": "financial_connections.account", "account_holder": { "customer": "cus_UaQ7kR2VtMbNqL", "type": "customer" }, "balance": { "as_of": 1787087700, "type": "cash", "current": { "usd": 811400 }, "cash": { "available": { "usd": 811400 } } }, "balance_refresh": { "last_attempted_at": 1787087700, "next_refresh_available_at": 1787109300, "status": "succeeded" }, "category": "cash", "subcategory": "savings", "display_name": "Business Savings", "institution_name": "Cedar Ridge Bank", "last4": "3318", "livemode": true, "permissions": ["balances", "ownership", "transactions"], "status": "active", "subscriptions": ["transactions"], "transaction_refresh": { "id": "fctxnref_1UbR8l2RIoLNqLiBx4Mf9wUr", "last_attempted_at": 1787562780, "next_refresh_available_at": 1787584380, "status": "succeeded" }, "transactions": { "object": "list", "url": "/v1/financial_connections/transactions", "has_more": false, "data": [ { "id": "fctxn_1UcT2qNr8VkXpz4bB1Hm6yWd", "object": "financial_connections.transaction", "account": "fca_1UbR8m2RIoLNqLiBwXyF94Le", "amount": 250000, "currency": "usd", "description": "TRANSFER FROM CHECKING", "status": "posted", "status_transitions": { "posted_at": 1786923000, "void_at": null }, "transacted_at": 1786923000, "transaction_refresh": "fctxnref_1UbR8l2RIoLNqLiBx4Mf9wUr", "livemode": true, "updated": 1786923100 } ] } } ] } } ``` --- ## Response A successful submission returns HTTP `200` with the `type` you submitted echoed back: ```json { "type": "stripe_financial_connections", "message": "Stripe Financial Connections data ingested" } ``` For Plaid the message is `"Plaid asset report ingested"`. Processing is asynchronous: Quantum runs cash flow analysis in the background. Monitor progress via `GET /api/v3/applications/{app_id}/status` or listen for status webhooks. ### Error responses | Status | Meaning | |--------|---------| | `403` | Invalid or missing API token, or the token is not authorized to submit transaction data | | `404` | Application ID not found, or it does not belong to your partner account | | `409` | Plaid: this `asset_report_id` has already been ingested. Stripe: this submission is identical to one already ingested for this application | | `422` | Payload failed validation: missing or unknown `type`, missing required fields, wrong field types, or (Stripe) an unanalysable account. The `details` array names every problem | | `510` | Unexpected error on Quantum's side. Retry later; if it persists, contact support | For complete request and response schemas, see the [API Reference](/api-reference.html). --- # Offers Once an application clears underwriting, Quantum returns one or more **offers**. Each offer represents a financing product the applicant is approved for. This guide explains how to retrieve offers and, importantly, which fields to expect for each product type. > **Note:** **Why offers look different from one another.** The offers endpoint returns a list of offers, but not every offer has the same shape. A Fee Based Line of Credit offer carries different fields than a Revenue Based Advance. The field you read depends on the offer's `loan_type`. This guide maps out exactly which fields appear for each product type. ## Retrieving offers **GET /api/v3/applications/{app_id}/offers** Returns every offer generated for the application. - `app_id` (string (uuid), required) The response is an `Offers` object: the application ID plus an array of offer objects. ```json { "application_id": "550e8400-e29b-41d4-a716-446655440001", "offers": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "loan_type": "fee_based_loc", "payment_frequency": "monthly", "term": 36, "has_disclosure": true, "expires_at": "2025-10-31 11:23:10", "status": "presented", "decline_reason": null, "annual_fee_in_cents": 10000, "commitment_fee_amount_in_cents": 10000, "facility_size_in_cents": 12500000, "minimum_draw_amount_in_cents": 100000, "basis_fee": "200.00" }, { "id": "660e8400-e29b-41d4-a716-446655440022", "loan_type": "revenue_based_advance", "payment_frequency": "monthly", "term": 12, "has_disclosure": true, "expires_at": "2025-10-31 11:23:10", "status": "presented", "decline_reason": null, "amount_in_cents": 10000000, "amortized_payment_amount_in_cents": 549189, "factor_rate": "1.10", "revenue_share_amount_in_cents": 0 } ] } ``` Notice the two offers above carry **different fields**. The first has `basis_fee` and `facility_size_in_cents`; the second has `factor_rate` and `amount_in_cents`. The next section explains why. ## The product types In the OpenAPI spec, each item in the `offers` array is an `anyOf` across the schemas below. In practice this is a **discriminated union**: the `loan_type` field tells you which product type an offer is, and therefore which fields it will contain. | Product type | `loan_type` value | Schema | |---|---|---| | Fee Based Line of Credit | `fee_based_loc` | `FeeBasedLOCOffer` | | Cobalt | `cobalt_fbloc` | `CobaltFBLOCOffer` | | Term Line of Credit | `term_loc` | `TermLOCOffer` | | Term Loan | `standard_term_loan` | `TermLoanOffer` | | Revenue Based Advance | `revenue_based_advance` | `RevenueBasedAdvanceOffer` | > **Note:** **Cobalt is field-identical to a Fee Based Line of Credit** but is a distinct product with its own `loan_type` (`cobalt_fbloc`). Branch on `loan_type`. Treat a `cobalt_fbloc` offer exactly as you would a `fee_based_loc` offer for field access, but keep the two `loan_type` values distinct. The `cobalt_fbloc` `loan_type` and the `CobaltFBLOCOffer` schema are live in the [API Reference](/api-reference.html). To generate Cobalt offers against a test application, use the `N Loans COBALT` offer-generation magic value in the [Sandbox](/sandbox-environment.html). > **Tip:** **Integration tip.** Always branch on `loan_type` first, then read the product-specific fields. Do not assume a field is present just because it appeared on another offer in the same response. ## Fields present on every offer These fields belong to **all** product types, so you can read them without checking `loan_type`. The first seven are always present; `decline_reason` is optional (see the note below). | Field | Type | Required | Description | |---|---|:---:|---| | `id` | string (uuid) | Yes | Offer ID. Use this to accept the offer or fetch its disclosure. | | `loan_type` | enum | Yes | The product type: `fee_based_loc`, `cobalt_fbloc`, `term_loc`, `standard_term_loan`, or `revenue_based_advance`. | | `payment_frequency` | enum | Yes | `monthly` or `semi_monthly`. | | `term` | integer | Yes | Term in months (e.g. `12`, `24`, `36`, `48`, `60`). | | `has_disclosure` | boolean | Yes | Whether a commercial financing disclosure PDF is available (true for states such as CA and NY). | | `expires_at` | string | Yes | When the offer expires (e.g. `2025-10-31 11:23:10`). | | `status` | enum | Yes | `presented`, `accepted`, or `rejected`. | | `decline_reason` | string \| null | No | Reason the offer was declined, if applicable. Optional and nullable: the key may be `null` or omitted entirely, so don't dereference it unconditionally. | ## Which extra fields each product type carries Beyond the shared fields, each product type adds its own. `✓` = part of that product type's schema; `○` = part of the schema but **optional/nullable** (the key may be `null` or omitted); a blank cell = not part of that product type's schema. | Field | Fee Based LOC | Cobalt | Term LOC | Term Loan | Revenue Based Advance | |---|:---:|:---:|:---:|:---:|:---:| | `annual_fee_in_cents` | ✓ | ✓ | ✓ | | | | `commitment_fee_amount_in_cents` | ○ | ○ | ○ | | | | `facility_size_in_cents` | ✓ | ✓ | ✓ | | | | `minimum_draw_amount_in_cents` | ○ | ○ | ○ | | | | `basis_fee` | ✓ | ✓ | | | | | `interest_rate` | | | ✓ | ✓ | | | `draw_fee` | | | ✓ | | | | `amount_in_cents` | | | | ✓ | ✓ | | `amortized_payment_amount_in_cents` | | | | ✓ | ✓ | | `revenue_share_amount_in_cents` | | | | ✓ | ✓ | | `origination_and_closing_fees` | | | | ✓ | | | `factor_rate` | | | | | ✓ | ### Fee Based Line of Credit (`fee_based_loc`) A revolving line of credit priced with fees rather than interest. Adds: - `annual_fee_in_cents` - `commitment_fee_amount_in_cents` *(optional/nullable)* - `facility_size_in_cents` - `minimum_draw_amount_in_cents` *(optional/nullable)* - `basis_fee` ### Cobalt (`cobalt_fbloc`) A distinct product that is **field-identical to the Fee Based Line of Credit**: the same revolving-line-of-credit shape priced with fees rather than interest. It carries the same fields; only the `loan_type` differs (`cobalt_fbloc`). Adds: - `annual_fee_in_cents` - `commitment_fee_amount_in_cents` *(optional/nullable)* - `facility_size_in_cents` - `minimum_draw_amount_in_cents` *(optional/nullable)* - `basis_fee` ### Term Line of Credit (`term_loc`) A revolving line of credit priced with an interest rate and per-draw fee. Adds: - `annual_fee_in_cents` - `commitment_fee_amount_in_cents` *(optional/nullable)* - `facility_size_in_cents` - `minimum_draw_amount_in_cents` *(optional/nullable)* - `interest_rate` - `draw_fee` ### Term Loan (`standard_term_loan`) A fixed-amount installment loan with an interest rate. Adds: - `amount_in_cents` - `amortized_payment_amount_in_cents` - `interest_rate` - `revenue_share_amount_in_cents` - `origination_and_closing_fees` ### Revenue Based Advance (`revenue_based_advance`) A lump-sum advance repaid via a factor rate rather than interest. Adds: - `amount_in_cents` - `amortized_payment_amount_in_cents` - `factor_rate` - `revenue_share_amount_in_cents` ## Field reference | Field | Type | Description | |---|---|---| | `annual_fee_in_cents` | integer | Annual fee, in cents. | | `commitment_fee_amount_in_cents` | integer \| null | Commitment fee, in cents. Optional/nullable; may be `null` or omitted. | | `facility_size_in_cents` | integer | Facility size (credit limit), in cents. | | `minimum_draw_amount_in_cents` | integer \| null | Minimum draw amount, in cents. Optional/nullable; may be `null` or omitted. | | `basis_fee` | number \| string | Basis fee amount, a decimal that may arrive as a JSON number (`200.00`) or string (`"200.00"`). | | `interest_rate` | number \| string | Interest rate as a fraction, decimal as number (`0.05`) or string (`"0.05"` = 5%). | | `draw_fee` | number \| string | Fee charged per draw, decimal as number (`15.00`) or string (`"15.00"`). | | `amount_in_cents` | integer | Principal loan / advance amount, in cents. | | `amortized_payment_amount_in_cents` | integer | Amortized payment amount, in cents. | | `revenue_share_amount_in_cents` | integer | Revenue share amount, in cents. | | `factor_rate` | number \| string | Factor rate applied to the advance, decimal as number (`1.10`) or string (`"1.10"`). | | `origination_and_closing_fees` | number \| string | Total origination & closing fee for a Term Loan, expressed as a **whole-number percent of the loan amount**: `5.00` means 5% (note: **not** a fraction like `interest_rate`, and **not** a dollar amount). A decimal that may arrive as a JSON number (`5.00`) or string (`"5.00"`). Term Loan offers only. | > **Warning:** **Money and number formats.** Every field ending in `_in_cents` is an **integer number of cents**. Divide by 100 for the dollar amount (`12500000` → $125,000.00). The rate and fee fields (`basis_fee`, `interest_rate`, `draw_fee`, `factor_rate`, and `origination_and_closing_fees`) are decimals the API may return **either as a JSON number (`5.00`) or as a string (`"5.00"`)**; handle both, and parse them as decimals (not floats) to preserve precision. Watch the units, which differ by field: `basis_fee` and `draw_fee` are plain **dollar amounts** (`"15.00"` = $15.00); `interest_rate` is a **fraction** (`"0.05"` = 5%); `origination_and_closing_fees` is a **whole-number percent** of the loan amount (`"5.00"` = 5%); and `factor_rate` is a unitless multiplier (`"1.10"`). ## Working with offers Once you have the offers, you can act on them: - **Accept an offer:** `POST /api/v3/applications/{app_id}/offer/{offer_id}/accept`. On success the offer's `status` becomes `accepted`. - **Decline offers:** `POST /api/v3/applications/{app_id}/decline-offers`. - **Download the disclosure PDF:** when `has_disclosure` is `true`, `GET /api/v3/applications/{app_id}/offers/{offer_id}/disclosure` returns the commercial financing disclosure document. See the [API Reference](/api-reference.html) for full request and response schemas for each of these endpoints. > **Note:** **Offers emit webhook events.** Rather than polling, you can react to offer activity in real time by subscribing to these events: - `application.offer.created`: a loan offer has been generated for the applicant - `application.offer.selected`: the customer selected/accepted an offer - `application.offer.declined`: the customer declined an offer See the [Webhooks Overview](/webhooks-overview.html) and [Webhooks Integration Guide](/webhooks-guide.html) to subscribe. ## Required disclosure step for New York & California > **Warning:** **New York and California have a regulatory requirement you must implement.** For a business located in **NY** or **CA**, you **must download and display the offer's commercial financing disclosure before you accept the offer**. Acceptance is blocked until the disclosure has been downloaded for that offer. This requirement exists so that, for NY/CA borrowers, Quantum can demonstrate the disclosure was presented to the applicant before they committed to the offer. Downloading the disclosure records the presentation; accepting then records the acknowledgement. The `has_disclosure` flag on each offer tells you when a disclosure exists. It is `true` for NY/CA offers, and for those offers the disclosure must be downloaded before the offer can be accepted. When it is `false`, the offer has no disclosure and calling the disclosure endpoint would return `404`. **You are responsible for implementing this flow in your integration.** The correct sequence is: 1. Retrieve offers: `GET /api/v3/applications/{app_id}/offers` 2. If `offer.has_disclosure` is `true`, **download and present the disclosure**: `GET /api/v3/applications/{app_id}/offers/{offer_id}/disclosure`. This is required before acceptance for NY/CA offers. 3. Accept the offer: `POST /api/v3/applications/{app_id}/offer/{offer_id}/accept` ```javascript const base = `https://api.quantum.com/api/v3/applications/${appId}`; const headers = { 'Authorization': 'Bearer YOUR_API_TOKEN' }; // 1. Retrieve offers and pick one. const { offers } = await (await fetch(`${base}/offers`, { headers })).json(); const offer = offers[0]; // 2. If the offer has a disclosure (true for NY/CA), download and display it // first. This records that it was presented to the applicant, and is // required before the offer can be accepted. if (offer.has_disclosure) { const disclosure = await fetch(`${base}/offers/${offer.id}/disclosure`, { headers }); const disclosurePdf = await disclosure.blob(); // present and retain the PDF } // 3. Accept the offer. const accept = await fetch(`${base}/offer/${offer.id}/accept`, { method: 'POST', headers, }); if (accept.status === 412) { // NY/CA: the disclosure has not been downloaded for this offer yet. // Call the disclosure endpoint above, then retry the accept. } ``` If you attempt to accept a NY/CA offer **before** downloading its disclosure, the API responds with **`412 Precondition Failed`**: ```json { "error": { "code": "PRECONDITION_FAILED", "message": "Download the offer disclosure before accepting this offer." } } ``` Branch on the **`412` status code** to detect this case. To resolve it, download the disclosure for that offer and then retry the acceptance. > **Note:** The download-before-accept requirement applies **only to businesses located in New York or California**. For all other states, accept the offer directly; no disclosure download is required. Only call the disclosure endpoint when the offer's `has_disclosure` flag is `true`. --- # Embedded Contract Signing The Embedded Contract Signing SDK lets you render a loan agreement for signature directly inside your own web application, so applicants never leave your experience. You load a small JavaScript SDK, hand it a signing token from the Quantum API, and subscribe to a handful of Quantum-shaped events to track progress. The SDK is a thin, vendor-neutral wrapper. Your integration is written against the Quantum API surface described here, not against whichever document provider Quantum uses under the hood, so the contract you build to stays stable even if the underlying provider changes. ## Table of Contents - [How It Works](#how-it-works) - [Get a Signing Token](#get-a-signing-token) - [Installation](#installation) - [Quick Start](#quick-start) - [Configuration](#configuration) - [Events](#events) - [Error Handling](#error-handling) - [Lifecycle Methods](#lifecycle-methods) - [Embedding & Security](#embedding-and-security) - [Try It Live](#try-it-live) - [Next Steps](#next-steps) --- ## How It Works The embedded signing flow has three steps: ``` 1. YOUR BACKEND REQUESTS A SIGNING TOKEN └─→ GET /api/v3/applications/{app_id}/contracts └─→ Response includes a signing_token for each signer 2. YOUR FRONTEND LOADS THE SDK └─→ Load the SDK from the Quantum CDN └─→ new QuantumContracts(container, { signingToken }) └─→ qc.open() 3. THE APPLICANT SIGNS IN YOUR PAGE └─→ The SDK renders the signing experience inside your container └─→ You receive contract.loading / loaded / ready / completed events └─→ contract.completed fires once the signer finishes ``` The signing token is short-lived and scoped to a single signer on a single contract. Fetch it from your backend (where your API credentials live) and pass it to the browser only when you are ready to render the signing experience. --- ## Get a Signing Token **GET /api/v3/applications/{app_id}/contracts** Call this endpoint from your backend once an application has reached the document-signing stage. The response lists the contract's signers, each with a `signing_token` you hand to the SDK. > **Note:** The `signing_token` is a credential. Request it from your backend using your API token, then deliver it to the browser over a secure channel only when you are about to render the signing experience. Treat it like a session token: never log it, and never embed it in a URL. See the [API Reference](/api-reference.html) for the full request and response schema. --- ## Installation ### CDN (recommended): pinned version with Subresource Integrity Pin to an exact version and verify the bundle with [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) (SRI). The integrity hash is published as a sidecar alongside each release, so you can confirm the bytes you load are the bytes Quantum published. ```html
``` Look up the hash for the version you are pinning: ```bash curl https://cdn.quantumlends.com/packages/contracts-sdk/v1.0.0/index.umd.js.integrity # → sha384- ``` The CDN bundle (UMD) exposes a single global namespace, `QuantumSDK`: ```js const { QuantumContracts, KNOWN_ERROR_CODES, SDK_VERSION } = QuantumSDK; ``` ### CDN (convenience): floating major version If you would rather pick up patch and minor releases automatically, load the floating major-version URL. The trade-off is that you cannot use SRI with a floating tag. The hash changes whenever we publish an update, so the `integrity` attribute would reject the new bundle. ```html ``` > **Warning:** Choose deliberately. Pin + SRI gives you supply-chain protection; the floating tag gives you hands-off updates. Most integrations should pin to an exact version with SRI and bump it on your own schedule. --- ## Quick Start A complete integration is small. The example below loads the SDK from the CDN, opens a contract, and reacts to the lifecycle events. ```html
``` > **Note:** Server-side completion notification is separate from this SDK. Use the `contract.completed` event for in-page UX, but rely on Quantum webhooks for authoritative, server-confirmed completion. See the [Webhooks Integration Guide](/webhooks-guide.html). --- ## Configuration Construct the SDK with a container and a configuration object: ```ts new QuantumContracts(container, config); ``` **`container`:** either the `id` of an element (a string) or an `HTMLElement` reference. The SDK renders the signing experience inside this element. **`config`** options: The signing token for a single signer, obtained from `GET /api/v3/applications/{app_id}/contracts`. Your own identifier for this contract. The SDK never reads or derives it from the provider. It simply echoes the value you pass back in every event payload, so you can correlate events with your own records. Width of the signing container. A `number` is applied as pixels (`600` → `600px`); a `string` is applied verbatim (`"100%"`, `"50vw"`). Defaults to leaving your container's styling untouched. Height of the signing container. Same handling as `width`. A typical full-page signing experience is around `965` pixels. Enables verbose console logging for troubleshooting. The signing token is redacted in debug output. Defaults to `false`. --- ## Events Subscribe with `on(eventName, handler)`. Every payload includes the `contractId` you supplied in the constructor (or `undefined` if you did not supply one). | Event | When it fires | Payload | |-------|---------------|---------| | `contract.loading` | The signing experience is initializing | `{ contractId? }` | | `contract.loaded` | The contract document is loaded and visible | `{ contractId? }` | | `contract.ready` | The document has rendered all of its pages | `{ contractId? }` | | `contract.completed` | The signer has completed all required fields and submitted | `{ contractId? }` | | `contract.error` | An error occurred; inspect `code` | `{ contractId?, code, message? }` | ```js qc.on("contract.loading", (p) => updateStatus("Loading…")); qc.on("contract.loaded", (p) => updateStatus("Awaiting signature")); qc.on("contract.ready", (p) => updateStatus("Document ready")); qc.on("contract.completed", (p) => updateStatus("Signed")); qc.on("contract.error", (p) => showError(p.code, p.message)); ``` > **Note:** The event set is intentionally small and may grow. Additional events (for example, a future `contract.declined`) can be added in a minor release without breaking your existing handlers, since you only receive the events you subscribe to. --- ## Error Handling All failures surface through a single `contract.error` event carrying a `code` and an optional sanitized `message`. This gives you one consistent place to handle problems. | `code` | Meaning | |--------|---------| | `not_found` | The signing token is invalid or its document is no longer available | | `verification_required` | The signer must complete an identity verification step first | | `verification_limit_exceeded` | The signer exhausted their verification attempts; signing cannot proceed | | `loading_error` | The signing experience failed to initialize (network, container, or provider issue) | | `unknown` | The provider signaled a failure without a specific code | ```js qc.on("contract.error", (p) => { switch (p.code) { case "not_found": // Token expired or invalid. Fetch a fresh signing_token and retry. break; case "verification_required": case "verification_limit_exceeded": // Surface a verification message to the signer. break; default: // Future codes you don't recognize yet: log and show a generic message. console.error("Signing error:", p.code, p.message); } }); ``` > **Warning:** The `code` list is **not exhaustive**. New codes may be added in any release. Always include a `default` branch when switching on `code` so your handler stays forward-compatible. The runtime export `KNOWN_ERROR_CODES` lists the codes known to the version you loaded. The optional `message` is a human-readable description with provider-specific identifiers and hostnames stripped out. It is safe to log, but it is intended for diagnostics. Drive your UX off `code`, not off the message text. --- ## Lifecycle Methods | Method | Description | |--------|-------------| | `open()` | Renders the signing experience and resolves once the session is open. Returns a `Promise`. | | `close()` | Tears down the signing experience and restores a clean container. The instance stays usable: you can `open()` again with the same or a new token. | | `destroy()` | Permanently tears down the instance and unsubscribes all handlers. The instance cannot be reused afterward. | | `on(event, handler)` | Subscribe to an event. Returns the instance, so calls can be chained. | | `once(event, handler)` | Subscribe to the next occurrence of an event only. | | `off(event, handler)` | Remove a previously registered handler. | ```js const qc = new QuantumContracts("contract-container", { signingToken }); qc.on("contract.completed", () => qc.destroy()); // clean up when done await qc.open(); // Later, to swap to a different contract in the same container: qc.close(); qc.open(); // after assigning a new token, if needed ``` > **Note:** Vendor-side failures emit a `contract.error` event rather than rejecting the `open()` promise, so you have a single error channel. It is safe to call `open()` again from inside a `contract.error` handler to retry. --- ## Embedding & Security The SDK renders the signing experience in an `