0

Update an installment added to a deal

by
Published Oct 17, 2025

Edits an installment added to a deal. Only available in Advanced and above plans.

Script pipedrive Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Pipedrive = {
3
  apiToken: string;
4
};
5
/**
6
 * Update an installment added to a deal
7
 * Edits an installment added to a deal.
8

9
Only available in Advanced and above plans.
10

11
 */
12
export async function main(
13
  auth: Pipedrive,
14
  id: string,
15
  installment_id: string,
16
  body: { description?: string; amount?: number; billing_date?: string },
17
) {
18
  const url = new URL(
19
    `https://api.pipedrive.com/api/v2/deals/${id}/installments/${installment_id}`,
20
  );
21

22
  const response = await fetch(url, {
23
    method: "PATCH",
24
    headers: {
25
      "Content-Type": "application/json",
26
      "x-api-token": auth.apiToken,
27
    },
28
    body: JSON.stringify(body),
29
  });
30
  if (!response.ok) {
31
    const text = await response.text();
32
    throw new Error(`${response.status} ${text}`);
33
  }
34
  return await response.json();
35
}
36