Download the PHP package crashingberries/pipedrive without Composer

On this page you can find all versions of the php package crashingberries/pipedrive. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pipedrive

Pipedrive client for PHP based apps

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:

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

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

With OAuth 2

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

Parameter Description
oAuthClientId OAuth 2 Client ID
oAuthClientSecret OAuth 2 Client Secret
oAuthRedirectUri OAuth 2 Redirection endpoint or Callback Uri

API client can be initialized as following:

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.

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:

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

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.

Refreshing token

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

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:

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.

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:

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

authcallback.php

Contributing

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 class can be accessed from the API Client.

Method: deleteMultipleActivitiesInBulk

Marks multiple activities as deleted.

Parameters

Parameter Tags Description
ids Comma-separated IDs that will be deleted

Example Usage

Method: getAllActivitiesAssignedToAParticularUser

Returns all activities assigned to a particular user.

Parameters

Parameter Tags Description
userId ID of the user whose activities will be fetched. If omitted, the user associated with the API token will be used. If 0, activities for all company users will be fetched based on the permission sets.
filterId ID of the filter to use (will narrow down results if used together with user_id parameter).
type Type of the activity, can be one type or multiple types separated by a comma. This is in correlation with the key_string parameter of ActivityTypes.
start Pagination start
limit Items shown per page
startDate Date in format of YYYY-MM-DD from which activities to fetch from.
endDate Date in format of YYYY-MM-DD until which activities to fetch to.
done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted returns both Done and Not done activities.

Example Usage

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.

Parameters

Parameter Tags Description
subject Subject of the activity
type Type of the activity. This is in correlation with the key_string parameter of ActivityTypes.
done TODO: Add a parameter description
dueDate Due date of the activity. Format: YYYY-MM-DD
dueTime Due time of the activity in UTC. Format: HH:MM
duration Duration of the activity. Format: HH:MM
userId ID of the user whom the activity will be assigned to. If omitted, the activity will be assigned to the authorized user.
dealId ID of the deal this activity will be associated with
personId ID of the person this activity will be associated with
participants List of multiple persons (participants) this activity will be associated with. If omitted, single participant from person_id field is used. It requires a structure as follows: [{"person_id":1,"primary_flag":true}]
orgId ID of the organization this activity will be associated with
note Note of the activity (HTML format)

Example Usage

Method: deleteAnActivity

Deletes an activity.

Parameters

Parameter Tags Description
id ID of the activity

Example Usage

Method: getDetailsOfAnActivity

Returns details of a specific activity.

Parameters

Parameter Tags Description
id ID of the activity

Example Usage

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).

Parameters

Parameter Tags Description
id ID of the activity
subject Subject of the activity
type Type of the activity. This is in correlation with the key_string parameter of ActivityTypes.
done TODO: Add a parameter description
dueDate Due date of the activity. Format: YYYY-MM-DD
dueTime Due time of the activity in UTC. Format: HH:MM
duration Duration of the activity. Format: HH:MM
userId ID of the user whom the activity will be assigned to. If omitted, the activity will be assigned to the authorized user.
dealId ID of the deal this activity will be associated with
personId ID of the person this activity will be associated with
participants List of multiple persons (participants) this activity will be associated with. If omitted, single participant from person_id field is used. It requires a structure as follows: [{"person_id":1,"primary_flag":true}]
orgId ID of the organization this activity will be associated with
note Note of the activity (HTML format)

Example Usage

Back to List of Controllers

Class: ActivityFieldsController

Get singleton instance

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

Method: getAllFieldsForAnActivity

Return list of all fields for activity

Example Usage

Back to List of Controllers

Class: ActivityTypesController

Get singleton instance

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

Method: deleteMultipleActivityTypesInBulk

Marks multiple activity types as deleted.

Parameters

Parameter Tags Description
ids Comma-separated activity type IDs to delete

Example Usage

Method: getAllActivityTypes

Returns all activity types

Example Usage

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.

Parameters

Parameter Tags Description
name Name of the activity type
iconKey Icon graphic to use for representing this activity type.
color A designated color for the activity type in 6-character HEX format (e.g. FFFFFF for white, 000000 for black).

Example Usage

Method: deleteAnActivityType

Marks an activity type as deleted.

Parameters

Parameter Tags Description
id ID of the activity type

Example Usage

Method: updateEditActivityType

Updates an activity type.

Parameters

Parameter Tags Description
id ID of the activity type
name Name of the activity type
iconKey Icon graphic to use for representing this activity type.
color A designated color for the activity type in 6-character HEX format (e.g. FFFFFF for white, 000000 for black).
orderNr An order number for this activity type. Order numbers should be used to order the types in the activity type selections.

Example Usage

Back to List of Controllers

Class: CallLogsController

Get singleton instance

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

Method: getAllCallLogsAssignedToAParticularUser

Returns all call logs assigned to a particular user

Parameters

Parameter Tags Description
start For pagination, the position that represents the first result for the page
limit For pagination, the limit of entries to be returned

Example Usage

Method: getDetailsOfACallLog

Returns details of a specific call log

Parameters

Parameter Tags Description
id ID of the field

Example Usage

Method: addACallLog

Adds a new call log

Parameters

Parameter Tags Description
user_id The ID of the owner of the call log
activity_id If specified, this activity will be converted into a call log, with the information provided. When this field is used, you don't need to specify deal_id, person_id or org_id, as they will be ignored in favor of the values already available in the activity.
subject Name of the activity this call is attached to
duration Call duration in seconds
outcome Describes the outcome of the call
from_phone_number The number that made the call
to_phone_number The number called
start_time The date and time of the start of the call in UTC. Format: YYYY-MM-DD HH:MM:SS.
end_time The date and time of the end of the call in UTC. Format: YYYY-MM-DD HH:MM:SS.
person_id The ID of the Person this call is associated with
org_id The ID of the Organization this call is associated with
deal_id The ID of the Deal this call is associated with

Example Usage

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.

Parameters

Parameter Tags Description
id The ID received when you create the call log
file Audio file supported by the HTML5 specification
mime_type The mime type of the file, according to html5 standards (eg.: audio/wave for a .wav file )

Example Usage

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.

Parameters

Parameter Tags Description
id ID of the callLog

Example Usage

Back to List of Controllers

Class: CurrenciesController

Get singleton instance

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

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.

Parameters

Parameter Tags Description
term Optional search term that is searched for from currency's name and/or code.

Example Usage

Back to List of Controllers

Class: DealFieldsController

Get singleton instance

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

Method: deleteMultipleDealFieldsInBulk

Marks multiple fields as deleted.

Parameters

Parameter Tags Description
ids Comma-separated field IDs to delete

Example Usage

Method: getAllDealFields

Returns data about all fields deals can have

Parameters

Parameter Tags Description
start Pagination start
limit Items shown per page

Example Usage

Method: addANewDealField

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

Parameters

Parameter Tags Description
body TODO: Add a parameter description

Example Usage

Method: deleteADealField

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

Parameters

Parameter Tags Description
id ID of the field

Example Usage

Method: getOneDealField

