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

Service Resource


A Service is the top-level scope of all other resources in the REST API. It contains all the objects in a Sync application. Services allow you to:

  • Create multiple environments (dev, stage, prod) under the same Twilio account with segregated data
  • Scope access to resources through the REST API
  • Configure the behavior of those resources in the scope of a Service

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

unique_namestring

An application-defined string that uniquely identifies the resource. It can be used in place of the resource's sid in the URL to address the resource. It is a read-only property, it cannot be assigned using REST API.


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
PII MTL: 7 days

The string that you assigned to describe the resource.


date_updatedstring<date-time>

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


urlstring<uri>

The absolute URL of the Service resource.


webhook_urlstring<uri>

The URL we call when Sync objects are manipulated.


webhooks_from_rest_enabledboolean

Whether the Service instance should call webhook_url when the REST API is used to update Sync objects. The default is false.


reachability_webhooks_enabledboolean

Whether the service instance calls webhook_url when client endpoints connect to Sync. The default is false.


acl_enabledboolean

Whether token identities in the Service must be granted access to Sync objects by using the Permissions resource. It is disabled (false) by default.


reachability_debouncing_enabledboolean

Whether every endpoint_disconnected event should occur after a configurable delay. The default is false, where the endpoint_disconnected event occurs immediately after disconnection. When true, intervening reconnections can prevent the endpoint_disconnected event.


reachability_debouncing_windowinteger

The reachability event delay in milliseconds if reachability_debouncing_enabled = true. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before webhook_url is called, if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the reachability event from occurring.


linksobject<uri-map>

The URLs of related resources.


Create a Service resource

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

Request body parameters

request-body-parameters page anchor
Property nameTypeRequiredPIIDescription
FriendlyNamestringOptional

A string that you assign to describe the resource.


WebhookUrlstring<uri>Optional

The URL we should call when Sync objects are manipulated.


ReachabilityWebhooksEnabledbooleanOptional

Whether the service instance should call webhook_url when client endpoints connect to Sync. The default is false.


AclEnabledbooleanOptional

Whether token identities in the Service must be granted access to Sync objects by using the Permissions resource.


ReachabilityDebouncingEnabledbooleanOptional

Whether every endpoint_disconnected event should occur after a configurable delay. The default is false, where the endpoint_disconnected event occurs immediately after disconnection. When true, intervening reconnections can prevent the endpoint_disconnected event.


ReachabilityDebouncingWindowintegerOptional

The reachability event delay in milliseconds if reachability_debouncing_enabled = true. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before the webhook_url is called if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the call to webhook_url.


WebhooksFromRestEnabledbooleanOptional

Whether the Service instance should call webhook_url when the REST API is used to update Sync objects. The default is false.

Create Service resource

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

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.sync.v1.services.create().then(service => console.log(service.sid));

Output

_21
{
_21
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_21
"date_created": "2015-07-30T20:00:00Z",
_21
"date_updated": "2015-07-30T20:00:00Z",
_21
"friendly_name": "friendly_name",
_21
"links": {
_21
"documents": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Documents",
_21
"lists": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists",
_21
"maps": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps",
_21
"streams": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Streams"
_21
},
_21
"sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_21
"unique_name": "unique_name",
_21
"url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_21
"webhook_url": "http://www.example.com",
_21
"webhooks_from_rest_enabled": false,
_21
"reachability_webhooks_enabled": false,
_21
"acl_enabled": true,
_21
"reachability_debouncing_enabled": false,
_21
"reachability_debouncing_window": 5000
_21
}

Create Service resource with a webhook URL

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

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.sync.v1.services.create({webhookUrl: 'https://example.com/sync'})
_10
.then(service => console.log(service.sid));

Output

_21
{
_21
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_21
"date_created": "2015-07-30T20:00:00Z",
_21
"date_updated": "2015-07-30T20:00:00Z",
_21
"friendly_name": "friendly_name",
_21
"links": {
_21
"documents": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Documents",
_21
"lists": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists",
_21
"maps": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps",
_21
"streams": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Streams"
_21
},
_21
"sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_21
"unique_name": "unique_name",
_21
"url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_21
"webhook_url": "https://example.com/sync",
_21
"webhooks_from_rest_enabled": false,
_21
"reachability_webhooks_enabled": false,
_21
"acl_enabled": true,
_21
"reachability_debouncing_enabled": false,
_21
"reachability_debouncing_window": 5000
_21
}


Fetch a Service resource

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

Property nameTypeRequiredPIIDescription
Sidstringrequired

