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
Resource properties
sidtype: SID<IS>Not PII

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


unique_nametype: stringNot PII

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.


friendly_nametype: stringPII MTL: 7 days

The string that you assigned to describe the resource.


date_createdtype: string<DATE TIME>Not PII

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


date_updatedtype: string<DATE TIME>Not PII

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


urltype: string<URI>Not PII

The absolute URL of the Service resource.


webhook_urltype: string<URI>Not PII

The URL we call when Sync objects are manipulated.


webhooks_from_rest_enabledtype: booleanNot PII

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


reachability_webhooks_enabledtype: booleanNot PII

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


acl_enabledtype: booleanNot PII

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


reachability_debouncing_enabledtype: booleanNot PII

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_windowtype: integerNot PII

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.


linkstype: object<URI MAP>Not PII

The URLs of related resources.


Create a Service resource

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

Parameters

create-parameters page anchor
Request body parameters
FriendlyNametype: stringPII MTL: 7 days

A string that you assign to describe the resource.


WebhookUrltype: string<URI>Not PII

The URL we should call when Sync objects are manipulated.


ReachabilityWebhooksEnabledtype: booleanNot PII

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


AclEnabledtype: booleanNot PII

Whether token identities in the Service must be granted access to Sync objects by using the Permissions(link takes you to an external page) resource.


ReachabilityDebouncingEnabledtype: booleanNot PII

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.


ReachabilityDebouncingWindowtype: integerNot PII

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.


WebhooksFromRestEnabledtype: booleanNot PII

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.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}

URI parameters
Sidtype: stringNot PII
Path Parameter

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

URI parameters
PageSizetype: integerNot PII
Query Parameter

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


Pagetype: integerNot PII
Query Parameter

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


PageTokentype: stringNot PII
Query Parameter

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}

URI parameters
Sidtype: stringNot PII
Path Parameter

The SID of the Service resource to update.


Request body parameters
WebhookUrltype: string<URI>Not PII

The URL we should call when Sync objects are manipulated.


FriendlyNametype: stringPII MTL: 7 days

A string that you assign to describe the resource.


ReachabilityWebhooksEnabledtype: booleanNot PII

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


AclEnabledtype: booleanNot PII

Whether token identities in the Service must be granted access to Sync objects by using the Permissions(link takes you to an external page) resource.


ReachabilityDebouncingEnabledtype: booleanNot PII

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.


ReachabilityDebouncingWindowtype: integerNot PII

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.


WebhooksFromRestEnabledtype: booleanNot PII

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}

URI parameters
Sidtype: stringNot PII
Path Parameter

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: