Unlocks an existing card.
by hugo697 ยท 10/17/2025
1
//native
2
type Brex = {
3
token: string;
4
};
5
/**
6
*
7
Unlock card
8
9
10
11
12
*/
13
export async function main(auth: Brex, id: string, Idempotency_Key?: string) {
14
const url = new URL(`https://platform.brexapis.com/v2/cards/${id}/unlock`);
15
16
const response = await fetch(url, {
17
method: "POST",
18
headers: {
19
...(Idempotency_Key ? { "Idempotency-Key": Idempotency_Key } : {}),
20
Authorization: "Bearer " + auth.token,
21
},
22
body: undefined,
23
});
24
if (!response.ok) {
25
const text = await response.text();
26
throw new Error(`${response.status} ${text}`);
27
}
28
return await response.json();
29
30