Returns data about a specific deal field.

Parameters

Parameter Tags Description
id ID of the field

Example Usage

Method: updateADealField

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

Parameters

Parameter Tags Description
id ID of the field
name Name of the field
options When field_type is either set or enum, possible options must be supplied as a JSON-encoded sequential array, for example: ["red","blue","lilac"]

Example Usage

Back to List of Controllers

Class: DealsController

Get singleton instance

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

Method: deleteMultipleDealsInBulk

Marks multiple deals as deleted.

Parameters

Parameter Tags Description
ids Comma-separated IDs that will be deleted

Example Usage

Method: getAllDeals

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

Parameters

Parameter Tags Description
userId If supplied, only deals matching the given user will be returned.
filterId ID of the filter to use
stageId If supplied, only deals within the given stage will be returned.
status Only fetch deals with specific status. If omitted, all not deleted deals are fetched.
start Pagination start
limit Items shown per page
sort Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys).
ownedByYou When supplied, only deals owned by you are returned. However filter_id takes precedence over owned_by_you when both are supplied.

Example Usage

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.

Parameters

Parameter Tags Description
term The search term to look for. Minimum 2 characters (or 1 if using exact_match).
fields Optional A comma-separated string array. The fields to perform the search from. Defaults to all of them.
exactMatch Optional When enabled, only full exact matches against the given term are returned. It is not case sensitive.
personId Optional Will filter Deals by the provided Person ID. The upper limit of found Deals associated with the Person is 2000.
organizationId Optional Will filter Deals by the provided Organization ID. The upper limit of found Deals associated with the Organization is 2000.
status Optional Will filter Deals by the provided specific status. open = Open, won = Won, lost = Lost. The upper limit of found Deals associated with the status is 2000.
includeFields Optional Supports including optional fields in the results which are not provided by default.
start Optional Pagination start. Note that the pagination is based on main results and does not include related items when using search_for_related_items parameter.
limit Optional Items shown per page

Example Usage

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.

Parameters

Parameter Tags Description
body Optional TODO: Add a parameter description

Example Usage

Method: getDealsSummary

Returns summary of all the deals.

Parameters

Parameter Tags Description
status Optional Only fetch deals with specific status. open = Open, won = Won, lost = Lost
filterId Optional user_id will not be considered. Only deals matching the given filter will be returned.
userId Optional Only deals matching the given user will be returned. user_id will not be considered if you use filter_id.
stageId Optional Only deals within the given stage will be returned.

Example Usage

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.

Parameters

Parameter Tags Description
startDate Required Date where first interval starts. Format: YYYY-MM-DD
interval Required Type of interval.
day
Day
week
A full week (7 days) starting from start_date
month
A full month (depending on the number of days in given month) starting from start_date
quarter
A full quarter (3 months) starting from start_date
amount Required Number of given intervals, starting from start_date, to fetch. E.g. 3 (months).
fieldKey Required The name of the date field by which to get deals by.
userId Optional If supplied, only deals matching the given user will be returned.
pipelineId Optional If supplied, only deals matching the given pipeline will be returned.
filterId Optional If supplied, only deals matching the given filter will be returned.
excludeDeals Optional Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned.
totalsConvertCurrency Optional 3-letter currency code of any of the supported currencies. When supplied, totals_converted is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to 'default_currency' in which case users default currency is used.

Example Usage

Method: deleteADeal

Marks a deal as deleted.

Parameters

Parameter Tags Description
id Required ID of the deal

Example Usage

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.

Parameters

Parameter Tags Description
id Required ID of the deal

Example Usage

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.

Parameters

Parameter Tags Description
id Required ID of the deal
title Optional Deal title
value Optional Value of the deal. If omitted, value will be set to 0.
currency Optional Currency of the deal. Accepts a 3-character currency code. If omitted, currency will be set to the default currency of the authorized user.
user_id Optional ID of the user who will be marked as the owner of this deal. If omitted, the authorized user ID will be used.
person_id Optional ID of the person this deal will be associated with
org_id Optional ID of the organization this deal will be associated with
stage_id Optional ID of the stage this deal will be placed in a pipeline (note that you can't supply the ID of the pipeline as this will be assigned automatically based on stage_id). If omitted, the deal will be placed in the first stage of the default pipeline.
status Optional open = Open, won = Won, lost = Lost, deleted = Deleted. If omitted, status will be set to open.
expected_close_date Optional The expected close date of the Deal. In ISO 8601 format: YYYY-MM-DD.
probability Optional Deal success probability percentage. Used/shown only when deal_probability for the pipeline of the deal is enabled.
lost_reason Optional Optional message about why the deal was lost (to be used when status=lost)
visible_to Optional Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.
1
Owner & followers (private)
3
Entire company (shared)

Example Usage

Method: listActivitiesAssociatedWithADeal

Lists activities associated with a deal.

Parameters

Parameter Tags Description
id Required ID of the deal
start Optional DefaultValue Pagination start
limit Optional Items shown per page
done Optional Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted returns both Done and Not done activities.
exclude Optional A comma-separated string of activity IDs to exclude from result

Example Usage

Method: createDuplicateDeal

Duplicate a deal

Parameters

Parameter Tags Description
id Required ID of the deal

Example Usage

Method: listFilesAttachedToADeal

Lists files associated with a deal.

Parameters

Parameter Tags Description
id Required ID of the deal
start Optional DefaultValue Pagination start
limit Optional Items shown per page
includeDeletedFiles Optional When enabled, the list of files will also include deleted files. Please note that trying to download these files will not work.
sort Optional Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys). Supported fields: id, user_id, deal_id, person_id, org_id, product_id, add_time, update_time, file_name, file_type, file_size, comment.

Example Usage

Method: listUpdatesAboutADeal

Lists updates about a deal.

Parameters

Parameter Tags Description
id Required ID of the deal
start Optional DefaultValue Pagination start
limit Optional Items shown per page

Example Usage

Method: listFollowersOfADeal

Lists the followers of a deal.

Parameters

Parameter Tags Description
id Required ID of the deal

Example Usage

Method: addAFollowerToADeal

Adds a follower to a deal.

Parameters

Parameter Tags Description
id Required ID of the deal
userId Required ID of the user

Example Usage

Method: deleteAFollowerFromADeal

Deletes a follower from a deal.

Parameters

Parameter Tags Description
id Required ID of the deal
followerId Required ID of the follower

Example Usage

Method: listMailMessagesAssociatedWithADeal

Lists mail messages associated with a deal.

Parameters

Parameter Tags Description
id Required ID of the deal
start Optional DefaultValue Pagination start
limit Optional Items shown per page

Example Usage

Method: updateMergeTwoDeals

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

Parameters

Parameter Tags Description
id Required ID of the deal
mergeWithId Required ID of the deal that the deal will be merged with

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

Parameter Tags Description
id Required ID of the deal
start Optional DefaultValue Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
id Required ID of the deal
personId Required ID of the person

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

Parameter Tags Description
id Required ID of the deal
dealParticipantId Required ID of the deal participant

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

Parameter Tags Description
id Required ID of the deal

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

