Lists transfers

This endpoint lists existing transfers for an account. Currently, the API can only return transfers for the following payment rails: - ACH - DOMESTIC_WIRE - CHEQUE - INTERNATIONAL_WIRE

Script brex Verified

by hugo697 ยท 10/17/2025

The script

Submitted by hugo697 Bun
Verified 217 days ago
1
//native
2
type Brex = {
3
  token: string;
4
};
5
/**
6
 * 
7
Lists transfers 
8

9
 * 
10
This endpoint lists existing transfers for an account.
11

12
Currently, the API can only return transfers for the following payment rails:
13
- ACH
14
- DOMESTIC_WIRE
15
- CHEQUE
16
- INTERNATIONAL_WIRE
17

18
 */
19
export async function main(
20
  auth: Brex,
21
  cursor: string | undefined,
22
  limit: string | undefined,
23
) {
24
  const url = new URL(`https://platform.brexapis.com/v1/transfers`);
25
  for (const [k, v] of [
26
    ["cursor", cursor],
27
    ["limit", limit],
28
  ]) {
29
    if (v !== undefined && v !== "" && k !== undefined) {
30
      url.searchParams.append(k, v);
31
    }
32
  }
33
  const response = await fetch(url, {
34
    method: "GET",
35
    headers: {
36
      Authorization: "Bearer " + auth.token,
37
    },
38
    body: undefined,
39
  });
40
  if (!response.ok) {
41
    const text = await response.text();
42
    throw new Error(`${response.status} ${text}`);
43
  }
44
  return await response.json();
45
}
46