How can I link a Lead to an Activity using API requests?

I’m a developer who is integrating form submissions from my client’s site to his Pipedrive account via API requests.
The client has set the objectives to:

(1) create a new contact once the form on his site is submitted.
(2) a new lead should be created (and linked to the contact).
After that
(3) a call (an Activity object) should be scheduled and linked to the new contact and the new deal.
I’ve done the first two parts.
I also managed to create a new Call activity and link it to the new contact.
But, I’m having troubles with linking the call to the lead that I’ve created on the step (2). I’ve inspected the HTTP requests that are made by my browser when I’m adding a new call activity to a Lead via Pipedrive dashboard, and figured out that I needed to send two additional fields - “lead_id” and “lead_title”. I’ve added those fields in my requests and they are successfully saved on the server (I’ve inspected the server response). But, still the Call activity isn’t shown for the lead when I inspect the leads in dashboard.
Can you please help me to figure out what I’m doing wrong?

Hi @dan

To my knowledge, there is no good way to attach an Activity to a Lead via API at the moment. This question was raised a few times already, and the team that is working on it is already aware of this case. I can not give any ETA or promises but there is a high chance that this case will be solved.