Parameter Tags Description
id Required ID of the deal
start Optional DefaultValue Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
id Required ID of the deal
start Optional DefaultValue Pagination start
limit Optional Items shown per page
includeProductData Optional Whether to fetch product data along with each attached product (1) or not (0, default).

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

Parameter Tags Description
id Required ID of the deal
body Optional TODO: Add a parameter description

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

Parameter Tags Description
id Required ID of the deal
productAttachmentId Required ID of the deal-product (the ID of the product attached to the deal)
itemPrice Optional Price at which this product will be added to the deal
quantity Optional Quantity – e.g. how many items of this product will be added to the deal
discountPercentage Optional Discount %. If omitted, will be set to 0
duration Optional Duration of the product (when product durations are not enabled for the company or if omitted, defaults to 1)
productVariationId Optional ID of the product variation to use. When omitted, no variation will be used.
comments Optional Any textual comment associated with this product-deal attachment. Visible and editable in the application UI.
enabledFlag Optional Whether the product is enabled on the deal or not. This makes it possible to add products to a deal with specific price and discount criteria - but keep them disabled, which refrains them from being included in deal price calculation. When omitted, the product will be marked as enabled by default.

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

Parameter Tags Description
id Required ID of the deal
productAttachmentId Required Product attachment ID. This is returned as product_attachment_id after attaching a product to a deal or as id when listing the products attached to a deal.

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

Parameter Tags Description
start Optional DefaultValue Pagination start
limit Optional Items shown per page
includeDeletedFiles Optional When enabled, the list of files will also include deleted files. Please note that trying to download these files will not work.
sort Optional Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys). Supported fields: id, user_id, deal_id, person_id, org_id, product_id, add_time, update_time, file_name, file_type, file_size, comment.

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

Parameter Tags Description
file Required A single file, supplied in the multipart/form-data encoding and contained within the given boundaries.
dealId Optional ID of the deal to associate file(s) with
personId Optional ID of the person to associate file(s) with
orgId Optional ID of the organization to associate file(s) with
productId Optional ID of the product to associate file(s) with
activityId Optional ID of the activity to associate file(s) with
noteId Optional ID of the note to associate file(s) with

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

Parameter Tags Description
fileType Required The file type
title Required The title of the file
itemType Required The item type
itemId Required ID of the item to associate the file with
remoteLocation Required The location type to send the file to. Only googledrive is supported at the moment.

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

Parameter Tags Description
itemType Required The item type
itemId Required ID of the item to associate the file with
remoteId Required The remote item id
remoteLocation Required The location type to send the file to. Only googledrive is supported at the moment.

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

Parameter Tags Description
id Required ID of the file

Example Usage

$id = 27;

$files->deleteAFile($id);

Method: getOneFile

Returns data about a specific file.

function getOneFile($id)

Parameters

Parameter Tags Description
id Required ID of the file

Example Usage

$id = 27;

$files->getOneFile($id);

Method: updateFileDetails

Updates the properties of a file.

function updateFileDetails($options)

Parameters

Parameter Tags Description
id Required ID of the file
name Optional Visible name of the file
description Optional Description of the file

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

Parameter Tags Description
id Required ID of the file

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

Parameter Tags Description
ids Required Comma-separated filter IDs to delete

Example Usage

$ids = 'ids';

$filters->deleteMultipleFiltersInBulk($ids);

Method: getAllFilters

Returns data about all filters

function getAllFilters($type = null)

Parameters

Parameter Tags Description
type Optional Types of filters to fetch

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

Parameter Tags Description
name Required Filter name
conditions Required Filter conditions as a JSON object. It requires a minimum structure as follows: {"glue":"and","conditions":[{"glue":"and","conditions": [CONDITION_OBJECTS]},{"glue":"or","conditions":[CONDITION_OBJECTS]}]}. Replace CONDITION_OBJECTS with JSON objects of the following structure: {"object":"","field_id":"", "operator":"","value":"", "extra_value":""} or leave the array empty. Depending on the object type you should use another API endpoint to get field_id. There are five types of objects you can choose from: "person", "deal", "organization", "product", "activity" and you can use these types of operators depending on what type of a field you have: "IS NOT NULL", "IS NULL", "<=", ">=", "<", ">", "!=", "=", "LIKE '%$%'", "NOT LIKE '%$%'", "LIKE '$%'", "NOT LIKE '$%'", "LIKE '%$'", "NOT LIKE '%$'". To get a better understanding of how filters work try creating them directly from the Pipedrive application.
type Required Type of filter to create.

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 this tutorial.

function getAllFilterHelpers()

Example Usage


$filters->getAllFilterHelpers();

Method: deleteAFilter

Marks a filter as deleted.

function deleteAFilter($id)

Parameters

Parameter Tags Description
id Required ID of the filter

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

Parameter Tags Description
id Required ID of the filter

Example Usage

$id = 27;

$filters->getOneFilter($id);

Method: updateFilter

Updates existing filter.

function updateFilter($options)

Parameters

Parameter Tags Description
id Required ID of the filter
conditions Required Filter conditions as a JSON object. It requires a minimum structure as follows: {"glue":"and","conditions":[{"glue":"and","conditions": [CONDITION_OBJECTS]},{"glue":"or","conditions":[CONDITION_OBJECTS]}]}. Replace CONDITION_OBJECTS with JSON objects of the following structure: {"object":"","field_id":"", "operator":"","value":"", "extra_value":""} or leave the array empty. Depending on the object type you should use another API endpoint to get field_id. There are five types of objects you can choose from: "person", "deal", "organization", "product", "activity" and you can use these types of operators depending on what type of a field you have: "IS NOT NULL", "IS NULL", "<=", ">=", "<", ">", "!=", "=", "LIKE '%$%'", "NOT LIKE '%$%'", "LIKE '$%'", "NOT LIKE '$%'", "LIKE '%$'", "NOT LIKE '%$'". To get a better understanding of how filters work try creating them directly from the Pipedrive application.
name Optional Filter name

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

Parameter Tags Description
limit Optional DefaultValue Number of messages to get from 1 to 100. The message number 1 is returned by default.

Example Usage

$limit = 1;

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

Method: deleteDismissAGlobalMessage

Removes global message from being shown, if message is dismissible

function deleteDismissAGlobalMessage($id)

Parameters

Parameter Tags Description
id Required ID of global message to be dismissed.

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

Parameter Tags Description
body Optional TODO: Add a parameter description

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

