0

Fetch multiple EOR Contract forms

by
Published Oct 17, 2025

Retrieve paginated, versioned form definitions for creating EOR contracts for the specified countries. Use this endpoint when initializing or resuming a contract-creation flow to determine the required sections, fields, validation rules, and conditional logic per country (and optional contract type/locale). Always consume the latest effective version from the response and handle pagination. Not intended for reading or updating existing contracts. **Token scopes**: `forms:read`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Fetch multiple EOR Contract forms
4
 * Retrieve paginated, versioned form definitions for creating EOR contracts for the specified countries. Use this endpoint when initializing or resuming a contract-creation flow to determine the required sections, fields, validation rules, and conditional logic per country (and optional contract type/locale). Always consume the latest effective version from the response and handle pagination. Not intended for reading or updating existing contracts.
5
 **Token scopes**: `forms:read`
6
 */
7
export async function main(
8
	auth: RT.Deel,
9
	body: Body,
10
	limit?: string | undefined,
11
	cursor?: string | undefined
12
) {
13
	const url = new URL(`https://api.letsdeel.com/rest/v2/forms/eor/create-contract/definitions`)
14
	for (const [k, v] of [
15
		['limit', limit],
16
		['cursor', cursor]
17
	]) {
18
		if (v !== undefined && v !== '') {
19
			url.searchParams.append(k, v)
20
		}
21
	}
22
	const response = await fetch(url, {
23
		method: 'POST',
24
		headers: {
25
			'Content-Type': 'application/json',
26
			Authorization: 'Bearer ' + auth.apiKey
27
		},
28
		body: JSON.stringify(body)
29
	})
30
	if (!response.ok) {
31
		const text = await response.text()
32
		throw new Error(`${response.status} ${text}`)
33
	}
34
	return await response.json()
35
}
36

37
/* eslint-disable */
38
/**
39
 * This file was automatically generated by json-schema-to-typescript.
40
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
41
 * and run json-schema-to-typescript to regenerate this file.
42
 */
43

44
export interface Body {
45
	data: {
46
		/**
47
		 * Array of countries for which to fetch quote forms. Maximum 10 countries per request.
48
		 *
49
		 * @minItems 1
50
		 */
51
		countries: {
52
			/**
53
			 * The selected state code of the contract. This is only required for countries that specify it.
54
			 */
55
			state?: string
56
			/**
57
			 * Two-letter country code in ISO 3166-1 alpha-2 format
58
			 */
59
			country_code: string
60
			[k: string]: unknown
61
		}[]
62
		/**
63
		 * The selected start date of the contract in ISO 8601 formatted date string.
64
		 */
65
		start_date?: string
66
		/**
67
		 * The selected number of work hours per week.
68
		 */
69
		work_hours_per_week?: number
70
		/**
71
		 * The contract duration in days for definite contracts.
72
		 */
73
		contract_duration_in_days?: number
74
		[k: string]: unknown
75
	}
76
	[k: string]: unknown
77
}
78