The SID of the Service resource to fetch.

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

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.fetch()
_10
.then(service => console.log(service.uniqueName));

Output

_21
{
_21
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_21
"date_created": "2015-07-30T20:00:00Z",
_21
"date_updated": "2015-07-30T20:00:00Z",
_21
"friendly_name": "friendly_name",
_21
"links": {
_21
"documents": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Documents",
_21
"lists": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists",
_21
"maps": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps",
_21
"streams": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Streams"
_21
},
_21
"sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_21
"unique_name": "unique_name",
_21
"url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_21
"webhook_url": "http://www.example.com",
_21
"webhooks_from_rest_enabled": false,
_21
"reachability_webhooks_enabled": false,
_21
"acl_enabled": false,
_21
"reachability_debouncing_enabled": false,
_21
"reachability_debouncing_window": 5000
_21
}


Read multiple Service resources

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

Property nameTypeRequiredPIIDescription
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.

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

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.sync.v1.services.list({limit: 20})
_10
.then(services => services.forEach(s => console.log(s.sid)));

Output

_34
{
_34
"meta": {
_34
"first_page_url": "https://sync.twilio.com/v1/Services?PageSize=50&Page=0",
_34
"key": "services",
_34
"next_page_url": "https://sync.twilio.com/v1/Services?PageSize=50&Page=1",
_34
"page": 0,
_34
"page_size": 50,
_34
"previous_page_url": "https://sync.twilio.com/v1/Services?PageSize=50&Page=0",
_34
"url": "https://sync.twilio.com/v1/Services?PageSize=50&Page=0"
_34
},
_34
"services": [
_34
{
_34
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_34
"date_created": "2015-07-30T20:00:00Z",
_34
"date_updated": "2015-07-30T20:00:00Z",
_34
"friendly_name": "friendly_name",
_34
"links": {
_34
"documents": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Documents",
_34
"lists": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists",
_34
"maps": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps",
_34
"streams": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Streams"
_34
},
_34
"sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_34
"unique_name": "unique_name",
_34
"url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_34
"webhook_url": "http://www.example.com",
_34
"webhooks_from_rest_enabled": false,
_34
"reachability_webhooks_enabled": false,
_34
"acl_enabled": false,
_34
"reachability_debouncing_enabled": false,
_34
"reachability_debouncing_window": 5000
_34
}
_34
]
_34
}


Update a Service resource

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

Property nameTypeRequiredPIIDescription
Sidstringrequired

The SID of the Service resource to update.

Property nameTypeRequiredPIIDescription
WebhookUrlstring<uri>Optional

The URL we should call when Sync objects are manipulated.


FriendlyNamestringOptional

A string that you assign to describe the resource.


ReachabilityWebhooksEnabledbooleanOptional

Whether the service instance should call webhook_url when client endpoints connect to Sync. The default is false.


AclEnabledbooleanOptional

Whether token identities in the Service must be granted access to Sync objects by using the Permissions resource.


ReachabilityDebouncingEnabledbooleanOptional

Whether every endpoint_disconnected event should occur after a configurable delay. The default is false, where the endpoint_disconnected event occurs immediately after disconnection. When true, intervening reconnections can prevent the endpoint_disconnected event.


ReachabilityDebouncingWindowintegerOptional

The reachability event delay in milliseconds if reachability_debouncing_enabled = true. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before the webhook is called if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the webhook from being called.


WebhooksFromRestEnabledbooleanOptional

Whether the Service instance should call webhook_url when the REST API is used to update Sync objects. The default is false.

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

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.update({webhookUrl: 'https://example.com'})
_10
.then(service => console.log(service.uniqueName));

Output

_21
{
_21
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_21
"date_created": "2015-07-30T20:00:00Z",
_21
"date_updated": "2015-07-30T20:00:00Z",
_21
"friendly_name": "friendly_name",
_21
"links": {
_21
"documents": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Documents",
_21
"lists": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists",
_21
"maps": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps",
_21
"streams": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Streams"
_21
},
_21
"sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_21
"unique_name": "unique_name",
_21
"url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_21
"webhook_url": "http://www.example.com",
_21
"webhooks_from_rest_enabled": false,
_21
"reachability_webhooks_enabled": false,
_21
"acl_enabled": true,
_21
"reachability_debouncing_enabled": false,
_21
"reachability_debouncing_window": 5000
_21
}


Delete a Service resource

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

Property nameTypeRequiredPIIDescription
Sidstringrequired

The SID of the Service resource to delete.

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

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove();


Rate this page: