Pipedrive API Documentation

The testing-readme Developer Hub

Welcome to the testing-readme developer hub. You'll find comprehensive guides and documentation to help you start working with testing-readme as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

About the Pipedrive API

Last updated June 11, 2018

Reminder

An application programming interface (API) is a set of functions and procedures for building software applications.

Our Pipedrive RESTful API Reference is accessed from https://developers.pipedrive.com/docs/api/v1/ where you can find a list of endpoints and their descriptions. All calls to our API are validated against an API token. Learn how you can find and use the api_token with the practical task below.

Hello, World!

Here's a simple PHP command-line application. It makes a request to our Pipedrive RESTful API showcasing the basic functionality for operating with it.

The quick example below will list all the existing deals from your Pipedrive account. Don't worry, if you haven't created any deals yet, you can still test the code.

Step 1: Things you'll need

Step 2: Hello, World

Create a file hello_world.php and then copy-paste this code below into it. Don't forget to give values to the api_token and the company_domain variables:

<?php
// Content of hello_world.php
 
// Pipedrive API token
$api_token = 'Your API token goes here';

// Pipedrive company domain
$company_domain = 'Your company domain goes here';
 
//URL for Deal listing with your $company_domain and $api_token variables
$url = 'https://'.$company_domain.'.pipedrive.com/v1/deals?api_token=' . $api_token;
 
//GET request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
echo 'Sending request...' . PHP_EOL;
 
$output = curl_exec($ch);
curl_close($ch);
 
// Create an array from the data that is sent back from the API
// As the original content from server is in JSON format, you need to convert it to a PHP array
$result = json_decode($output, true);

// Check if data returned in the result is not empty
if (empty($result['data'])) {
    exit('No deals created yet' . PHP_EOL);
}

// Iterate over all found deals
foreach ($result['data'] as $key => $deal) {
    $deal_title = $deal['title'];
  		// Print out a deal title
			echo '#' . ($key + 1) . ': ' . $deal_title . PHP_EOL;
}

Step 3: Execute the code

Use php -f hello_world.php command to execute the code in the command line.

Here's an example output with 21 deals:

$ php -f hello_world.php
Sending request...
#1 Batman deal (Deal ID:134)
#2 Big apple sale (Deal ID:135)
#3 Robin sale (Deal ID:136)
#4 Silly goose (Deal ID:137)
#5 Mademoiselle sale (Deal ID:138)
#6 Cats and dogs (Deal ID:139)
#7 Panna on vaja (Deal ID:140)
#8 Lucky (Deal ID:141)
#9 Call him now (Deal ID:142)
#10 Sending (Deal ID:143)
#11 Wolt (Deal ID:144)
#12 PD (Deal ID:145)
#13 The Explorer (Deal ID:146)
#14 The Carryall (Deal ID:147)
#15 The Pineapple (Deal ID:148)
#16 The Base (Deal ID:149)
#17 Kisser (Deal ID:150)
#18 Hugger (Deal ID:151)
#19 The Scholar (Deal ID:152)
#20 The Artist (Deal ID:153)
#21 The Ace (Deal ID:154)

If you don't have any deals, you should see this output:

$ php -f hello_world.php
Sending request...
No deals created yet