0

Get credits balance

Published today

Get the number of credits remaining on your Linkup account.

Script linkup Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 3 hours ago
1
//native
2

3
/**
4
 * Get credits balance
5
 * Get the number of credits remaining on your Linkup account.
6
 */
7
export async function main(auth: RT.Linkup) {
8
  const url = new URL("https://api.linkup.so/v1/credits/balance")
9

10
  const response = await fetch(url, {
11
    method: "GET",
12
    headers: {
13
      Authorization: `Bearer ${auth.token}`,
14
      Accept: "application/json",
15
    },
16
  })
17

18
  if (!response.ok) {
19
    throw new Error(`${response.status} ${await response.text()}`)
20
  }
21

22
  return await response.json()
23
}
24