Updating a Lead Failing

I am trying to update a LEAD using this URL

$lead_url = ‘https://’.$company_domain.’.pipedrive.com/api/v1/leads/’ . $leadID . ‘?api_token=’ . $PD_API_KEY;

But it returns 404 Not Found. When I check this URL in the browser it returns the complete information of that lead.

Here is my Curl Code:

function pipedrive_update_curl($arr , $endpoint)
$response = array();
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($arr));

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

$response_result = curl_exec($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curl_errors = curl_error($ch);
$response['error'] = $curl_errors;
$response['status'] = $status_code;
$response['response'] = $response_result;
return $response;


Can somebody please explain where I am going wrong?

Hi @Rana_Faizan,

For Leads, to update you need to use a PATCH HTTP Method and not PUT

I’m having this same issue and PATCH doesn’t work either. It returns a 400 Bad Request error.