crashingberries/pipedrive

Pipedrive REST client for PHP

4.0.2.1 2022-05-10 14:10 UTC

README

Pipedrive is a sales pipeline software that gets you organized. It's a powerful sales CRM with effortless sales pipeline management. See www.pipedrive.com for details.

This is the official Pipedrive API wrapper-client for PHP based apps, distributed by Pipedrive Inc freely under the MIT licence. It provides convenient access to the Pipedrive API, allowing you to operate with objects such as Deals, Persons, Organizations, Products and much more.

⚠️ Version 1 is the initial release of our official php client. It provides its users access to our API in a convenient way using either API tokens or OAuth2.

Please use the issues page for reporting bugs or leaving feedback. Keep in mind most of the code is automatically generated.

Installation

You can install the package via composer require command:

composer require pipedrive/pipedrive

Or simply add it to your composer.json dependences and run composer update:

"require": {
    "pipedrive/pipedrive": "^3.0"
}

API Documentation

The Pipedrive REST API documentation can be found at https://developers.pipedrive.com/v1

Licence

This Pipedrive API client is distributed under the MIT licence.

How to use

With a pre-set API token

<?php

require_once __DIR__.'/vendor/autoload.php';

session_start();

// Client configuration
$apiToken = 'YOUR_API_TOKEN_HERE';

$client = new Pipedrive\Client(null, null, null, $apiToken); // First 3 parameters are for OAuth2

try {
    $response = $client->getUsers()->getCurrentUserData();
    echo '<pre>';
    var_dump($response);
    echo '</pre>';
} catch (\Pipedrive\APIException $e) {
    echo $e;
}

With OAuth 2

In order to setup authentication in the API client, you need the following information.

API client can be initialized as following:

$oAuthClientId = 'oAuthClientId'; // OAuth 2 Client ID
$oAuthClientSecret = 'oAuthClientSecret'; // OAuth 2 Client Secret
$oAuthRedirectUri = 'https://example.com/oauth/callback'; // OAuth 2 Redirection endpoint or Callback Uri

$client = new Pipedrive\Client($oAuthClientId, $oAuthClientSecret, $oAuthRedirectUri);

You must now authorize the client.

Authorizing your client

Your application must obtain user authorization before it can execute an endpoint call. The SDK uses OAuth 2.0 authorization to obtain a user's consent to perform an API request on user's behalf.

1. Obtain user consent

To obtain user's consent, you must redirect the user to the authorization page. The buildAuthorizationUrl() method creates the URL to the authorization page.

$authUrl = $client->auth()->buildAuthorizationUrl();
header('Location: ' . filter_var($authUrl, FILTER_SANITIZE_URL));

2. Handle the OAuth server response

Once the user responds to the consent request, the OAuth 2.0 server responds to your application's access request by redirecting the user to the redirect URI specified set in Configuration.

If the user approves the request, the authorization code will be sent as the code query string:

https://example.com/oauth/callback?code=XXXXXXXXXXXXXXXXXXXXXXXXX

If the user does not approve the request, the response contains an error query string:

https://example.com/oauth/callback?error=access_denied

3. Authorize the client using the code

After the server receives the code, it can exchange this for an access token. The access token is an object containing information for authorizing client requests and refreshing the token itself.

try {
    $client->auth()->authorize($_GET['code']);
} catch (Pipedrive\Exceptions\OAuthProviderException $ex) {
    // handle exception
}

Refreshing token

An access token may expire after sometime. To extend its lifetime, you must refresh the token.

if ($client->auth()->isTokenExpired()) {
    try {
        $client->auth()->refreshToken();
    } catch (Pipedrive\Exceptions\OAuthProviderException $ex) {
        // handle exception
    }
}

If a token expires, the SDK will attempt to automatically refresh the token before the next endpoint call requiring authentication.

Storing an access token for reuse

It is recommended that you store the access token for reuse.

You can store the access token in the $_SESSION global:

// store token
$_SESSION['access_token'] = Pipedrive\Configuration::$oAuthToken;

However, since the the SDK will attempt to automatically refresh the token when it expires, it is recommended that you register a token update callback to detect any change to the access token.

Pipedrive\Configuration::$oAuthTokenUpdateCallback = function($token) {
    // use session or some other way to persist the $token
    $_SESSION['access_token'] = $token;
};

The token update callback will be fired upon authorization as well as token refresh.

Creating a client from a stored token

To authorize a client from a stored access token, just set the access token in Configuration along with the other configuration parameters before creating the client:

// load token later...
Pipedrive\Configuration::$oAuthToken = $_SESSION['access_token'];

// Set other configuration, then instantiate client
$client = new Pipedrive\Client();

Complete example with OAuth2

In this example, the index.php will first check if an access token is available for the user. If one is not set, it redirects the user to authcallback.php which will obtain an access token and redirect the user back to the index.php page. Now that an access token is set, index.php can use the client to make authorized calls to the server.

index.php

<?php

require_once __DIR__.'/vendor/autoload.php';

session_start();

// Client configuration
$oAuthClientId = 'oAuthClientId';
$oAuthClientSecret = 'oAuthClientSecret';
$oAuthRedirectUri = 'http://' . $_SERVER['HTTP_HOST'] . '/authcallback.php';

$client = new Pipedrive\Client($oAuthClientId, $oAuthClientSecret, $oAuthRedirectUri);

// callback stores token for reuse when token is updated
Pipedrive\Configuration::$oAuthTokenUpdateCallback = function($token) {
    $_SESSION['access_token'] = $token;
};

// check if a token is available
if (isset($_SESSION['access_token']) && $_SESSION['access_token']) {
    // set access token in configuration
    Pipedrive\Configuration::$oAuthToken = $_SESSION['access_token'];

    try {
        $response = $client->getUsers()->getCurrentUserData();
        echo '<pre>';
        var_dump($response);
        echo '</pre>';
    } catch (\Pipedrive\APIException $e) {
        echo $e;
    }

    // now you can use $client to make endpoint calls
    // client will automatically refresh the token when it expires and call the token update callback
} else {
    // redirect user to a page that handles authorization
    header('Location: ' . filter_var($oAuthRedirectUri, FILTER_SANITIZE_URL));
}

authcallback.php

<?php
require_once __DIR__.'/vendor/autoload.php';

session_start();

// Client configuration
$oAuthClientId = 'oAuthClientId';
$oAuthClientSecret = 'oAuthClientSecret';
$oAuthRedirectUri = 'http://' . $_SERVER['HTTP_HOST'] . '/authcallback.php';

$client = new Pipedrive\Client($oAuthClientId, $oAuthClientSecret, $oAuthRedirectUri);

// callback stores token for reuse when token is updated
Pipedrive\Configuration::$oAuthTokenUpdateCallback = function($token) {
    $_SESSION['access_token'] = $token;
};

if (! isset($_GET['code'])) {
    // if authorization code is absent, redirect to authorization page
    $authUrl = $client->auth()->buildAuthorizationUrl();
    header('Location: ' . filter_var($authUrl, FILTER_SANITIZE_URL));
} else {
    try {
        // authorize client (calls token update callback as well)
        $token = $client->auth()->authorize($_GET['code']);

        // resume user activity
        $redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . '/';
        header('Location: ' . filter_var($redirect_uri, FILTER_SANITIZE_URL));
    } catch (Pipedrive\Exceptions\OAuthProviderException $ex) {
        // handle exception
    }
}

Contributing

  • Run tests
  • Open a pull request

Please be aware that most of the code is auto-generated. You are welcome to suggest changes and report bugs. However, any updates will have to be implemented in the underlying generator.

How to Test

Unit tests in this SDK can be run using PHPUnit.

  1. First install the dependencies using composer including the require-dev dependencies.
  2. Run vendor\bin\phpunit --verbose from commandline to execute tests. If you have installed PHPUnit globally, run tests using phpunit --verbose instead.

You can change the PHPUnit test configuration in the phpunit.xml file.

Class Reference

List of Controllers

Class: ActivitiesController

Get singleton instance

The singleton instance of the ActivitiesController class can be accessed from the API Client.

$activities = $client->getActivities();

Method: deleteMultipleActivitiesInBulk

Marks multiple activities as deleted.

function deleteMultipleActivitiesInBulk($ids)

Parameters

Example Usage

$ids = 'ids';

$activities->deleteMultipleActivitiesInBulk($ids);

Method: getAllActivitiesAssignedToAParticularUser

Returns all activities assigned to a particular user.

function getAllActivitiesAssignedToAParticularUser($options)

Parameters

Example Usage

$userId = 119;
$collect['userId'] = $userId;

$filterId = 119;
$collect['filterId'] = $filterId;

$type = 'type';
$collect['type'] = $type;

$start = 0;
$collect['start'] = $start;

$limit = 119;
$collect['limit'] = $limit;

$startDate = date("D M d, Y G:i");
$collect['startDate'] = $startDate;

$endDate = date("D M d, Y G:i");
$collect['endDate'] = $endDate;

$done = int::ENUM_0;
$collect['done'] = $done;


$activities->getAllActivitiesAssignedToAParticularUser($collect);

Method: addAnActivity

Adds a new activity. Includes more_activities_scheduled_in_context property in response's additional_data which indicates whether there are more undone activities scheduled with the same deal, person or organization (depending on the supplied data). For more information on how to add an activity, see this tutorial.

function addAnActivity($options)

Parameters

Example Usage

$subject = 'subject';
$collect['subject'] = $subject;

$type = 'type';
$collect['type'] = $type;

$done = int::ENUM_0;
$collect['done'] = $done;

$dueDate = date("D M d, Y G:i");
$collect['dueDate'] = $dueDate;

$dueTime = 'due_time';
$collect['dueTime'] = $dueTime;

$duration = 'duration';
$collect['duration'] = $duration;

$userId = 119;
$collect['userId'] = $userId;

$dealId = 119;
$collect['dealId'] = $dealId;

$personId = 119;
$collect['personId'] = $personId;

$participants = 'participants';
$collect['participants'] = $participants;

$orgId = 119;
$collect['orgId'] = $orgId;

$note = 'note';
$collect['note'] = $note;


$activities->addAnActivity($collect);

Method: deleteAnActivity

Deletes an activity.

function deleteAnActivity($id)

Parameters

Example Usage

$id = 119;

$activities->deleteAnActivity($id);

Method: getDetailsOfAnActivity

Returns details of a specific activity.

function getDetailsOfAnActivity($id)

Parameters

Example Usage

$id = 119;

$activities->getDetailsOfAnActivity($id);

Method: updateEditAnActivity

Modifies an activity. Includes more_activities_scheduled_in_context property in response's additional_data which indicates whether there are more undone activities scheduled with the same deal, person or organization (depending on the supplied data).

function updateEditAnActivity($options)

