CRM API

Connect Banklyze to your CRM to keep deal data synchronized. Configure your provider credentials, define field mappings, trigger manual syncs, and receive incoming CRM webhooks for real-time updates.

Supported CRM providers: Salesforce, HubSpot, and custom REST APIs. Field mapping supports three sync directions: bidirectional, banklyze_to_crm, and crm_to_banklyze.

Get CRM Config

Returns the current CRM integration configuration, including the provider, connection status, and last sync timestamp. API credentials are not returned in the response.

Request
curl https://api.banklyze.com/v1/crm/config \
  -H "Authorization: Bearer bkz_live_abc123"
200 OK
{
  "data": {
    "provider": "salesforce",
    "base_url": "https://mycompany.my.salesforce.com",
    "enabled": true,
    "connected_at": "2025-09-20T11:00:00Z",
    "last_sync_at": "2025-11-01T06:00:00Z",
    "updated_at": "2025-10-15T14:30:00Z"
  }
}

Set CRM Config

Creates or replaces the CRM integration configuration. Banklyze validates the connection by making a test API call to the provider before saving.

NameTypeRequiredDescription
providerstringRequiredCRM provider: salesforce, hubspot, or custom
api_keystringRequiredAPI key or personal access token for the CRM
base_urlstringRequiredBase URL of the CRM instance
enabledbooleanDefault: trueWhether syncing is enabled
Request
curl -X PUT https://api.banklyze.com/v1/crm/config \
  -H "Authorization: Bearer bkz_live_abc123" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "salesforce",
    "api_key": "sf_pat_01JDKF9X2M3N4P5Q6R7S8T9U",
    "base_url": "https://mycompany.my.salesforce.com",
    "enabled": true
  }'
200 OK
{
  "data": {
    "provider": "salesforce",
    "base_url": "https://mycompany.my.salesforce.com",
    "enabled": true,
    "connected_at": "2025-11-01T14:30:00Z",
    "last_sync_at": null,
    "updated_at": "2025-11-01T14:30:00Z"
  }
}

List Field Mappings

Returns all configured field mappings between Banklyze deal fields and CRM object fields. Each mapping specifies the sync direction.

Request
curl https://api.banklyze.com/v1/crm/field-mappings \
  -H "Authorization: Bearer bkz_live_abc123"
200 OK
{
  "data": [
    {
      "banklyze_field": "business_name",
      "crm_field": "Account.Name",
      "direction": "bidirectional"
    },
    {
      "banklyze_field": "health_score",
      "crm_field": "Opportunity.Health_Score__c",
      "direction": "banklyze_to_crm"
    },
    {
      "banklyze_field": "decision",
      "crm_field": "Opportunity.Underwriting_Decision__c",
      "direction": "banklyze_to_crm"
    },
    {
      "banklyze_field": "funding_amount_requested",
      "crm_field": "Opportunity.Amount",
      "direction": "crm_to_banklyze"
    },
    {
      "banklyze_field": "external_reference",
      "crm_field": "Opportunity.Id",
      "direction": "crm_to_banklyze"
    }
  ]
}

Set Field Mappings

Replaces all field mappings with the provided array. Each mapping defines a Banklyze field, a CRM field, and the sync direction.

NameTypeRequiredDescription
banklyze_fieldstringRequiredBanklyze deal field name
crm_fieldstringRequiredCRM object and field (e.g. Account.Name)
directionstringRequiredSync direction: bidirectional, banklyze_to_crm, or crm_to_banklyze
Request
curl -X PUT https://api.banklyze.com/v1/crm/field-mappings \
  -H "Authorization: Bearer bkz_live_abc123" \
  -H "Content-Type: application/json" \
  -d '[
    {
      "banklyze_field": "business_name",
      "crm_field": "Account.Name",
      "direction": "bidirectional"
    },
    {
      "banklyze_field": "health_score",
      "crm_field": "Opportunity.Health_Score__c",
      "direction": "banklyze_to_crm"
    },
    {
      "banklyze_field": "decision",
      "crm_field": "Opportunity.Underwriting_Decision__c",
      "direction": "banklyze_to_crm"
    },
    {
      "banklyze_field": "funding_amount_requested",
      "crm_field": "Opportunity.Amount",
      "direction": "crm_to_banklyze"
    }
  ]'
