0

Applications Create

by
Published Oct 17, 2025

Applications Create

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 Create
7
 * Applications Create
8
 */
9
export async function main(
10
  auth: Basistheory,
11
  body: {
12
    create_key?: string;
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
    type?: string;
24
  },
25
) {
26
  const url = new URL(`https://api.basistheory.com/applications`);
27

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