Overview
Build custom integrations or scripts that convert leads into deals programmatically using Laywork’s REST API.
Steps
Obtain an API token under Profile → API Keys.
Fetch the lead you want to convert via GET /api/v1/lead-contacts/{lead_id}.
Send a POST /api/v1/deals request with JSON payload, mapping lead fields into the deal:
{
"lead_id": "123",
"name": "Deal for John Doe",
"pipeline_id": 1,
"stage_id": 2,
"value": 5000,
"close_date": "2025-06-30"
}
Optional: call PATCH /api/v1/lead-contacts/{lead_id} to update lead status to “Converted.”
Confirm the deal appears in Leads → Deals and the lead’s history shows the conversion.
Tips
Use consistent naming conventions for deal names (e.g. “LeadName – Products”) to ease cross‑referencing.
Handle API errors (e.g. missing fields) by logging them and retrying with corrected data.
Secure your token and rotate it regularly to maintain integration security.