About the API category

Our open API allows you to create integrations and apps that will work directly with Pipedrive. Best place for topics relating to API

Sometimes I am facing an issue in creating an organisation, person and deal. This issue is not occurring every time, but it happens sometimes.

I am using php curl for creating organisation, person and deal. Below is my code snippet. This code is called using Ajax request with post data.

Please advise if I am going wrong with this below code.

use \Curl\Curl;
    $post = $_POST; //all post data in a variable
    $curl = new Curl();
    $curl->setHeader('Content-Type', 'application/json');
    $token = TOKEN; // pipedrive token
    // Add Organization
    $customer_name = $_POST['customerfname']." ".$_POST['customerlname'];
    $url = "https://api.pipedrive.com/v1/organizations?api_token=".$token;   
    $org = ['name' => 'Company of ' . $customer_name];
    $curl->post($url, $org);
    $result1 = $curl->response;
    if($result1->success == true) {
        $org_id = $result1->data->id;
        //Create a person
        $persons = ['name' => $customer_name, 'email' => $post['Email'], 'phone'=> $post['phone'], 'org_id' => $org_id];
        // Add Person
        $url = "https://api.pipedrive.com/v1/persons?api_token=".$token;
        $curl->post($url, $persons);   
        $result = $curl->response;           
        if($result->success == true){
            $person_id = $result->data->id;
            // Add Deal
            $url = "https://api.pipedrive.com/v1/deals?api_token=".$token;
            $deal = [
                'title' => $customer_name,       
                'org_id' => $org_id,
                'person_id' => $person_id,
                "60622b5221f5668fa3399c15gh521556fgh13554" => (isset($post['Description']))?$post['Description']:"",
                "15cc7af921f5668fa3399c15gh521556f3f823091" => (isset($post['message']))?$post['message']:"",
            $curl->post($url, $deal);
            $result2 = $curl->response;           
            if($result2->success == true){       
                   //file upload process
                   if(count($_POST['allfiles'])==0){ //check file available or not
                        echo 1;
                    else {
                        $deal_id = $result2->data->id;                                           
                        // Add Files
                        $url = "https://api.pipedrive.com/v1/files?api_token=".$token;           
                                                $c = count($_POST['allfiles']);   
                        for($i = 0;$i<$c;$i++){
                            $curl->setHeader('Content-Type', 'multipart/form-data');
                            $file = ['deal_id' => $deal_id,       
                            'person_id' => $person_id,
                            'file'=>new CURLFile(dirname(__FILE__) . '/uploads/doc/'.$_POST['allfiles'][$i])
                            $curl->post($url, $file);
                            $result3 = $curl->response;
                                                        $path = "uploads/doc/".$_POST['allfiles'][$i];
                        if($result3->success == true){           
                            echo 1;
                            echo 0;
            else{ echo 0; }
        else{ echo 0; }
    else{ echo 0; }
else{ echo 0; }


I am using a service called CallTools, it is a dialing system. It has the capability to integrate with PipeDrive, however it can only do so by Pushing my leads into the CONTACTS and I want it to be both DEALS and CONTACTS. Can anyone help please???

Hi. Would it be possible to integrate other software with yours? Because we have another software that also has open API. But I don’t know how you work about it. Because in their case, they do not integrate other software with theirs, they only make the code available for them to be integrated with others. I don’t know if I could make myself clear. But that’s it.

Does Pipedrive have an API for facebook?

Does Pipedrive have an API for Facebook???

Hello I would like to export the information from pipedrive custom fields to Active Campaign using integromat. Can someone help me.

I am not a developer my contact is jmmarban@arancione.com.mx