0

Reactors Create

by
Published Oct 17, 2025

Reactors 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
 * Reactors Create
7
 * Reactors Create
8
 */
9
export async function main(
10
  auth: Basistheory,
11
  body: {
12
    application?: {
13
      created_at?: string;
14
      created_by?: string;
15
      id?: string;
16
      key?: string;
17
      keys?: {
18
        created_at?: string;
19
        created_by?: string;
20
        id?: string;
21
        key?: string;
22
        version?: string;
23
      }[];
24
      modified_at?: string;
25
      modified_by?: string;
26
      name?: string;
27
      permissions?: string[];
28
      rules?: {
29
        conditions?: {
30
          attribute?: string;
31
          operator?: string;
32
          value?: string;
33
        }[];
34
        container?: string;
35
        description?: string;
36
        permissions?: string[];
37
        priority?: string;
38
        transform?: string;
39
      }[];
40
      tenant_id?: string;
41
      type?: string;
42
    };
43
    code?: string;
44
    configuration?: {
45
      consectetur__c?: string;
46
      dolor45?: string;
47
      voluptateac_?: string;
48
    };
49
    name?: string;
50
  },
51
) {
52
  const url = new URL(`https://api.basistheory.com/reactors`);
53

54
  const response = await fetch(url, {
55
    method: "POST",
56
    headers: {
57
      "Content-Type": "application/json",
58
      "BT-API-KEY": auth.apiKey,
59
    },
60
    body: JSON.stringify(body),
61
  });
62
  if (!response.ok) {
63
    const text = await response.text();
64
    throw new Error(`${response.status} ${text}`);
65
  }
66
  return await response.json();
67
}
68