BanklyzeBanklyze/Developer Docs
Sign In

CRM Integration

Banklyze can sync deal data bi-directionally with your CRM. Supported providers are Salesforce, HubSpot, and Pipedrive. Each provider is configured independently per organization — you can run multiple integrations simultaneously.

Configuration follows a three-step flow: (1) save credentials via PUT /crm/config/{provider}, (2) verify the connection with POST /crm/config/{provider}/test, and (3) define field mappings with PUT /crm/field-mapping/{provider}. Once configured, Banklyze syncs deal data on a schedule and after key deal events. Manual syncs are available via POST /crm/sync.

Retrieve the current CRM configuration for a provider. The has_credentials flag indicates whether credentials are stored — the credential values themselves are never returned.

Path Parameters

NameTypeRequiredDescription
providerstringRequiredThe CRM provider: salesforce, hubspot, or pipedrive

Example

curl
curl -X GET https://api.banklyze.com/v1/crm/config/hubspot \
  -H "X-API-Key: your_api_key_here"

Response

Response — 200 OK
{
  "provider": "hubspot",
  "enabled": true,
  "has_credentials": true,
  "sync_interval_minutes": 60,
  "last_sync_at": "2026-03-04T10:00:00Z",
  "last_sync_status": "success"
}

Upsert the CRM configuration for a provider. If a configuration already exists it is replaced. Credentials are encrypted at rest and never returned in subsequent GET responses. After saving credentials, call POST /crm/config/{provider}/test to verify the connection before enabling the integration.

Path Parameters

NameTypeRequiredDescription
providerstringRequiredThe CRM provider: salesforce, hubspot, or pipedrive

Request Body

NameTypeRequiredDescription
enabledbooleanDefault: trueWhether the integration is active. Disabled integrations will not sync.
credentialsobjectOptionalProvider-specific credentials object. For HubSpot: { access_token }. For Salesforce: { client_id, client_secret, refresh_token, instance_url }. For Pipedrive: { api_token }.
sync_interval_minutesintegerDefault: 60How often to sync, in minutes. Minimum 15, maximum 1440 (24 hours).

Example

curl
curl -X PUT https://api.banklyze.com/v1/crm/config/hubspot \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "credentials": {
      "access_token": "pat-na1-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    },
    "sync_interval_minutes": 60
  }'

Response

Response — 200 OK
{
  "provider": "hubspot",
  "enabled": true,
  "has_credentials": true,
  "sync_interval_minutes": 60,
  "last_sync_at": null,
  "last_sync_status": null
}

Remove the CRM configuration and stored credentials for a provider. Any scheduled syncs for this provider will stop. Field mappings are also deleted. This action is irreversible.

Path Parameters

NameTypeRequiredDescription
providerstringRequiredThe CRM provider: salesforce, hubspot, or pipedrive

Example

curl
curl -X DELETE https://api.banklyze.com/v1/crm/config/hubspot \
  -H "X-API-Key: your_api_key_here"

Response

Response — 200 OK
{
  "status": "ok",
  "message": "CRM configuration removed"
}

Verify that the stored credentials for a provider are valid and the connection can be established. Returns a human-readable message with authentication details on success, or an error description on failure. Does not modify any configuration.

Path Parameters

NameTypeRequiredDescription
providerstringRequiredThe CRM provider: salesforce, hubspot, or pipedrive

Example

curl
curl -X POST https://api.banklyze.com/v1/crm/config/hubspot/test \
  -H "X-API-Key: your_api_key_here"

Response

Response — 200 OK
{
  "success": true,
  "message": "Connection to HubSpot verified. Authenticated as Acme Lending (account ID 12345678)."
}

Field Mappings

Field mappings define which Banklyze deal fields map to which CRM fields, and in which direction data flows. The direction value can be to_crm (Banklyze writes to CRM only), from_crm (CRM writes to Banklyze only), or both (bi-directional sync, last-write-wins).

Retrieve all configured field mappings for a provider. Returns an empty mappings array if no mappings have been configured yet.

Path Parameters

NameTypeRequiredDescription
providerstringRequiredThe CRM provider: salesforce, hubspot, or pipedrive

Example

curl
curl -X GET https://api.banklyze.com/v1/crm/field-mapping/hubspot \
  -H "X-API-Key: your_api_key_here"

Response

Response — 200 OK
{
  "provider": "hubspot",
  "mappings": [
    {
      "banklyze_field": "business_name",
      "crm_field": "dealname",
      "direction": "both"
    },
    {
      "banklyze_field": "funding_amount_requested",
      "crm_field": "amount",
      "direction": "to_crm"
    },
    {
      "banklyze_field": "health_score",
      "crm_field": "banklyze_health_score__c",
      "direction": "to_crm"
    },
    {
      "banklyze_field": "health_grade",
      "crm_field": "banklyze_grade__c",
      "direction": "to_crm"
    },
    {
      "banklyze_field": "owner_name",
      "crm_field": "contact_firstname",
      "direction": "from_crm"
    }
  ]
}

Replace all field mappings for a provider. The entire mapping set is overwritten — any mappings not included in the request body are deleted. Send an empty mappings array to clear all mappings.

Path Parameters

NameTypeRequiredDescription
providerstringRequiredThe CRM provider: salesforce, hubspot, or pipedrive

Request Body

NameTypeRequiredDescription
mappingsobject[]RequiredArray of mapping objects. Each object has: banklyze_field (string), crm_field (string), direction (to_crm | from_crm | both).

Example

curl
curl -X PUT https://api.banklyze.com/v1/crm/field-mapping/hubspot \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "mappings": [
      {
        "banklyze_field": "business_name",
        "crm_field": "dealname",
        "direction": "both"
      },
      {
        "banklyze_field": "health_score",
        "crm_field": "banklyze_health_score__c",
        "direction": "to_crm"
      }
    ]
  }'

Response

Response — 200 OK
{
  "provider": "hubspot",
  "mappings": [
    {
      "banklyze_field": "business_name",
      "crm_field": "dealname",
      "direction": "both"
    },
    {
      "banklyze_field": "health_score",
      "crm_field": "banklyze_health_score__c",
      "direction": "to_crm"
    }
  ]
}

Sync

Banklyze runs scheduled syncs automatically based on sync_interval_minutes. Syncs are also triggered after key deal events: when a deal reaches ready status, when a decision is set, or when a recommendation is generated. Use the manual sync endpoint to push changes immediately without waiting for the next scheduled interval.

Push a single deal to all enabled CRM integrations immediately. The sync runs synchronously and returns the result. If multiple CRM providers are configured, all are synced and results are aggregated.

Request Body

NameTypeRequiredDescription
deal_idintegerRequiredThe deal to sync to the CRM

Example

curl
curl -X POST https://api.banklyze.com/v1/crm/sync \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "deal_id": 42
  }'

Response

Response — 200 OK
{
  "status": "success",
  "external_id": "0065g00000AbCdEFAZ",
  "error": null
}

Retrieve the history of CRM sync attempts for your organization. Filter by deal to see all sync events for a specific deal. Both successful syncs and errors are recorded. Sync log entries are retained for 90 days.

Query Parameters

NameTypeRequiredDescription
deal_idintegerOptionalFilter sync events by deal ID
providerstringOptionalFilter by provider: salesforce, hubspot, or pipedrive
statusstringOptionalFilter by sync status: success or error
pageintegerDefault: 1Page number
per_pageintegerDefault: 25Results per page (max 100)

Example

curl
curl -X GET "https://api.banklyze.com/v1/crm/sync-log?deal_id=42&page=1&per_page=25" \
  -H "X-API-Key: your_api_key_here"

Response

Response — 200 OK
{
  "data": [
    {
      "id": 18,
      "deal_id": 42,
      "provider": "hubspot",
      "direction": "to_crm",
      "status": "success",
      "external_id": "0065g00000AbCdEFAZ",
      "error": null,
      "synced_at": "2026-03-04T11:05:00Z"
    },
    {
      "id": 12,
      "deal_id": 42,
      "provider": "hubspot",
      "direction": "to_crm",
      "status": "error",
      "external_id": null,
      "error": "Property 'banklyze_health_score__c' does not exist on Deal objects.",
      "synced_at": "2026-03-04T10:00:00Z"
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total": 2,
    "total_pages": 1
  }
}