LEADS API title or person_id field errors

Hi there,

if i use the post lead function via:


the result is:

"error_info": "child \"person_id\" fails because [\"person_id\" must be a number]"

but i entered a number (8275). what am i doing wrong??

if i try it with my API code it fails with the following message:

2020-07-22 18:06:30 debug: Request Data : Array
[title] => Anfrage Kontaktformular 2020-07-22 18:06:30
[note] => Mein Anliegen
[person_id] => 8279
[organization_id] => 2829

2020-07-22 18:06:30 info: Response Status : 400

2020-07-22 18:06:30 error: Got Http response code 400 when accessing https://XXXXXXX.pipedrive.com/v1/leads?api_token=YYYYYYYYYYY. {“success”:false,“data”:null,“additional_data”:null,“error”:“provided dataset is not valid”,“error_info”:“child “title” fails because [“title” is required]”}

but i submitted a title…

with nearly the same code i can create a person and an organisation. changing the endpoint to lead and the data fields is enough to make it stop working


Regarding the first issue ([\"person_id\" must be a number]), this should be fixed now, just a hard refresh is required in your browser in order to fetch the new version of the API documentation without cache.

I will now look closed into the second issue.



hey jakub,

i tried again today and the error code changed to:

2020-07-28 13:22:46 error: Got Http response code 400 when accessing https://XXXXX.pipedrive.com/v1/leads?api_token=YYYYYYYYY. {“success”:false,“data”:null,“additional_data”:null,“error”:“expected request body to be sent with application/json content-type”,“error_info”:“Please check developers.pipedrive.com for more information about Pipedrive API.”}

however all other requests work and they do work WITHOUT setting a content-type (multipart/form-data is used in all other requests). this seems to be fairly inconsistent especially since your docs also use form-data encoding:

1 Like

Still running into the same issue! Webform for testing works, but curl request (as in documentation for deals) runs into this ERROR as result.
My data block contains - title, person_id, note

A fascinating marginal note - since your July-changes in the API for Leads, my other API calls that were running for months without issues stop working properly. There i used the Deal Endpoint and Activities.

I had luck on refining my php request - i assume, that the leads endpoint has a different code base thus the person type and header needs to be set/changed:

  1. person as INT intval(…)
  2. change header to application/json
  3. json_encode(…) the req-body content
 $lead = [
       'title' => 'my-title'
        'person_id' => intval($person_id),
        'note' =>'the message',
    $url = 'https://' . $GLOBALS['company_domain'] . '.pipedrive.com/v1/leads?api_token=' . $GLOBALS['api_token'];

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($lead));
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));

I hope you have nearly the same issue and that you can proceed now.