### Install Pipedrive Node.js Client Source: https://github.com/pipedrive/client-nodejs/blob/master/README.md Install the Pipedrive client package using npm. ```bash npm install pipedrive --save ``` -------------------------------- ### Install Pipedrive Node.js Client Source: https://github.com/pipedrive/client-nodejs/blob/master/migration.md Command to install version 24.0.0 of the Pipedrive Node.js client using npm. ```bash npm i pipedrive@24.0.0 ``` -------------------------------- ### Manage Deal Installments Source: https://context7.com/pipedrive/client-nodejs/llms.txt Provides examples for adding, listing, updating, and deleting payment installments associated with deals. Note that this feature requires specific Pipedrive plan levels. ```typescript import { Configuration, DealInstallmentsApi } from 'pipedrive/v2'; const api = new DealInstallmentsApi(new Configuration({ apiKey: 'YOUR_API_TOKEN' })); const dealId = 101; // --- Add an installment --- const { data: created } = await api.postInstallment({ id: dealId, AddInstallmentRequestBody: { amount: 10000, due_at: '2024-12-01', description: 'Q4 Invoice', }, }); const installmentId = created.data.id; // --- List installments for multiple deals --- const { data: list } = await api.getInstallments({ id: [101, 102, 103] }); console.log(list.data); // --- Update --- await api.updateInstallment({ id: dealId, installment_id: installmentId, UpdateInstallmentRequestBody: { amount: 11000, due_at: '2024-12-15' }, }); // --- Delete --- await api.deleteInstallment({ id: dealId, installment_id: installmentId }); ``` -------------------------------- ### Get All Files Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Retrieves a list of all files. ```APIDOC ## GET /files ### Description Get all files. ### Method GET ### Endpoint /files ``` -------------------------------- ### Get Deals Summary Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Retrieves a summary of all deals. ```APIDOC ## GET /deals/summary ### Description Get deals summary. ### Method GET ### Endpoint /deals/summary ``` -------------------------------- ### WebhooksApi (v1) - Get Webhooks Source: https://context7.com/pipedrive/client-nodejs/llms.txt Retrieves a list of all configured webhooks. ```APIDOC ## getWebhooks ### Description Retrieves a list of all configured webhooks. ### Method GET ### Endpoint /webhooks ### Response #### Success Response (200) - **data** (array) - An array of webhook objects. ### Request Example ```typescript const { data: hooks } = await webhooksApi.getWebhooks(); ``` ### Response Example ```json { "data": [ { "id": 123, "subscription_url": "https://yourapp.com/webhook", "event_action": "*", "event_object": "deal" } ] } ``` ``` -------------------------------- ### Get All Currencies Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Retrieves a list of all supported currencies. ```APIDOC ## GET /currencies ### Description Get all supported currencies. ### Method GET ### Endpoint /currencies ``` -------------------------------- ### Get Project Boards Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Fetches a list of all project boards. This endpoint allows retrieval of all configured project boards. ```APIDOC ## GET /boards ### Description Get all project boards ### Method GET ### Endpoint /boards ``` -------------------------------- ### Get All Deal Fields Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Retrieves a list of all deal fields. ```APIDOC ## GET /dealFields ### Description Get all deal fields. ### Method GET ### Endpoint /dealFields ``` -------------------------------- ### Complete Express Application Example Source: https://github.com/pipedrive/client-nodejs/blob/master/migration.md Demonstrates an Express application for handling session persistence with cookie-parser and cookie-session. It includes endpoints for checking token status, initiating authorization, and handling the callback to store the token. ```typescript import express from "express"; import { Configuration, DealsApi, OAuth2Configuration } from "pipedrive/v1"; import cookieParser from "cookie-parser"; import cookieSession from "cookie-session"; const app = express(); app.use(cookieParser()); app.use(cookieSession({ name: "session", keys: ["key1"] })); const PORT = 3000; const oauth2 = new OAuth2Configuration({ clientId: "clientId", // OAuth 2 Client ID clientSecret: "clientSecret", // OAuth 2 Client Secret redirectUri: 'redirectUri' // OAuth 2 Redirection endpoint or Callback Uri }); app.listen(PORT, () => { console.log(`Listening on port ${PORT}`); }); app.get('/', async (req, res) => { try { // method will handle return null if token is not available in the session const token = oauth2.updateToken(req.session?.accessToken); if (!token) { const authUrl = oauth2.authorizationUrl; return res.redirect(authUrl); } const apiConfig = new Configuration({ accessToken: oauth2.getAccessToken, basePath: oauth2.basePath, }); const dealsApi = new DealsApi(apiConfig) const response = await dealsApi.getDeals(); const { data: deals } = response; return res.send(deals); } catch (error){ console.error(error) return res.status(500).send(error) } }); app.get('/callback', async (req, res) => { try { const authCode = req.query.code as string; const newAccessToken = await oauth2.authorize(authCode); req.session.accessToken = newAccessToken; return res.redirect("/"); }catch (error) { console.error(error) return res.status(500).send(error) } }); ``` -------------------------------- ### Get Installments Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Lists installments added to a list of deals. This endpoint retrieves installment information for multiple deals. ```APIDOC ## GET /deals/installments ### Description List installments added to a list of deals ### Method GET ### Endpoint /deals/installments ``` -------------------------------- ### Get Deal Files Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Lists all files attached to a specific deal. ```APIDOC ## GET /deals/{id}/files ### Description List files attached to a deal. ### Method GET ### Endpoint /deals/{id}/files ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the deal. ``` -------------------------------- ### Get Project Templates Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Retrieves a list of all available project templates. Useful for understanding the available project structures. ```APIDOC ## GET /projectTemplates ### Description Get all project templates. ### Method GET ### Endpoint /projectTemplates ``` -------------------------------- ### DealInstallmentsApi (v2) Source: https://context7.com/pipedrive/client-nodejs/llms.txt Manage payment installment schedules for deals. This feature is available on Growth plans and above. ```APIDOC ## DealInstallmentsApi (v2) ### Description Manage payment installment schedules on deals (available on Growth plans and above). ### Methods - `postInstallment`: Adds a new payment installment to a deal. - `getInstallments`: Retrieves a list of payment installments for one or more deals. - `updateInstallment`: Updates an existing payment installment for a deal. - `deleteInstallment`: Deletes a specific payment installment from a deal. ### Request Example (postInstallment) ```typescript const { data: created } = await api.postInstallment({ id: dealId, AddInstallmentRequestBody: { amount: 10000, due_at: '2024-12-01', description: 'Q4 Invoice', }, }); ``` ### Request Example (getInstallments) ```typescript const { data: list } = await api.getInstallments({ id: [101, 102, 103] }); ``` ### Request Example (updateInstallment) ```typescript await api.updateInstallment({ id: dealId, installment_id: installmentId, UpdateInstallmentRequestBody: { amount: 11000, due_at: '2024-12-15' }, }); ``` ### Response Example (getInstallments) ```json { "data": [ { "id": 1, "deal_id": 101, "amount": 10000, "due_at": "2024-12-01", "description": "Q4 Invoice" } ] } ``` ``` -------------------------------- ### Get Deals Timeline Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Retrieves a timeline view of all deals. ```APIDOC ## GET /deals/timeline ### Description Get deals timeline. ### Method GET ### Endpoint /deals/timeline ``` -------------------------------- ### Manage Pipeline Stages with StagesApi (v2) Source: https://context7.com/pipedrive/client-nodejs/llms.txt Provides examples for creating, listing, retrieving, updating, and deleting stages within a sales pipeline. Ensure the pipeline_id is valid. ```typescript import { Configuration, StagesApi } from 'pipedrive/v2'; const api = new StagesApi(new Configuration({ apiKey: 'YOUR_API_TOKEN' })); // --- Create a stage --- const { data: created } = await api.addStage({ AddStageRequest: { name: 'Proposal Sent', pipeline_id: 1, deal_probability: 60, }, }); const stageId = created.data.id; // --- List stages (optionally filter by pipeline) --- const { data: list } = await api.getStages({ pipeline_id: 1 }); console.log(list.data.map((s) => s.name)); // --- Get one --- const { data: stage } = await api.getStage({ id: stageId }); // --- Update --- await api.updateStage({ id: stageId, UpdateStageRequest: { name: 'Quote Sent', deal_probability: 70 }, }); // --- Delete --- await api.deleteStage({ id: stageId }); ``` -------------------------------- ### Get All Activity Types Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Retrieves a list of all configured activity types. ```APIDOC ## GET /activityTypes ### Description Get all activity types. ### Method GET ### Endpoint /activityTypes ``` -------------------------------- ### Get All Filters Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Retrieves a list of all filters. ```APIDOC ## GET /filters ### Description Get all filters. ### Method GET ### Endpoint /filters ``` -------------------------------- ### Get Project Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Retrieves detailed information about a specific project using its ID. ```APIDOC ## GET /projects/{id} ### Description Get details of a project. ### Method GET ### Endpoint /projects/{id} ``` -------------------------------- ### Get Projects Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Retrieves a list of all projects. This is a comprehensive endpoint for viewing all active projects. ```APIDOC ## GET /projects ### Description Get all projects. ### Method GET ### Endpoint /projects ``` -------------------------------- ### Get Deal Participants Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Lists all users who are participants in a specific deal. ```APIDOC ## GET /deals/{id}/participants ### Description List participants of a deal. ### Method GET ### Endpoint /deals/{id}/participants ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the deal. ``` -------------------------------- ### Get Project Phases Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Fetches a list of all project phases. This endpoint allows retrieval of all phases defined across projects. ```APIDOC ## GET /phases ### Description Get project phases ### Method GET ### Endpoint /phases ``` -------------------------------- ### FilesApi (v1) - Get Files Source: https://context7.com/pipedrive/client-nodejs/llms.txt Retrieves a list of files associated with a deal. ```APIDOC ## getFiles ### Description Retrieves a list of files associated with a deal. ### Method GET ### Endpoint /files ### Parameters #### Query Parameters - **deal_id** (number) - Required - The ID of the deal to retrieve files for. ### Response #### Success Response (200) - **data** (array) - An array of file objects associated with the deal. ### Request Example ```typescript const { data: files } = await filesApi.getFiles({ deal_id: 101 }); ``` ### Response Example ```json { "data": [ { "id": 1001, "name": "document.pdf" } ] } ``` ``` -------------------------------- ### Get All Activity Fields Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Retrieves a list of all available activity fields. ```APIDOC ## GET /activityFields ### Description Get all activity fields. ### Method GET ### Endpoint /activityFields ``` -------------------------------- ### Get Archived Deals Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Retrieves a list of all deals that have been archived. ```APIDOC ## GET /deals/archived ### Description Get all archived deals. ### Method GET ### Endpoint /deals/archived ``` -------------------------------- ### OAuth 2.0 Authentication with Express Source: https://context7.com/pipedrive/client-nodejs/llms.txt Provides a full Express integration example for OAuth 2.0 authentication, including token refresh and session persistence. ```APIDOC ## OAuth 2.0 — Full Express Integration ### Description Complete OAuth2 flow with automatic token refresh, token-update callback, and session persistence using Express. ### Method Utilize `OAuth2Configuration` to manage the OAuth2 flow. Set up Express routes for the main application and the callback URL. Persist tokens using session cookies. ### Example ```typescript import express from 'express'; import cookieParser from 'cookie-parser'; import cookieSession from 'cookie-session'; import { Configuration, DealsApi, OAuth2Configuration } from 'pipedrive/v2'; const app = express(); app.use(cookieParser()); app.use(cookieSession({ name: 'session', keys: ['secret-key'] })); const oauth2 = new OAuth2Configuration({ clientId: 'YOUR_CLIENT_ID', clientSecret: 'YOUR_CLIENT_SECRET', redirectUri: 'https://yourapp.com/callback', }); // Persist token changes (e.g. after auto-refresh) oauth2.onTokenUpdate = (token) => { console.log('Token refreshed, new expiry in', token.expires_in, 'seconds'); }; app.get('/', async (req, res) => { const token = oauth2.updateToken(req.session?.accessToken ?? null); if (!token) return res.redirect(oauth2.authorizationUrl); const apiConfig = new Configuration({ accessToken: oauth2.getAccessToken, basePath: oauth2.basePath, }); const { data: deals } = await new DealsApi(apiConfig).getDeals(); return res.json(deals); }); app.get('/callback', async (req, res) => { const newToken = await oauth2.authorize(req.query.code as string); req.session.accessToken = newToken; return res.redirect('/'); }); app.listen(3000); ``` ``` -------------------------------- ### Configure Pipedrive Client with API Token Source: https://github.com/pipedrive/client-nodejs/blob/master/migration.md Example of configuring the Pipedrive client using an API token for authentication within an Express.js application. ```typescript import express from "express"; import { Configuration, DealsApi } from "pipedrive/v1"; const app = express(); const PORT = 3000; // Configure Client with API key authorization const apiConfig = new Configuration({ apiKey: "YOUR_API_TOKEN_HERE", }); app.listen(PORT, () => { console.log(`Listening on port ${PORT}`); }); app.get("/", async (req, res) => { const dealsApi = new DealsApi(apiConfig); const response = await dealsApi.getDeals(); const { data: deals } = response; res.send(deals); }); ``` -------------------------------- ### Get File Details Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Retrieves details of a specific file by its ID. ```APIDOC ## GET /files/{id} ### Description Get one file. ### Method GET ### Endpoint /files/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the file to retrieve. ``` -------------------------------- ### Get Deal Participants Changelog Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Lists all updates related to participants of a specific deal. ```APIDOC ## GET /deals/{id}/participantsChangelog ### Description List updates about participants of a deal. ### Method GET ### Endpoint /deals/{id}/participantsChangelog ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the deal. ``` -------------------------------- ### Get Company Add-ons Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Retrieves information about all add-ons associated with a company. ```APIDOC ## GET /billing/subscriptions/addons ### Description Get all add-ons for a single company. ### Method GET ### Endpoint /billing/subscriptions/addons ``` -------------------------------- ### Get Archived Deals Summary Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Retrieves a summary of archived deals. ```APIDOC ## GET /deals/summary/archived ### Description Get archived deals summary. ### Method GET ### Endpoint /deals/summary/archived ``` -------------------------------- ### Get Deal Products Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Lists products attached to a specific deal. This endpoint retrieves all products associated with a given deal. ```APIDOC ## GET /deals/{id}/products ### Description List products attached to a deal ### Method GET ### Endpoint /deals/{id}/products ``` -------------------------------- ### Get Project Fields Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Fetches a list of all project fields. This includes standard and custom fields available for projects. ```APIDOC ## GET /projectFields ### Description Get all project fields ### Method GET ### Endpoint /projectFields ``` -------------------------------- ### Get Deal Followers Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Lists all users who are followers of a specific deal. ```APIDOC ## GET /deals/{id}/followers ### Description List followers of a deal. ### Method GET ### Endpoint /deals/{id}/followers ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the deal. ``` -------------------------------- ### Get Tasks Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Fetches a list of all tasks. This endpoint allows retrieval of all tasks within the system. ```APIDOC ## GET /tasks ### Description Get all tasks ### Method GET ### Endpoint /tasks ``` -------------------------------- ### Get Permitted Users for Deal Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Lists all users who have permission to access a specific deal. ```APIDOC ## GET /deals/{id}/permittedUsers ### Description List permitted users. ### Method GET ### Endpoint /deals/{id}/permittedUsers ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the deal. ``` -------------------------------- ### Get Files Associated with a Deal (v1) Source: https://context7.com/pipedrive/client-nodejs/llms.txt Retrieve a list of files associated with a specific deal using the v1 API. ```typescript import { Configuration, FilesApi } from 'pipedrive/v1'; const cfg = new Configuration({ apiKey: 'YOUR_API_TOKEN' }); // --- Files --- const filesApi = new FilesApi(cfg); const { data: files } = await filesApi.getFiles({ deal_id: 101 }); console.log(files.data.map((f) => f.name)); ``` -------------------------------- ### Get Project Template Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Retrieves detailed information for a specific project template using its ID. ```APIDOC ## GET /projectTemplates/{id} ### Description Get details of a template. ### Method GET ### Endpoint /projectTemplates/{id} ``` -------------------------------- ### Get Stages Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Retrieves a list of all available stages. This endpoint provides an overview of all defined stages. ```APIDOC ## GET /stages ### Description Get all stages. ### Method GET ### Endpoint /stages ``` -------------------------------- ### Get Deals Products Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Retrieves deal products for several deals. This endpoint allows fetching product information across multiple deals. ```APIDOC ## GET /deals/products ### Description Get deal products of several deals ### Method GET ### Endpoint /deals/products ``` -------------------------------- ### Previous Pipedrive SDK Function Signatures Source: https://github.com/pipedrive/client-nodejs/blob/master/migration.md Illustrates the function signature for adding, updating, and getting deals in the previous version of the SDK. ```javascript await dealsApi.addDeal({ title: 'My First Deal', }); await dealsApi.updateDeal(1, { title: 'Updated Title', }); await api.getDeal(1); ``` -------------------------------- ### Get Stage Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Retrieves detailed information about a single stage using its ID. ```APIDOC ## GET /stages/{id} ### Description Get one stage. ### Method GET ### Endpoint /stages/{id} ``` -------------------------------- ### Get Activities Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Retrieves a list of all activities. This endpoint can be used to fetch all activity records associated with the account. ```APIDOC ## GET /activities ### Description Get all activities ### Method GET ### Endpoint /activities ``` -------------------------------- ### Get Deal Changelog Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Lists all updates and changes made to a specific deal's fields. ```APIDOC ## GET /deals/{id}/changelog ### Description List updates about deal field values. ### Method GET ### Endpoint /deals/{id}/changelog ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the deal. ``` -------------------------------- ### Manage Products with ProductsApi (v2) Source: https://context7.com/pipedrive/client-nodejs/llms.txt Demonstrates full product catalog management including creation, retrieval, search, variation management, duplication, and deletion. Ensure you have a valid API key and the necessary permissions. ```typescript import { Configuration, ProductsApi } from 'pipedrive/v2'; const api = new ProductsApi(new Configuration({ apiKey: 'YOUR_API_TOKEN' })); // --- Create a product --- const { data: created } = await api.addProduct({ AddProductRequest: { name: 'Premium Support Package', code: 'SUP-PREMIUM', unit: 'year', tax: 20, prices: [{ currency: 'USD', price: 1200, cost: 400 }], }, }); const productId = created.data.id; // --- Get details --- const { data: product } = await api.getProduct({ id: productId }); console.log(product.data.name); // --- Search --- const { data: results } = await api.searchProducts({ term: 'support', limit: 10 }); // --- Add a variation --- await api.addProductVariation({ id: productId, AddProductVariationRequest: { name: 'Enterprise Tier', prices: [{ currency: 'USD', price: 2400 }], }, }); // --- List variations --- const { data: variations } = await api.getProductVariations({ id: productId }); // --- Duplicate a product --- const { data: copy } = await api.duplicateProduct({ id: productId }); // --- Delete --- await api.deleteProduct({ id: productId }); ``` -------------------------------- ### Create, Read, Update, Delete Persons (v2) Source: https://context7.com/pipedrive/client-nodejs/llms.txt Provides examples for managing persons, including creation with contact details, retrieval, updates, and deletion. Requires a valid API token. ```typescript import { Configuration, PersonsApi } from 'pipedrive/v2'; const api = new PersonsApi(new Configuration({ apiKey: 'YOUR_API_TOKEN' })); // --- Create a person --- const { data: created } = await api.addPerson({ AddPersonRequest: { name: 'Jane Doe', emails: [{ value: 'jane.doe@example.com', primary: true, label: 'work' }], phones: [{ value: '+15551234567', primary: true, label: 'mobile' }], org_id: 42, }, }); const personId = created.data.id; // --- Retrieve a person --- const { data: person } = await api.getPerson({ id: personId }); console.log(person.data.name); // 'Jane Doe' // --- Update a person --- await api.updatePerson({ id: personId, UpdatePersonRequest: { name: 'Jane Smith' }, }); // --- Delete a person --- await api.deletePerson({ id: personId }); ``` -------------------------------- ### Get Deal Fields Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Fetches a list of all deal fields. This includes standard and custom fields available for deals. ```APIDOC ## GET /dealFields ### Description Get all deal fields ### Method GET ### Endpoint /dealFields ``` -------------------------------- ### Manage Deal Discounts and Conversions (v2) Source: https://context7.com/pipedrive/client-nodejs/llms.txt Shows how to add a percentage-based discount to a deal and convert a deal into a lead. Includes polling for the conversion status. ```typescript // --- Add a discount --- const { data: discount } = await api.postAdditionalDiscount({ id: dealId, AddAdditionalDiscountRequestBody: { type: 'percentage', amount: 10, description: 'Q4 promo' }, }); // --- Convert deal to lead --- const { data: conversion } = await api.convertDealToLead({ id: dealId }); // Poll for result: const { data: status } = await api.getDealConversionStatus({ id: dealId, conversion_id: conversion.data.conversion_id, }); console.log(status.data.status); // 'completed' | 'running' | 'failed' ``` -------------------------------- ### Update Installment Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Updates an installment associated with a deal. This endpoint allows for modification of existing installment details. ```APIDOC ## PATCH /deals/{id}/installments/{installment_id} ### Description Update an installment added to a deal ### Method PATCH ### Endpoint /deals/{id}/installments/{installment_id} ``` -------------------------------- ### Post Installment Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Adds an installment to a deal. This endpoint allows for the creation of new installment records for a deal. ```APIDOC ## POST /deals/{id}/installments ### Description Add an installment to a deal ### Method POST ### Endpoint /deals/{id}/installments ``` -------------------------------- ### Delete Installment Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Deletes a specific installment from a deal. This action removes the installment record associated with a deal. ```APIDOC ## DELETE /deals/{id}/installments/{installment_id} ### Description Delete an installment from a deal ### Method DELETE ### Endpoint /deals/{id}/installments/{installment_id} ``` -------------------------------- ### Search and Convert Leads Source: https://context7.com/pipedrive/client-nodejs/llms.txt Shows how to search for leads using keywords and convert them into deals. The conversion process is asynchronous, requiring a poll for status updates. ```typescript import { Configuration, LeadsApi } from 'pipedrive/v2'; const api = new LeadsApi(new Configuration({ apiKey: 'YOUR_API_TOKEN' })); // --- Search leads --- const { data: results } = await api.searchLeads({ term: 'software', fields: 'title,notes', exact_match: false, limit: 25, }); console.log(results.data.items); // --- Convert lead to deal --- const { data: job } = await api.convertLeadToDeal({ id: 'LEAD_UUID', ConvertLeadToDealRequest: { pipeline_id: 1, stage_id: 2 }, }); const conversionId = job.data.id; // --- Poll for conversion status --- let statusData; do { await new Promise((r) => setTimeout(r, 1000)); const { data } = await api.getLeadConversionStatus({ id: 'LEAD_UUID', conversion_id: conversionId, }); statusData = data.data; } while (statusData.status === 'running'); console.log('Deal ID:', statusData.deal_id); // ID of the created deal ``` -------------------------------- ### Create, Read, Update, Delete Deals (v2) Source: https://context7.com/pipedrive/client-nodejs/llms.txt Demonstrates full CRUD operations for deals, including adding, retrieving, updating, and deleting. Ensure you have a valid API token and pipeline/stage IDs. ```typescript import { Configuration, DealsApi } from 'pipedrive/v2'; const api = new DealsApi(new Configuration({ apiKey: 'YOUR_API_TOKEN' })); // --- Create a deal --- const { data: created } = await api.addDeal({ AddDealRequest: { title: 'Enterprise License Q4', value: 50000, currency: 'USD', pipeline_id: 1, stage_id: 3, status: 'open', }, }); const dealId = created.data.id; console.log('Created deal ID:', dealId); // --- Get a single deal --- const { data: deal } = await api.getDeal({ id: dealId }); console.log(deal.data.title); // 'Enterprise License Q4' // --- Update a deal --- await api.updateDeal({ id: dealId, UpdateDealRequest: { stage_id: 4, value: 55000 }, }); // --- Delete a deal --- await api.deleteDeal({ id: dealId }); ``` -------------------------------- ### New Pipedrive SDK Function Signatures Source: https://github.com/pipedrive/client-nodejs/blob/master/migration.md Demonstrates the updated function signatures for adding, updating, getting, and deleting deals in the new SDK version, requiring strongly typed request objects. ```javascript await dealsApi.addDeal({ AddDealRequest: { title: 'My First Deal', }, }); await dealsApi.updateDeal({ id: 1, UpdateDealRequest: { title: 'Updated Title', }, }); await dealsApi.getDeal({ id : 1 }) await dealsApi.deleteDeal({ id : 1 }) ``` -------------------------------- ### Initialize Client with API Token Source: https://github.com/pipedrive/client-nodejs/blob/master/README.md Configure the Pipedrive client using an API token for authentication. Ensure the API token is kept secure. ```typescript import express from 'express'; import { Configuration, DealsApi } from 'pipedrive/v2'; const app = express(); const PORT = 3000; // Configure Client with API key authorization const apiConfig = new Configuration({ apiKey: 'YOUR_API_TOKEN_HERE', }); app.listen(PORT, () => { console.log(`Listening on port ${PORT}`); }); app.get('/', async (req, res) => { const dealsApi = new DealsApi(apiConfig); const responseAllDeals = await dealsApi.getDeals(); const { data: deals } = responseAllDeals; const responseOneDeal = await dealsApi.getDeal({ id: 1 }); const { data: deal } = responseOneDeal; res.send({ deals, deal }); }); ``` -------------------------------- ### Manage Deal Products (Add, List, Update, Delete) Source: https://context7.com/pipedrive/client-nodejs/llms.txt Covers operations for adding single or multiple products to a deal, listing existing products, updating quantities or discounts, and removing products. ```typescript import { Configuration, DealProductsApi } from 'pipedrive/v2'; const api = new DealProductsApi(new Configuration({ apiKey: 'YOUR_API_TOKEN' })); const dealId = 101; // --- Add a single product to a deal --- const { data: added } = await api.addDealProduct({ id: dealId, AddDealProductRequest: { product_id: 5, item_price: 299.99, quantity: 3, discount: 5, // percent currency: 'USD', }, }); const attachmentId = added.data.id; // --- Add multiple products in bulk --- await api.addManyDealProducts({ id: dealId, CreateManyDealProductRequest: { products: [ { product_id: 6, item_price: 49.99, quantity: 10 }, { product_id: 7, item_price: 19.99, quantity: 5 }, ], }, }); // --- List products on a deal --- const { data: list } = await api.getDealProducts({ id: dealId }); console.log(list.data); // --- Update attachment --- await api.updateDealProduct({ id: dealId, product_attachment_id: attachmentId, UpdateDealProductRequest: { quantity: 4, discount: 10 }, }); // --- Remove one product --- await api.deleteDealProduct({ id: dealId, product_attachment_id: attachmentId }); // --- Remove all products at once --- await api.deleteManyDealProducts({ id: dealId }); ``` -------------------------------- ### Get Activity Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Fetches the details of a specific activity using its unique ID. This provides comprehensive information about a single activity. ```APIDOC ## GET /activities/{id} ### Description Get details of an activity ### Method GET ### Endpoint /activities/{id} ``` -------------------------------- ### Create, Read, Update, Delete Activities Source: https://context7.com/pipedrive/client-nodejs/llms.txt Demonstrates the full lifecycle of an activity, from creation to deletion. Ensure you have a valid API token and appropriate deal/person IDs. ```typescript import { Configuration, ActivitiesApi } from 'pipedrive/v2'; const api = new ActivitiesApi(new Configuration({ apiKey: 'YOUR_API_TOKEN' })); // --- Create an activity --- const { data: created } = await api.addActivity({ AddActivityRequest: { subject: 'Follow-up call with Jane', type: 'call', due_date: '2024-09-01', due_time: '14:00', duration: '00:30', deal_id: 101, person_id: 55, note: 'Discuss contract renewal terms', participants: [{ person_id: 55, primary_flag: true }], }, }); const activityId = created.data.id; // --- Retrieve --- const { data: activity } = await api.getActivity({ id: activityId }); console.log(activity.data.subject); // --- List all activities --- const { data: list } = await api.getActivities({ limit: 100, done: false }); // --- Update (mark done) --- await api.updateActivity({ id: activityId, UpdateActivityRequest: { done: true }, }); // --- Delete --- await api.deleteActivity({ id: activityId }); ``` -------------------------------- ### Get Project Permitted Users Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Lists all users who have been granted permission to access a specific project, identified by the project ID. ```APIDOC ## GET /projects/{id}/permittedUsers ### Description List permitted users. ### Method GET ### Endpoint /projects/{id}/permittedUsers ``` -------------------------------- ### ProductsApi (v2) Source: https://context7.com/pipedrive/client-nodejs/llms.txt Full product catalog management: CRUD, variations, image upload/management, followers, and search. ```APIDOC ## ProductsApi (v2) Full product catalog management: CRUD, variations, image upload/management, followers, and search. ### Create a product ```typescript const { data: created } = await api.addProduct({ AddProductRequest: { name: 'Premium Support Package', code: 'SUP-PREMIUM', unit: 'year', tax: 20, prices: [{ currency: 'USD', price: 1200, cost: 400 }], }, }); const productId = created.data.id; ``` ### Get product details ```typescript const { data: product } = await api.getProduct({ id: productId }); console.log(product.data.name); ``` ### Search products ```typescript const { data: results } = await api.searchProducts({ term: 'support', limit: 10 }); ``` ### Add a product variation ```typescript await api.addProductVariation({ id: productId, AddProductVariationRequest: { name: 'Enterprise Tier', prices: [{ currency: 'USD', price: 2400 }], }, }); ``` ### List product variations ```typescript const { data: variations } = await api.getProductVariations({ id: productId }); ``` ### Duplicate a product ```typescript const { data: copy } = await api.duplicateProduct({ id: productId }); ``` ### Delete a product ```typescript await api.deleteProduct({ id: productId }); ``` ``` -------------------------------- ### Deals API (v2) Source: https://context7.com/pipedrive/client-nodejs/llms.txt Manage deals, the core revenue-tracking object in Pipedrive. Supports full CRUD, followers, discounts, installments, deal-to-lead conversion, and search. ```APIDOC ## Deals API (v2) Manage deals — the core revenue-tracking object in Pipedrive. Supports full CRUD, followers, discounts, installments, deal-to-lead conversion, and search. All mutations use PATCH; the base URL is `https://api.pipedrive.com/api/v2/deals`. ### Create a deal ```typescript const { data: created } = await api.addDeal({ AddDealRequest: { title: 'Enterprise License Q4', value: 50000, currency: 'USD', pipeline_id: 1, stage_id: 3, status: 'open', }, }); const dealId = created.data.id; console.log('Created deal ID:', dealId); ``` ### Get a single deal ```typescript const { data: deal } = await api.getDeal({ id: dealId }); console.log(deal.data.title); // 'Enterprise License Q4' ``` ### List all deals (cursor-based pagination) ```typescript const { data: list } = await api.getDeals({ limit: 50 }); const nextCursor = list.additional_data?.next_cursor; ``` ### Update a deal ```typescript await api.updateDeal({ id: dealId, UpdateDealRequest: { stage_id: 4, value: 55000 }, }); ``` ### Search deals ```typescript const { data: results } = await api.searchDeals({ term: 'Enterprise', exact_match: false, limit: 20 }); console.log(results.data.items); // Array of matching deal summaries ``` ### Add a discount ```typescript const { data: discount } = await api.postAdditionalDiscount({ id: dealId, AddAdditionalDiscountRequestBody: { type: 'percentage', amount: 10, description: 'Q4 promo' }, }); ``` ### Convert deal to lead ```typescript const { data: conversion } = await api.convertDealToLead({ id: dealId }); // Poll for result: const { data: status } = await api.getDealConversionStatus({ id: dealId, conversion_id: conversion.data.conversion_id, }); console.log(status.data.status); // 'completed' | 'running' | 'failed' ``` ### Delete a deal ```typescript await api.deleteDeal({ id: dealId }); ``` ``` -------------------------------- ### PipelinesApi (v2) Source: https://context7.com/pipedrive/client-nodejs/llms.txt Create and manage sales pipelines. ```APIDOC ## PipelinesApi (v2) Create and manage sales pipelines. ### Create a pipeline ```typescript const { data: created } = await api.addPipeline({ AddPipelineRequest: { name: 'Enterprise Sales', deal_probability: true }, }); const pipelineId = created.data.id; ``` ### List all pipelines ```typescript const { data: list } = await api.getPipelines(); console.log(list.data.map((p) => `${p.id}: ${p.name}`)); ``` ### Get a single pipeline ```typescript const { data: pipeline } = await api.getPipeline({ id: pipelineId }); ``` ### Update a pipeline ```typescript await api.updatePipeline({ id: pipelineId, UpdatePipelineRequest: { name: 'Enterprise Sales 2024' }, }); ``` ### Delete a pipeline ```typescript await api.deletePipeline({ id: pipelineId }); ``` ``` -------------------------------- ### Get Project Board Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Retrieves details of a specific project board using its ID. This endpoint provides information about a particular project board. ```APIDOC ## GET /boards/{id} ### Description Get details of a project board ### Method GET ### Endpoint /boards/{id} ``` -------------------------------- ### List and Search Deals (v2) Source: https://context7.com/pipedrive/client-nodejs/llms.txt Covers listing deals with cursor-based pagination and searching deals by a term with optional exact matching. Useful for retrieving multiple deals or finding specific ones. ```typescript // --- List all deals (cursor-based pagination) --- const { data: list } = await api.getDeals({ limit: 50 }); const nextCursor = list.additional_data?.next_cursor; // --- Search deals --- const { data: results } = await api.searchDeals({ term: 'Enterprise', exact_match: false, limit: 20 }); console.log(results.data.items); // Array of matching deal summaries ``` -------------------------------- ### MeetingsApi - saveUserProviderLink Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Links a user with the installed video call integration. ```APIDOC ## POST /meetings/userProviderLinks ### Description Links a user with the installed video call integration. ### Method POST ### Endpoint /meetings/userProviderLinks ``` -------------------------------- ### LeadsApi - addLead Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Adds a new lead. ```APIDOC ## POST /leads ### Description Adds a lead. ### Method POST ### Endpoint /leads ``` -------------------------------- ### Get Filter Helpers Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Retrieves information about filter helper options. ```APIDOC ## GET /filters/helpers ### Description Get all filter helpers. ### Method GET ### Endpoint /filters/helpers ``` -------------------------------- ### Get One Filter Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Retrieves details of a specific filter by its ID. ```APIDOC ## GET /filters/{id} ### Description Get one filter. ### Method GET ### Endpoint /filters/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the filter to retrieve. ``` -------------------------------- ### LeadsApi (v2) Source: https://context7.com/pipedrive/client-nodejs/llms.txt Manage leads and convert them into deals. This version includes search functionality and asynchronous lead-to-deal conversion. ```APIDOC ## LeadsApi (v2) ### Description Manage leads and convert them to deals. The v2 API adds search and async lead-to-deal conversion. ### Methods - `searchLeads`: Searches for leads based on specified terms and fields. - `convertLeadToDeal`: Converts a lead into a deal, specifying pipeline and stage. - `getLeadConversionStatus`: Polls for the status of a lead-to-deal conversion. ### Request Example (searchLeads) ```typescript const { data: results } = await api.searchLeads({ term: 'software', fields: 'title,notes', exact_match: false, limit: 25, }); ``` ### Request Example (convertLeadToDeal) ```typescript const { data: job } = await api.convertLeadToDeal({ id: 'LEAD_UUID', ConvertLeadToDealRequest: { pipeline_id: 1, stage_id: 2 }, }); ``` ### Response Example (getLeadConversionStatus) ```json { "data": { "id": "CONVERSION_ID", "status": "running", "deal_id": null } } ``` ``` -------------------------------- ### Initialize Client with OAuth 2.0 Configuration Source: https://github.com/pipedrive/client-nodejs/blob/master/README.md Set up OAuth 2.0 configuration for the Pipedrive client, including client ID, client secret, and redirect URI. The API token should not be set when using OAuth 2.0. ```typescript import { OAuth2Configuration, Configuration } from 'pipedrive/v2'; // Configuration parameters and credentials const oauth2 = new OAuth2Configuration({ clientId: 'clientId', // OAuth 2 Client ID clientSecret: 'clientSecret', // OAuth 2 Client Secret redirectUri: 'redirectUri' // OAuth 2 Redirection endpoint or Callback Uri }); const apiConfig = new Configuration({ accessToken: oauth2.getAccessToken, basePath: oauth2.basePath, }); ``` -------------------------------- ### Add New Goal Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Creates a new goal. ```APIDOC ## POST /goals ### Description Add a new goal. ### Method POST ### Endpoint /goals ``` -------------------------------- ### Manage Projects with ProjectsApi Source: https://context7.com/pipedrive/client-nodejs/llms.txt Use ProjectsApi to create, retrieve, list, search, archive, update, and delete projects. Ensure you have a valid API token and project details. ```typescript import { Configuration, ProjectsApi } from 'pipedrive/v2'; const api = new ProjectsApi(new Configuration({ apiKey: 'YOUR_API_TOKEN' })); // --- Create --- const { data: created } = await api.addProject({ AddProjectRequest: { title: 'Website Redesign', description: 'Full redesign of company website', board_id: 1, phase_id: 2, }, }); const projectId = created.data.id; // --- Get --- const { data: project } = await api.getProject({ id: projectId }); console.log(project.data.title); // --- List all active projects --- const { data: list } = await api.getProjects({ status: 'open', limit: 50 }); // --- Search --- const { data: found } = await api.searchProjects({ term: 'redesign' }); // --- Changelog (field value history) --- const { data: log } = await api.getProjectChangelog({ id: projectId }); console.log(log.data); // --- Archive --- await api.archiveProject({ id: projectId }); // --- Update --- await api.updateProject({ id: projectId, UpdateProjectRequest: { title: 'Website Redesign 2024' }, }); // --- Delete --- await api.deleteProject({ id: projectId }); ``` -------------------------------- ### Add Channel Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Creates a new channel. ```APIDOC ## POST /channels ### Description Add a channel. ### Method POST ### Endpoint /channels ``` -------------------------------- ### LeadsApi - getLeads Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Retrieves all leads. ```APIDOC ## GET /leads ### Description Gets all leads. ### Method GET ### Endpoint /leads ``` -------------------------------- ### MeetingsApi - deleteUserProviderLink Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Deletes the link between a user and an installed video call integration. ```APIDOC ## DELETE /meetings/userProviderLinks/{id} ### Description Deletes the link between a user and the installed video call integration. ### Method DELETE ### Endpoint /meetings/userProviderLinks/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the user provider link to delete. ``` -------------------------------- ### ProductsApi | getProducts Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v2.md Retrieves a list of all products. ```APIDOC ## GET /products ### Description Get all products. ### Method GET ### Endpoint /products ``` -------------------------------- ### API Key Authentication Source: https://context7.com/pipedrive/client-nodejs/llms.txt Demonstrates how to authenticate with the Pipedrive API using a static API key and fetch deals. ```APIDOC ## API Key Authentication ### Description Configure the SDK with a Pipedrive API token retrieved from your account settings. ### Method Instantiate `Configuration` with `apiKey` and then instantiate an API class (e.g., `DealsApi`) with the configuration. ### Example ```typescript import { Configuration, DealsApi } from 'pipedrive/v2'; const apiConfig = new Configuration({ apiKey: 'YOUR_API_TOKEN_HERE', }); const dealsApi = new DealsApi(apiConfig); // Fetch all deals const { data: deals } = await dealsApi.getDeals(); console.log(deals); // { success: true, data: [...], additional_data: { next_cursor: '...' } } ``` ``` -------------------------------- ### Authenticate with API Key (Static Token) Source: https://context7.com/pipedrive/client-nodejs/llms.txt Configure the SDK with a Pipedrive API token for authentication. This method is suitable for server-side applications where the API token can be securely stored. ```typescript import { Configuration, DealsApi } from 'pipedrive/v2'; const apiConfig = new Configuration({ apiKey: 'YOUR_API_TOKEN_HERE', }); const dealsApi = new DealsApi(apiConfig); // Fetch all deals const { data: deals } = await dealsApi.getDeals(); console.log(deals); // { success: true, data: [...], additional_data: { next_cursor: '...' } } ``` -------------------------------- ### Get Archived Deals Timeline Source: https://github.com/pipedrive/client-nodejs/blob/master/docs/v1.md Retrieves a timeline view of archived deals. ```APIDOC ## GET /deals/timeline/archived ### Description Get archived deals timeline. ### Method GET ### Endpoint /deals/timeline/archived ```