Parameter Tags Description
typeName Optional Type of the goal. If provided, everyone's goals will be returned.
title Optional Title of the goal.
isActive Optional DefaultValue Whether goal is active or not.
assigneeId Optional ID of the user who's goal to fetch. When omitted, only your goals will be returned.
assigneeType Optional Type of the goal's assignee. If provided, everyone's goals will be returned.
expectedOutcomeTarget Optional Numeric value of the outcome. If provided, everyone's goals will be returned.
expectedOutcomeTrackingMetric Optional Tracking metric of the expected outcome of the goal. If provided, everyone's goals will be returned.
expectedOutcomeCurrencyId Optional | Numeric ID of the goal's currency. Only applicable to goals with expected_outcome.tracking_metric with value sum. If provided, everyone's goals will be returned.
typeParamsPipelineId Optional | ID of the pipeline or null for all pipelines. If provided, everyone's goals will be returned.
typeParamsStageId Optional | ID of the stage. Applicable to only deals_progressed type of goals. If provided, everyone's goals will be returned.
typeParamsActivityTypeId Optional | ID of the activity type. Applicable to only activities_completed or activities_added types of goals. If provided, everyone's goals will be returned.
periodStart Optional | Start date of the period for which to find goals. Date in format of YYYY-MM-DD. When period.start is provided, period.end must be provided too.
periodEnd Optional End date of the period for which to find goals. Date in format of YYYY-MM-DD.

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

Parameter Tags Description
id Required ID of the goal to be updated.
title Optional Title of the goal.
assignee Optional | Who is this goal assigned to. It requires the following JSON structure: { "id": "1", "type": "person" }. type can be either person, company or team. ID of the assignee person, company or team.
type Optional | Type of the goal. It requires the following JSON structure: { "name": "deals_started", "params": { "pipeline_id": 1 } }. Type can be one of: deals_won,deals_progressed,activities_completed,activities_added or deals_started. params can include pipeline_id, stage_id or activity_type_id. stage_id is related to only deals_progressed type of goals and activity_type_id to activities_completed or activities_added types of goals. To track goal in all pipelines set pipeline_id as null.
expectedOutcome Optional | Expected outcome of the goal. Expected outcome can be tracked either by quantity or by sum. It requires the following JSON structure: { "target": "50", "tracking_metric": "quantity" } or { "target": "50", "tracking_metric": "sum", "currency_id": 1 }. currency_id should only be added to sum type of goals.
duration Optional Date when the goal starts and ends. It requires the following JSON structure: { "start": "2019-01-01", "end": "2022-12-31" }. Date in format of YYYY-MM-DD.
interval Optional Date when the goal starts and ends. It requires the following JSON structure: { "start": "2019-01-01", "end": "2022-12-31" }. Date in format of YYYY-MM-DD.

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

Parameter Tags Description
id Required ID of the goal to be deleted.

Example Usage

$id = 'id';

$goals->deleteExistingGoal($id);

Method: getResultOfAGoal

Gets progress of a goal for specified period.

function getResultOfAGoal($options)

Parameters

Parameter Tags Description
id Required ID of the goal that the results are looked for.
periodStart Required Start date of the period for which to find progress of a goal. Date in format of YYYY-MM-DD.
periodEnd Required End date of the period for which to find progress of a goal. Date in format of YYYY-MM-DD.

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

Parameter Tags Description
term Required Search term to look for, minimum 2 characters.
itemTypes Optional A comma-separated string array. The type of items to perform the search from. Defaults to all.
fields Optional A comma-separated string array. The fields to perform the search from. Defaults to all.
searchForRelatedItems Optional When enabled, the response will include up to 100 newest related Leads and 100 newest related Deals for each found Person and Organization and up to 100 newest related Persons for each found Organization.
exactMatch Optional When enabled, only full exact matches against the given term are returned. It is not case sensitive.
includeFields Optional A comma-separated string array. Supports including optional fields in the results which are not provided by default.
start Optional Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
term Required The search term to look for. Minimum 2 characters (or 1 if using exact_match).
fieldType Required The type of the field to perform the search from
fieldKey Required The key of the field to search from. The field key can be obtained by fetching the list of the fields using any of the fields' API GET methods (dealFields, personFields, etc.).
exactMatch Optional When enabled, only full exact matches against the given term are returned. The search is case sensitive.
returnItemIds Optional Whether to return the IDs of the matching items or not. When not set or set to 0 or false, only distinct values of the searched field are returned. When set to 1 or true, the ID of each found item is returned.
start Optional Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
id Required ID of the mail message to fetch.
includeBody Optional Whether to include full message body or not. 0 = Don't include, 1 = Include

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

Parameter Tags Description
folder Required DefaultValue Type of folder to fetch.
start Optional DefaultValue Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
id Required ID of the mail thread

Example Usage

$id = 27;

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

Method: getOneMailThread

Returns specific mail thread.

function getOneMailThread($id)

Parameters

Parameter Tags Description
id Required ID of the mail thread

Example Usage

$id = 27;

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

Method: updateMailThreadDetails

Updates the properties of a mail thread.

function updateMailThreadDetails($options)

Parameters

Parameter Tags Description
id Required ID of the mail thread
dealId Optional ID of the deal this thread is associated with
sharedFlag Optional TODO: Add a parameter description
readFlag Optional TODO: Add a parameter description
archivedFlag Optional TODO: Add a parameter description

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

Parameter Tags Description
id Required ID of the mail thread

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

Parameter Tags Description
userId Optional ID of the user whose notes to fetch. If omitted, notes by all users will be returned.
leadId Optional ID of the lead which notes to fetch. If omitted, notes about all leads will be returned.
dealId Optional ID of the deal which notes to fetch. If omitted, notes about all deals will be returned.
personId Optional ID of the person whose notes to fetch. If omitted, notes about all persons will be returned.
orgId Optional ID of the organization which notes to fetch. If omitted, notes about all organizations will be returned.
start Optional DefaultValue Pagination start
limit Optional Items shown per page
sort Optional Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys). Supported fields: id, user_id, deal_id, person_id, org_id, content, add_time, update_time.
startDate Optional Date in format of YYYY-MM-DD from which notes to fetch from.
endDate Optional Date in format of YYYY-MM-DD until which notes to fetch to.
pinnedToLeadlFlag Optional If set, then results are filtered by note to lead pinning state.
pinnedToDealFlag Optional If set, then results are filtered by note to deal pinning state.
pinnedToOrganizationFlag Optional If set, then results are filtered by note to organization pinning state.
pinnedToPersonFlag Optional If set, then results are filtered by note to person pinning state.

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

Parameter Tags Description
content Required Content of the note in HTML format. Subject to sanitization on the back-end.
userId Optional ID of the user who will be marked as the author of this note. Only an admin can change the author.
leadId Optional ID of the lead the note will be attached to.
dealId Optional ID of the deal the note will be attached to.
personId Optional ID of the person this note will be attached to.
orgId Optional ID of the organization this note will be attached to.
addTime Optional Optional creation date & time of the Note in UTC. Can be set in the past or in the future. Requires admin user API token. Format: YYYY-MM-DD HH:MM:SS
pinnedToLeadFlag Optional If set, then results are filtered by note to lead pinning state (lead_id is also required).
pinnedToDealFlag Optional If set, then results are filtered by note to deal pinning state (deal_id is also required).
pinnedToOrganizationFlag Optional If set, then results are filtered by note to organization pinning state (org_id is also required).
pinnedToPersonFlag Optional If set, then results are filtered by note to person pinning state (person_id is also required).

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

Parameter Tags Description
id Required ID of the note

Example Usage

$id = 69;

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

Method: getOneNote

