0

Update Form Title

by
Published Mar 25, 2024

Updates an existing form's title. [See the docs here](https://developer.typeform.com/create/reference/update-form-patch/)

Script typeform Verified

The script

Submitted by hugo697 Bun
Verified 398 days ago
1
import { createClient } from '@typeform/api-client'
2

3
type Typeform = {
4
	token: string
5
	baseUrl: string
6
}
7

8
export async function main(
9
	resource: Typeform,
10
	data: {
11
		formId: string
12
		title: string
13
	}
14
) {
15
	const typeformAPI = createClient({
16
		token: resource.token,
17
		apiBaseUrl: resource.baseUrl
18
	})
19

20
	return await typeformAPI.forms.update({
21
		uid: data.formId,
22
		override: false,
23
		data: [
24
			{
25
				op: 'replace',
26
				path: '/title',
27
				value: data.title
28
			}
29
		]
30
	})
31
}
32