Parameters

Example Usage

$id = 119;
$collect['id'] = $id;

$subject = 'subject';
$collect['subject'] = $subject;

$type = 'type';
$collect['type'] = $type;

$done = int::ENUM_0;
$collect['done'] = $done;

$dueDate = date("D M d, Y G:i");
$collect['dueDate'] = $dueDate;

$dueTime = 'due_time';
$collect['dueTime'] = $dueTime;

$duration = 'duration';
$collect['duration'] = $duration;

$userId = 119;
$collect['userId'] = $userId;

$dealId = 119;
$collect['dealId'] = $dealId;

$personId = 119;
$collect['personId'] = $personId;

$participants = 'participants';
$collect['participants'] = $participants;

$orgId = 119;
$collect['orgId'] = $orgId;

$note = 'note';
$collect['note'] = $note;


$activities->updateEditAnActivity($collect);

Back to List of Controllers

Class: ActivityFieldsController

Get singleton instance

The singleton instance of the ActivityFieldsController class can be accessed from the API Client.

$activityFields = $client->getActivityFields();

Method: getAllFieldsForAnActivity

Return list of all fields for activity

function getAllFieldsForAnActivity()

Example Usage

$activityFields->getAllFieldsForAnActivity();

Back to List of Controllers

Class: ActivityTypesController

Get singleton instance

The singleton instance of the ActivityTypesController class can be accessed from the API Client.

$activityTypes = $client->getActivityTypes();

Method: deleteMultipleActivityTypesInBulk

Marks multiple activity types as deleted.

function deleteMultipleActivityTypesInBulk($ids)

Parameters

Example Usage

$ids = 'ids';

$activityTypes->deleteMultipleActivityTypesInBulk($ids);

Method: getAllActivityTypes

Returns all activity types

function getAllActivityTypes()

Example Usage

$activityTypes->getAllActivityTypes();

Method: addNewActivityType

Adds a new activity type, returns the ID, the key_string and the order number of the newly added activity type upon success.

function addNewActivityType($options)

Parameters

Example Usage

$name = 'name';
$collect['name'] = $name;

$iconKey = string::TASK;
$collect['iconKey'] = $iconKey;

$color = 'color';
$collect['color'] = $color;


$activityTypes->addNewActivityType($collect);

Method: deleteAnActivityType

Marks an activity type as deleted.

function deleteAnActivityType($id)

Parameters

Example Usage

$id = 119;

$activityTypes->deleteAnActivityType($id);

Method: updateEditActivityType

Updates an activity type.

function updateEditActivityType($options)

Parameters

Example Usage

$id = 119;
$collect['id'] = $id;

$name = 'name';
$collect['name'] = $name;

$iconKey = string::TASK;
$collect['iconKey'] = $iconKey;

$color = 'color';
$collect['color'] = $color;

$orderNr = 119;
$collect['orderNr'] = $orderNr;


$activityTypes->updateEditActivityType($collect);

Back to List of Controllers

Class: CallLogsController

Get singleton instance

The singleton instance of the CallLogsController class can be accessed from the API Client.

$callLogs = $client->getCallLogs();

Method: getAllCallLogsAssignedToAParticularUser

Returns all call logs assigned to a particular user

function getAllCallLogsAssignedToAParticularUser($options)

Parameters

Example Usage

$start = 0;
$options['start'] = $start;

$limit = 119;
$options['limit'] = $limit;

$callLogs->getAllCallLogsAssignedToAParticularUser($options);

Method: getDetailsOfACallLog

Returns details of a specific call log

function getDetailsOfACallLog($id)

Parameters

Example Usage

$id = 1;

$callLogs->getDetailsOfACallLog($id);

Method: addACallLog

Adds a new call log

function addACallLog($collect)

Parameters

Example Usage

$subject = 'subject';
$collect['subject'] = $subject;

$duration = 60;
$collect['duration'] = $duration;

$outcome = 'connected'
$collect['outcome'] = $connected;

$fromPhoneNumber = '+55 555 5555';
$collect['from_phone_number'] = $fromPhoneNumber;

$fromPhoneNumber = '+55 555 5556';
$collect['to_phone_number'] = $fromPhoneNumber;

$startTime = '2021-01-30 22:30:00';
$collect['start_time'] = $startTime;

$endTime = '2021-01-30 22:31:00';
$collect['end_time'] = $endTime;

$personId = 1;
$collect['person_id'] = $personId;

$orgId = 1;
$collect['org_id'] = $orgId;

$dealId = 1;
$collect['deal_id'] = $dealId;

$note = 'note';
$collect['note'] = $note;

$callLogs->addACallLog($collect);

Method: attachAnAudioFileToTheCallLog

Adds an audio recording to the call log. That audio can be played by those who have access to the call log object.

function attachAnAudioFileToTheCallLog($id, $collect)

Parameters

Example Usage

$id = 'id';

$file = "PathToFile";
$collect['file'] = $file;

$callLogs->attachAnAudioFileToTheCallLog($id, $collect);

Method: deleteACallLog

Deletes a call log. If there is an audio recording attached to it, it will also be deleted. The related activity will not be removed by this request. If you want to remove the related activities, please use the endpoint which is specific for activities.

function deleteACallLog($id)

Parameters

Example Usage

$id = 'id';

$callLogs->deleteACallLog($id);

Back to List of Controllers

Class: CurrenciesController

Get singleton instance

The singleton instance of the CurrenciesController class can be accessed from the API Client.

$currencies = $client->getCurrencies();

Method: getAllSupportedCurrencies

Returns all supported currencies in given account which should be used when saving monetary values with other objects. The 'code' parameter of the returning objects is the currency code according to ISO 4217 for all non-custom currencies.

function getAllSupportedCurrencies($term = null)

Parameters

Example Usage

$term = 'term';

$result = $currencies->getAllSupportedCurrencies($term);

Back to List of Controllers

Class: DealFieldsController

Get singleton instance

The singleton instance of the DealFieldsController class can be accessed from the API Client.

$dealFields = $client->getDealFields();

Method: deleteMultipleDealFieldsInBulk

Marks multiple fields as deleted.

function deleteMultipleDealFieldsInBulk($ids)

Parameters

Example Usage

$ids = 'ids';

$dealFields->deleteMultipleDealFieldsInBulk($ids);

Method: getAllDealFields

Returns data about all fields deals can have

function getAllDealFields($options)

Parameters

Example Usage

$start = 0;
$collect['start'] = $start;

$limit = 119;
$collect['limit'] = $limit;


$dealFields->getAllDealFields($collect);

Method: addANewDealField

Adds a new deal field. For more information on adding a new custom field, see this tutorial.

function addANewDealField($body = null)

Parameters

Example Usage

$body = array('key' => 'value');

$dealFields->addANewDealField($body);

Method: deleteADealField

Marks a field as deleted. For more information on how to delete a custom field, see this tutorial.

function deleteADealField($id)

Parameters

Example Usage

$id = 119;

$dealFields->deleteADealField($id);

Method: getOneDealField

Returns data about a specific deal field.

function getOneDealField($id)

Parameters

Example Usage

$id = 119;

$dealFields->getOneDealField($id);

Method: updateADealField

Updates a deal field. See an example of updating custom fields’ values in this tutorial.

function updateADealField($options)

Parameters

Example Usage

$id = 119;
$collect['id'] = $id;

$name = 'name';
$collect['name'] = $name;

$options = 'options';
$collect['options'] = $options;


$dealFields->updateADealField($collect);

Back to List of Controllers

Class: DealsController

Get singleton instance

The singleton instance of the DealsController class can be accessed from the API Client.

$deals = $client->getDeals();

Method: deleteMultipleDealsInBulk

Marks multiple deals as deleted.

function deleteMultipleDealsInBulk($ids)

Parameters

Example Usage

$ids = 'ids';

$result = $deals->deleteMultipleDealsInBulk($ids);

Method: getAllDeals

Returns all deals. For more information on how to get all deals, see this tutorial.

function getAllDeals($options)

Parameters

Example Usage

$userId = 119;
$collect['userId'] = $userId;

$filterId = 119;
$collect['filterId'] = $filterId;

$stageId = 119;
$collect['stageId'] = $stageId;

$status = string::ALL_NOT_DELETED;
$collect['status'] = $status;

$start = 0;
$collect['start'] = $start;

$limit = 119;
$collect['limit'] = $limit;

$sort = 'sort';
$collect['sort'] = $sort;

$ownedByYou = int::ENUM_0;
$collect['ownedByYou'] = $ownedByYou;


$result = $deals->getAllDeals($collect);

Method: searchDeals

Searches all Deals by title, notes and/or custom fields. This endpoint is a wrapper of /v1/itemSearch with a narrower OAuth scope. Found Deals can be filtered by Person ID and Organization ID.

function searchDeals($options)

Parameters

Example Usage

$term = 'term';
$collect['term'] = $term;

$results = $deals->searchDeals($collect);

Method: addADeal

Adds a new deal. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the dealFields and look for 'key' values. For more information on how to add a deal, see this tutorial.

function addADeal($body = null)

Parameters

Example Usage

$body = array('key' => 'value');

$result = $deals->addADeal($body);

Method: getDealsSummary

Returns summary of all the deals.

function getDealsSummary($options)

Parameters

Example Usage

$status = string::OPEN;
$collect['status'] = $status;

$filterId = 119;
$collect['filterId'] = $filterId;

$userId = 119;
$collect['userId'] = $userId;

$stageId = 119;
$collect['stageId'] = $stageId;


$result = $deals->getDealsSummary($collect);

Method: getDealsTimeline

Returns open and won deals, grouped by defined interval of time set in a date-type dealField (field_key) — e.g. when month is the chosen interval, and 3 months are asked starting from January 1st, 2012, deals are returned grouped into 3 groups — January, February and March — based on the value of the given field_key.

function getDealsTimeline($options)

Parameters

Example Usage

$startDate = date("D M d, Y G:i");
$collect['startDate'] = $startDate;

$interval = string::DAY;
$collect['interval'] = $interval;

$amount = 119;
$collect['amount'] = $amount;

$fieldKey = 'field_key';
$collect['fieldKey'] = $fieldKey;

$userId = 119;
$collect['userId'] = $userId;

$pipelineId = 119;
$collect['pipelineId'] = $pipelineId;

$filterId = 119;
$collect['filterId'] = $filterId;

$excludeDeals = int::ENUM_0;
$collect['excludeDeals'] = $excludeDeals;

$totalsConvertCurrency = 'totals_convert_currency';
$collect['totalsConvertCurrency'] = $totalsConvertCurrency;


$result = $deals->getDealsTimeline($collect);

Method: deleteADeal

Marks a deal as deleted.

function deleteADeal($id)

Parameters

Example Usage

$id = 119;

