0

Applications Update

by
Published Oct 17, 2025

Applications Update

Script basis_theory Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Basistheory = {
3
  apiKey: string;
4
};
5
/**
6
 * Applications Update
7
 * Applications Update
8
 */
9
export async function main(
10
  auth: Basistheory,
11
  id: string,
12
  body: {
13
    name?: string;
14
    permissions?: string[];
15
    rules?: {
16
      conditions?: { attribute?: string; operator?: string; value?: string }[];
17
      container?: string;
18
      description?: string;
19
      permissions?: string[];
20
      priority?: string;
21
      transform?: string;
22
    }[];
23
  },
24
) {
25
  const url = new URL(`https://api.basistheory.com/applications/${id}`);
26

27
  const response = await fetch(url, {
28
    method: "PUT",
29
    headers: {
30
      "Content-Type": "application/json",
31
      "BT-API-KEY": auth.apiKey,
32
    },
33
    body: JSON.stringify(body),
34
  });
35
  if (!response.ok) {
36
    const text = await response.text();
37
    throw new Error(`${response.status} ${text}`);
38
  }
39
  return await response.json();
40
}
41