0

Get enhanced cash flow report

by
Published Oct 17, 2025

> **Categorization engine** > > The categorization engine uses machine learning and has been fully trained against Plaid and TrueLayer banking data sources. It is not fully trained against the Basiq banking data source. The Enhanced Cash Flow Transactions endpoint provides a fully categorized list of banking transactions for a company. Accounts and transaction data are obtained from the company's banking data sources.

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 enhanced cash flow report
7
 * > **Categorization engine**
8
> 
9
> The categorization engine uses machine learning and has been fully trained against Plaid and TrueLayer banking data sources. It is not fully trained against the Basiq banking data source.
10

11
The Enhanced Cash Flow Transactions endpoint provides a fully categorized list of banking transactions for a company. Accounts and transaction data are obtained from the company's banking data sources.
12
 */
13
export async function main(
14
	auth: Codat,
15
	companyId: string,
16
	page: string | undefined,
17
	pageSize: string | undefined,
18
	query: string | undefined
19
) {
20
	const url = new URL(
21
		`https://api.codat.io/companies/${companyId}/reports/enhancedCashFlow/transactions`
22
	)
23
	for (const [k, v] of [
24
		['page', page],
25
		['pageSize', pageSize],
26
		['query', query]
27
	]) {
28
		if (v !== undefined && v !== '' && k !== undefined) {
29
			url.searchParams.append(k, v)
30
		}
31
	}
32

33
	const response = await fetch(url, {
34
		method: 'GET',
35
		headers: {
36
			Authorization: `Basic ${auth.encodedKey}`
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