0

Request bulk setting SIM card public IPs.

by
Published Apr 8, 2025

This API triggers an asynchronous operation to set a public IP for each of the specified SIM cards. For each SIM Card a SIM Card Action will be generated. The status of the SIM Card Action can be followed through the [List SIM Card Action](https://developersdev.telnyx.com/docs/api/v2/wireless/SIM-Card-Actions#ListSIMCardActions) API.

Script telnyx Verified

The script

Submitted by hugo697 Bun
Verified 428 days ago
1
//native
2
type Telnyx = {
3
	apiKey: string
4
}
5
/**
6
 * Request bulk setting SIM card public IPs.
7
 * This API triggers an asynchronous operation to set a public IP for each of the specified SIM cards.
8
For each SIM Card a SIM Card Action will be generated. The status of the SIM Card Action can be followed through the [List SIM Card Action](https://developersdev.telnyx.com/docs/api/v2/wireless/SIM-Card-Actions#ListSIMCardActions) API.
9

10
 */
11
export async function main(auth: Telnyx, body: { sim_card_ids: string[] }) {
12
	const url = new URL(`https://api.telnyx.com/v2/sim_cards/actions/bulk_set_public_ips`)
13

14
	const response = await fetch(url, {
15
		method: 'POST',
16
		headers: {
17
			'Content-Type': 'application/json',
18
			Authorization: 'Bearer ' + auth.apiKey
19
		},
20
		body: JSON.stringify(body)
21
	})
22
	if (!response.ok) {
23
		const text = await response.text()
24
		throw new Error(`${response.status} ${text}`)
25
	}
26
	return await response.json()
27
}
28