200 OK
{
  "data": [
    {
      "banklyze_field": "business_name",
      "crm_field": "Account.Name",
      "direction": "bidirectional"
    },
    {
      "banklyze_field": "health_score",
      "crm_field": "Opportunity.Health_Score__c",
      "direction": "banklyze_to_crm"
    },
    {
      "banklyze_field": "decision",
      "crm_field": "Opportunity.Underwriting_Decision__c",
      "direction": "banklyze_to_crm"
    },
    {
      "banklyze_field": "funding_amount_requested",
      "crm_field": "Opportunity.Amount",
      "direction": "crm_to_banklyze"
    }
  ]
}

Trigger Sync

Initiates a manual bidirectional sync between Banklyze and the configured CRM. The sync runs asynchronously in the background. Use the sync logs endpoint to track progress.

Request
curl -X POST https://api.banklyze.com/v1/crm/sync \
  -H "Authorization: Bearer bkz_live_abc123"
202 Accepted
{
  "data": {
    "sync_id": "sync_01JE8L9Y3N4O5P6Q7R8S",
    "status": "running",
    "started_at": "2025-11-01T14:30:00Z",
    "direction": "bidirectional",
    "records_queued": 47
  }
}

List Sync Logs

Returns a paginated list of sync runs with status, record counts, and timing information. Filter by status to find failed syncs.

NameTypeRequiredDescription
pageintegerDefault: 1Page number
per_pageintegerDefault: 25Results per page (1-100)
statusstringOptionalFilter by status: running, completed, failed
Request
curl "https://api.banklyze.com/v1/crm/sync/logs?page=1&per_page=10&status=completed" \
  -H "Authorization: Bearer bkz_live_abc123"
200 OK
{
  "data": [
    {
      "id": "sync_01JE8L9Y3N4O5P6Q7R8S",
      "status": "completed",
      "direction": "bidirectional",
      "records_synced": 47,
      "records_failed": 0,
      "started_at": "2025-11-01T14:30:00Z",
      "completed_at": "2025-11-01T14:30:12Z",
      "duration_ms": 12340
    },
    {
      "id": "sync_01JE7K8X2M3N4P5Q6R7S",
      "status": "completed",
      "direction": "bidirectional",
      "records_synced": 23,
      "records_failed": 1,
      "started_at": "2025-11-01T06:00:00Z",
      "completed_at": "2025-11-01T06:00:08Z",
      "duration_ms": 8120
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 10,
    "total": 2,
    "total_pages": 1
  }
}

Sync Log Detail

Returns detailed results of a specific sync run, including per-direction record counts and individual error details for any failed records.

NameTypeRequiredDescription
log_idstringRequiredThe sync log ID
Request
curl https://api.banklyze.com/v1/crm/sync/logs/sync_01JE7K8X2M3N4P5Q6R7S \
  -H "Authorization: Bearer bkz_live_abc123"
200 OK
{
  "data": {
    "id": "sync_01JE7K8X2M3N4P5Q6R7S",
    "status": "completed",
    "direction": "bidirectional",
    "records_synced": 23,
    "records_failed": 1,
    "started_at": "2025-11-01T06:00:00Z",
    "completed_at": "2025-11-01T06:00:08Z",
    "duration_ms": 8120,
    "details": {
      "created_in_crm": 5,
      "updated_in_crm": 12,
      "created_in_banklyze": 2,
      "updated_in_banklyze": 4,
      "skipped": 0,
      "errors": [
        {
          "record_id": "opp_8821",
          "field": "Health_Score__c",
          "error": "Field is read-only in Salesforce",
          "direction": "banklyze_to_crm"
        }
      ]
    }
  }
}

Handle CRM Webhook

Receives incoming webhooks from the CRM provider. When a CRM record is created or updated, this endpoint maps the changed fields to the corresponding Banklyze deal and triggers a partial sync.

NameTypeRequiredDescription
providerstringRequiredCRM provider identifier
eventstringRequiredCRM event type (e.g. opportunity.updated)
record_idstringRequiredCRM record ID that changed
fieldsobjectRequiredChanged field values from the CRM
timestampstringRequiredISO 8601 timestamp of the CRM event
Request
curl -X POST https://api.banklyze.com/v1/crm/webhooks \
  -H "Authorization: Bearer bkz_live_abc123" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "salesforce",
    "event": "opportunity.updated",
    "record_id": "006Hs00001abcDEF",
    "fields": {
      "Amount": 150000,
      "StageName": "Underwriting",
      "Account_Name": "Acme Trucking LLC"
    },
    "timestamp": "2025-11-01T14:35:00Z"
  }'
200 OK
{
  "data": {
    "received": true,
    "deal_id": 42,
    "action": "updated",
    "fields_mapped": 2,
    "sync_id": "sync_01JE8M0Z4O5P6Q7R8S9T"
  }
}