Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Notify Service Resource


A Service is the top-level scope of all other resources in Notify REST API.

You can create up to 10 Service resources per account and you can use them to:

  • Create separate operational environments, such as dev , stage , and prod , all using the same Twilio account.
  • Scope access to resources used by the Notify REST API
  • Configure different behaviors of a push-notification or messaging service.

If you need more than 10 Service resources for your account, please contact support(link takes you to an external page).


Service Properties

service-properties page anchor
Property nameTypePIIDescription
sidSID<IS>
Not PII

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

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

account_sidSID<AC>

The SID of the Account that created the Service resource.

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

friendly_namestring

The string that you assigned to describe the resource.


date_createdstring<date-time>

The date and time in GMT when the resource was created specified in RFC 2822(link takes you to an external page) format.


date_updatedstring<date-time>

The date and time in GMT when the resource was last updated specified in RFC 2822(link takes you to an external page) format.


apn_credential_sidSID<CR>

The SID of the Credential to use for APN Bindings.

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

gcm_credential_sidSID<CR>

The SID of the Credential to use for GCM Bindings.

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

fcm_credential_sidSID<CR>

The SID of the Credential to use for FCM Bindings.

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

messaging_service_sidSID<MG>

The SID of the Messaging Service to use for SMS Bindings. In order to send SMS notifications this parameter has to be set.

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

facebook_messenger_page_idstring

Deprecated.


default_apn_notification_protocol_versionstring

The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


default_gcm_notification_protocol_versionstring

The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


default_fcm_notification_protocol_versionstring

The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


log_enabledboolean

Whether to log notifications. Can be: true or false and the default is true.


urlstring<uri>

The absolute URL of the Service resource.


linksobject<uri-map>

The URLs of the Binding, Notification, Segment, and User resources related to the service.


alexa_skill_idstring

Deprecated.


default_alexa_notification_protocol_versionstring

Deprecated.


delivery_callback_urlstring

URL to send delivery status callback.


delivery_callback_enabledboolean

Callback configuration that enables delivery callbacks, default false


Create a Service resource

create-a-service-resource page anchor
POST https://notify.twilio.com/v1/Services

Request body parameters

request-body-parameters page anchor
Property nameTypeRequiredPIIDescription
FriendlyNamestringOptional

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


ApnCredentialSidSID<CR>Optional

The SID of the Credential to use for APN Bindings.

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

GcmCredentialSidSID<CR>Optional

The SID of the Credential to use for GCM Bindings.

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

MessagingServiceSidSID<MG>Optional

The SID of the Messaging Service to use for SMS Bindings. This parameter must be set in order to send SMS notifications.

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

FacebookMessengerPageIdstringOptional

Deprecated.


DefaultApnNotificationProtocolVersionstringOptional

The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


DefaultGcmNotificationProtocolVersionstringOptional

The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


FcmCredentialSidSID<CR>Optional

The SID of the Credential to use for FCM Bindings.

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

DefaultFcmNotificationProtocolVersionstringOptional

The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


LogEnabledbooleanOptional

Whether to log notifications. Can be: true or false and the default is true.


AlexaSkillIdstringOptional

Deprecated.


DefaultAlexaNotificationProtocolVersionstringOptional

Deprecated.


DeliveryCallbackUrlstringOptional

URL to send delivery status callback.


DeliveryCallbackEnabledbooleanOptional

Callback configuration that enables delivery callbacks, default false

Create a Service resource

create-a-service-resource-1 page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_16
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = twilio(accountSid, authToken);
_16
_16
async function createService() {
_16
const service = await client.notify.v1.services.create();
_16
_16
console.log(service.sid);
_16
}
_16
_16
createService();

Output

_28
{
_28
"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c",
_28
"date_created": "2016-03-09T20:22:31Z",
_28
"date_updated": "2016-03-09T20:22:31Z",
_28
"apn_credential_sid": null,
_28
"gcm_credential_sid": null,
_28
"fcm_credential_sid": null,
_28
"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"facebook_messenger_page_id": "4",
_28
"alexa_skill_id": null,
_28
"default_apn_notification_protocol_version": "3",
_28
"default_gcm_notification_protocol_version": "3",
_28
"default_fcm_notification_protocol_version": "3",
_28
"default_alexa_notification_protocol_version": "3",
_28
"log_enabled": true,
_28
"type": "S",
_28
"delivery_callback_url": "Hello",
_28
"delivery_callback_enabled": true,
_28
"url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"links": {
_28
"bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",
_28
"notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications",
_28
"segments": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Segments",
_28
"users": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"
_28
}
_28
}


Fetch a Service resource

fetch-a-service-resource page anchor
GET https://notify.twilio.com/v1/Services/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<IS>required

The Twilio-provided string that uniquely identifies the Service resource to fetch.

Pattern: ^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function fetchService() {
_18
const service = await client.notify.v1
_18
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.fetch();
_18
_18
console.log(service.sid);
_18
}
_18
_18
fetchService();

Output

_28
{
_28
"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c",
_28
"date_created": "2016-03-09T20:22:31Z",
_28
"date_updated": "2016-03-09T20:22:31Z",
_28
"apn_credential_sid": null,
_28
"gcm_credential_sid": null,
_28
"fcm_credential_sid": null,
_28
"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"facebook_messenger_page_id": "4",
_28
"alexa_skill_id": null,
_28
"default_apn_notification_protocol_version": "3",
_28
"default_gcm_notification_protocol_version": "3",
_28
"default_fcm_notification_protocol_version": "3",
_28
"default_alexa_notification_protocol_version": "3",
_28
"log_enabled": true,
_28
"type": "S",
_28
"delivery_callback_url": "Hello",
_28
"delivery_callback_enabled": true,
_28
"url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"links": {
_28
"bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",
_28
"notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications",
_28
"segments": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Segments",
_28
"users": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"
_28
}
_28
}


