0

List data integrity details

by
Published Oct 17, 2025

The *List data integrity details* endpoint returns the match result record by record for a given data type, filtered based on a query string in the same way as summary results. The [details](https://docs.codat.io/lending-api#/schemas/DataIntegrityDetail) are paginated and support ordering, following the same conventions as our other data endpoints.

Script codat Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Codat = {
3
	encodedKey: string
4
}
5
/**
6
 * List data integrity details
7
 * The *List data integrity details* endpoint returns the match result record by record for a given data type, filtered based on a query string in the same way as summary results.
8

9
The [details](https://docs.codat.io/lending-api#/schemas/DataIntegrityDetail) are paginated and support ordering, following the same conventions as our other data endpoints.
10
 */
11
export async function main(
12
	auth: Codat,
13
	companyId: string,
14
	dataType: 'banking-accounts' | 'banking-transactions' | 'bankAccounts' | 'accountTransactions',
15
	page: string | undefined,
16
	pageSize: string | undefined,
17
	query: string | undefined,
18
	orderBy: string | undefined
19
) {
20
	const url = new URL(
21
		`https://api.codat.io/data/companies/${companyId}/assess/dataTypes/${dataType}/dataIntegrity/details`
22
	)
23
	for (const [k, v] of [
24
		['page', page],
25
		['pageSize', pageSize],
26
		['query', query],
27
		['orderBy', orderBy]
28
	]) {
29
		if (v !== undefined && v !== '' && k !== undefined) {
30
			url.searchParams.append(k, v)
31
		}
32
	}
33

34
	const response = await fetch(url, {
35
		method: 'GET',
36
		headers: {
37
			Authorization: `Basic ${auth.encodedKey}`
38
		},
39
		body: undefined
40
	})
41
	if (!response.ok) {
42
		const text = await response.text()
43
		throw new Error(`${response.status} ${text}`)
44
	}
45
	return await response.json()
46
}
47