LendWorksLendWorksDocs

Getting Started

Install the LendWorks SDK and make your first API call in under a minute.

Installation

npm install @lendworks/sdk-node

The SDK is ESM-only and requires Node.js 18 or later.

Get Your API Key

  1. Log in to the LendWorks Dashboard
  2. Navigate to Admin > API Keys
  3. Click Create API Key
  4. Copy the key — it won't be shown again

Your key follows the format lw_{prefix}_{secret}. The prefix identifies the key for lookup without exposing the secret.

Make Your First Request

Using the SDK

import { LendWorksClient } from '@lendworks/sdk-node'

const client = new LendWorksClient({
  apiKey: process.env.LENDWORKS_API_KEY,
})

// List your leads
const { data: leads, meta } = await client.leads.list({ limit: 10 })
console.log(`Found ${meta.total} leads`)

for (const lead of leads) {
  console.log(`${lead.attributes.businessName} — ${lead.attributes.email}`)
}

Using cURL

curl -H "Authorization: Bearer lw_live_xxxxxxxxxxxxxxxx" \
     https://api.lend.works/v1/leads?limit=10

Using fetch

const response = await fetch('https://api.lend.works/v1/leads?limit=10', {
  headers: {
    'Authorization': 'Bearer lw_live_xxxxxxxxxxxxxxxx',
    'Content-Type': 'application/json',
  },
})

const { data, meta } = await response.json()
console.log(data)

Create a Lead

const lead = await client.leads.create({
  businessName: 'Acme Corp',
  contactFirstName: 'Jane',
  contactLastName: 'Doe',
  email: 'jane@acme.com',
  phone: '555-0100',
  requestedAmount: '250000',
  monthlyRevenue: '85000',
  industry: 'Technology',
  source: 'api',
  priority: 'high',
})

console.log(`Created lead: ${lead.data.id}`)

With cURL:

curl -X POST https://api.lend.works/v1/leads \
  -H "Authorization: Bearer lw_live_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "businessName": "Acme Corp",
    "contactFirstName": "Jane",
    "contactLastName": "Doe",
    "email": "jane@acme.com",
    "phone": "555-0100",
    "requestedAmount": "250000",
    "monthlyRevenue": "85000",
    "industry": "Technology",
    "source": "api",
    "priority": "high"
  }'

Set Up Webhooks

Receive real-time notifications when events happen in your account:

npm install @lendworks/webhook-verify
import { createVerifier } from '@lendworks/webhook-verify'
import express from 'express'

const app = express()
const verifier = createVerifier({ secret: process.env.WEBHOOK_SECRET })

app.post('/webhooks/lendworks', express.raw({ type: 'application/json' }), (req, res) => {
  const event = verifier.verify(req.body, {
    'x-webhook-signature': req.headers['x-webhook-signature'],
    'x-webhook-id': req.headers['x-webhook-id'],
    'x-webhook-timestamp': req.headers['x-webhook-timestamp'],
  })

  switch (event.event) {
    case 'lead.created':
      console.log('New lead:', event.data.leadId)
      break
    case 'deal.funded':
      console.log('Deal funded:', event.data.dealId)
      break
  }

  res.sendStatus(200)
})

See the full Webhooks guide for event types, retry policies, and more.

Package Namespaces

PackagePurpose
@lendworks/sdk-nodeNode.js SDK for the Broker API
@lendworks/webhook-verifyLightweight webhook signature verification

Next Steps