Returns details about a specific note.

function getOneNote($id)

Parameters

Parameter Tags Description
id Required ID of the note

Example Usage

$id = 69;

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

Method: updateANote

Updates a note.

function updateANote($options)

Parameters

Parameter Tags Description
id Required ID of the note
content Required Content of the note in HTML format. Subject to sanitization on the back-end.
userId Optional ID of the user who will be marked as the author of this note. Only an admin can change the author.
leadId Optional ID of the lead the note will be attached to.
dealId Optional ID of the deal the note will be attached to.
personId Optional ID of the person this note will be attached to.
orgId Optional ID of the organization this note will be attached to.
addTime Optional Optional creation date & time of the Note in UTC. Can be set in the past or in the future. Requires admin user API token. Format: YYYY-MM-DD HH:MM:SS
pinnedToLeadFlag Optional If set, then results are filtered by note to lead pinning state (lead_id is also required).
pinnedToDealFlag Optional If set, then results are filtered by note to deal pinning state (deal_id is also required).
pinnedToOrganizationFlag Optional If set, then results are filtered by note to organization pinning state (org_id is also required).
pinnedToPersonFlag Optional If set, then results are filtered by note to person pinning state (person_id is also required).

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

Parameter Tags Description
ids Required Comma-separated field IDs to delete

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

Parameter Tags Description
body Optional TODO: Add a parameter description

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

Parameter Tags Description
id Required ID of the field

Example Usage

$id = 69;

$organizationFields->deleteAnOrganizationField($id);

Method: getOneOrganizationField

Returns data about a specific organization field.

function getOneOrganizationField($id)

Parameters

Parameter Tags Description
id Required ID of the field

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

Parameter Tags Description
id Required ID of the field
name Required Name of the field
options Optional When field_type is either set or enum, possible options must be supplied as a JSON-encoded sequential array of objects. All active items must be supplied and already existing items must have their ID supplied. New items only require a label. Example: [{"id":123,"label":"Existing Item"},{"label":"New Item"}]

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

Parameter Tags Description
orgId Required ID of the organization to get relationships for

Example Usage

$orgId = 69;

$organizationRelationships->getAllRelationshipsForOrganization($orgId);

Method: createAnOrganizationRelationship

Creates and returns an organization relationship.

function createAnOrganizationRelationship($body = null)

Parameters

Parameter Tags Description
body Optional TODO: Add a parameter description

Example Usage

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

$organizationRelationships->createAnOrganizationRelationship($body);

Method: deleteAnOrganizationRelationship

Deletes an organization relationship and returns the deleted id.

function deleteAnOrganizationRelationship($id)

Parameters

Parameter Tags Description
id Required ID of the organization relationship

Example Usage

$id = 69;

$organizationRelationships->deleteAnOrganizationRelationship($id);

Method: getOneOrganizationRelationship

Finds and returns an organization relationship from its ID.

function getOneOrganizationRelationship($options)

Parameters

Parameter Tags Description
id Required ID of the organization relationship
orgId Optional ID of the base organization for the returned calculated values

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

Parameter Tags Description
id Required ID of the organization relationship
orgId Optional ID of the base organization for the returned calculated values
type Optional The type of organization relationship.
relOwnerOrgId Optional The owner of this relationship. If type is 'parent', then the owner is the parent and the linked organization is the daughter.
relLinkedOrgId Optional The linked organization in this relationship. If type is 'parent', then the linked organization is the daughter.

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

Parameter Tags Description
ids Required Comma-separated IDs that will be deleted

Example Usage

$ids = 'ids';

$organizations->deleteMultipleOrganizationsInBulk($ids);

Method: getAllOrganizations

Returns all organizations

function getAllOrganizations($options)

Parameters

Parameter Tags Description
userId Optional If supplied, only organizations owned by the given user will be returned.
filterId Optional ID of the filter to use
firstChar Optional If supplied, only organizations whose name starts with the specified letter will be returned (case insensitive).
start Optional DefaultValue Pagination start
limit Optional Items shown per page
sort Optional Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys).

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

Parameter Tags Description
term Required The search term to look for. Minimum 2 characters (or 1 if using exact_match).
fields Optional A comma-separated string array. The fields to perform the search from. Defaults to all of them.
exactMatch Optional When enabled, only full exact matches against the given term are returned. It is not case sensitive.
start Optional Pagination start. Note that the pagination is based on main results and does not include related items when using search_for_related_items parameter.
limit Optional Items shown per page

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

Parameter Tags Description
body Optional TODO: Add a parameter description

Example Usage

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

$organizations->addAnOrganization($body);

Method: deleteAnOrganization

Marks an organization as deleted.

function deleteAnOrganization($id)

Parameters

Parameter Tags Description
id Required ID of the organization

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

Parameter Tags Description
id Required ID of the organization

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

Parameter Tags Description
id Required ID of the organization
name Optional Organization name
ownerId Optional ID of the user who will be marked as the owner of this organization. When omitted, the authorized user ID will be used.
visibleTo Optional Visibility of the organization. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.<dl class=\"fields-list\">
1
Owner & followers (private)
3
Entire company (shared)

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

Parameter Tags Description
id Required ID of the organization
start Optional DefaultValue Pagination start
limit Optional Items shown per page
done Optional Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted returns both Done and Not done activities.
exclude Optional A comma-separated string of activity IDs to exclude from result

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

Parameter Tags Description
id Required ID of the organization
start Optional DefaultValue Pagination start
limit Optional Items shown per page
status Optional DefaultValue Only fetch deals with specific status. If omitted, all not deleted deals are fetched.
sort Optional Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys).
onlyPrimaryAssociation Optional If set, only deals that are directly associated to the organization are fetched. If not set (default), all deals are fetched that are either directly or indirectly related to the organization. Indirect relations include relations through custom, organization-type fields and through persons of the given organization.

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

Parameter Tags Description
id Required ID of the organization
start Optional DefaultValue Pagination start
limit Optional Items shown per page
includeDeletedFiles Optional When enabled, the list of files will also include deleted files. Please note that trying to download these files will not work.
sort Optional Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys). Supported fields: id, user_id, deal_id, person_id, org_id, product_id, add_time, update_time, file_name, file_type, file_size, comment.

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

Parameter Tags Description
id Required ID of the organization
start Optional DefaultValue Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
id Required ID of the organization

Example Usage

$id = 69;

$organizations->listFollowersOfAnOrganization($id);

Method: addAFollowerToAnOrganization

Adds a follower to an organization.

function addAFollowerToAnOrganization($options)

Parameters

Parameter Tags Description
id Required ID of the organization
userId Required ID of the user

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

Parameter Tags Description
id Required ID of the organization
followerId Required ID of the follower

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

Parameter Tags Description
id Required ID of the organization
start Optional DefaultValue Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
id Required ID of the organization
mergeWithId Required ID of the organization that the organization will be merged with

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

Parameter Tags Description
id Required ID of the organization

Example Usage

$id = 69;

$organizations->listPermittedUsers($id);

Method: listPersonsOfAnOrganization

Lists persons associated with an organization.

