Skip to main content
This quickstart creates a borrower, reports an approved application, opens a credit user account, and defines a term loan. Then it draws the principal with a funding and posts it in sandbox. Every call runs in sandbox, Lead’s test system, so nothing here moves real money. It doesn’t cover uploading loan documents, sending the money on to the borrower, or reporting repayments. Those are in Originate and service an on-sheet loan, which is the full version of this flow. To get sandbox credentials first, see Set up sandbox. This page is the v2 version. The v1 quickstart, Originate your first loan, uses the /v0 endpoints.

Before you start

  • Get sandbox credentials and make one successful call. See Set up sandbox.
  • Have your program’s product_config_id. A program is one product or set of products you run with Lead. Your Technical Account Manager gives you the ID. There is no endpoint to look it up.
  • Ask your Technical Account Manager which account number Lead has enabled to receive fundings, and have its ID.

What you’ll do

  1. Get a token with the scopes this flow needs.
  2. Create the borrower as an entity.
  3. Report the underwriting decision as an application.
  4. Open the user account.
  5. Define the loan as a user credit balance.
  6. Draw the principal with a funding.
  7. Post the funding in sandbox.
  8. Confirm the money moved.

Steps

Step 1: Get a token

One token covers the whole flow if you request every scope up front.
Sample request
Modify your code:
  • Replace CLIENT_ID and CLIENT_SECRET with your sandbox credentials.
  • Store access_token from the response as ACCESS_TOKEN and send it on every call in this flow.
Sample response
Result: 200. The token is valid for expires_in seconds, which is 24 hours by default.

Step 2: Create the borrower as an entity

The borrower is an individual who will hold the loan, so send intended_eligibility: ["account_holder"]. Lead then checks that the entity has everything an account holder needs. If it doesn’t, the request fails now, not at account opening.
Sample request
Modify your code:
  • Replace TAX_ID with the borrower’s SSN, nine digits. For an ITIN, set tax_identification.type to itin.
  • Set kyc and ofac to the result and time of your own screening.
  • Set risk_score from your own risk rating.
  • Generate a new Idempotency-Key for this request. A UUID works. Every POST from here on needs its own key. Reuse a key only to retry the same request.
Sample response (trimmed)
Result: 200. eligibility.account_holder.status is eligible. Store id as ENTITY_ID.

Step 3: Report the underwriting decision as an application

You underwrite in your own system and report the result. An application is reported in a terminal status, here approved. Amounts are in minor units, so a $5,000 limit is 500000.
Sample request
Modify your code:
  • Replace PRODUCT_CONFIG_ID with the value from your Technical Account Manager, and ENTITY_ID with the ID from Step 2.
  • Set underwriting.grade, limit, and max_limit from your decision, and decision.details to the reason for it.
  • Send documents as []. The full guide covers uploading loan documents.
  • Generate a new Idempotency-Key.
Sample response (trimmed)
Result: 200. account_holder_type is consumer because the only account holder is an individual. Store id as APPLICATION_ID.

Step 4: Open the user account

The user account is the borrower’s credit relationship with Lead. Two fields decide what it is: requested_features says it’s underwritten credit, and balance_sheet_model says Lead holds the loan.
Sample request
Modify your code:
  • Replace APPLICATION_ID with the ID from Step 3, and ENTITY_ID and PRODUCT_CONFIG_ID as before.
  • Send all seven fields in underwriting.
  • Generate a new Idempotency-Key.
Sample response (trimmed)
Result: 200. status is active and features is what Lead granted. Store id as USER_ACCOUNT_ID.

Step 5: Define the loan as a user credit balance

The user credit balance holds the loan’s terms, and later its running position. A non_revolving loan needs all its terms up front: maturity date, maximum funding amount, duration, finance charge, and repayment schedule. This example is $5,000 over 12 months at 9.99%. That's 12 monthly payments of $439.56, and $274.72 in total interest. Rates are decimal fractions, so 9.99% is 0.0999. The three rate fields mean different things: effective_apr matches interest_rate here because this loan has no fees.
Sample request
Modify your code:
  • Replace USER_ACCOUNT_ID with the ID from Step 4.
  • Set terms from your own loan. Every field is on The user credit balance object.
  • Generate a new Idempotency-Key.
Sample response (trimmed)
Result: 200. The user credit balance is active with every amount at zero. Store id as USER_CREDIT_BALANCE_ID.

Step 6: Draw the principal with a funding

A funding moves the principal from Lead’s general ledger to an account number your program controls. amount is the whole principal. On a non_revolving balance, this funding plus any earlier ones can’t add up to more than max_funding_amount.
Sample request
Modify your code:
  • Replace USER_CREDIT_BALANCE_ID with the ID from Step 5.
  • Replace ACCOUNT_NUMBER_ID with the account number Lead enabled for fundings, from Before you start.
  • Store the funding ID when it comes back. There is no list endpoint for fundings.
  • Generate a new Idempotency-Key.
Sample response
Result: 200. status is processing. In production, Lead posts it. In sandbox, it waits for you. Store id as FUNDING_ID.

Step 7: Post the funding in sandbox

Nothing in sandbox moves on its own, so move the funding to posted yourself with the advance call. It’s the one call on this page that exists only in sandbox.
Sample request
Modify your code:
  • Replace FUNDING_ID with the ID from Step 6.
  • Keep this call out of your production code. In production it returns 404.
  • Generate a new Idempotency-Key.
Sample response
Result: 200 with an empty object. The funding is now posted. Lead sends funding.posted when funding events are enabled for your program. Your Technical Account Manager can tell you whether they are.

Step 8: Confirm the money moved

Read the funding back. Don’t wait for a webhook: retrieving the object is the reliable check, in sandbox and in production. Then check that Lead recorded the draw on the user credit balance.
Sample request
Modify your code:
  • Replace FUNDING_ID with the ID from Step 6.
  • Confirm the funding is posted before you send money on to the borrower. The 200 from Step 6 doesn’t mean the money moved.
  • Do not post a user credit transaction for the draw yourself. Lead posts a funding user credit transaction for you. It can arrive a few seconds after funding.posted.
Sample response (trimmed)
Result: 200 with status posted. A funding posted in sandbox has no core_transaction_id. In production it names the core transaction that moved the money. To see the draw, call GET /v2/user_credit_balances/USER_CREDIT_BALANCE_ID. amount_breakdown.principal is 500000. If it’s still 0, wait a few seconds and call again.

What happens next

In production, Step 7 doesn’t exist. Lead moves the funding to posted when the money reaches your account number, and sets core_transaction_id. If funding events are enabled for your program (your Technical Account Manager can tell you), Lead also sends funding.posted. The funding is the only object on this page with an event, so retrieve the entity, application, user account, and user credit balance when you need their current state. See Funding statuses.

Common errors

Errors you can hit in this flow: Every call after Step 1 uses the v2 error body. See Errors. The token call in Step 1 uses Lead’s older error format.

Test in sandbox

Every step on this page runs in sandbox. For the full set of funding tests before you go live, see Test and go live with fundings.

Next step

Build the full flow, with loan documents, the disbursement to the borrower, and repayment reporting.