0

Create an Image

by
Published Mar 25, 2024

Adds an image in your Typeform account. [See the docs here](https://developer.typeform.com/create/reference/create-image/)

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
		image: string
12
		url?: string
13
		fileName: string
14
	}
15
) {
16
	const typeformAPI = createClient({
17
		token: resource.token,
18
		apiBaseUrl: resource.baseUrl
19
	})
20

21
	return await typeformAPI.images.add({ ...data })
22
}
23