function listPersonsOfAnOrganization($options)

Parameters

Parameter Tags Description
id Required ID of the organization
start Optional DefaultValue Pagination start
limit Optional Items shown per page

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

Error Code Error Description
404 If the User ID has no assignments, then it will return NotFound

Method: getOnePermissionSet

Get one Permission Set

function getOnePermissionSet($id)

Parameters

Parameter Tags Description
id Required ID of the permission set

Example Usage

$id = 69;

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

Errors

Error Code Error Description
404 If the User ID has no assignments, then it will return NotFound

Method: listPermissionSetAssignments

The list of assignments for a Permission Set

function listPermissionSetAssignments($options)

Parameters

Parameter Tags Description
id Required ID of the permission set
start Optional DefaultValue Pagination start
limit Optional Items shown per page

Example Usage

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

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

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

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

Errors

Error Code Error Description
404 If the User ID has no assignments, then it will return NotFound

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

Parameter Tags Description
ids Required Comma-separated field IDs to delete

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

Parameter Tags Description
body Optional TODO: Add a parameter description

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

Parameter Tags Description
id Required ID of the field

Example Usage

$id = 69;

$personFields->deleteAPersonField($id);

Method: getOnePersonField

Returns data about a specific person field.

function getOnePersonField($id)

Parameters

Parameter Tags Description
id Required ID of the field

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

Parameter Tags Description
id Required ID of the field
name Required Name of the field
options Optional When field_type is either set or enum, possible options must be supplied as a JSON-encoded sequential array of objects. All active items must be supplied and already existing items must have their ID supplied. New items only require a label. Example: [{"id":123,"label":"Existing Item"},{"label":"New Item"}]

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

Parameter Tags Description
ids Optional Comma-separated IDs that will be deleted

Example Usage

$ids = 'ids';

$persons->deleteMultiplePersonsInBulk($ids);

Method: getAllPersons

Returns all persons

function getAllPersons($options)

Parameters

Parameter Tags Description
userId Optional If supplied, only persons owned by the given user will be returned.
filterId Optional ID of the filter to use.
firstChar Optional If supplied, only persons whose name starts with the specified letter will be returned (case insensitive).
start Optional DefaultValue Pagination start
limit Optional Items shown per page
sort Optional Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys).

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

Parameter Tags Description
term Required The search term to look for. Minimum 2 characters (or 1 if using exact_match).
fields Optional A comma-separated string array. The fields to perform the search from. Defaults to all of them.
exactMatch Optional When enabled, only full exact matches against the given term are returned. It is not case sensitive.
organizationId Optional Will filter Deals by the provided Organization ID. The upper limit of found Deals associated with the Organization is 2000.
includeFields Optional Supports including optional fields in the results which are not provided by default.
start Optional Pagination start. Note that the pagination is based on main results and does not include related items when using search_for_related_items parameter.
limit Optional Items shown per page

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

Parameter Tags Description
body Optional TODO: Add a parameter description

Example Usage

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

$persons->addAPerson($body);

Method: deleteAPerson

Marks a person as deleted.

function deleteAPerson($id)

Parameters

Parameter Tags Description
id Required ID of a person

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

Parameter Tags Description
id Required ID of a person

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

Parameter Tags Description
id Required ID of a person
name Optional Person name
ownerId Optional ID of the user who will be marked as the owner of this person. When omitted, the authorized user ID will be used.
orgId Optional ID of the organization this person will belong to.
email Optional Collection Email addresses (one or more) associated with the person, presented in the same manner as received by GET request of a person.
phone Optional Collection Phone numbers (one or more) associated with the person, presented in the same manner as received by GET request of a person.
visibleTo Optional Visibility of the person. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.
1
Owner & followers (private)
3
Entire company (shared)

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

Parameter Tags Description
id Required ID of a person
start Optional DefaultValue Pagination start
limit Optional Items shown per page
done Optional Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted returns both Done and Not done activities.
exclude Optional A comma-separated string of activity IDs to exclude from result

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

Parameter Tags Description
id Required ID of a person
start Optional DefaultValue Pagination start
limit Optional Items shown per page
status Optional DefaultValue Only fetch deals with specific status. If omitted, all not deleted deals are fetched.
sort Optional Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys).

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

Parameter Tags Description
id Required ID of a person
start Optional DefaultValue Pagination start
limit Optional Items shown per page
includeDeletedFiles Optional When enabled, the list of files will also include deleted files. Please note that trying to download these files will not work.
sort Optional Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys). Supported fields: id, user_id, deal_id, person_id, org_id, product_id, add_time, update_time, file_name, file_type, file_size, comment.

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

Parameter Tags Description
id Required ID of a person
start Optional DefaultValue Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
id Required ID of a person

Example Usage

$id = 233;

$persons->listFollowersOfAPerson($id);

Method: addAFollowerToAPerson

Adds a follower to a person.

function addAFollowerToAPerson($options)

Parameters

Parameter Tags Description
id Required ID of a person
userId Required ID of the user

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

Parameter Tags Description
id Required ID of a person
followerId Required ID of the follower

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

Parameter Tags Description
id Required ID of a person
start Optional DefaultValue Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
id Required ID of a person
mergeWithId Required ID of the person that the person will be merged with

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

Parameter Tags Description
id Required ID of a person

Example Usage

$id = 19;

$persons->listPermittedUsers($id);

Method: deletePersonPicture

Delete person picture

function deletePersonPicture($id)

Parameters

Parameter Tags Description
id Required ID of a person

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

Parameter Tags Description
id Required ID of a person
file Required One image supplied in the multipart/form-data encoding.
cropX Optional X coordinate to where start cropping form (in pixels)
cropY Optional Y coordinate to where start cropping form (in pixels)
cropWidth Optional Width of cropping area (in pixels)
cropHeight Optional Height of cropping area (in pixels)

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

Parameter Tags Description
id Required ID of a person
start Optional DefaultValue Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
name Optional Name of the pipeline
dealProbability Optional TODO: Add a parameter description
orderNr Optional Defines pipelines order. First order(order_nr=0) is the default pipeline.
active Optional TODO: Add a parameter description

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

Parameter Tags Description
id Required ID of the pipeline

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

Parameter Tags Description
id Required ID of the pipeline
totalsConvertCurrency Optional 3-letter currency code of any of the supported currencies. When supplied, per_stages_converted is returned in deals_summary which contains the currency-converted total amounts in the given currency per each stage. You may also set this parameter to 'default_currency' in which case users default currency is used.

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

Parameter Tags Description
id Required ID of the pipeline
name Optional Name of the pipeline
dealProbability Optional TODO: Add a parameter description
orderNr Optional Defines pipelines order. First order(order_nr=0) is the default pipeline.
active Optional TODO: Add a parameter description

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

Parameter Tags Description
id Required ID of the pipeline
startDate Required Start of the period. Date in format of YYYY-MM-DD.
endDate Required End of the period. Date in format of YYYY-MM-DD.
userId Optional ID of the user who's pipeline metrics statistics to fetch. If omitted, the authorized user will be used.

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

