Pipedrive client for NodeJS 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 NodeJS 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.
Installation
npm install pipedrive
⚠️ Version 10 is a complete rewrite of the library and introduces breaking changes in the client API. This release includes improved OAuth 2 support, async & await / promises and access to all Pipedrive API endpoints.
If you have been using a previous version of the client and cannot upgrade immediately, older versions are still available.
Please use the issues page for reporting bugs or leaving feedback. Note that most of the code is automatically generated.
API Reference
The Pipedrive RESTful API Reference can be found at https://developers.pipedrive.com/docs/api/v1
License
This Pipedrive API client is distributed under the MIT license.
How to use
With a pre-set API token
const express = require('express');const app = express();const lib = require('pipedrive'); const PORT = 1800; lib.Configuration.apiToken = 'YOUR_API_TOKEN_HERE'; app.listen(PORT, () => { console.log(`Listening on port ${PORT}`);}); app.get('/', async (req, res) => { const user = await lib.UsersController.getCurrentUserData(); res.send(user);});
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:
const lib = require('pipedrive'); // Configuration parameters and credentialslib.Configuration.oAuthClientId = "oAuthClientId"; // OAuth 2 Client IDlib.Configuration.oAuthClientSecret = "oAuthClientSecret"; // OAuth 2 Client Secretlib.Configuration.oAuthRedirectUri = "oAuthRedirectUri"; // OAuth 2 Redirection endpoint or Callback Uri
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. Obtaining 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.
const oAuthManager = lib.OAuthManager;const authUrl = oAuthManager.buildAuthorizationUrl();// open up the authUrl in the browser
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 using the URL specified in the request.
If the user approves the request, the authorization code will be sent as the code
query string:
https://example.com/oauth/callback?code=XXXXXXXXXXXXXXXXXXXXXXXXX
If the user does not approve the request, the response contains an error
query string:
https://example.com/oauth/callback?error=access_denied
3. Authorize the client using the code
After the server receives the code, it can exchange this for an access token. The access token is an object containing information for authorizing the client and refreshing the token itself.
const tokenPromise = oAuthManager.authorize(code);
The Node.js SDK supports both callbacks and promises. So, the authorize call returns a promise and also returns response back in the callback (if one is provided)
Refreshing token
Access tokens may expire after sometime. To extend its lifetime, you must refresh the token.
const refreshPromise = oAuthManager.refreshToken();refreshPromise.then(() => { // token has been refreshed} , (exception) => { // error occurred, exception will be of type lib/Exceptions/OAuthProviderException});
If a token expires, the SDK will attempt to automatically refresh the token before the next endpoint call which requires authentication.
Storing an access token for reuse
It is recommended that you store the access token for reuse.
This code snippet stores the access token in a session for an express application. It uses the cookie-parser and cookie-session npm packages for storing the access token.
const express = require('express');const cookieParser = require('cookie-parser');const cookieSession = require('cookie-session'); const app = express();app.use(cookieParser());app.use(cookieSession({ name: 'session', keys: ['key1']})); const lib = require('pipedrive');...// store token in the sessionreq.session.token = lib.Configuration.oAuthToken;
However, since the the SDK will attempt to automatically refresh the token when it expires, it is recommended that you register a token update callback to detect any change to the access token.
lib.Configuration.oAuthTokenUpdateCallback = function(token) { // getting the updated token req.session.token = token;}
The token update callback will be fired upon authorization as well as token refresh.
Creating a client from a stored token
To authorize a client from a stored access token, just set the access token in Configuration
along with the other configuration parameters before making endpoint calls:
NB! This code only supports one client and should not be used as production code. Please store a separate access token for each client.
const express = require('express');const cookieParser = require('cookie-parser');const cookieSession = require('cookie-session'); const app = express();app.use(cookieParser());app.use(cookieSession({ name: 'session', keys: ['key1']})); const lib = require('pipedrive'); app.get('/', (req, res) => { lib.Configuration.oAuthToken = req.session.token; // the access token stored in the session});
Complete example
This example demonstrates an express application (which uses cookie-parser and cookie-session) for handling session persistence.
In this example, there are 2 endpoints. The base endpoint '/'
first checks if the token is stored in the session. If it is, API endpoints can be called using the corresponding SDK controllers.
However, if the token is not set in the session, then authorization URL is built and opened up. The response comes back at the '/callback'
endpoint, which uses the code to authorize the client and store the token in the session. It then redirects back to the base endpoint for calling endpoints from the SDK.
const express = require('express');const app = express();const cookieParser = require('cookie-parser');const cookieSession = require('cookie-session'); app.use(cookieParser());app.use(cookieSession({ name: 'session', keys: ['key1']}));const PORT = 1800; const lib = require('pipedrive');const oAuthManager = lib.OAuthManager; lib.Configuration.oAuthClientId = 'oAuthClientId'; // OAuth 2 Client IDlib.Configuration.oAuthClientSecret = 'oAuthClientSecret'; // OAuth 2 Client Secretlib.Configuration.oAuthRedirectUri = 'http://localhost:1800/callback'; // OAuth 2 Redirection endpoint or Callback Uri app.listen(PORT, () => { console.log(`Listening on port ${PORT}`);}); app.get('/', async (req, res) => { if (req.session.token !== null && req.session.token !== undefined) { // token is already set in the session // now make API calls as required // client will automatically refresh the token when it expires and call the token update callback const user = await lib.UsersController.getCurrentUserData(); res.send(user); } else { const authUrl = oAuthManager.buildAuthorizationUrl(); res.redirect(authUrl); }}); app.get('/callback', (req, res) => { const authCode = req.query.code; const promise = oAuthManager.authorize(authCode); promise.then(() => { req.session.token = lib.Configuration.oAuthToken; res.redirect('/'); }, (exception) => { // error occurred, exception will be of type lib/Exceptions/OAuthProviderException });});
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
These tests use Mocha framework for testing, coupled with Chai for assertions. These dependencies need to be installed for tests to run. Tests can be run in a number of ways:
Method 1 (Run all tests)
- Navigate to the root directory of the SDK folder from command prompt.
- Type
mocha --recursive
to run all the tests.
Method 2 (Run all tests)
- Navigate to the
../test/Controllers/
directory from command prompt. - Type
mocha *
to run all the tests.
Method 3 (Run specific controller's tests)
- Navigate to the
../test/Controllers/
directory from command prompt. - Type
mocha Pipedrive API v1Controller
to run all the tests in that controller file.
To increase mocha's default timeout, you can change the
TEST_TIMEOUT
parameter's value inTestBootstrap.js
.
Class Reference
List of Controllers
- ActivitiesController
- ActivityFieldsController
- ActivityTypesController
- CurrenciesController
- DealFieldsController
- DealsController
- FilesController
- FiltersController
- GlobalMessagesController
- GoalsController
- MailMessagesController
- MailThreadsController
- NoteFieldsController
- NotesController
- OrganizationFieldsController
- OrganizationRelationshipsController
- OrganizationsController
- PermissionSetsController
- PersonFieldsController
- PersonsController
- PipelinesController
- ProductFieldsController
- ProductsController
- RecentsController
- RolesController
- SearchResultsController
- StagesController
- TeamsController
- UserConnectionsController
- UserSettingsController
- UsersController
- WebhooksController
ActivitiesController
Get singleton instance
The singleton instance of the ActivitiesController
class can be accessed from the API Client.
var controller = libActivitiesController;
deleteMultipleActivitiesInBulk
Marks multiple activities as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
ids | Required |
Comma-separated IDs that will be deleted |
Example Usage
var ids = 'ids'; controller;
getAllActivitiesAssignedToAParticularUser
Returns all activities assigned to a particular user.
Parameters
Parameter | Tags | Description |
---|---|---|
userId | Optional |
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 | Optional |
ID of the filter to use (will narrow down results if used together with user_id parameter). |
type | Optional |
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 | Optional DefaultValue |
Pagination start |
limit | Optional |
Items shown per page |
startDate | Optional |
Date in format of YYYY-MM-DD from which activities to fetch from. |
endDate | Optional |
Date in format of YYYY-MM-DD until which activities to fetch to. |
done | Optional |
Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted returns both Done and Not done activities. |
Example Usage
var input = ; input'userId' = 58; input'filterId' = 58; input'type' = 'type'; input'start' = 0; input'limit' = 58; input'startDate' = '2019-11-22'; input'endDate' = '2019-11-22'; input'done' = Object0; controller;
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 | Required |
Subject of the activity |
type | Required |
Type of the activity. This is in correlation with the key_string parameter of ActivityTypes. |
done | Optional |
TODO: Add a parameter description |
dueDate | Optional |
Due date of the activity. Format: YYYY-MM-DD |
dueTime | Optional |
Due time of the activity in UTC. Format: HH:MM |
duration | Optional |
Duration of the activity. Format: HH:MM |
userId | Optional |
ID of the user whom the activity will be assigned to. If omitted, the activity will be assigned to the authorized user. |
dealId | Optional |
ID of the deal this activity will be associated with |
personId | Optional |
ID of the person this activity will be associated with |
participants | Optional |
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 | Optional |
ID of the organization this activity will be associated with |
note | Optional |
Note of the activity (HTML format) |
Example Usage
var input = ; input'subject' = 'subject'; input'type' = 'type'; input'done' = Object0; input'dueDate' = '2019-11-22'; input'dueTime' = due_time; input'duration' = 'duration'; input'userId' = 58; input'dealId' = 58; input'personId' = 58; input'participants' = 'participants'; input'orgId' = 58; input'note' = 'note'; controller;
deleteAnActivity
Deletes an activity.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the activity |
Example Usage
var id = 58; controller;
getDetailsOfAnActivity
Returns details of a specific activity.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the activity |
Example Usage
var id = 58; controller;
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 | Required |
ID of the activity |
subject | Required |
Subject of the activity |
type | Required |
Type of the activity. This is in correlation with the key_string parameter of ActivityTypes. |
done | Optional |
TODO: Add a parameter description |
dueDate | Optional |
Due date of the activity. Format: YYYY-MM-DD |
dueTime | Optional |
Due time of the activity in UTC. Format: HH:MM |
duration | Optional |
Duration of the activity. Format: HH:MM |
userId | Optional |
ID of the user whom the activity will be assigned to. If omitted, the activity will be assigned to the authorized user. |
dealId | Optional |
ID of the deal this activity will be associated with |
personId | Optional |
ID of the person this activity will be associated with |
participants | Optional |
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 | Optional |
ID of the organization this activity will be associated with |
note | Optional |
Note of the activity (HTML format) |
Example Usage
var input = ; input'id' = 58; input'subject' = 'subject'; input'type' = 'type'; input'done' = Object0; input'dueDate' = '2019-11-22'; input'dueTime' = due_time; input'duration' = 'duration'; input'userId' = 58; input'dealId' = 58; input'personId' = 58; input'participants' = 'participants'; input'orgId' = 58; input'note' = 'note'; controller;
ActivityFieldsController
Get singleton instance
The singleton instance of the ActivityFieldsController
class can be accessed from the API Client.
var controller = libActivityFieldsController;
getAllFieldsForAnActivity
Return list of all fields for activity
Example Usage
controller;
ActivityTypesController
Get singleton instance
The singleton instance of the ActivityTypesController
class can be accessed from the API Client.
var controller = libActivityTypesController;
deleteMultipleActivityTypesInBulk
Marks multiple activity types as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
ids | Required |
Comma-separated activity type IDs to delete |
Example Usage
var ids = 'ids'; controller;
getAllActivityTypes
Returns all activity types
Example Usage
controller;
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 | Required |
Name of the activity type |
iconKey | Required |
Icon graphic to use for representing this activity type. |
color | Optional |
A designated color for the activity type in 6-character HEX format (e.g. FFFFFF for white, 000000 for black). |
Example Usage
var input = ; input'name' = 'name'; input'iconKey' = Object0; input'color' = 'color'; controller;
deleteAnActivityType
Marks an activity type as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the activity type |
Example Usage
var id = 58; controller;
updateEditActivityType
Updates an activity type.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the activity type |
name | Optional |
Name of the activity type |
iconKey | Optional |
Icon graphic to use for representing this activity type. |
color | Optional |
A designated color for the activity type in 6-character HEX format (e.g. FFFFFF for white, 000000 for black). |
orderNr | Optional |
An order number for this activity type. Order numbers should be used to order the types in the activity type selections. |
Example Usage
var input = ; input'id' = 58; input'name' = 'name'; input'iconKey' = Object0; input'color' = 'color'; input'orderNr' = 58; controller;
CurrenciesController
Get singleton instance
The singleton instance of the CurrenciesController
class can be accessed from the API Client.
var controller = libCurrenciesController;
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 |
Optional search term that is searched for from currency's name and/or code. |
Example Usage
var term = 'term'; controller;
DealFieldsController
Get singleton instance
The singleton instance of the DealFieldsController
class can be accessed from the API Client.
var controller = libDealFieldsController;
deleteMultipleDealFieldsInBulk
Marks multiple fields as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
ids | Required |
Comma-separated field IDs to delete |
Example Usage
var ids = 'ids'; controller;
getAllDealFields
Returns data about all fields deals can have
Parameters
Parameter | Tags | Description |
---|---|---|
start | Optional DefaultValue |
Pagination start |
limit | Optional |
Items shown per page |
Example Usage
var input = ; input'start' = 0; input'limit' = 58; controller;
addANewDealField
Adds a new deal field. For more information on adding a new custom field, see this tutorial.
Parameters
Parameter | Tags | Description |
---|---|---|
contentType | Optional |
TODO: Add a parameter description |
body | Optional |
TODO: Add a parameter description |
Example Usage
var input = ; input'contentType' = 'Content-Type'; input'body' = id : 21 ; controller;
deleteADealField
Marks a field as deleted. For more information on how to delete a custom field, see this tutorial.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the field |
Example Usage
var id = 58; controller;
getOneDealField
Returns data about a specific deal field.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the field |
Example Usage
var id = 58; controller;
updateADealField
Updates a deal field. See an example of updating custom fields’ values in this tutorial.
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, for example: ["red","blue","lilac"] |
Example Usage
var input = ; input'id' = 58; input'name' = 'name'; input'options' = 'options'; controller;
DealsController
Get singleton instance
The singleton instance of the DealsController
class can be accessed from the API Client.
var controller = libDealsController;
deleteMultipleDealsInBulk
Marks multiple deals as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
ids | Required |
Comma-separated IDs that will be deleted |
Example Usage
var ids = 'ids'; controller;
getAllDeals
Returns all deals. For more information on how to get all deals, see this tutorial.
Parameters
Parameter | Tags | Description |
---|---|---|
userId | Optional |
If supplied, only deals matching the given user will be returned. |
filterId | Optional |
ID of the filter to use |
stageId | Optional |
If supplied, only deals within the given stage will be returned. |
status | Optional DefaultValue |
Only fetch deals with specific status. If omitted, all not deleted deals are fetched. |
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). |
ownedByYou | Optional |
When supplied, only deals owned by you are returned. However filter_id takes precedence over owned_by_you when both are supplied. |
Example Usage
var input = ; input'userId' = 58; input'filterId' = 58; input'stageId' = 58; input'status' = all_not_deleted; input'start' = 0; input'limit' = 58; input'sort' = 'sort'; input'ownedByYou' = Object0; controller;
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 |
---|---|---|
contentType | Optional |
TODO: Add a parameter description |
body | Optional |
TODO: Add a parameter description |
Example Usage
var input = ; input'contentType' = 'Content-Type'; input'body' = id : 21 ; controller;
findDealsByName
Searches all deals by their title.
Parameters
Parameter | Tags | Description |
---|---|---|
term | Required |
Search term to look for |
personId | Optional |
ID of the person the Deal is associated with. |
orgId | Optional |
ID of the organization the Deal is associated with. |
Example Usage
var input = ; input'term' = 'term'; input'personId' = 58; input'orgId' = 58; controller;
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
var input = ; input'status' = Object0; input'filterId' = 58; input'userId' = 58; input'stageId' = 58; controller;
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.
|
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
var input = ; input'startDate' = '2019-11-22'; input'interval' = Object0; input'amount' = 58; input'fieldKey' = field_key; input'userId' = 58; input'pipelineId' = 58; input'filterId' = 58; input'excludeDeals' = Object0; input'totalsConvertCurrency' = totals_convert_currency; controller;
deleteADeal
Marks a deal as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the deal |
Example Usage
var id = 58; controller;
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
var id = 58; controller;
updateADeal
Updates the properties of a deal. 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. |
userId | Optional |
ID of the user who will be marked as the owner of this deal. If omitted, the authorized user ID will be used. |
personId | Optional |
ID of the person this deal will be associated with |
orgId | Optional |
ID of the organization this deal will be associated with |
stageId | 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. |
probability | Optional |
Deal success probability percentage. Used/shown only when deal_probability for the pipeline of the deal is enabled. |
lostReason | Optional |
Optional message about why the deal was lost (to be used when status=lost) |
visibleTo | Optional |
Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.
|
Example Usage
var input = ; input'id' = 58; input'title' = 'title'; input'value' = 'value'; input'currency' = 'currency'; input'userId' = 58; input'personId' = 58; input'orgId' = 58; input'stageId' = 58; input'status' = Object0; input'probability' = 585644835925496; input'lostReason' = lost_reason; input'visibleTo' = Object0; controller;
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
var input = ; input'id' = 58; input'start' = 58; input'limit' = 58; input'done' = Object0; input'exclude' = 'exclude'; controller;
createDuplicateDeal
Duplicate a deal
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the deal |
Example Usage
var id = 58; controller;
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
var input = ; input'id' = 58; input'start' = 58; input'limit' = 58; input'includeDeletedFiles' = Object0; input'sort' = 'sort'; controller;
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
var input = ; input'id' = 58; input'start' = 58; input'limit' = 58; controller;
listFollowersOfADeal
Lists the followers of a deal.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the deal |
Example Usage
var id = 58; controller;
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
var input = ; input'id' = 58; input'userId' = 58; controller;
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
var input = ; input'id' = 58; input'followerId' = 58; controller;
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
var input = ; input'id' = 58; input'start' = 58; input'limit' = 58; controller;
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
var input = ; input'id' = 58; input'mergeWithId' = 58; controller;
listParticipantsOfADeal
Lists participants 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
var input = ; input'id' = 58; input'start' = 58; input'limit' = 58; controller;
addAParticipantToADeal
Adds a participant to a deal.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the deal |
personId | Required |
ID of the person |
Example Usage
var input = ; input'id' = 58; input'personId' = 58; controller;
deleteAParticipantFromADeal
Deletes a participant from a deal.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the deal |
dealParticipantId | Required |
ID of the deal participant |
Example Usage
var input = ; input'id' = 58; input'dealParticipantId' = 58; controller;
listPermittedUsers
List users permitted to access a deal
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the deal |
Example Usage
var id = 58; controller;
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.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the deal |
start | Optional DefaultValue |
Pagination start |
limit | Optional |
Items shown per page |
Example Usage
var input = ; input'id' = 58; input'start' = 58; input'limit' = 58; controller;
listProductsAttachedToADeal
Lists products attached to a deal.
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
var input = ; input'id' = 58; input'start' = 58; input'limit' = 58; input'includeProductData' = Object0; controller;
addAProductToTheDealEventuallyCreatingANewItemCalledADealProduct
Adds a product to the deal.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the deal |
contentType | Optional |
TODO: Add a parameter description |
body | Optional |
TODO: Add a parameter description |
Example Usage
var input = ; input'id' = 58; input'contentType' = 'Content-Type'; input'body' = id : 21 ; controller;
updateProductAttachmentDetailsOfTheDealProductAProductAlreadyAttachedToADeal
Updates product attachment details.
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
var input = ; input'id' = 58; input'productAttachmentId' = 58; input'itemPrice' = 585644835925496; input'quantity' = 58; input'discountPercentage' = 585644835925496; input'duration' = 585644835925496; input'productVariationId' = 58; input'comments' = 'comments'; input'enabledFlag' = Object0; controller;
deleteAnAttachedProductFromADeal
Deletes a product attachment from a deal, using the product_attachment_id.
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
var input = ; input'id' = 58; input'productAttachmentId' = 58; controller;
FilesController
Get singleton instance
The singleton instance of the FilesController
class can be accessed from the API Client.
var controller = libFilesController;
getAllFiles
Returns data about all files.
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
var input = ; input'start' = 0; input'limit' = 58; input'includeDeletedFiles' = Object0; input'sort' = 'sort'; controller;
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.
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
TestHelper;
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.
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
var input = ; input'fileType' = Object0; input'title' = 'title'; input'itemType' = Object0; input'itemId' = 58; input'remoteLocation' = Object0; controller;
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.
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
var input = ; input'itemType' = Object0; input'itemId' = 58; input'remoteId' = remote_id; input'remoteLocation' = Object0; controller;
deleteAFile
Marks a file as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the file |
Example Usage
var id = 58; controller;
getOneFile
Returns data about a specific file.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the file |
Example Usage
var id = 58; controller;
updateFileDetails
Updates the properties of a file.
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
var input = ; input'id' = 58; input'name' = 'name'; input'description' = 'description'; controller;
getDownloadOneFile
Initializes a file download.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the file |
Example Usage
var id = 58; controller;
FiltersController
Get singleton instance
The singleton instance of the FiltersController
class can be accessed from the API Client.
var controller = libFiltersController;
deleteMultipleFiltersInBulk
Marks multiple filters as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
ids | Required |
Comma-separated filter IDs to delete |
Example Usage
var ids = 'ids'; controller;
getAllFilters
Returns data about all filters
Parameters
Parameter | Tags | Description |
---|---|---|
type | Optional |
Types of filters to fetch |
Example Usage
var type = Object0; controller;
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.
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
var input = ; input'name' = 'name'; input'conditions' = 'conditions'; input'type' = Object0; controller;
getAllFilterHelpers
Returns all supported filter helpers. It helps to know what conditions and helpers are available when you want to add or update filters. For more information on how filter’s helpers can be used, see this tutorial.
Example Usage
controller;
deleteAFilter
Marks a filter as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the filter |
Example Usage
var id = 58; controller;
getOneFilter
Returns data about a specific filter. Note that this also returns the condition lines of the filter.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the filter |
Example Usage
var id = 58; controller;
updateFilter
Updates existing filter.
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
var input = ; input'id' = 58; input'conditions' = 'conditions'; input'name' = 'name'; controller;
GlobalMessagesController
Get singleton instance
The singleton instance of the GlobalMessagesController
class can be accessed from the API Client.
var controller = libGlobalMessagesController;
getGlobalMessages
Returns data about global messages to display for the authorized user.
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
var limit = 58; controller;
deleteDismissAGlobalMessage
Removes global message from being shown, if message is dismissible
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of global message to be dismissed. |
Example Usage
var id = 58; controller;
GoalsController
Get singleton instance
The singleton instance of the GoalsController
class can be accessed from the API Client.
var controller = libGoalsController;
addANewGoal
Adds a new goal.
Parameters
Parameter | Tags | Description |
---|---|---|
contentType | Optional |
TODO: Add a parameter description |
body | Optional |
TODO: Add a parameter description |
Example Usage
var input = ; input'contentType' = 'Content-Type'; input'body' = id : 21 ; controller;
findGoals
Returns data about goals based on criteria. For searching, append
{searchField}={searchValue}
to the URL, wheresearchField
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 providingperiod.start
,period.end
must also be provided and vice versa.
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
var input = ; input'typeName' = Object0; input'title' = 'title'; input'isActive' = True; input'assigneeId' = 58; input'assigneeType' = Object0; input'expectedOutcomeTarget' = 585644835925496; input'expectedOutcomeTrackingMetric' = Object0; input'expectedOutcomeCurrencyId' = 58; input'typeParamsPipelineId' = 58; input'typeParamsStageId' = 58; input'typeParamsActivityTypeId' = 58; input'periodStart' = '2019-11-22'; input'periodEnd' = '2019-11-22'; controller;
updateExistingGoal
Updates existing goal.
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
var input = ; input'id' = 'id'; input'title' = 'title'; input'assignee' = id : 21 ; input'type' = id : 21 ; input'expectedOutcome' = id : 21 ; input'duration' = id : 21 ; input'interval' = Object0; controller;
deleteExistingGoal
Marks goal as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the goal to be deleted. |
Example Usage
var id = 'id'; controller;
getResultOfAGoal
Gets progress of a goal for specified period.
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
var input = ; input'id' = 'id'; input'periodStart' = '2019-11-22'; input'periodEnd' = '2019-11-22'; controller;
MailMessagesController
Get singleton instance
The singleton instance of the MailMessagesController
class can be accessed from the API Client.
var controller = libMailMessagesController;
getOneMailMessage
Returns data about specific mail message.
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
var input = ; input'id' = 58; input'includeBody' = Object0; controller;
MailThreadsController
Get singleton instance
The singleton instance of the MailThreadsController
class can be accessed from the API Client.
var controller = libMailThreadsController;
getMailThreads
Returns mail threads in specified folder ordered by most recent message within.
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
var input = ; input'folder' = inbox; input'start' = 0; input'limit' = 58; controller;
deleteMailThread
Marks mail thread as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the mail thread |
Example Usage
var id = 58; controller;
getOneMailThread
Returns specific mail thread.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the mail thread |
Example Usage
var id = 58; controller;
updateMailThreadDetails
Updates the properties of a mail thread.
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
var input = ; input'id' = 58; input'dealId' = 58; input'sharedFlag' = Object0; input'readFlag' = Object0; input'archivedFlag' = Object0; controller;
getAllMailMessagesOfMailThread
Get mail messages inside specified mail thread.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the mail thread |
Example Usage
var id = 58; controller;
NoteFieldsController
Get singleton instance
The singleton instance of the NoteFieldsController
class can be accessed from the API Client.
var controller = libNoteFieldsController;
getAllFieldsForANote
Return list of all fields for note
Example Usage
controller;
NotesController
Get singleton instance
The singleton instance of the NotesController
class can be accessed from the API Client.
var controller = libNotesController;
getAllNotes
Returns all notes.
Parameters
Parameter | Tags | Description |
---|---|---|
userId | Optional |
ID of the user whose notes to fetch. If omitted, notes by all users will be returned. |
dealId | Optional |
ID of the deal which notes to fetch. If omitted, notes about all deals with be returned. |
personId | Optional |
ID of the person whose notes to fetch. If omitted, notes about all persons with be returned. |
orgId | Optional |
ID of the organization which notes to fetch. If omitted, notes about all organizations with 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. |
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
var input = ; input'userId' = 58; input'dealId' = 58; input'personId' = 58; input'orgId' = 58; input'start' = 0; input'limit' = 58; input'sort' = 'sort'; input'startDate' = '2019-11-22'; input'endDate' = '2019-11-22'; input'pinnedToDealFlag' = Object0; input'pinnedToOrganizationFlag' = Object0; input'pinnedToPersonFlag' = Object0; controller;
addANote
Adds a new note.
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. |
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 |
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
var input = ; input'content' = 'content'; input'userId' = 58; input'dealId' = 58; input'personId' = 58; input'orgId' = 58; input'addTime' = add_time; input'pinnedToDealFlag' = Object0; input'pinnedToOrganizationFlag' = Object0; input'pinnedToPersonFlag' = Object0; controller;
deleteANote
Deletes a specific note.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the note |
Example Usage
var id = 58; controller;
getOneNote
Returns details about a specific note.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the note |
Example Usage
var id = 58; controller;
updateANote
Updates a note.
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. |
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 |
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
var input = ; input'id' = 58; input'content' = 'content'; input'userId' = 58; input'dealId' = 58; input'personId' = 58; input'orgId' = 58; input'addTime' = add_time; input'pinnedToDealFlag' = Object0; input'pinnedToOrganizationFlag' = Object0; input'pinnedToPersonFlag' = Object0; controller;
OrganizationFieldsController
Get singleton instance
The singleton instance of the OrganizationFieldsController
class can be accessed from the API Client.
var controller = libOrganizationFieldsController;
deleteMultipleOrganizationFieldsInBulk
Marks multiple fields as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
ids | Required |
Comma-separated field IDs to delete |
Example Usage
var ids = 'ids'; controller;
getAllOrganizationFields
Returns data about all organization fields
Example Usage
controller;
addANewOrganizationField
Adds a new organization field. For more information on adding a new custom field, see this tutorial.
Parameters
Parameter | Tags | Description |
---|---|---|
contentType | Optional |
TODO: Add a parameter description |
body | Optional |
TODO: Add a parameter description |
Example Usage
var input = ; input'contentType' = 'Content-Type'; input'body' = id : 21 ; controller;
deleteAnOrganizationField
Marks a field as deleted. For more information on how to delete a custom field, see this tutorial.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the field |
Example Usage
var id = 58; controller;
getOneOrganizationField
Returns data about a specific organization field.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the field |
Example Usage
var id = 58; controller;
updateAnOrganizationField
Updates an organization field. See an example of updating custom fields’ values in this tutorial.
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
var input = ; input'id' = 58; input'name' = 'name'; input'options' = 'options'; controller;
OrganizationRelationshipsController
Get singleton instance
The singleton instance of the OrganizationRelationshipsController
class can be accessed from the API Client.
var controller = libOrganizationRelationshipsController;
getAllRelationshipsForOrganization
Gets all of the relationships for a supplied organization id.
Parameters
Parameter | Tags | Description |
---|---|---|
orgId | Required |
ID of the organization to get relationships for |
Example Usage
var orgId = 58; controller;
createAnOrganizationRelationship
Creates and returns an organization relationship.
Parameters
Parameter | Tags | Description |
---|---|---|
contentType | Optional |
TODO: Add a parameter description |
body | Optional |
TODO: Add a parameter description |
Example Usage
var input = ; input'contentType' = 'Content-Type'; input'body' = id : 21 ; controller;
deleteAnOrganizationRelationship
Deletes an organization relationship and returns the deleted id.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the organization relationship |
Example Usage
var id = 58; controller;
getOneOrganizationRelationship
Finds and returns an organization relationship from its ID.
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
var input = ; input'id' = 58; input'orgId' = 58; controller;
updateAnOrganizationRelationship
Updates and returns an organization relationship.
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
var input = ; input'id' = 58; input'orgId' = 58; input'type' = Object0; input'relOwnerOrgId' = 58; input'relLinkedOrgId' = 58; controller;
OrganizationsController
Get singleton instance
The singleton instance of the OrganizationsController
class can be accessed from the API Client.
var controller = libOrganizationsController;
deleteMultipleOrganizationsInBulk
Marks multiple organizations as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
ids | Required |
Comma-separated IDs that will be deleted |
Example Usage
var ids = 'ids'; controller;
getAllOrganizations
Returns all organizations
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
var input = ; input'userId' = 58; input'filterId' = 58; input'firstChar' = first_char; input'start' = 0; input'limit' = 58; input'sort' = 'sort'; controller;
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.
Parameters
Parameter | Tags | Description |
---|---|---|
contentType | Optional |
TODO: Add a parameter description |
body | Optional |
TODO: Add a parameter description |
Example Usage
var input = ; input'contentType' = 'Content-Type'; input'body' = id : 21 ; controller;
findOrganizationsByName
Searches all organizations by their name.
Parameters
Parameter | Tags | Description |
---|---|---|
term | Required |
Search term to look for |
start | Optional DefaultValue |
Pagination start |
limit | Optional |
Items shown per page |
Example Usage
var input = ; input'term' = 'term'; input'start' = 58; input'limit' = 58; controller;
deleteAnOrganization
Marks an organization as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the organization |
Example Usage
var id = 58; controller;
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.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the organization |
Example Usage
var id = 58; controller;
updateAnOrganization
Updates the properties of an organization.
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"> |
Example Usage
var input = ; input'id' = 58; input'name' = 'name'; input'ownerId' = 58; input'visibleTo' = Object0; controller;
listActivitiesAssociatedWithAnOrganization
Lists activities associated with an organization.
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
var input = ; input'id' = 58; input'start' = 58; input'limit' = 58; input'done' = Object0; input'exclude' = 'exclude'; controller;
listDealsAssociatedWithAnOrganization
Lists deals associated with an organization.
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
var input = ; input'id' = 58; input'start' = 58; input'limit' = 58; input'status' = Object0; input'sort' = 'sort'; input'onlyPrimaryAssociation' = Object0; controller;
listFilesAttachedToAnOrganization
Lists files associated with an organization.
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
var input = ; input'id' = 16; input'start' = 16; input'limit' = 16; input'includeDeletedFiles' = Object0; input'sort' = 'sort'; controller;
listUpdatesAboutAnOrganization
Lists updates about an organization.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the organization |
start | Optional DefaultValue |
Pagination start |
limit | Optional |
Items shown per page |
Example Usage
var input = ; input'id' = 16; input'start' = 16; input'limit' = 16; controller;
listFollowersOfAnOrganization
Lists the followers of an organization.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the organization |
Example Usage
var id = 16; controller;
addAFollowerToAnOrganization
Adds a follower to an organization.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the organization |
userId | Required |
ID of the user |
Example Usage
var input = ; input'id' = 16; input'userId' = 16; controller;
deleteAFollowerFromAnOrganization
Deletes a follower from an organization. You can retrieve the follower_id from the List followers of an organization endpoint.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the organization |
followerId | Required |
ID of the follower |
Example Usage
var input = ; input'id' = 16; input'followerId' = 16; controller;
listMailMessagesAssociatedWithAnOrganization
Lists mail messages associated with an organization.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the organization |
start | Optional DefaultValue |
Pagination start |
limit | Optional |
Items shown per page |
Example Usage
var input = ; input'id' = 16; input'start' = 16; input'limit' = 16; controller;
updateMergeTwoOrganizations
Merges an organization with another organization. For more information on how to merge two organizations, see this tutorial.
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
var input = ; input'id' = 16; input'mergeWithId' = 16; controller;
listPermittedUsers
List users permitted to access an organization
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the organization |
Example Usage
var id = 16; controller;
listPersonsOfAnOrganization
Lists persons associated with an organization.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the organization |
start | Optional DefaultValue |
Pagination start |
limit | Optional |
Items shown per page |
Example Usage
var input = ; input'id' = 16; input'start' = 16; input'limit' = 16; controller;
PermissionSetsController
Get singleton instance
The singleton instance of the PermissionSetsController
class can be accessed from the API Client.
var controller = libPermissionSetsController;
getAllPermissionSets
Get all Permission Sets
Example Usage
controller;
Errors
Error Code | Error Description |
---|---|
404 | If the User ID has no assignments, then it will return NotFound |
getOnePermissionSet
Get one Permission Set
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the permission set |
Example Usage
var id = 16; controller;
Errors
Error Code | Error Description |
---|---|
404 | If the User ID has no assignments, then it will return NotFound |
listPermissionSetAssignments
The list of assignments for a Permission Set
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the permission set |
start | Optional DefaultValue |
Pagination start |
limit | Optional |
Items shown per page |
Example Usage
var input = ; input'id' = 16; input'start' = 16; input'limit' = 16; controller;
Errors
Error Code | Error Description |
---|---|
404 | If the User ID has no assignments, then it will return NotFound |
PersonFieldsController
Get singleton instance
The singleton instance of the PersonFieldsController
class can be accessed from the API Client.
var controller = libPersonFieldsController;
deleteMultiplePersonFieldsInBulk
Marks multiple fields as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
ids | Required |
Comma-separated field IDs to delete |
Example Usage
var ids = 'ids'; controller;
getAllPersonFields
Returns data about all person fields
Example Usage
controller;
addANewPersonField
Adds a new person field. For more information on adding a new custom field, see this tutorial.
Parameters
Parameter | Tags | Description |
---|---|---|
contentType | Optional |
TODO: Add a parameter description |
body | Optional |
TODO: Add a parameter description |
Example Usage
var input = ; input'contentType' = 'Content-Type'; input'body' = id : 21 ; controller;
deleteAPersonField
Marks a field as deleted. For more information on how to delete a custom field, see this tutorial.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the field |
Example Usage
var id = 16; controller;
getOnePersonField
Returns data about a specific person field.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of the field |
Example Usage
var id = 16; controller;
updateAPersonField
Updates a person field. See an example of updating custom fields’ values in this tutorial.
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
var input = ; input'id' = 16; input'name' = 'name'; input'options' = 'options'; controller;
PersonsController
Get singleton instance
The singleton instance of the PersonsController
class can be accessed from the API Client.
var controller = libPersonsController;
deleteMultiplePersonsInBulk
Marks multiple persons as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
ids | Optional |
Comma-separated IDs that will be deleted |
Example Usage
var ids = 'ids'; controller;
getAllPersons
Returns all persons
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
var input = ; input'userId' = 16; input'filterId' = 16; input'firstChar' = first_char; input'start' = 0; input'limit' = 16; input'sort' = 'sort'; controller;
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.
Parameters
Parameter | Tags | Description |
---|---|---|
contentType | Optional |
TODO: Add a parameter description |
body | Optional |
TODO: Add a parameter description |
Example Usage
var input = ; input'contentType' = 'Content-Type'; input'body' = id : 21 ; controller;
findPersonsByName
Searches all persons by their name.
Parameters
Parameter | Tags | Description |
---|---|---|
term | Required |
Search term to look for |
orgId | Optional |
ID of the organization person is associated with. |
start | Optional DefaultValue |
Pagination start |
limit | Optional |
Items shown per page |
searchByEmail | Optional |
When enabled, term will only be matched against email addresses of people. Default: false |
Example Usage
var input = ; input'term' = 'term'; input'orgId' = 16; input'start' = 16; input'limit' = 16; input'searchByEmail' = Object0; controller;
deleteAPerson
Marks a person as deleted.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of a person |
Example Usage
var id = 16; controller;
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.
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
ID of a person |
Example Usage
var id = 16; controller;