0

Generate source account credentials

by
Published Oct 17, 2025

The _Generate Bank Account Credentials_ endpoint can be used to generate credentials for QuickBooks Online to use for authentication of the Bank Feed in their portal, each time this is used a new set of credentials will be generated. The old credentials will still be valid until the revoke credentials endpoint is used, which will revoke all credentials associated to the data connection.

Script codat Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Codat = {
3
	encodedKey: string
4
}
5
/**
6
 * Generate source account credentials
7
 * The _Generate Bank Account Credentials_ endpoint can be used to generate credentials for QuickBooks Online to use for authentication of the Bank Feed in their portal, each time this is used a new set of credentials will be generated.
8

9
The old credentials will still be valid until the revoke credentials endpoint is used, which will revoke all credentials associated to the data connection.
10

11
 */
12
export async function main(auth: Codat, companyId: string, connectionId: string) {
13
	const url = new URL(
14
		`https://api.codat.io/companies/${companyId}/connections/${connectionId}/connectionInfo/bankFeedAccounts/credentials`
15
	)
16

17
	const response = await fetch(url, {
18
		method: 'POST',
19
		headers: {
20
			'Content-Type': 'application/json',
21
			Authorization: `Basic ${auth.encodedKey}`
22
		},
23
		body: undefined
24
	})
25
	if (!response.ok) {
26
		const text = await response.text()
27
		throw new Error(`${response.status} ${text}`)
28
	}
29
	return await response.json()
30
}
31