Sending request to add a deal together with the person's info

Any way I can send ajax request with the information of the person’s name, contact, email and organization to be included in a new deal after I click submit form using the form I created myself? I am now trying to send two requests to add both a deal , and the person’s details, and i have to figure out how to link them together, which is very troublesome at the moment.

Are you currently gaining the data via a webform?

I created my own form on website and tried to hook it up with the api of pipedrive.
Not using pipedrive webform due to our own strict styling format

Got it.
It would require 2 calls to be able create a Person as well as a Deal.
There’s no endpoints to create both at the same time.

I did that and created both a person and a deal. But that would not be able to link up both together to establish the deal’s contact. Any idea how to achieve this?

Because of how the linking works within the app, you would first need to create the Person or Deal, get the person_id or deal_id and then connect it when creating the deal/person