Read multiple Service resources

read-multiple-service-resources page anchor
GET https://notify.twilio.com/v1/Services

Property nameTypeRequiredPIIDescription
FriendlyNamestringOptional

The string that identifies the Service resources to read.


PageSizeintegerOptional

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

Minimum: 1Maximum: 1000

PageintegerOptional

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

Minimum: 0

PageTokenstringOptional

The page token. This is provided by the API.

Read multiple Service resources

read-multiple-service-resources-1 page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_16
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = twilio(accountSid, authToken);
_16
_16
async function listService() {
_16
const services = await client.notify.v1.services.list({ limit: 20 });
_16
_16
services.forEach((s) => console.log(s.sid));
_16
}
_16
_16
listService();

Output

_41
{
_41
"meta": {
_41
"page": 0,
_41
"page_size": 50,
_41
"first_page_url": "https://notify.twilio.com/v1/Services?PageSize=50&Page=0",
_41
"previous_page_url": null,
_41
"url": "https://notify.twilio.com/v1/Services?PageSize=50&Page=0",
_41
"next_page_url": null,
_41
"key": "services"
_41
},
_41
"services": [
_41
{
_41
"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_41
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_41
"friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c",
_41
"date_created": "2016-03-09T20:22:31Z",
_41
"date_updated": "2016-03-09T20:22:31Z",
_41
"apn_credential_sid": null,
_41
"gcm_credential_sid": null,
_41
"fcm_credential_sid": null,
_41
"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_41
"facebook_messenger_page_id": "4",
_41
"alexa_skill_id": null,
_41
"default_apn_notification_protocol_version": "3",
_41
"default_gcm_notification_protocol_version": "3",
_41
"default_fcm_notification_protocol_version": "3",
_41
"default_alexa_notification_protocol_version": "3",
_41
"log_enabled": true,
_41
"type": "S",
_41
"delivery_callback_url": "Hello",
_41
"delivery_callback_enabled": true,
_41
"url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_41
"links": {
_41
"bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",
_41
"notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications",
_41
"segments": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Segments",
_41
"users": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"
_41
}
_41
}
_41
]
_41
}


Update a Service resource

update-a-service-resource page anchor
POST https://notify.twilio.com/v1/Services/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<IS>required

The Twilio-provided string that uniquely identifies the Service resource to update.

Pattern: ^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34
Property nameTypeRequiredPIIDescription
FriendlyNamestringOptional

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


ApnCredentialSidSID<CR>Optional

The SID of the Credential to use for APN Bindings.

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

GcmCredentialSidSID<CR>Optional

The SID of the Credential to use for GCM Bindings.

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

MessagingServiceSidSID<MG>Optional

The SID of the Messaging Service to use for SMS Bindings. This parameter must be set in order to send SMS notifications.

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

FacebookMessengerPageIdstringOptional

Deprecated.


DefaultApnNotificationProtocolVersionstringOptional

The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


DefaultGcmNotificationProtocolVersionstringOptional

The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


FcmCredentialSidSID<CR>Optional

The SID of the Credential to use for FCM Bindings.

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

DefaultFcmNotificationProtocolVersionstringOptional

The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a Binding resource.


LogEnabledbooleanOptional

Whether to log notifications. Can be: true or false and the default is true.


AlexaSkillIdstringOptional

Deprecated.


DefaultAlexaNotificationProtocolVersionstringOptional

Deprecated.


DeliveryCallbackUrlstringOptional

URL to send delivery status callback.


DeliveryCallbackEnabledbooleanOptional

Callback configuration that enables delivery callbacks, default false

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function updateService() {
_18
const service = await client.notify.v1
_18
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.update({ friendlyName: "FriendlyName" });
_18
_18
console.log(service.sid);
_18
}
_18
_18
updateService();

Output

_28
{
_28
"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"friendly_name": "FriendlyName",
_28
"date_created": "2016-03-09T20:22:31Z",
_28
"date_updated": "2016-03-09T20:22:31Z",
_28
"apn_credential_sid": null,
_28
"gcm_credential_sid": null,
_28
"fcm_credential_sid": null,
_28
"default_apn_notification_protocol_version": "3",
_28
"default_gcm_notification_protocol_version": "3",
_28
"default_fcm_notification_protocol_version": "3",
_28
"default_alexa_notification_protocol_version": "3",
_28
"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"alexa_skill_id": null,
_28
"facebook_messenger_page_id": "4",
_28
"log_enabled": true,
_28
"type": "S",
_28
"delivery_callback_url": "Hello",
_28
"delivery_callback_enabled": true,
_28
"url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"links": {
_28
"bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",
_28
"notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications",
_28
"segments": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Segments",
_28
"users": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users"
_28
}
_28
}


Delete a Service resource

delete-a-service-resource page anchor
DELETE https://notify.twilio.com/v1/Services/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<IS>required

The Twilio-provided string that uniquely identifies the Service resource to delete.

Pattern: ^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_16
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = twilio(accountSid, authToken);
_16
_16
async function deleteService() {
_16
await client.notify.v1
_16
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_16
.remove();
_16
}
_16
_16
deleteService();


Rate this page: