Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.keenpartner.com/llms.txt

Use this file to discover all available pages before exploring further.

Some external CRMs still reference leads by the original numeric ID from the legacy Xano system rather than the current Supabase UUID. Use this action to look up a lead by that integer and retrieve the full lead object. The returned lead.id is the UUID you should use for all subsequent actions such as update_status, update_status_id, and create_purchase.

Authentication

Request

action
string
required
Must be "get_lead_by_legacy_id".
legacy_id
number
required
The original integer ID from the legacy system.

Response

Returns the full lead object, including nested property_values with their property_definitions — the same shape as leads returned by get_leads.
lead
object

Example

Request

curl -X POST https://data.keenpartner.com/functions/v1/keen-api \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -d '{
    "action": "get_lead_by_legacy_id",
    "legacy_id": 12345
  }'

Response

{
  "lead": {
    "id": "99887766-5544-3322-1100-aabbccddeeff",
    "legacy_id": 12345,
    "created_at": "2025-04-01T14:22:00.000Z",
    "email": "jane@example.com",
    "first_name": "Jane",
    "last_name": "Smith",
    "phone": "+1-555-0199",
    "company_name": "Smith Consulting",
    "source": "Website",
    "employee": null,
    "status": "Qualified",
    "lead_status_id": "bbbbbbbb-cccc-dddd-eeee-ffffffffffff",
    "notes": "Interested in enterprise plan",
    "business_id": null,
    "channels_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "property_values": [
      {
        "id": "77665544-3322-1100-aabb-ccddeeff0011",
        "value": "50000",
        "property_definitions_id": "11111111-2222-3333-4444-555555555555",
        "property_definitions": {
          "id": "11111111-2222-3333-4444-555555555555",
          "name": "Deal size",
          "type": "number"
        }
      }
    ]
  }
}

Errors

StatusErrorCause
400"legacy_id required"The legacy_id field is missing or not a valid number.
401"Invalid API key"Missing or invalid X-Api-Key header.
403"Lead not accessible"The lead belongs to a channel your company does not have access to.
404"Lead not found"No lead exists with the given legacy_id.