0

Deactivate a Repo Sync

by
Published Oct 17, 2025

Deactivate an active Repo Sync. Import and export can't be performed on deactivated syncs and the pushes to the repository won't trigger the import to Phrase.

Script phrase Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Phrase = {
3
	token: string
4
	baseUrl: string
5
}
6
/**
7
 * Deactivate a Repo Sync
8
 * Deactivate an active Repo Sync. Import and export can't be performed on deactivated syncs
9
and the pushes to the repository won't trigger the import to Phrase.
10
 */
11
export async function main(auth: Phrase, account_id: string, id: string) {
12
	const url = new URL(`${auth.baseUrl}/accounts/${account_id}/repo_syncs/${id}/deactivate`)
13

14
	const response = await fetch(url, {
15
		method: 'POST',
16
		headers: {
17
			Authorization: 'ApiToken ' + auth.token
18
		},
19
		body: undefined
20
	})
21
	if (!response.ok) {
22
		const text = await response.text()
23
		throw new Error(`${response.status} ${text}`)
24
	}
25
	return await response.json()
26
}
27