0

Request a SIM card disable

by
Published Apr 8, 2025

This API disables a SIM card, disconnecting it from the network and making it impossible to consume data. The API will trigger an asynchronous operation called a SIM Card Action. Transitioning to the disabled state may take a period of time. 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 a SIM card disable
7
 * This API disables a SIM card, disconnecting it from the network and making it impossible to consume data.
8
The API will trigger an asynchronous operation called a SIM Card Action. Transitioning to the disabled state may take a period of time. 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, id: string) {
12
	const url = new URL(`https://api.telnyx.com/v2/sim_cards/${id}/actions/disable`)
13

14
	const response = await fetch(url, {
15
		method: 'POST',
16
		headers: {
17
			Authorization: 'Bearer ' + auth.apiKey
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