0

Get configuration

by
Published Oct 17, 2025

The *Get configuration* endpoint returns supplemental data configuration previously created for each integration and data type combination. [Supplemental data](https://docs.codat.io/using-the-api/supplemental-data/overview) is additional data you can include in Codat's standard data types.

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 configuration
7
 * The *Get configuration* endpoint returns supplemental data configuration previously created for each integration and data type combination.
8

9
[Supplemental data](https://docs.codat.io/using-the-api/supplemental-data/overview) is additional data you can include in Codat's standard data types.
10
 */
11
export async function main(
12
	auth: Codat,
13
	platformKey: string,
14
	dataType:
15
		| 'chartOfAccounts'
16
		| 'bills'
17
		| 'company'
18
		| 'creditNotes'
19
		| 'customers'
20
		| 'invoices'
21
		| 'items'
22
		| 'journalEntries'
23
		| 'suppliers'
24
		| 'taxRates'
25
		| 'commerce-companyInfo'
26
		| 'commerce-customers'
27
		| 'commerce-disputes'
28
		| 'commerce-locations'
29
		| 'commerce-orders'
30
		| 'commerce-payments'
31
		| 'commerce-paymentMethods'
32
		| 'commerce-products'
33
		| 'commerce-productCategories'
34
		| 'commerce-taxComponents'
35
		| 'commerce-transactions'
36
) {
37
	const url = new URL(
38
		`https://api.codat.io/integrations/${platformKey}/dataTypes/${dataType}/supplementalDataConfig`
39
	)
40

41
	const response = await fetch(url, {
42
		method: 'GET',
43
		headers: {
44
			Authorization: `Basic ${auth.encodedKey}`
45
		},
46
		body: undefined
47
	})
48
	if (!response.ok) {
49
		const text = await response.text()
50
		throw new Error(`${response.status} ${text}`)
51
	}
52
	return await response.json()
53
}
54