0

Update base currency

by
Published Oct 17, 2025
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 base currency
7
 *
8
 */
9
export async function main(
10
  auth: Zoho,
11
  body: {
12
    base_currency?: {
13
      iso_code: string;
14
      symbol: string;
15
      created_time: string;
16
      is_active: false | true;
17
      exchange_rate: string;
18
      format: {
19
        decimal_separator: "Comma" | "Period";
20
        thousand_separator: "Comma" | "Period" | "Space";
21
        decimal_places: "0" | "2" | "3";
22
      };
23
      created_by: { name: string; id: string; email?: string };
24
      prefix_symbol: false | true;
25
      is_base: false | true;
26
      modified_time: string;
27
      name: string;
28
      modified_by: { name: string; id: string; email?: string };
29
      id: string;
30
    };
31
  },
32
) {
33
  const url = new URL(
34
    `https://zohoapis.com/crm/v8/org/currencies/actions/enable`,
35
  );
36

37
  const response = await fetch(url, {
38
    method: "PUT",
39
    headers: {
40
      "Content-Type": "application/json",
41
      Authorization: "Zoho-oauthtoken " + auth.token,
42
    },
43
    body: JSON.stringify(body),
44
  });
45
  if (!response.ok) {
46
    const text = await response.text();
47
    throw new Error(`${response.status} ${text}`);
48
  }
49
  return await response.json();
50
}
51