$result = $deals->deleteADeal($id);

Method: getDetailsOfADeal

Returns details of a specific deal. Note that this also returns some additional fields which are not present when asking for all deals – such as deal age and stay in pipeline stages. Also note that custom fields appear as long hashes in the resulting data. These hashes can be mapped against the 'key' value of dealFields. For more information on how to get all details of a deal, see this tutorial.

function getDetailsOfADeal($id)

Parameters

Example Usage

$id = 119;

$result = $deals->getDetailsOfADeal($id);

Method: updateADeal

Updates the properties of a deal. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the dealFields and look for 'key' values. For more information on how to update a deal, see this tutorial.

function updateADeal($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$title = 'title';
$collect['title'] = $title;

$value = 'value';
$collect['value'] = $value;

$currency = 'currency';
$collect['currency'] = $currency;

$userId = 27;
$collect['user_id'] = $userId;

$personId = 27;
$collect['person_id'] = $personId;

$orgId = 27;
$collect['org_id'] = $orgId;

$stageId = 27;
$collect['stage_id'] = $stageId;

$status = string::OPEN;
$collect['status'] = $status;

$probability = 27.9633801840075;
$collect['probability'] = $probability;

$lostReason = 'lost_reason';
$collect['lost_reason'] = $lostReason;

$visibleTo = int::ENUM_1;
$collect['visible_to'] = $visibleTo;


$result = $deals->updateADeal($collect);

Method: listActivitiesAssociatedWithADeal

Lists activities associated with a deal.

function listActivitiesAssociatedWithADeal($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 27;
$collect['limit'] = $limit;

$done = int::ENUM_0;
$collect['done'] = $done;

$exclude = 'exclude';
$collect['exclude'] = $exclude;


$deals->listActivitiesAssociatedWithADeal($collect);

Method: createDuplicateDeal

Duplicate a deal

function createDuplicateDeal($id)

Parameters

Example Usage

$id = 27;

$result = $deals->createDuplicateDeal($id);

Method: listFilesAttachedToADeal

Lists files associated with a deal.

function listFilesAttachedToADeal($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 27;
$collect['limit'] = $limit;

$includeDeletedFiles = int::ENUM_0;
$collect['includeDeletedFiles'] = $includeDeletedFiles;

$sort = 'sort';
$collect['sort'] = $sort;


$deals->listFilesAttachedToADeal($collect);

Method: listUpdatesAboutADeal

Lists updates about a deal.

function listUpdatesAboutADeal($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 27;
$collect['limit'] = $limit;


$deals->listUpdatesAboutADeal($collect);

Method: listFollowersOfADeal

Lists the followers of a deal.

function listFollowersOfADeal($id)

Parameters

Example Usage

$id = 27;

$deals->listFollowersOfADeal($id);

Method: addAFollowerToADeal

Adds a follower to a deal.

function addAFollowerToADeal($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$userId = 27;
$collect['userId'] = $userId;


$result = $deals->addAFollowerToADeal($collect);

Method: deleteAFollowerFromADeal

Deletes a follower from a deal.

function deleteAFollowerFromADeal($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$followerId = 27;
$collect['followerId'] = $followerId;


$result = $deals->deleteAFollowerFromADeal($collect);

Method: listMailMessagesAssociatedWithADeal

Lists mail messages associated with a deal.

function listMailMessagesAssociatedWithADeal($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 27;
$collect['limit'] = $limit;


$deals->listMailMessagesAssociatedWithADeal($collect);

Method: updateMergeTwoDeals

Merges a deal with another deal. For more information on how to merge two deals, see this tutorial.

function updateMergeTwoDeals($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$mergeWithId = 27;
$collect['mergeWithId'] = $mergeWithId;


$result = $deals->updateMergeTwoDeals($collect);

Method: listParticipantsOfADeal

Lists participants associated with a deal.

function listParticipantsOfADeal($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 27;
$collect['limit'] = $limit;


$deals->listParticipantsOfADeal($collect);

Method: addAParticipantToADeal

Adds a participant to a deal.

function addAParticipantToADeal($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$personId = 27;
$collect['personId'] = $personId;


$deals->addAParticipantToADeal($collect);

Method: deleteAParticipantFromADeal

Deletes a participant from a deal.

function deleteAParticipantFromADeal($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$dealParticipantId = 27;
$collect['dealParticipantId'] = $dealParticipantId;


$result = $deals->deleteAParticipantFromADeal($collect);

Method: listPermittedUsers

List users permitted to access a deal

function listPermittedUsers($id)

Parameters

Example Usage

$id = 27;

$deals->listPermittedUsers($id);

Method: listAllPersonsAssociatedWithADeal

Lists all persons associated with a deal, regardless of whether the person is the primary contact of the deal, or added as a participant.

function listAllPersonsAssociatedWithADeal($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 27;
$collect['limit'] = $limit;


$deals->listAllPersonsAssociatedWithADeal($collect);

Method: listProductsAttachedToADeal

Lists products attached to a deal.

function listProductsAttachedToADeal($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 27;
$collect['limit'] = $limit;

$includeProductData = int::ENUM_0;
$collect['includeProductData'] = $includeProductData;


$deals->listProductsAttachedToADeal($collect);

Method: addAProductToTheDealEventuallyCreatingANewItemCalledADealProduct

Adds a product to the deal.

function addAProductToTheDealEventuallyCreatingANewItemCalledADealProduct($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$body = array('key' => 'value');
$collect['body'] = $body;


$result = $deals->addAProductToTheDealEventuallyCreatingANewItemCalledADealProduct($collect);

Method: updateProductAttachmentDetailsOfTheDealProductAProductAlreadyAttachedToADeal

Updates product attachment details.

function updateProductAttachmentDetailsOfTheDealProductAProductAlreadyAttachedToADeal($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$productAttachmentId = 27;
$collect['productAttachmentId'] = $productAttachmentId;

$itemPrice = 27.9633801840075;
$collect['itemPrice'] = $itemPrice;

$quantity = 27;
$collect['quantity'] = $quantity;

$discountPercentage = 27.9633801840075;
$collect['discountPercentage'] = $discountPercentage;

$duration = 27.9633801840075;
$collect['duration'] = $duration;

$productVariationId = 27;
$collect['productVariationId'] = $productVariationId;

$comments = 'comments';
$collect['comments'] = $comments;

$enabledFlag = int::ENUM_0;
$collect['enabledFlag'] = $enabledFlag;


$result = $deals->updateProductAttachmentDetailsOfTheDealProductAProductAlreadyAttachedToADeal($collect);

Method: deleteAnAttachedProductFromADeal

Deletes a product attachment from a deal, using the product_attachment_id.

function deleteAnAttachedProductFromADeal($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$productAttachmentId = 27;
$collect['productAttachmentId'] = $productAttachmentId;


$result = $deals->deleteAnAttachedProductFromADeal($collect);

Back to List of Controllers

Class: FilesController

Get singleton instance

The singleton instance of the FilesController class can be accessed from the API Client.

$files = $client->getFiles();

Method: getAllFiles

Returns data about all files.

function getAllFiles($options)

Parameters

Example Usage

$start = 0;
$collect['start'] = $start;

$limit = 27;
$collect['limit'] = $limit;

$includeDeletedFiles = int::ENUM_0;
$collect['includeDeletedFiles'] = $includeDeletedFiles;

$sort = 'sort';
$collect['sort'] = $sort;


$files->getAllFiles($collect);

Method: addFile

Lets you upload a file and associate it with Deal, Person, Organization, Activity or Product. For more information on how to add a file, see this tutorial.

function addFile($options)

Parameters

Example Usage

$file = "PathToFile";
$collect['file'] = $file;

$dealId = 27;
$collect['dealId'] = $dealId;

$personId = 27;
$collect['personId'] = $personId;

$orgId = 27;
$collect['orgId'] = $orgId;

$productId = 27;
$collect['productId'] = $productId;

$activityId = 27;
$collect['activityId'] = $activityId;

$noteId = 27;
$collect['noteId'] = $noteId;


$files->addFile($collect);

Method: createARemoteFileAndLinkItToAnItem

Creates a new empty file in the remote location (googledrive) that will be linked to the item you supply. For more information on how to add a remote file, see this tutorial.

function createARemoteFileAndLinkItToAnItem($options)

Parameters

Example Usage

$fileType = string::GDOC;
$collect['fileType'] = $fileType;

$title = 'title';
$collect['title'] = $title;

$itemType = string::DEAL;
$collect['itemType'] = $itemType;

$itemId = 27;
$collect['itemId'] = $itemId;

$remoteLocation = string::GOOGLEDRIVE;
$collect['remoteLocation'] = $remoteLocation;


$files->createARemoteFileAndLinkItToAnItem($collect);

Method: createLinkARemoteFileToAnItem

Links an existing remote file (googledrive) to the item you supply. For more information on how to link a remote file, see this tutorial.

function createLinkARemoteFileToAnItem($options)

Parameters

Example Usage

$itemType = string::DEAL;
$collect['itemType'] = $itemType;

$itemId = 27;
$collect['itemId'] = $itemId;

$remoteId = 'remote_id';
$collect['remoteId'] = $remoteId;

$remoteLocation = string::GOOGLEDRIVE;
$collect['remoteLocation'] = $remoteLocation;


$files->createLinkARemoteFileToAnItem($collect);

Method: deleteAFile

Marks a file as deleted.

function deleteAFile($id)

Parameters

Example Usage

$id = 27;

$files->deleteAFile($id);

Method: getOneFile

Returns data about a specific file.

function getOneFile($id)

Parameters

Example Usage

$id = 27;

$files->getOneFile($id);

Method: updateFileDetails

Updates the properties of a file.

function updateFileDetails($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$name = 'name';
$collect['name'] = $name;

$description = 'description';
$collect['description'] = $description;


$files->updateFileDetails($collect);

Method: getDownloadOneFile

Initializes a file download.

function getDownloadOneFile($id)

Parameters

Example Usage

$id = 27;

$files->getDownloadOneFile($id);

Back to List of Controllers

Class: FiltersController

Get singleton instance

The singleton instance of the FiltersController class can be accessed from the API Client.

$filters = $client->getFilters();

Method: deleteMultipleFiltersInBulk

Marks multiple filters as deleted.

function deleteMultipleFiltersInBulk($ids)

Parameters

Example Usage

$ids = 'ids';

$filters->deleteMultipleFiltersInBulk($ids);

Method: getAllFilters

Returns data about all filters

function getAllFilters($type = null)

Parameters

Example Usage

$type = string::DEALS;

$filters->getAllFilters($type);

Method: addANewFilter

Adds a new filter, returns the ID upon success. Note that in the conditions json object only one first-level condition group is supported, and it must be glued with 'AND', and only two second level condition groups are supported of which one must be glued with 'AND' and the second with 'OR'. Other combinations do not work (yet) but the syntax supports introducing them in future. For more information on how to add a new filter, see this tutorial.

function addANewFilter($options)

Parameters

Example Usage

$name = 'name';
$collect['name'] = $name;

$conditions = 'conditions';
$collect['conditions'] = $conditions;

$type = string::DEALS;
$collect['type'] = $type;


$filters->addANewFilter($collect);

Method: getAllFilterHelpers

Returns all supported filter helpers. It helps to know what conditions and helpers are available when you want to add or update filters. For more information on how filter’s helpers can be used, see this tutorial.

function getAllFilterHelpers()

Example Usage

$filters->getAllFilterHelpers();

Method: deleteAFilter

Marks a filter as deleted.

function deleteAFilter($id)

Parameters

Example Usage

$id = 27;

$filters->deleteAFilter($id);

Method: getOneFilter

Returns data about a specific filter. Note that this also returns the condition lines of the filter.

function getOneFilter($id)

Parameters

Example Usage

$id = 27;

$filters->getOneFilter($id);

Method: updateFilter

Updates existing filter.

function updateFilter($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$conditions = 'conditions';
$collect['conditions'] = $conditions;

$name = 'name';
$collect['name'] = $name;


$filters->updateFilter($collect);

Back to List of Controllers

Class: GlobalMessagesController

Get singleton instance

The singleton instance of the GlobalMessagesController class can be accessed from the API Client.

$globalMessages = $client->getGlobalMessages();

Method: getGlobalMessages

Returns data about global messages to display for the authorized user.

function getGlobalMessages($limit = 1)

Parameters

Example Usage

$limit = 1;

$result = $globalMessages->getGlobalMessages($limit);

Method: deleteDismissAGlobalMessage

Removes global message from being shown, if message is dismissible

function deleteDismissAGlobalMessage($id)

Parameters

Example Usage

$id = 27;

$result = $globalMessages->deleteDismissAGlobalMessage($id);

Back to List of Controllers

Class: GoalsController

Get singleton instance

The singleton instance of the GoalsController class can be accessed from the API Client.

$goals = $client->getGoals();

Method: addANewGoal

Adds a new goal.

function addANewGoal($body = null)

Parameters

Example Usage

$body = array('key' => 'value');

$goals->addANewGoal($body);

Method: findGoals

Returns data about goals based on criteria. For searching, append {searchField}={searchValue} to the URL, where searchField can be any one of the lowest-level fields in dot-notation (e.g. type.params.pipeline_id; title). searchValue should be the value you are looking for on that field. Additionally, is_active=<true|false> can be provided to search for only active/inactive goals. When providing period.start, period.end must also be provided and vice versa.

function findGoals($options)

Parameters

Example Usage

$typeName = string::DEALS_WON;
$collect['typeName'] = $typeName;

$title = 'title';
$collect['title'] = $title;

$isActive = true;
$collect['isActive'] = $isActive;

$assigneeId = 27;
$collect['assigneeId'] = $assigneeId;

$assigneeType = string::PERSON;
$collect['assigneeType'] = $assigneeType;

$expectedOutcomeTarget = 27.9633801840075;
$collect['expectedOutcomeTarget'] = $expectedOutcomeTarget;

$expectedOutcomeTrackingMetric = string::QUANTITY;
$collect['expectedOutcomeTrackingMetric'] = $expectedOutcomeTrackingMetric;

$expectedOutcomeCurrencyId = 27;
$collect['expectedOutcomeCurrencyId'] = $expectedOutcomeCurrencyId;

$typeParamsPipelineId = 27;
$collect['typeParamsPipelineId'] = $typeParamsPipelineId;

$typeParamsStageId = 27;
$collect['typeParamsStageId'] = $typeParamsStageId;

$typeParamsActivityTypeId = 27;
$collect['typeParamsActivityTypeId'] = $typeParamsActivityTypeId;

$periodStart = date("D M d, Y G:i");
$collect['periodStart'] = $periodStart;

$periodEnd = date("D M d, Y G:i");
$collect['periodEnd'] = $periodEnd;


$goals->findGoals($collect);

Method: updateExistingGoal

Updates existing goal.

function updateExistingGoal($options)

Parameters

Example Usage

$id = 'id';
$collect['id'] = $id;

$title = 'title';
$collect['title'] = $title;

$assignee = array('key' => 'value');
$collect['assignee'] = $assignee;

$type = array('key' => 'value');
$collect['type'] = $type;

$expectedOutcome = array('key' => 'value');
$collect['expectedOutcome'] = $expectedOutcome;

$duration = array('key' => 'value');
$collect['duration'] = $duration;

$interval = string::WEEKLY;
$collect['interval'] = $interval;


$goals->updateExistingGoal($collect);

Method: deleteExistingGoal

Marks goal as deleted.

function deleteExistingGoal($id)

Parameters

Example Usage

$id = 'id';

$goals->deleteExistingGoal($id);

Method: getResultOfAGoal

Gets progress of a goal for specified period.

function getResultOfAGoal($options)

Parameters

Example Usage

$id = 'id';
$collect['id'] = $id;

$periodStart = date("D M d, Y G:i");
$collect['periodStart'] = $periodStart;

$periodEnd = date("D M d, Y G:i");
$collect['periodEnd'] = $periodEnd;


$goals->getResultOfAGoal($collect);

Back to List of Controllers

Class: ItemSearchController

Get singleton instance

The singleton instance of the ItemSearchController class can be accessed from the API Client.

$itemSearch = $client->getItemSearch();

Method: performASearchFromMultipleItemTypes

Perform a search from multiple item types

function performASearchFromMultipleItemTypes($options)

Parameters

Example Usage

$term = 'term';
$collect['term'] = $term;

$results = $itemSearch->performASearchFromMultipleItemTypes($collect);

Method: performASearchUsingASpecificFieldFromAnItemType

Perform a search using a specific field from an item type

function performASearchUsingASpecificFieldFromAnItemType($options)

Parameters

Example Usage

$collect['term'] = 'term';
$collect['fieldType'] = 'dealField';
$collect['fieldKey'] = 'title';

$results = $itemSearch->performASearchUsingASpecificFieldFromAnItemType($collect);

Back to List of Controllers

Class: MailMessagesController

Get singleton instance

The singleton instance of the MailMessagesController class can be accessed from the API Client.

$mailMessages = $client->getMailMessages();

Method: getOneMailMessage

Returns data about specific mail message.

function getOneMailMessage($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$includeBody = int::ENUM_0;
$collect['includeBody'] = $includeBody;


$result = $mailMessages->getOneMailMessage($collect);

Back to List of Controllers

Class: MailThreadsController

Get singleton instance

The singleton instance of the MailThreadsController class can be accessed from the API Client.

$mailThreads = $client->getMailThreads();

Method: getMailThreads

Returns mail threads in specified folder ordered by most recent message within.

function getMailThreads($options)

Parameters

Example Usage

$folder = string::INBOX;
$collect['folder'] = $folder;

$start = 0;
$collect['start'] = $start;

$limit = 27;
$collect['limit'] = $limit;


$result = $mailThreads->getMailThreads($collect);

Method: deleteMailThread

Marks mail thread as deleted.

function deleteMailThread($id)

Parameters

Example Usage

$id = 27;

$result = $mailThreads->deleteMailThread($id);

Method: getOneMailThread

Returns specific mail thread.

function getOneMailThread($id)

Parameters

Example Usage

$id = 27;

$result = $mailThreads->getOneMailThread($id);

Method: updateMailThreadDetails

Updates the properties of a mail thread.

function updateMailThreadDetails($options)

Parameters

Example Usage

$id = 27;
$collect['id'] = $id;

$dealId = 27;
$collect['dealId'] = $dealId;

$sharedFlag = int::ENUM_0;
$collect['sharedFlag'] = $sharedFlag;

$readFlag = int::ENUM_0;
$collect['readFlag'] = $readFlag;

$archivedFlag = int::ENUM_0;
$collect['archivedFlag'] = $archivedFlag;


$result = $mailThreads->updateMailThreadDetails($collect);

Method: getAllMailMessagesOfMailThread

Get mail messages inside specified mail thread.

function getAllMailMessagesOfMailThread($id)

Parameters

Example Usage

$id = 27;

$result = $mailThreads->getAllMailMessagesOfMailThread($id);

Back to List of Controllers

Class: NoteFieldsController

Get singleton instance

The singleton instance of the NoteFieldsController class can be accessed from the API Client.

$noteFields = $client->getNoteFields();

Method: getAllFieldsForANote

Return list of all fields for note

function getAllFieldsForANote()

Example Usage

$noteFields->getAllFieldsForANote();

Back to List of Controllers

Class: NotesController

Get singleton instance

The singleton instance of the NotesController class can be accessed from the API Client.

$notes = $client->getNotes();

Method: getAllNotes

Returns all notes.

function getAllNotes($options)

Parameters

Example Usage

$userId = 69;
$collect['userId'] = $userId;

$leadId = 'adf21080-0e10-11eb-879b-05d71fb426ec';
$collect['leadId'] = $leadId;

$dealId = 69;
$collect['dealId'] = $dealId;

$personId = 69;
$collect['personId'] = $personId;

$orgId = 69;
$collect['orgId'] = $orgId;

$start = 0;
$collect['start'] = $start;

$limit = 69;
$collect['limit'] = $limit;

$sort = 'sort';
$collect['sort'] = $sort;

$startDate = date("D M d, Y G:i");
$collect['startDate'] = $startDate;

$endDate = date("D M d, Y G:i");
$collect['endDate'] = $endDate;

$pinnedToLeadFlag = int::ENUM_0;
$collect['pinnedToLeadFlag'] = $pinnedToLeadFlag;

$pinnedToDealFlag = int::ENUM_0;
$collect['pinnedToDealFlag'] = $pinnedToDealFlag;

$pinnedToOrganizationFlag = int::ENUM_0;
$collect['pinnedToOrganizationFlag'] = $pinnedToOrganizationFlag;

$pinnedToPersonFlag = int::ENUM_0;
$collect['pinnedToPersonFlag'] = $pinnedToPersonFlag;


$result = $notes->getAllNotes($collect);

Method: addANote

Adds a new note.

function addANote($options)

Parameters

Example Usage

$content = 'content';
$collect['content'] = $content;

$userId = 69;
$collect['userId'] = $userId;

$leadId = 'adf21080-0e10-11eb-879b-05d71fb426ec';
$collect['leadId'] = $leadId;

$dealId = 69;
$collect['dealId'] = $dealId;

$personId = 69;
$collect['personId'] = $personId;

$orgId = 69;
$collect['orgId'] = $orgId;

$addTime = 'add_time';
$collect['addTime'] = $addTime;

$pinnedToLeadFlag = int::ENUM_0;
$collect['pinnedToLeadFlag'] = $pinnedToLeadFlag;

$pinnedToDealFlag = int::ENUM_0;
$collect['pinnedToDealFlag'] = $pinnedToDealFlag;

$pinnedToOrganizationFlag = int::ENUM_0;
$collect['pinnedToOrganizationFlag'] = $pinnedToOrganizationFlag;

$pinnedToPersonFlag = int::ENUM_0;
$collect['pinnedToPersonFlag'] = $pinnedToPersonFlag;


$result = $notes->addANote($collect);

Method: deleteANote

Deletes a specific note.

function deleteANote($id)

Parameters

Example Usage

$id = 69;

$result = $notes->deleteANote($id);

Method: getOneNote

Returns details about a specific note.

function getOneNote($id)

Parameters

Example Usage

$id = 69;

$result = $notes->getOneNote($id);

Method: updateANote

Updates a note.

function updateANote($options)

Parameters

Example Usage

$id = 69;
$collect['id'] = $id;

$content = 'content';
$collect['content'] = $content;

$userId = 69;
$collect['userId'] = $userId;

$leadId = 'adf21080-0e10-11eb-879b-05d71fb426ec';
$collect['leadId'] = $leadId;

$dealId = 69;
$collect['dealId'] = $dealId;

$personId = 69;
$collect['personId'] = $personId;

$orgId = 69;
$collect['orgId'] = $orgId;

$addTime = 'add_time';
$collect['addTime'] = $addTime;

$pinnedToLeadFlag = int::ENUM_0;
$collect['pinnedToLeadFlag'] = $pinnedToLeadFlag;

$pinnedToDealFlag = int::ENUM_0;
$collect['pinnedToDealFlag'] = $pinnedToDealFlag;

$pinnedToOrganizationFlag = int::ENUM_0;
$collect['pinnedToOrganizationFlag'] = $pinnedToOrganizationFlag;

$pinnedToPersonFlag = int::ENUM_0;
$collect['pinnedToPersonFlag'] = $pinnedToPersonFlag;


$result = $notes->updateANote($collect);

Back to List of Controllers

Class: OrganizationFieldsController

Get singleton instance

The singleton instance of the OrganizationFieldsController class can be accessed from the API Client.

$organizationFields = $client->getOrganizationFields();

Method: deleteMultipleOrganizationFieldsInBulk

Marks multiple fields as deleted.

function deleteMultipleOrganizationFieldsInBulk($ids)

Parameters

Example Usage

$ids = 'ids';

$organizationFields->deleteMultipleOrganizationFieldsInBulk($ids);

Method: getAllOrganizationFields

Returns data about all organization fields

function getAllOrganizationFields()

Example Usage

$organizationFields->getAllOrganizationFields();

Method: addANewOrganizationField

Adds a new organization field. For more information on adding a new custom field, see this tutorial.

function addANewOrganizationField($body = null)

Parameters

Example Usage

$body = array('key' => 'value');

$organizationFields->addANewOrganizationField($body);

Method: deleteAnOrganizationField

Marks a field as deleted. For more information on how to delete a custom field, see this tutorial.

function deleteAnOrganizationField($id)

Parameters

Example Usage

$id = 69;

$organizationFields->deleteAnOrganizationField($id);

Method: getOneOrganizationField

Returns data about a specific organization field.

function getOneOrganizationField($id)

Parameters

Example Usage

$id = 69;

$organizationFields->getOneOrganizationField($id);

Method: updateAnOrganizationField

Updates an organization field. See an example of updating custom fields’ values in this tutorial.

function updateAnOrganizationField($options)

Parameters

Example Usage

$id = 69;
$collect['id'] = $id;

$name = 'name';
$collect['name'] = $name;

$options = 'options';
$collect['options'] = $options;


$organizationFields->updateAnOrganizationField($collect);

Back to List of Controllers

Class: OrganizationRelationshipsController

Get singleton instance

The singleton instance of the OrganizationRelationshipsController class can be accessed from the API Client.

$organizationRelationships = $client->getOrganizationRelationships();

Method: getAllRelationshipsForOrganization

Gets all of the relationships for a supplied organization id.

function getAllRelationshipsForOrganization($orgId)

Parameters

Example Usage

$orgId = 69;

$organizationRelationships->getAllRelationshipsForOrganization($orgId);

Method: createAnOrganizationRelationship

Creates and returns an organization relationship.

function createAnOrganizationRelationship($body = null)

Parameters

Example Usage

$body = array('key' => 'value');

$organizationRelationships->createAnOrganizationRelationship($body);

Method: deleteAnOrganizationRelationship

Deletes an organization relationship and returns the deleted id.

function deleteAnOrganizationRelationship($id)

Parameters

Example Usage

$id = 69;

$organizationRelationships->deleteAnOrganizationRelationship($id);

Method: getOneOrganizationRelationship

Finds and returns an organization relationship from its ID.

function getOneOrganizationRelationship($options)

Parameters

Example Usage

$id = 69;
$collect['id'] = $id;

$orgId = 69;
$collect['orgId'] = $orgId;


$organizationRelationships->getOneOrganizationRelationship($collect);

Method: updateAnOrganizationRelationship

Updates and returns an organization relationship.

function updateAnOrganizationRelationship($options)

Parameters

Example Usage

$id = 69;
$collect['id'] = $id;

$orgId = 69;
$collect['orgId'] = $orgId;

$type = string::PARENT;
$collect['type'] = $type;

$relOwnerOrgId = 69;
$collect['relOwnerOrgId'] = $relOwnerOrgId;

$relLinkedOrgId = 69;
$collect['relLinkedOrgId'] = $relLinkedOrgId;


$organizationRelationships->updateAnOrganizationRelationship($collect);

Back to List of Controllers

Class: OrganizationsController

Get singleton instance

The singleton instance of the OrganizationsController class can be accessed from the API Client.

$organizations = $client->getOrganizations();

Method: deleteMultipleOrganizationsInBulk

Marks multiple organizations as deleted.

function deleteMultipleOrganizationsInBulk($ids)

Parameters

Example Usage

$ids = 'ids';

$organizations->deleteMultipleOrganizationsInBulk($ids);

Method: getAllOrganizations

Returns all organizations

function getAllOrganizations($options)

Parameters

Example Usage

$userId = 69;
$collect['userId'] = $userId;

$filterId = 69;
$collect['filterId'] = $filterId;

$firstChar = 'first_char';
$collect['firstChar'] = $firstChar;

$start = 0;
$collect['start'] = $start;

$limit = 69;
$collect['limit'] = $limit;

$sort = 'sort';
$collect['sort'] = $sort;


$organizations->getAllOrganizations($collect);

Method: searchOrganizations

Searches all Organizations by name, address, notes and/or custom fields. This endpoint is a wrapper of /v1/itemSearch with a narrower OAuth scope.

function searchOrganizations($options)

Parameters

Example Usage

$term = 'term';
$collect['term'] = $term;

$results = $organizations->searchOrganizations($collect);

Method: addAnOrganization

Adds a new organization. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the organizationFields and look for 'key' values. For more information on how to add an organization, see this tutorial.

function addAnOrganization($body = null)

Parameters

Example Usage

$body = array('key' => 'value');

$organizations->addAnOrganization($body);

Method: deleteAnOrganization

Marks an organization as deleted.

function deleteAnOrganization($id)

Parameters

Example Usage

$id = 69;

$organizations->deleteAnOrganization($id);

Method: getDetailsOfAnOrganization

Returns details of an organization. Note that this also returns some additional fields which are not present when asking for all organizations. Also note that custom fields appear as long hashes in the resulting data. These hashes can be mapped against the 'key' value of organizationFields.

function getDetailsOfAnOrganization($id)

Parameters

Example Usage

$id = 69;

$organizations->getDetailsOfAnOrganization($id);

Method: updateAnOrganization

Updates the properties of an organization. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the organizationFields and look for 'key' values.

function updateAnOrganization($options)

Parameters

Example Usage

$id = 69;
$collect['id'] = $id;

$name = 'name';
$collect['name'] = $name;

$ownerId = 69;
$collect['ownerId'] = $ownerId;

$visibleTo = int::ENUM_1;
$collect['visibleTo'] = $visibleTo;


$organizations->updateAnOrganization($collect);

Method: listActivitiesAssociatedWithAnOrganization

Lists activities associated with an organization.

function listActivitiesAssociatedWithAnOrganization($options)

Parameters

Example Usage

$id = 69;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 69;
$collect['limit'] = $limit;

$done = int::ENUM_0;
$collect['done'] = $done;

$exclude = 'exclude';
$collect['exclude'] = $exclude;


$organizations->listActivitiesAssociatedWithAnOrganization($collect);

Method: listDealsAssociatedWithAnOrganization

Lists deals associated with an organization.

function listDealsAssociatedWithAnOrganization($options)

Parameters

Example Usage

$id = 69;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 69;
$collect['limit'] = $limit;

$status = string::ALL_NOT_DELETED;
$collect['status'] = $status;

$sort = 'sort';
$collect['sort'] = $sort;

$onlyPrimaryAssociation = int::ENUM_0;
$collect['onlyPrimaryAssociation'] = $onlyPrimaryAssociation;


$organizations->listDealsAssociatedWithAnOrganization($collect);

Method: listFilesAttachedToAnOrganization

Lists files associated with an organization.

function listFilesAttachedToAnOrganization($options)

Parameters

Example Usage

$id = 69;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 69;
$collect['limit'] = $limit;

$includeDeletedFiles = int::ENUM_0;
$collect['includeDeletedFiles'] = $includeDeletedFiles;

$sort = 'sort';
$collect['sort'] = $sort;


$organizations->listFilesAttachedToAnOrganization($collect);

Method: listUpdatesAboutAnOrganization

Lists updates about an organization.

function listUpdatesAboutAnOrganization($options)

Parameters

Example Usage

$id = 69;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 69;
$collect['limit'] = $limit;


$organizations->listUpdatesAboutAnOrganization($collect);

Method: listFollowersOfAnOrganization

Lists the followers of an organization.

function listFollowersOfAnOrganization($id)

Parameters

Example Usage

$id = 69;

$organizations->listFollowersOfAnOrganization($id);

Method: addAFollowerToAnOrganization

Adds a follower to an organization.

function addAFollowerToAnOrganization($options)

Parameters

Example Usage

$id = 69;
$collect['id'] = $id;

$userId = 69;
$collect['userId'] = $userId;


$organizations->addAFollowerToAnOrganization($collect);

Method: deleteAFollowerFromAnOrganization

Deletes a follower from an organization. You can retrieve the follower_id from the List followers of an organization endpoint.

function deleteAFollowerFromAnOrganization($options)

Parameters

Example Usage

$id = 69;
$collect['id'] = $id;

$followerId = 69;
$collect['followerId'] = $followerId;


$organizations->deleteAFollowerFromAnOrganization($collect);

Method: listMailMessagesAssociatedWithAnOrganization

Lists mail messages associated with an organization.

function listMailMessagesAssociatedWithAnOrganization($options)

Parameters

Example Usage

$id = 69;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 69;
$collect['limit'] = $limit;


$organizations->listMailMessagesAssociatedWithAnOrganization($collect);

Method: updateMergeTwoOrganizations

Merges an organization with another organization. For more information on how to merge two organizations, see this tutorial.

function updateMergeTwoOrganizations($options)

Parameters

Example Usage

$id = 69;
$collect['id'] = $id;

$mergeWithId = 69;
$collect['mergeWithId'] = $mergeWithId;


$organizations->updateMergeTwoOrganizations($collect);

Method: listPermittedUsers

List users permitted to access an organization

function listPermittedUsers($id)

Parameters

Example Usage

$id = 69;

$organizations->listPermittedUsers($id);

Method: listPersonsOfAnOrganization

Lists persons associated with an organization.

function listPersonsOfAnOrganization($options)

Parameters

Example Usage

$id = 69;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 69;
$collect['limit'] = $limit;


$organizations->listPersonsOfAnOrganization($collect);

Back to List of Controllers

Class: PermissionSetsController

Get singleton instance

The singleton instance of the PermissionSetsController class can be accessed from the API Client.

$permissionSets = $client->getPermissionSets();

Method: getAllPermissionSets

Get all Permission Sets

function getAllPermissionSets()

Example Usage

$result = $permissionSets->getAllPermissionSets();

Errors

Method: getOnePermissionSet

Get one Permission Set

function getOnePermissionSet($id)

Parameters

Example Usage

$id = 69;

$result = $permissionSets->getOnePermissionSet($id);

Errors

Method: listPermissionSetAssignments

The list of assignments for a Permission Set

function listPermissionSetAssignments($options)

Parameters

Example Usage

$id = 69;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 69;
$collect['limit'] = $limit;


$result = $permissionSets->listPermissionSetAssignments($collect);

Errors

Back to List of Controllers

Class: PersonFieldsController

Get singleton instance

The singleton instance of the PersonFieldsController class can be accessed from the API Client.

$personFields = $client->getPersonFields();

Method: deleteMultiplePersonFieldsInBulk

Marks multiple fields as deleted.

function deleteMultiplePersonFieldsInBulk($ids)

Parameters

Example Usage

$ids = 'ids';

$personFields->deleteMultiplePersonFieldsInBulk($ids);

Method: getAllPersonFields

Returns data about all person fields

function getAllPersonFields()

Example Usage

$personFields->getAllPersonFields();

Method: addANewPersonField

Adds a new person field. For more information on adding a new custom field, see this tutorial.

function addANewPersonField($body = null)

Parameters

Example Usage

$body = array('key' => 'value');

$personFields->addANewPersonField($body);

Method: deleteAPersonField

Marks a field as deleted. For more information on how to delete a custom field, see this tutorial.

function deleteAPersonField($id)

Parameters

Example Usage

$id = 69;

$personFields->deleteAPersonField($id);

Method: getOnePersonField

Returns data about a specific person field.

function getOnePersonField($id)

Parameters

Example Usage

$id = 69;

$personFields->getOnePersonField($id);

Method: updateAPersonField

Updates a person field. See an example of updating custom fields’ values in this tutorial.

function updateAPersonField($options)

Parameters

Example Usage

$id = 69;
$collect['id'] = $id;

$name = 'name';
$collect['name'] = $name;

$options = 'options';
$collect['options'] = $options;


$personFields->updateAPersonField($collect);

Back to List of Controllers

Class: PersonsController

Get singleton instance

The singleton instance of the PersonsController class can be accessed from the API Client.

$persons = $client->getPersons();

Method: deleteMultiplePersonsInBulk

Marks multiple persons as deleted.

function deleteMultiplePersonsInBulk($ids = null)

Parameters

Example Usage

$ids = 'ids';

$persons->deleteMultiplePersonsInBulk($ids);

Method: getAllPersons

Returns all persons

function getAllPersons($options)

Parameters

Example Usage

$userId = 233;
$collect['userId'] = $userId;

$filterId = 233;
$collect['filterId'] = $filterId;

$firstChar = 'first_char';
$collect['firstChar'] = $firstChar;

$start = 0;
$collect['start'] = $start;

$limit = 233;
$collect['limit'] = $limit;

$sort = 'sort';
$collect['sort'] = $sort;


$persons->getAllPersons($collect);

Method: searchPersons

Searches all Persons by name, email, phone, notes and/or custom fields. This endpoint is a wrapper of /v1/itemSearch with a narrower OAuth scope. Found Persons can be filtered by Organization ID.

function searchPersons($options)

Parameters

Example Usage

$term = 'term';
$collect['term'] = $term;

$results = $persons->searchPersons($collect);

Method: addAPerson

Adds a new person. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the personFields and look for 'key' values.

function addAPerson($body = null)

Parameters

Example Usage

$body = array('key' => 'value');

$persons->addAPerson($body);

Method: deleteAPerson

Marks a person as deleted.

function deleteAPerson($id)

Parameters

Example Usage

$id = 233;

$persons->deleteAPerson($id);

Method: getDetailsOfAPerson

Returns details of a person. Note that this also returns some additional fields which are not present when asking for all persons. Also note that custom fields appear as long hashes in the resulting data. These hashes can be mapped against the 'key' value of personFields.

function getDetailsOfAPerson($id)

Parameters

Example Usage

$id = 233;

$persons->getDetailsOfAPerson($id);

Method: updateAPerson

Updates the properties of a person. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the personFields and look for 'key' values. For more information on how to update a person, see this tutorial.

function updateAPerson($options)

Parameters

Example Usage

$id = 233;
$collect['id'] = $id;

$name = 'name';
$collect['name'] = $name;

$ownerId = 233;
$collect['ownerId'] = $ownerId;

$orgId = 233;
$collect['orgId'] = $orgId;

$email = array('email');
$collect['email'] = $email;

$phone = array('phone');
$collect['phone'] = $phone;

$visibleTo = int::ENUM_1;
$collect['visibleTo'] = $visibleTo;


$persons->updateAPerson($collect);

Method: listActivitiesAssociatedWithAPerson

Lists activities associated with a person.

function listActivitiesAssociatedWithAPerson($options)

Parameters

Example Usage

$id = 233;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 233;
$collect['limit'] = $limit;

$done = int::ENUM_0;
$collect['done'] = $done;

$exclude = 'exclude';
$collect['exclude'] = $exclude;


$persons->listActivitiesAssociatedWithAPerson($collect);

Method: listDealsAssociatedWithAPerson

Lists deals associated with a person.

function listDealsAssociatedWithAPerson($options)

Parameters

Example Usage

$id = 233;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 233;
$collect['limit'] = $limit;

$status = string::ALL_NOT_DELETED;
$collect['status'] = $status;

$sort = 'sort';
$collect['sort'] = $sort;


$persons->listDealsAssociatedWithAPerson($collect);

Method: listFilesAttachedToAPerson

Lists files associated with a person.

function listFilesAttachedToAPerson($options)

Parameters

Example Usage

$id = 233;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 233;
$collect['limit'] = $limit;

$includeDeletedFiles = int::ENUM_0;
$collect['includeDeletedFiles'] = $includeDeletedFiles;

$sort = 'sort';
$collect['sort'] = $sort;


$persons->listFilesAttachedToAPerson($collect);

Method: listUpdatesAboutAPerson

Lists updates about a person.

function listUpdatesAboutAPerson($options)

Parameters

Example Usage

$id = 233;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 233;
$collect['limit'] = $limit;


$persons->listUpdatesAboutAPerson($collect);

Method: listFollowersOfAPerson

Lists the followers of a person.

function listFollowersOfAPerson($id)

Parameters

Example Usage

$id = 233;

$persons->listFollowersOfAPerson($id);

Method: addAFollowerToAPerson

Adds a follower to a person.

function addAFollowerToAPerson($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$userId = 19;
$collect['userId'] = $userId;


$persons->addAFollowerToAPerson($collect);

Method: deletesAFollowerFromAPerson

Delete a follower from a person

function deletesAFollowerFromAPerson($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$followerId = 19;
$collect['followerId'] = $followerId;


$persons->deletesAFollowerFromAPerson($collect);

Method: listMailMessagesAssociatedWithAPerson

Lists mail messages associated with a person.

function listMailMessagesAssociatedWithAPerson($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 19;
$collect['limit'] = $limit;


$persons->listMailMessagesAssociatedWithAPerson($collect);

Method: updateMergeTwoPersons

Merges a person with another person. For more information on how to merge two persons, see this tutorial.

function updateMergeTwoPersons($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$mergeWithId = 19;
$collect['mergeWithId'] = $mergeWithId;


$persons->updateMergeTwoPersons($collect);

Method: listPermittedUsers

List users permitted to access a person

function listPermittedUsers($id)

Parameters

Example Usage

$id = 19;

$persons->listPermittedUsers($id);

Method: deletePersonPicture

Delete person picture

function deletePersonPicture($id)

Parameters

Example Usage

$id = 19;

$persons->deletePersonPicture($id);

Method: addPersonPicture

Add a picture to a person. If a picture is already set, the old picture will be replaced. Added image (or the cropping parameters supplied with the request) should have an equal width and height and should be at least 128 pixels. GIF, JPG and PNG are accepted. All added images will be resized to 128 and 512 pixel wide squares.

function addPersonPicture($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$file = "PathToFile";
$collect['file'] = $file;

$cropX = 19;
$collect['cropX'] = $cropX;

$cropY = 19;
$collect['cropY'] = $cropY;

$cropWidth = 19;
$collect['cropWidth'] = $cropWidth;

$cropHeight = 19;
$collect['cropHeight'] = $cropHeight;


$persons->addPersonPicture($collect);

Method: listProductsAssociatedWithAPerson

Lists products associated with a person.

function listProductsAssociatedWithAPerson($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 19;
$collect['limit'] = $limit;


$persons->listProductsAssociatedWithAPerson($collect);

Back to List of Controllers

Class: PipelinesController

Get singleton instance

The singleton instance of the PipelinesController class can be accessed from the API Client.

$pipelines = $client->getPipelines();

Method: getAllPipelines

Returns data about all pipelines

function getAllPipelines()

Example Usage

$pipelines->getAllPipelines();

Method: addANewPipeline

Adds a new pipeline

function addANewPipeline($options)

Parameters

Example Usage

$name = 'name';
$collect['name'] = $name;

$dealProbability = int::ENUM_0;
$collect['dealProbability'] = $dealProbability;

$orderNr = 19;
$collect['orderNr'] = $orderNr;

$active = int::ENUM_0;
$collect['active'] = $active;


$pipelines->addANewPipeline($collect);

Method: deleteAPipeline

Marks a pipeline as deleted.

function deleteAPipeline($id)

Parameters

Example Usage

$id = 19;

$pipelines->deleteAPipeline($id);

Method: getOnePipeline

Returns data about a specific pipeline. Also returns the summary of the deals in this pipeline across its stages.

function getOnePipeline($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$totalsConvertCurrency = 'totals_convert_currency';
$collect['totalsConvertCurrency'] = $totalsConvertCurrency;


$pipelines->getOnePipeline($collect);

Method: updateEditAPipeline

Updates pipeline properties

function updateEditAPipeline($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$name = 'name';
$collect['name'] = $name;

$dealProbability = int::ENUM_0;
$collect['dealProbability'] = $dealProbability;

$orderNr = 19;
$collect['orderNr'] = $orderNr;

$active = int::ENUM_0;
$collect['active'] = $active;


$pipelines->updateEditAPipeline($collect);

Method: getDealsConversionRatesInPipeline

Returns all stage-to-stage conversion and pipeline-to-close rates for given time period.

function getDealsConversionRatesInPipeline($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$startDate = date("D M d, Y G:i");
$collect['startDate'] = $startDate;

$endDate = date("D M d, Y G:i");
$collect['endDate'] = $endDate;

$userId = 19;
$collect['userId'] = $userId;


$pipelines->getDealsConversionRatesInPipeline($collect);

Method: getDealsInAPipeline

Lists deals in a specific pipeline across all its stages

function getDealsInAPipeline($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$filterId = 19;
$collect['filterId'] = $filterId;

$userId = 19;
$collect['userId'] = $userId;

$everyone = int::ENUM_0;
$collect['everyone'] = $everyone;

$stageId = 19;
$collect['stageId'] = $stageId;

$start = 0;
$collect['start'] = $start;

$limit = 19;
$collect['limit'] = $limit;

$getSummary = int::ENUM_0;
$collect['getSummary'] = $getSummary;

$totalsConvertCurrency = 'totals_convert_currency';
$collect['totalsConvertCurrency'] = $totalsConvertCurrency;


$pipelines->getDealsInAPipeline($collect);

Method: getDealsMovementsInPipeline

Returns statistics for deals movements for given time period.

function getDealsMovementsInPipeline($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$startDate = date("D M d, Y G:i");
$collect['startDate'] = $startDate;

$endDate = date("D M d, Y G:i");
$collect['endDate'] = $endDate;

$userId = 19;
$collect['userId'] = $userId;


$pipelines->getDealsMovementsInPipeline($collect);

Back to List of Controllers

Class: ProductFieldsController

Get singleton instance

The singleton instance of the ProductFieldsController class can be accessed from the API Client.

$productFields = $client->getProductFields();

Method: deleteMultipleProductFieldsInBulk

Marks multiple fields as deleted.

function deleteMultipleProductFieldsInBulk($ids)

Parameters

Example Usage

$ids = 'ids';

$result = $productFields->deleteMultipleProductFieldsInBulk($ids);

Method: getAllProductFields

Returns data about all product fields

function getAllProductFields()

Example Usage

$result = $productFields->getAllProductFields();

Method: addANewProductField

Adds a new product field. For more information on adding a new custom field, see this tutorial.

function addANewProductField($body = null)

Parameters

Example Usage

$body = array('key' => 'value');

$result = $productFields->addANewProductField($body);

Method: deleteAProductField

Marks a field as deleted. For more information on how to delete a custom field, see this tutorial.

function deleteAProductField($id)

Parameters

Example Usage

$id = 19;

$result = $productFields->deleteAProductField($id);

Errors

Method: getOneProductField

Returns data about a specific product field.

function getOneProductField($id)

Parameters

Example Usage

$id = 19;

$result = $productFields->getOneProductField($id);

Errors

Method: updateAProductField

Updates a product field. See an example of updating custom fields’ values in this tutorial.

function updateAProductField($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$name = 'name';
$collect['name'] = $name;

$options = 'options';
$collect['options'] = $options;


$result = $productFields->updateAProductField($collect);

Back to List of Controllers

Class: ProductsController

Get singleton instance

The singleton instance of the ProductsController class can be accessed from the API Client.

$products = $client->getProducts();

Method: getAllProducts

Returns data about all products.

function getAllProducts($options)

Parameters

Example Usage

$userId = 19;
$collect['userId'] = $userId;

$filterId = 19;
$collect['filterId'] = $filterId;

$firstChar = 'first_char';
$collect['firstChar'] = $firstChar;

$start = 0;
$collect['start'] = $start;

$limit = 19;
$collect['limit'] = $limit;


$result = $products->getAllProducts($collect);

Method: searchProducts

Searches all Products by name, code and/or custom fields. This endpoint is a wrapper of /v1/itemSearch with a narrower OAuth scope.

function searchProducts($options)

Parameters

Example Usage

$term = 'term';
$collect['term'] = $term;

$results = $products->searchProducts($collect);

Method: addAProduct

Adds a new product to the products inventory. For more information on how to add a product, see this tutorial. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the productFields and look for 'key' values.

function addAProduct($body = null)

Parameters

Example Usage

$body = array('key' => 'value');

$products->addAProduct($body);

Method: deleteAProduct

Marks a product as deleted.

function deleteAProduct($id)

Parameters

Example Usage

$id = 19;

$products->deleteAProduct($id);

Method: getOneProduct

Returns data about a specific product.

function getOneProduct($id)

Parameters

Example Usage

$id = 19;

$products->getOneProduct($id);

Method: updateAProduct

Updates product data. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the productFields and look for 'key' values.

function updateAProduct($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$name = 'name';
$collect['name'] = $name;

$code = 'code';
$collect['code'] = $code;

$unit = 'unit';
$collect['unit'] = $unit;

$tax = 19.9144447454784;
$collect['tax'] = $tax;

$activeFlag = int::ENUM_0;
$collect['activeFlag'] = $activeFlag;

$visibleTo = int::ENUM_1;
$collect['visibleTo'] = $visibleTo;

$ownerId = 19;
$collect['ownerId'] = $ownerId;

$prices = 'prices';
$collect['prices'] = $prices;


$result = $products->updateAProduct($collect);

Method: getDealsWhereAProductIsAttachedTo

Returns data about deals that have a product attached to.

function getDealsWhereAProductIsAttachedTo($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 19;
$collect['limit'] = $limit;

$status = string::ALL_NOT_DELETED;
$collect['status'] = $status;


$result = $products->getDealsWhereAProductIsAttachedTo($collect);

Method: listFilesAttachedToAProduct

Lists files associated with a product.

function listFilesAttachedToAProduct($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 19;
$collect['limit'] = $limit;

$includeDeletedFiles = int::ENUM_0;
$collect['includeDeletedFiles'] = $includeDeletedFiles;

$sort = 'sort';
$collect['sort'] = $sort;


$products->listFilesAttachedToAProduct($collect);

Method: listFollowersOfAProduct

Lists the followers of a Product

function listFollowersOfAProduct($id)

Parameters

Example Usage

$id = 19;

$result = $products->listFollowersOfAProduct($id);

Method: addAFollowerToAProduct

Adds a follower to a product.

function addAFollowerToAProduct($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$userId = 19;
$collect['userId'] = $userId;


$result = $products->addAFollowerToAProduct($collect);

Method: deleteAFollowerFromAProduct

Deletes a follower from a product.

function deleteAFollowerFromAProduct($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$followerId = 19;
$collect['followerId'] = $followerId;


$result = $products->deleteAFollowerFromAProduct($collect);

Method: listPermittedUsers

Lists users permitted to access a product.

function listPermittedUsers($id)

Parameters

Example Usage

$id = 19;

$result = $products->listPermittedUsers($id);

Back to List of Controllers

Class: RecentsController

Get singleton instance

The singleton instance of the RecentsController class can be accessed from the API Client.

$recents = $client->getRecents();

Method: getRecents

Returns data about all recent changes occured after given timestamp.

function getRecents($options)

Parameters

Example Usage

$sinceTimestamp = 'since_timestamp';
$collect['sinceTimestamp'] = $sinceTimestamp;

$items = string::ACTIVITY;
$collect['items'] = $items;

$start = 0;
$collect['start'] = $start;

$limit = 19;
$collect['limit'] = $limit;


$recents->getRecents($collect);

Back to List of Controllers

Class: RolesController

Get singleton instance

The singleton instance of the RolesController class can be accessed from the API Client.

$roles = $client->getRoles();

Method: getAllRoles

Get all roles

function getAllRoles($options)

Parameters

Example Usage

$start = 0;
$collect['start'] = $start;

$limit = 19;
$collect['limit'] = $limit;


$result = $roles->getAllRoles($collect);

Method: addARole

Add a role

function addARole($body = null)

Parameters

Example Usage

$body = array('key' => 'value');

$result = $roles->addARole($body);

Method: deleteARole

Delete a role

function deleteARole($id)

Parameters

Example Usage

$id = 19;

$result = $roles->deleteARole($id);

Method: getOneRole

Get one role

function getOneRole($id)

Parameters

Example Usage

$id = 19;

$result = $roles->getOneRole($id);

Method: updateRoleDetails

Update role details

function updateRoleDetails($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$parentRoleId = 19;
$collect['parentRoleId'] = $parentRoleId;

$name = 'name';
$collect['name'] = $name;


$result = $roles->updateRoleDetails($collect);

Method: deleteARoleAssignment

Delete assignment from a role

function deleteARoleAssignment($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$userId = 19;
$collect['userId'] = $userId;


$result = $roles->deleteARoleAssignment($collect);

Method: listRoleAssignments

List assignments for a role

function listRoleAssignments($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 19;
$collect['limit'] = $limit;


$result = $roles->listRoleAssignments($collect);

Method: addRoleAssignment

Add assignment for a role

function addRoleAssignment($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$userId = 19;
$collect['userId'] = $userId;


$result = $roles->addRoleAssignment($collect);

Method: listRoleSubRoles

List role sub-roles

function listRoleSubRoles($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 19;
$collect['limit'] = $limit;


$result = $roles->listRoleSubRoles($collect);

Method: listRoleSettings

List role settings

function listRoleSettings($id)

Parameters

Example Usage

$id = 19;

$result = $roles->listRoleSettings($id);

Method: addOrUpdateRoleSetting

Add or update role setting

function addOrUpdateRoleSetting($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$settingKey = string::DEAL_DEFAULT_VISIBILITY;
$collect['settingKey'] = $settingKey;

$value = int::ENUM_0;
$collect['value'] = $value;


$result = $roles->addOrUpdateRoleSetting($collect);

Back to List of Controllers

Class: StagesController

Get singleton instance

The singleton instance of the StagesController class can be accessed from the API Client.

$stages = $client->getStages();

Method: deleteMultipleStagesInBulk

Marks multiple stages as deleted.

function deleteMultipleStagesInBulk($ids)

Parameters

Example Usage

$ids = 'ids';

$stages->deleteMultipleStagesInBulk($ids);

Method: getAllStages

Returns data about all stages

function getAllStages($pipelineId = null)

Parameters

Example Usage

$pipelineId = 19;

$stages->getAllStages($pipelineId);

Method: addANewStage

Adds a new stage, returns the ID upon success.

function addANewStage($body = null)

Parameters

Example Usage

$body = array('key' => 'value');

$stages->addANewStage($body);

Method: deleteAStage

Marks a stage as deleted.

function deleteAStage($id)

Parameters

Example Usage

$id = 19;

$stages->deleteAStage($id);

Method: getOneStage

Returns data about a specific stage

function getOneStage($id)

Parameters

Example Usage

$id = 19;

$stages->getOneStage($id);

Method: updateStageDetails

Updates the properties of a stage.

function updateStageDetails($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$body = array('key' => 'value');
$collect['body'] = $body;


$stages->updateStageDetails($collect);

Method: getDealsInAStage

Lists deals in a specific stage

function getDealsInAStage($options)

Parameters

Example Usage

$id = 19;
$collect['id'] = $id;

$filterId = 19;
$collect['filterId'] = $filterId;

$userId = 19;
$collect['userId'] = $userId;

$everyone = int::ENUM_0;
$collect['everyone'] = $everyone;

$start = 0;
$collect['start'] = $start;

$limit = 19;
$collect['limit'] = $limit;


$stages->getDealsInAStage($collect);

Back to List of Controllers

Class: TeamsController

Get singleton instance

The singleton instance of the TeamsController class can be accessed from the API Client.

$teams = $client->getTeams();

Method: getAllTeams

Returns data about teams within the company

function getAllTeams($options)

Parameters

Example Usage

$orderBy = string::ID;
$collect['orderBy'] = $orderBy;

$skipUsers = int::ENUM_0;
$collect['skipUsers'] = $skipUsers;


$result = $teams->getAllTeams($collect);

Method: addANewTeam

Adds a new team to the company and returns the created object

function addANewTeam($options)

Parameters

Example Usage

$name = 'name';
$collect['name'] = $name;

$managerId = 183;
$collect['managerId'] = $managerId;

$description = 'description';
$collect['description'] = $description;

$users = array(183);
$collect['users'] = $users;


$result = $teams->addANewTeam($collect);

Errors

Method: getASingleTeam

Returns data about a specific team

function getASingleTeam($options)

Parameters

Example Usage

$id = 183;
$collect['id'] = $id;

$skipUsers = int::ENUM_0;
$collect['skipUsers'] = $skipUsers;


$result = $teams->getASingleTeam($collect);

Errors

Method: updateATeam

Updates an existing team and returns the updated object

function updateATeam($options)

Parameters

Example Usage

$id = 183;
$collect['id'] = $id;

$body = array('key' => 'value');
$collect['body'] = $body;


$result = $teams->updateATeam($collect);

Errors

Method: getAllUsersInATeam

Returns list of all user IDs within a team

function getAllUsersInATeam($id)

Parameters

Example Usage

$id = 183;

$result = $teams->getAllUsersInATeam($id);

Errors

Method: addUsersToATeam

Adds users to an existing team

function addUsersToATeam($options)

Parameters

Example Usage

$id = 183;
$collect['id'] = $id;

$users = array(183);
$collect['users'] = $users;


$result = $teams->addUsersToATeam($collect);

Errors

Method: deleteUsersFromATeam

Deletes users from an existing team

function deleteUsersFromATeam($options)

Parameters

Example Usage

$id = 183;
$collect['id'] = $id;

$users = array(183);
$collect['users'] = $users;


$result = $teams->deleteUsersFromATeam($collect);

Errors

Method: getAllTeamsOfAUser

Returns data about all teams which have specified user as a member

function getAllTeamsOfAUser($options)

Parameters

Example Usage

$id = 183;
$collect['id'] = $id;

$orderBy = string::ID;
$collect['orderBy'] = $orderBy;

$skipUsers = int::ENUM_0;
$collect['skipUsers'] = $skipUsers;


$result = $teams->getAllTeamsOfAUser($collect);

Back to List of Controllers

Class: UserConnectionsController

Get singleton instance

The singleton instance of the UserConnectionsController class can be accessed from the API Client.

$userConnections = $client->getUserConnections();

Method: getAllUserConnections

Returns data about all connections for authorized user.

function getAllUserConnections()

Example Usage

$result = $userConnections->getAllUserConnections();

Errors

Back to List of Controllers

Class: UserSettingsController

Get singleton instance

The singleton instance of the UserSettingsController class can be accessed from the API Client.

$userSettings = $client->getUserSettings();

Method: listSettingsOfAuthorizedUser

Lists settings of authorized user.

function listSettingsOfAuthorizedUser()

Example Usage

$userSettings->listSettingsOfAuthorizedUser();

Back to List of Controllers

Class: UsersController

Get singleton instance

The singleton instance of the UsersController class can be accessed from the API Client.

$users = $client->getUsers();

Method: getAllUsers

Returns data about all users within the company

function getAllUsers()

Example Usage

$result = $users->getAllUsers();

Method: addANewUser

Adds a new user to the company, returns the ID upon success.

function addANewUser($options)

Parameters

Example Usage

$name = 'name';
$collect['name'] = $name;

$email = 'email';
$collect['email'] = $email;

$activeFlag = true;
$collect['activeFlag'] = $activeFlag;


$result = $users->addANewUser($collect);

Errors

Method: findUsersByName

Finds users by their name.

function findUsersByName($options)

Parameters

Example Usage

$term = 'term';
$collect['term'] = $term;

$searchByEmail = int::ENUM_0;
$collect['searchByEmail'] = $searchByEmail;


$result = $users->findUsersByName($collect);

Method: getCurrentUserData

Returns data about an authorized user within the company with bound company data: company ID, company name, and domain. Note that the 'locale' property means 'Date and number format' in the Pipedrive settings, not the chosen language.

function getCurrentUserData()

Example Usage

$result = $users->getCurrentUserData();

Errors

Method: getOneUser

Returns data about a specific user within the company

function getOneUser($id)

Parameters

Example Usage

$id = 183;

$result = $users->getOneUser($id);

Errors

Method: updateUserDetails

Updates the properties of a user. Currently, only active_flag can be updated.

function updateUserDetails($options)

Parameters

Example Usage

$id = 183;
$collect['id'] = $id;

$activeFlag = true;
$collect['activeFlag'] = $activeFlag;


$result = $users->updateUserDetails($collect);

Errors

Method: listBlacklistedEmailAddressesOfAUser

Lists blacklisted email addresses of a specific user. Blacklisted emails are such that will not get synced in to Pipedrive when using the built-in Mailbox.

function listBlacklistedEmailAddressesOfAUser($id)

Parameters

Example Usage

$id = 183;

$users->listBlacklistedEmailAddressesOfAUser($id);

Method: addBlacklistedEmailAddressForAUser

Add blacklisted email address for a specific user.

function addBlacklistedEmailAddressForAUser($options)

Parameters

Example Usage

$id = 183;
$collect['id'] = $id;

$address = 'address';
$collect['address'] = $address;


$users->addBlacklistedEmailAddressForAUser($collect);

Method: listFollowersOfAUser

Lists followers of a specific user.

function listFollowersOfAUser($id)

Parameters

Example Usage

$id = 183;

$result = $users->listFollowersOfAUser($id);

Errors

Method: listUserPermissions

List aggregated permissions over all assigned permission sets for a user

function listUserPermissions($id)

Parameters

Example Usage

$id = 183;

$users->listUserPermissions($id);

Method: deleteARoleAssignment

Delete a role assignment for a user

function deleteARoleAssignment($options)

Parameters

Example Usage

$id = 183;
$collect['id'] = $id;

$roleId = 183;
$collect['roleId'] = $roleId;


$users->deleteARoleAssignment($collect);

Method: listRoleAssignments

List role assignments for a user

function listRoleAssignments($options)

Parameters

Example Usage

$id = 183;
$collect['id'] = $id;

$start = 0;
$collect['start'] = $start;

$limit = 183;
$collect['limit'] = $limit;


$users->listRoleAssignments($collect);

Method: addRoleAssignment

Add role assignment for a user

function addRoleAssignment($options)

Parameters

Example Usage

$id = 183;
$collect['id'] = $id;

$roleId = 183;
$collect['roleId'] = $roleId;


$users->addRoleAssignment($collect);

Method: listUserRoleSettings

List settings of user's assigned role

function listUserRoleSettings($id)

Parameters

Example Usage

$id = 183;

$users->listUserRoleSettings($id);

Back to List of Controllers

Class: WebhooksController

Get singleton instance

The singleton instance of the WebhooksController class can be accessed from the API Client.

$webhooks = $client->getWebhooks();

Method: getAllWebhooks

Returns data about all webhooks of a company.

function getAllWebhooks()

Example Usage

$result = $webhooks->getAllWebhooks();

Errors

Method: createANewWebhook

Creates a new webhook and returns its details. Note that specifying an event which triggers the webhook combines 2 parameters - 'event_action' and 'event_object'. E.g., use '*.*' for getting notifications about all events, 'added.deal' for any newly added deals, 'deleted.persons' for any deleted persons, etc. See https://pipedrive.readme.io/docs/guide-for-webhooks for more details.

function createANewWebhook($options)

Parameters

Example Usage

$subscriptionUrl = 'subscription_url';
$collect['subscriptionUrl'] = $subscriptionUrl;

$eventAction = string::ENUM_0;
$collect['eventAction'] = $eventAction;

$eventObject = string::ENUM_0;
$collect['eventObject'] = $eventObject;

$userId = 183;
$collect['userId'] = $userId;

$httpAuthUser = 'http_auth_user';
$collect['httpAuthUser'] = $httpAuthUser;

$httpAuthPassword = 'http_auth_password';
$collect['httpAuthPassword'] = $httpAuthPassword;


$result = $webhooks->createANewWebhook($collect);

Errors

Method: deleteExistingWebhook

Deletes the specified webhook.

function deleteExistingWebhook($id)

Parameters

Example Usage

$id = 183;

$result = $webhooks->deleteExistingWebhook($id);

Errors

Back to List of Controllers