0

Get account transaction

by
Published Oct 17, 2025

The *Get account transaction* endpoint returns a single account transaction for a given accountTransactionId. [Account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction) represent bank activity within an accounting software. All transactions that go through a bank account are recorded as account transactions. Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data).

Script codat Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Codat = {
3
	encodedKey: string
4
}
5
/**
6
 * Get account transaction
7
 * The *Get account transaction* endpoint returns a single account transaction for a given accountTransactionId.
8

9
[Account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction) represent bank activity within an accounting software. All transactions that go through a bank account are recorded as account transactions.
10

11
Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data).
12

13
 */
14
export async function main(
15
	auth: Codat,
16
	companyId: string,
17
	connectionId: string,
18
	accountTransactionId: string
19
) {
20
	const url = new URL(
21
		`https://api.codat.io/companies/${companyId}/connections/${connectionId}/data/accountTransactions/${accountTransactionId}`
22
	)
23

24
	const response = await fetch(url, {
25
		method: 'GET',
26
		headers: {
27
			Authorization: `Basic ${auth.encodedKey}`
28
		},
29
		body: undefined
30
	})
31
	if (!response.ok) {
32
		const text = await response.text()
33
		throw new Error(`${response.status} ${text}`)
34
	}
35
	return await response.json()
36
}
37