Parameter Tags Description
id Required ID of the pipeline
filterId Optional If supplied, only deals matching the given filter will be returned.
userId Optional If supplied, filter_id will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned.
everyone Optional If supplied, filter_id and user_id will not be considered – instead, deals owned by everyone will be returned.
stageId Optional If supplied, only deals within the given stage will be returned.
start Optional DefaultValue Pagination start
limit Optional Items shown per page
getSummary Optional Whether to include summary of the pipeline in the additional_data or not.
totalsConvertCurrency Optional 3-letter currency code of any of the supported currencies. When supplied, per_stages_converted is returned inside deals_summary inside additional_data which contains the currency-converted total amounts in the given currency per each stage. You may also set this parameter to 'default_currency' in which case users default currency is used. Only works when get_summary parameter flag is enabled.

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

Parameter Tags Description
id Required ID of the pipeline
startDate Required Start of the period. Date in format of YYYY-MM-DD.
endDate Required End of the period. Date in format of YYYY-MM-DD.
userId Optional ID of the user who's pipeline statistics to fetch. If omitted, the authorized user will be used.

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

Parameter Tags Description
ids Required Comma-separated field IDs to delete

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

Parameter Tags Description
body Optional TODO: Add a parameter description

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

Parameter Tags Description
id Required ID of the Product Field

Example Usage

$id = 19;

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

Errors

Error Code Error Description
410 The Product Field with the specified ID does not exist or is inaccessible

Method: getOneProductField

Returns data about a specific product field.

function getOneProductField($id)

Parameters

Parameter Tags Description
id Required ID of the Product Field

Example Usage

$id = 19;

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

Errors

Error Code Error Description
410 The Product Field with the specified ID does not exist or is inaccessible

Method: updateAProductField

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

function updateAProductField($options)

Parameters

Parameter Tags Description
id Required ID of the Product Field
name Required Name of the field
options Optional When field_type is either set or enum, possible options must be supplied as a JSON-encoded sequential array, for example: ["red","blue","lilac"]

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

Parameter Tags Description
userId Optional If supplied, only products owned by the given user will be returned.
filterId Optional ID of the filter to use
firstChar Optional If supplied, only products whose name starts with the specified letter will be returned (case insensitive).
start Optional DefaultValue Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
term Required The search term to look for. Minimum 2 characters (or 1 if using exact_match).
fields Optional A comma-separated string array. The fields to perform the search from. Defaults to all of them.
exactMatch Optional When enabled, only full exact matches against the given term are returned. It is not case sensitive.
includeFields Optional Supports including optional fields in the results which are not provided by default.
start Optional Pagination start. Note that the pagination is based on main results and does not include related items when using search_for_related_items parameter.
limit Optional Items shown per page

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

Parameter Tags Description
body Optional TODO: Add a parameter description

Example Usage

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

$products->addAProduct($body);

Method: deleteAProduct

Marks a product as deleted.

function deleteAProduct($id)

Parameters

Parameter Tags Description
id Required ID of the product

Example Usage

$id = 19;

$products->deleteAProduct($id);

Method: getOneProduct

Returns data about a specific product.

function getOneProduct($id)

Parameters

Parameter Tags Description
id Required ID of the product

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

Parameter Tags Description
id Required ID of the product
name Optional Name of the product.
code Optional Product code.
unit Optional Unit in which this product is sold
tax Optional Tax percentage
activeFlag Optional Whether this product will be made active or not.
visibleTo Optional Visibility of the product. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.
1
Owner & followers (private)
3
Entire company (shared)
ownerId Optional ID of the user who will be marked as the owner of this product. When omitted, the authorized user ID will be used.
prices Optional Array of objects, each containing: currency (string), price (number), cost (number, optional), overhead_cost (number, optional). Note that there can only be one price per product per currency. When 'prices' is omitted altogether, no prices will be set up for the product.

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

Parameter Tags Description
id Required ID of the product
start Optional DefaultValue Pagination start
limit Optional Items shown per page
status Optional DefaultValue Only fetch deals with specific status. If omitted, all not deleted deals are fetched.

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

Parameter Tags Description
id Required ID of the product
start Optional DefaultValue Pagination start
limit Optional Items shown per page
includeDeletedFiles Optional When enabled, the list of files will also include deleted files. Please note that trying to download these files will not work.
sort Optional Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys). Supported fields: id, user_id, deal_id, person_id, org_id, product_id, add_time, update_time, file_name, file_type, file_size, comment.

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

Parameter Tags Description
id Required ID of the product

Example Usage

$id = 19;

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

Method: addAFollowerToAProduct

Adds a follower to a product.

function addAFollowerToAProduct($options)

Parameters

Parameter Tags Description
id Required ID of the product
userId Required ID of the user

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

Parameter Tags Description
id Required ID of the product
followerId Required ID of the follower

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

Parameter Tags Description
id Required ID of the product

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

Parameter Tags Description
sinceTimestamp Required Timestamp in UTC. Format: YYYY-MM-DD HH:MM:SS
items Optional Multiple selection of item types to include in query (optional)
start Optional DefaultValue Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
start Optional DefaultValue Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
body Optional TODO: Add a parameter description

Example Usage

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

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

Method: deleteARole

Delete a role

function deleteARole($id)

Parameters

Parameter Tags Description
id Required ID of the role

Example Usage

$id = 19;

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

Method: getOneRole

Get one role

function getOneRole($id)

Parameters

Parameter Tags Description
id Required ID of the role

Example Usage

$id = 19;

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

Method: updateRoleDetails

Update role details

function updateRoleDetails($options)

Parameters

Parameter Tags Description
id Required ID of the role
parentRoleId Optional The ID of the parent Role
name Optional The name of the Role

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

Parameter Tags Description
id Required ID of the role
userId Required ID of the user

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

Parameter Tags Description
id Required ID of the role
start Optional DefaultValue Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
id Required ID of the role
userId Required ID of the user

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

Parameter Tags Description
id Required ID of the role
start Optional DefaultValue Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
id Required ID of the role

Example Usage

$id = 19;

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

Method: addOrUpdateRoleSetting

Add or update role setting

function addOrUpdateRoleSetting($options)

Parameters

Parameter Tags Description
id Required ID of the role
settingKey Required TODO: Add a parameter description
value Required Possible values for default_visibility settings: 0...1.

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

Parameter Tags Description
ids Required Comma-separated stage IDs to delete

Example Usage

$ids = 'ids';

$stages->deleteMultipleStagesInBulk($ids);

Method: getAllStages

Returns data about all stages

function getAllStages($pipelineId = null)

Parameters

Parameter Tags Description
pipelineId Optional ID of the pipeline to fetch stages for. If omitted, stages for all pipelines will be fetched.

Example Usage

$pipelineId = 19;

$stages->getAllStages($pipelineId);

Method: addANewStage

Adds a new stage, returns the ID upon success.

function addANewStage($body = null)

Parameters

Parameter Tags Description
body Optional TODO: Add a parameter description

Example Usage

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

$stages->addANewStage($body);

Method: deleteAStage

Marks a stage as deleted.

