0

Configure

by
Published Oct 17, 2025

The *Configure* endpoint allows you to maintain or change configuration required to return supplemental data 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. **Integration-specific behaviour** See the *examples* for integration-specific frequently requested properties.

Script codat Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Codat = {
3
	encodedKey: string
4
}
5
/**
6
 * Configure
7
 * The *Configure* endpoint allows you to maintain or change configuration required to return supplemental data 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
**Integration-specific behaviour**
12
See the *examples* for integration-specific frequently requested properties.
13
 */
14
export async function main(
15
	auth: Codat,
16
	platformKey: string,
17
	dataType:
18
		| 'chartOfAccounts'
19
		| 'bills'
20
		| 'company'
21
		| 'creditNotes'
22
		| 'customers'
23
		| 'invoices'
24
		| 'items'
25
		| 'journalEntries'
26
		| 'suppliers'
27
		| 'taxRates'
28
		| 'commerce-companyInfo'
29
		| 'commerce-customers'
30
		| 'commerce-disputes'
31
		| 'commerce-locations'
32
		| 'commerce-orders'
33
		| 'commerce-payments'
34
		| 'commerce-paymentMethods'
35
		| 'commerce-products'
36
		| 'commerce-productCategories'
37
		| 'commerce-taxComponents'
38
		| 'commerce-transactions',
39
	body: { supplementalDataConfig?: {} }
40
) {
41
	const url = new URL(
42
		`https://api.codat.io/integrations/${platformKey}/dataTypes/${dataType}/supplementalDataConfig`
43
	)
44

45
	const response = await fetch(url, {
46
		method: 'PUT',
47
		headers: {
48
			'Content-Type': 'application/json',
49
			Authorization: `Basic ${auth.encodedKey}`
50
		},
51
		body: JSON.stringify(body)
52
	})
53
	if (!response.ok) {
54
		const text = await response.text()
55
		throw new Error(`${response.status} ${text}`)
56
	}
57
	return await response.text()
58
}
59