0

Update quote template

by
Published Oct 17, 2025

Update the pdf template associated with the quote.

Script zoho Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Zoho = {
3
  token: string;
4
};
5
/**
6
 * Update quote template
7
 * Update the pdf template associated with the quote.
8
 */
9
export async function main(
10
  auth: Zoho,
11
  estimate_id: string,
12
  template_id: string,
13
  X_com_zoho_subscriptions_organizationid: string,
14
) {
15
  const url = new URL(
16
    `https://www.zohoapis.com/billing/v1/estimates/${estimate_id}/templates/${template_id}`,
17
  );
18

19
  const response = await fetch(url, {
20
    method: "PUT",
21
    headers: {
22
      "X-com-zoho-subscriptions-organizationid":
23
        X_com_zoho_subscriptions_organizationid,
24
      Authorization: "Zoho-oauthtoken " + auth.token,
25
    },
26
    body: undefined,
27
  });
28
  if (!response.ok) {
29
    const text = await response.text();
30
    throw new Error(`${response.status} ${text}`);
31
  }
32
  return await response.json();
33
}
34