0

Reject contract

by
Published Oct 17, 2025

Rejects a contract that is in the pending (unsigned) state by specifying its public ID in the contract_id parameter. Use this endpoint when you do not wish to proceed with the agreement. Only contracts that have not yet been signed or previously rejected are eligible for this action **Token scopes**: `worker:write`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Reject contract
4
 * Rejects a contract that is in the pending (unsigned) state by specifying its public ID in the contract_id parameter. Use this endpoint when you do not wish to proceed with the agreement. Only contracts that have not yet been signed or previously rejected are eligible for this action
5
 **Token scopes**: `worker:write`
6
 */
7
export async function main(auth: RT.Deel, contract_id: string) {
8
	const url = new URL(`https://api.letsdeel.com/rest/v2/workers/contracts/${contract_id}/reject`)
9

10
	const response = await fetch(url, {
11
		method: 'POST',
12
		headers: {
13
			Authorization: 'Bearer ' + auth.apiKey
14
		},
15
		body: undefined
16
	})
17
	if (!response.ok) {
18
		const text = await response.text()
19
		throw new Error(`${response.status} ${text}`)
20
	}
21
	return await response.text()
22
}
23