function deleteAStage($id)

Parameters

Parameter Tags Description
id Required ID of the stage

Example Usage

$id = 19;

$stages->deleteAStage($id);

Method: getOneStage

Returns data about a specific stage

function getOneStage($id)

Parameters

Parameter Tags Description
id Required ID of the stage

Example Usage

$id = 19;

$stages->getOneStage($id);

Method: updateStageDetails

Updates the properties of a stage.

function updateStageDetails($options)

Parameters

Parameter Tags Description
id Required ID of the stage
body Optional TODO: Add a parameter description

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

Parameter Tags Description
id Required ID of the stage
filterId Optional If supplied, only deals matching the given filter will be returned.
userId Optional If supplied, filter_id will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned.
everyone Optional If supplied, filter_id and user_id will not be considered – instead, deals owned by everyone will be returned.
start Optional DefaultValue Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
orderBy Optional DefaultValue Field name to sort returned teams by
skipUsers Optional When enabled, the teams will not include IDs of member users

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

Parameter Tags Description
name Required The Team name
managerId Required The Team manager ID
description Optional The Team description
users Optional Collection IDs of the Users that belong to the Team

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

Error Code Error Description
403 Forbidden response

Method: getASingleTeam

Returns data about a specific team

function getASingleTeam($options)

Parameters

Parameter Tags Description
id Required ID of the team
skipUsers Optional When enabled, the teams will not include IDs of member users

Example Usage

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

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

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

Errors

Error Code Error Description
404 Team with specified ID does not exist or is inaccessible

Method: updateATeam

Updates an existing team and returns the updated object

function updateATeam($options)

Parameters

Parameter Tags Description
id Required ID of the team
body Optional TODO: Add a parameter description

Example Usage

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

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

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

Errors

Error Code Error Description
403 Forbidden response
404 Team with specified ID does not exist or is inaccessible

Method: getAllUsersInATeam

Returns list of all user IDs within a team

function getAllUsersInATeam($id)

Parameters

Parameter Tags Description
id Required ID of the team

Example Usage

$id = 183;

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

Errors

Error Code Error Description
404 Team with specified ID does not exist or is inaccessible

Method: addUsersToATeam

Adds users to an existing team

function addUsersToATeam($options)

Parameters

Parameter Tags Description
id Required ID of the team
users Required Collection List of User IDs

Example Usage

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

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

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

Errors

Error Code Error Description
403 Forbidden response
404 Team with specified ID does not exist or is inaccessible

Method: deleteUsersFromATeam

Deletes users from an existing team

function deleteUsersFromATeam($options)

Parameters

Parameter Tags Description
id Required ID of the team
users Required Collection List of User IDs

Example Usage

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

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

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

Errors

Error Code Error Description
403 Forbidden response
404 Team with specified ID does not exist or is inaccessible

Method: getAllTeamsOfAUser

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

function getAllTeamsOfAUser($options)

Parameters

Parameter Tags Description
id Required ID of the user
orderBy Optional DefaultValue Field name to sort returned teams by
skipUsers Optional When enabled, the teams will not include IDs of member users

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

Error Code Error Description
401 Unauthorized response

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

Parameter Tags Description
name Required Name of the user
email Required Email of the user
activeFlag Required Whether the user is active or not. false = Not activated, true = Activated

Example Usage

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

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

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

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

Errors

Error Code Error Description
403 Forbidden response

Method: findUsersByName

Finds users by their name.

function findUsersByName($options)

Parameters

Parameter Tags Description
term Required Search term to look for
searchByEmail Optional When enabled, term will only be matched against email addresses of users. Default: false

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

Error Code Error Description
401 Unauthorized response

Method: getOneUser

Returns data about a specific user within the company

function getOneUser($id)

Parameters

Parameter Tags Description
id Required ID of the user

Example Usage

$id = 183;

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

Errors

Error Code Error Description
404 User with specified ID does not exist or is inaccessible

Method: updateUserDetails

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

function updateUserDetails($options)

Parameters

Parameter Tags Description
id Required ID of the user
activeFlag Required Whether the user is active or not. false = Not activated, true = Activated

Example Usage

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

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

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

Errors

Error Code Error Description
403 Forbidden response
404 User with specified ID does not exist or is inaccessible

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

Parameter Tags Description
id Required ID of the user

Example Usage

$id = 183;

$users->listBlacklistedEmailAddressesOfAUser($id);

Method: addBlacklistedEmailAddressForAUser

Add blacklisted email address for a specific user.

function addBlacklistedEmailAddressForAUser($options)

Parameters

Parameter Tags Description
id Required ID of the user
address Required Email address to blacklist (can contain \ for wildcards, e.g. \@example.com, or john\@ex\.com)

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

Parameter Tags Description
id Required ID of the user

Example Usage

$id = 183;

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

Errors

Error Code Error Description
403 Forbidden response

Method: listUserPermissions

List aggregated permissions over all assigned permission sets for a user

function listUserPermissions($id)

Parameters

Parameter Tags Description
id Required ID of the user

Example Usage

$id = 183;

$users->listUserPermissions($id);

Method: deleteARoleAssignment

Delete a role assignment for a user

function deleteARoleAssignment($options)

Parameters

Parameter Tags Description
id Required ID of the user
roleId Required ID of the role

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

Parameter Tags Description
id Required ID of the user
start Optional DefaultValue Pagination start
limit Optional Items shown per page

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

Parameter Tags Description
id Required ID of the user
roleId Required ID of the role

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

Parameter Tags Description
id Required ID of the user

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

Error Code Error Description
401 Unauthorized response

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

Parameter Tags Description
subscriptionUrl Required A full, valid, publicly accessible URL. Determines where to send the notifications. Please note that you cannot use Pipedrive API endpoints as the subscription_url.
eventAction Required Type of action to receive notifications about. Wildcard will match all supported actions.
eventObject Required Type of object to receive notifications about. Wildcard will match all supported objects.
userId Optional The ID of the user this webhook will be authorized with. If not set, current authorized user will be used. Note that this does not filter only certain user's events — rather, this specifies the user's permissions under which each event is checked. Events about objects the selected user is not entitled to access are not sent. If you want to receive notifications for all events, a top-level admin user should be used.
httpAuthUser Optional HTTP basic auth username of the subscription URL endpoint (if required).
httpAuthPassword Optional HTTP basic auth password of the subscription URL endpoint (if required).

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

Error Code Error Description
400 The bad response on webhook creation
401 Unauthorized response

Method: deleteExistingWebhook

Deletes the specified webhook.

function deleteExistingWebhook($id)

Parameters

Parameter Tags Description
id Required The ID of the webhook to delete

Example Usage

$id = 183;

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

Errors

Error Code Error Description
401 Unauthorized response
403 The webhook deletion forbidden response
404 The webhook deletion not found response

Back to List of Controllers


All versions of pipedrive with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
ext-curl Version *
ext-json Version *
ext-mbstring Version *
mashape/unirest-php Version ~3.0.1
apimatic/jsonmapper Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package crashingberries/pipedrive contains the following files

Loading the files please wait ....