Thanks to visit codestin.com
Credit goes to www.twilio.com

Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Services resource


(new)

Public Beta

The Services resource is currently available as a Public Beta product. This means that some features for configuring your Messaging Service via the REST API are not yet implemented, and others may be changed before the product is declared Generally Available. Messaging Service Configuration through the Twilio ConsoleCodestin Search App is Generally Available.

Public Beta products are not covered by a Twilio SLACodestin Search App.

The resources for sending Messages with a Messaging Service are Generally Available.

When sending a message with a Messaging Service, you can improve message performance by enabling the included features.

Developers can associate phone numbers, short codes, and alpha sender IDs to an instance of a Messaging Service. The Service handles all inbound and outbound behaviors for the phone numbers and shortcodes.

Twilio Console

You can manage your Messaging Services through the Twilio Console when logged in.Codestin Search App


Messaging Services Resource

Codestin Search App

The Services resource represents a set of configurable behavior for sending and receiving Messages.

Subresources

Codestin Search App

The Services resource also has PhoneNumbers, ShortCodes, and AlphaSenders subresources for managing the phone numbers, short codes, and alpha sender IDs associated with the Service.

  • PhoneNumbers
  • ShortCodes
  • AlphaSenders

All URLs in this documentation use the following base URL:

https://messaging.twilio.com/v1

Service Properties

Codestin Search App
Property nameTypeRequiredPIIDescriptionChild properties
sidSID<MG>

Optional

Not PII

The unique string that we created to identify the Service resource.

Pattern: ^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34

accountSidSID<AC>

Optional

The SID of the Account that created the Service resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

friendlyNamestring

Optional

The string that you assigned to describe the resource.


dateCreatedstring<date-time>

Optional

The date and time in GMT when the resource was created specified in ISO 8601Codestin Search App format.


dateUpdatedstring<date-time>

Optional

The date and time in GMT when the resource was last updated specified in ISO 8601Codestin Search App format.


inboundRequestUrlstring<uri>

Optional

The URL we call using inbound_method when a message is received by any phone number or short code in the Service. When this property is null, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the use_inbound_webhook_on_number field is enabled then the webhook url defined on the phone number will override the inbound_request_url defined for the Messaging Service.


inboundMethodenum<http-method>

Optional

The HTTP method we use to call inbound_request_url. Can be GET or POST.

Possible values:
GETPOST

fallbackUrlstring<uri>

Optional

The URL that we call using fallback_method if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the use_inbound_webhook_on_number field is enabled then the webhook url defined on the phone number will override the fallback_url defined for the Messaging Service.


fallbackMethodenum<http-method>

Optional

The HTTP method we use to call fallback_url. Can be: GET or POST.

Possible values:
GETPOST

statusCallbackstring<uri>

Optional

The URL we call to pass status updates about message delivery.


stickySenderboolean

Optional

Whether to enable Sticky Sender on the Service instance.


mmsConverterboolean

Optional

Whether to enable the MMS Converter for messages sent through the Service instance.


smartEncodingboolean

Optional

Whether to enable Smart Encoding for messages sent through the Service instance.


scanMessageContentenum<string>

Optional

Reserved.

Possible values:
inheritenabledisable

fallbackToLongCodeboolean

Optional

[OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures.


areaCodeGeomatchboolean

Optional

Whether to enable Area Code Geomatch on the Service Instance.


synchronousValidationboolean

Optional

Reserved.


validityPeriodinteger

Optional

How long, in seconds, messages sent from the Service are valid. Can be an integer from 1 to 36,000. Default value is 36,000.

Default: 0

urlstring<uri>

Optional

The absolute URL of the Service resource.


linksobject<uri-map>

Optional

The absolute URLs of related resources.


usecasestring

Optional

A string that describes the scenario in which the Messaging Service will be used. Possible values are notifications, marketing, verification, discussion, poll, undeclared.


usAppToPersonRegisteredboolean

Optional

Whether US A2P campaign is registered for this Service.


useInboundWebhookOnNumberboolean

Optional

A boolean value that indicates either the webhook url configured on the phone number will be used or inbound_request_url/fallback_url url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the inbound_request_url/fallback_url defined for the Messaging Service.


Create a Service

Codestin Search App

POST https://messaging.twilio.com/v1/Services

Request body parameters

Codestin Search App
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredPIIDescriptionChild properties
friendlyNamestring
required

A descriptive string that you create to describe the resource. It can be up to 64 characters long.


inboundRequestUrlstring<uri>

Optional

The URL we call using inbound_method when a message is received by any phone number or short code in the Service. When this property is null, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the use_inbound_webhook_on_number field is enabled then the webhook url defined on the phone number will override the inbound_request_url defined for the Messaging Service.


inboundMethodenum<http-method>

Optional

The HTTP method we should use to call inbound_request_url. Can be GET or POST and the default is POST.

Possible values:
GETPOST

fallbackUrlstring<uri>

Optional

The URL that we call using fallback_method if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the use_inbound_webhook_on_number field is enabled then the webhook url defined on the phone number will override the fallback_url defined for the Messaging Service.


fallbackMethodenum<http-method>

Optional

The HTTP method we should use to call fallback_url. Can be: GET or POST.

Possible values:
GETPOST

statusCallbackstring<uri>

Optional

The URL we should call to pass status updates about message delivery.


stickySenderboolean

Optional

Whether to enable Sticky Sender on the Service instance.


mmsConverterboolean

Optional

Whether to enable the MMS Converter for messages sent through the Service instance.


smartEncodingboolean

Optional

Whether to enable Smart Encoding for messages sent through the Service instance.


scanMessageContentenum<string>

Optional

Reserved.

Possible values:
inheritenabledisable

fallbackToLongCodeboolean

Optional

[OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures.


areaCodeGeomatchboolean

Optional

Whether to enable Area Code Geomatch on the Service Instance.


validityPeriodinteger

Optional

How long, in seconds, messages sent from the Service are valid. Can be an integer from 1 to 36,000. Default value is 36,000.


synchronousValidationboolean

Optional

Reserved.


usecasestring

Optional

A string that describes the scenario in which the Messaging Service will be used. Possible values are notifications, marketing, verification, discussion, poll, undeclared.


useInboundWebhookOnNumberboolean

Optional

A boolean value that indicates either the webhook url configured on the phone number will be used or inbound_request_url/fallback_url url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the inbound_request_url/fallback_url defined for the Messaging Service.

Create a ServiceCodestin Search App
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createService() {
11
const service = await client.messaging.v1.services.create({
12
friendlyName: "FriendlyName",
13
});
14
15
console.log(service.sid);
16
}
17
18
createService();

Response

Codestin Search App
1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"date_created": "2015-07-30T20:12:31Z",
5
"date_updated": "2015-07-30T20:12:33Z",
6
"friendly_name": "FriendlyName",
7
"inbound_request_url": "https://www.example.com/",
8
"inbound_method": "POST",
9
"fallback_url": "https://www.example.com",
10
"fallback_method": "GET",
11
"status_callback": "https://www.example.com",
12
"sticky_sender": true,
13
"smart_encoding": false,
14
"mms_converter": true,
15
"fallback_to_long_code": true,
16
"scan_message_content": "inherit",
17
"area_code_geomatch": true,
18
"validity_period": 600,
19
"synchronous_validation": true,
20
"usecase": "marketing",
21
"us_app_to_person_registered": false,
22
"use_inbound_webhook_on_number": true,
23
"links": {
24
"phone_numbers": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers",
25
"short_codes": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes",
26
"alpha_senders": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AlphaSenders",
27
"messages": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages",
28
"us_app_to_person": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Compliance/Usa2p",
29
"us_app_to_person_usecases": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Compliance/Usa2p/Usecases",
30
"channel_senders": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelSenders",
31
"destination_alpha_senders": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DestinationAlphaSenders"
32
},
33
"url": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
34
}

Retrieve a Service

Codestin Search App

GET https://messaging.twilio.com/v1/Services/{Sid}

Path parameters

Codestin Search App
Property nameTypeRequiredPIIDescription
sidSID<MG>
required

The SID of the Service resource to fetch.

Pattern: ^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34
Fetch a ServiceCodestin Search App
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchService() {
11
const service = await client.messaging.v1
12
.services("MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.fetch();
14
15
console.log(service.sid);
16
}
17
18
fetchService();

Response

Codestin Search App
1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"date_created": "2015-07-30T20:12:31Z",
5
"date_updated": "2015-07-30T20:12:33Z",
6
"friendly_name": "My Service!",
7
"inbound_request_url": "https://www.example.com/",
8
"inbound_method": "POST",
9
"fallback_url": null,
10
"fallback_method": "POST",
11
"status_callback": "https://www.example.com",
12
"sticky_sender": true,
13
"mms_converter": true,
14
"smart_encoding": false,
15
"fallback_to_long_code": true,
16
"area_code_geomatch": true,
17
"validity_period": 600,
18
"scan_message_content": "inherit",
19
"synchronous_validation": true,
20
"usecase": "marketing",
21
"us_app_to_person_registered": false,
22
"use_inbound_webhook_on_number": true,
23
"links": {
24
"phone_numbers": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers",
25
"short_codes": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes",
26
"alpha_senders": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AlphaSenders",
27
"messages": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages",
28
"us_app_to_person": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Compliance/Usa2p",
29
"us_app_to_person_usecases": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Compliance/Usa2p/Usecases",
30
"channel_senders": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelSenders",
31
"destination_alpha_senders": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DestinationAlphaSenders"
32
},
33
"url": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
34
}

Retrieve a list of Services

Codestin Search App

GET https://messaging.twilio.com/v1/Services

Query parameters

Codestin Search App
Property nameTypeRequiredPIIDescription
pageSizeinteger<int64>

Optional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

pageinteger

Optional

The page index. This value is simply for client state.

Minimum: 0

pageTokenstring

Optional

The page token. This is provided by the API.

List multiple ServicesCodestin Search App
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function listService() {
11
const services = await client.messaging.v1.services.list({ limit: 20 });
12
13
services.forEach((s) => console.log(s.sid));
14
}
15
16
listService();

Response

Codestin Search App
1
{
2
"meta": {
3
"page": 0,
4
"page_size": 20,
5
"first_page_url": "https://messaging.twilio.com/v1/Services?PageSize=20&Page=0",
6
"previous_page_url": null,
7
"next_page_url": null,
8
"key": "services",
9
"url": "https://messaging.twilio.com/v1/Services?PageSize=20&Page=0"
10
},
11
"services": [
12
{
13
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
14
"friendly_name": "My Service!",
15
"sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
16
"date_created": "2015-07-30T20:12:31Z",
17
"date_updated": "2015-07-30T20:12:33Z",
18
"sticky_sender": true,
19
"mms_converter": true,
20
"smart_encoding": false,
21
"fallback_to_long_code": true,
22
"area_code_geomatch": true,
23
"validity_period": 600,
24
"scan_message_content": "inherit",
25
"synchronous_validation": true,
26
"inbound_request_url": "https://www.example.com/",
27
"inbound_method": "POST",
28
"fallback_url": null,
29
"fallback_method": "POST",
30
"status_callback": "https://www.example.com",
31
"usecase": "marketing",
32
"us_app_to_person_registered": false,
33
"use_inbound_webhook_on_number": false,
34
"links": {
35
"phone_numbers": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers",
36
"short_codes": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes",
37
"alpha_senders": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AlphaSenders",
38
"messages": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages",
39
"us_app_to_person": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Compliance/Usa2p",
40
"us_app_to_person_usecases": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Compliance/Usa2p/Usecases",
41
"channel_senders": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelSenders",
42
"destination_alpha_senders": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DestinationAlphaSenders"
43
},
44
"url": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
45
}
46
]
47
}

Update a Service

Codestin Search App

POST https://messaging.twilio.com/v1/Services/{Sid}

You may specify one or more of the optional parameters above to update the Service's respective properties. Parameters not specified in your request are not updated.

Path parameters

Codestin Search App
Property nameTypeRequiredPIIDescription
sidSID<MG>
required

The SID of the Service resource to update.

Pattern: ^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34

Request body parameters

Codestin Search App
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredPIIDescriptionChild properties
friendlyNamestring

Optional

A descriptive string that you create to describe the resource. It can be up to 64 characters long.


inboundRequestUrlstring<uri>

Optional

The URL we call using inbound_method when a message is received by any phone number or short code in the Service. When this property is null, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the use_inbound_webhook_on_number field is enabled then the webhook url defined on the phone number will override the inbound_request_url defined for the Messaging Service.


inboundMethodenum<http-method>

Optional

The HTTP method we should use to call inbound_request_url. Can be GET or POST and the default is POST.

Possible values:
GETPOST

fallbackUrlstring<uri>

Optional

The URL that we call using fallback_method if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the use_inbound_webhook_on_number field is enabled then the webhook url defined on the phone number will override the fallback_url defined for the Messaging Service.


fallbackMethodenum<http-method>

Optional

The HTTP method we should use to call fallback_url. Can be: GET or POST.

Possible values:
GETPOST

statusCallbackstring<uri>

Optional

The URL we should call to pass status updates about message delivery.


stickySenderboolean

Optional

Whether to enable Sticky Sender on the Service instance.


mmsConverterboolean

Optional

Whether to enable the MMS Converter for messages sent through the Service instance.


smartEncodingboolean

Optional

Whether to enable Smart Encoding for messages sent through the Service instance.


scanMessageContentenum<string>

Optional

Reserved.

Possible values:
inheritenabledisable

fallbackToLongCodeboolean

Optional

[OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures.


areaCodeGeomatchboolean

Optional

Whether to enable Area Code Geomatch on the Service Instance.


validityPeriodinteger

Optional

How long, in seconds, messages sent from the Service are valid. Can be an integer from 1 to 36,000. Default value is 36,000.


synchronousValidationboolean

Optional

Reserved.


usecasestring

Optional

A string that describes the scenario in which the Messaging Service will be used. Possible values are notifications, marketing, verification, discussion, poll, undeclared.


useInboundWebhookOnNumberboolean

Optional

A boolean value that indicates either the webhook url configured on the phone number will be used or inbound_request_url/fallback_url url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the inbound_request_url/fallback_url defined for the Messaging Service.

Update a ServiceCodestin Search App
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function updateService() {
11
const service = await client.messaging.v1
12
.services("MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.update({ friendlyName: "FriendlyName" });
14
15
console.log(service.sid);
16
}
17
18
updateService();

Response

Codestin Search App
1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"friendly_name": "FriendlyName",
4
"sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"date_created": "2015-07-30T20:12:31Z",
6
"date_updated": "2015-07-30T20:12:33Z",
7
"sticky_sender": false,
8
"mms_converter": true,
9
"smart_encoding": false,
10
"fallback_to_long_code": true,
11
"scan_message_content": "inherit",
12
"synchronous_validation": true,
13
"area_code_geomatch": true,
14
"validity_period": 600,
15
"inbound_request_url": "https://www.example.com",
16
"inbound_method": "POST",
17
"fallback_url": null,
18
"fallback_method": "POST",
19
"status_callback": "https://www.example.com",
20
"usecase": "marketing",
21
"us_app_to_person_registered": false,
22
"use_inbound_webhook_on_number": true,
23
"links": {
24
"phone_numbers": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers",
25
"short_codes": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes",
26
"alpha_senders": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AlphaSenders",
27
"messages": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages",
28
"us_app_to_person": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Compliance/Usa2p",
29
"us_app_to_person_usecases": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Compliance/Usa2p/Usecases",
30
"channel_senders": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelSenders",
31
"destination_alpha_senders": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DestinationAlphaSenders"
32
},
33
"url": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
34
}

Delete a Service

Codestin Search App

DELETE https://messaging.twilio.com/v1/Services/{Sid}

When a Service is deleted, all phone numbers and short codes in the Service are returned to your Account.

(warning)

Warning

If you are using a Messaging Service for A2P 10DLC, you should not delete the Messaging Service. Doing so deletes the A2P 10DLC Campaign, which immediately halts all US A2P 10DLC messaging. A new Campaign and Messaging Service must be created and re-registered. This process can take several days.

Path parameters

Codestin Search App
Property nameTypeRequiredPIIDescription
sidSID<MG>
required

The SID of the Service resource to delete.

Pattern: ^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34
Delete a ServiceCodestin Search App
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function deleteService() {
11
await client.messaging.v1
12
.services("MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.remove();
14
}
15
16
deleteService();