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

Service


Services are containers for your environments. You may only need one Service with many environments. When you begin working on a new application, you will likely want to create a new Service.

(warning)

Warning

The unique name of your service forms the first part of your Serverless domain and cannot be updated.


Service Properties

service-properties page anchor
sidSID<ZS>
Not PII

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

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

account_sidSID<AC>

friendly_namestring
PII MTL: 7 days

The string that you assigned to describe the Service resource.


unique_namestring

A user-defined string that uniquely identifies the Service resource. It can be used in place of the Service resource's sid in the URL to address the Service resource.


include_credentialsboolean

Whether to inject Account credentials into a function invocation context.


ui_editableboolean

Whether the Service resource's properties and subresources can be edited via the UI.


domain_basestring

The base domain name for this Service, which is a combination of the unique name and a randomly generated string.


date_createdstring<date-time>

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


date_updatedstring<date-time>

The date and time in GMT when the Service 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.


linksobject<uri-map>

The URLs of the Service's nested resources.


Create a Service resource

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

Request body parameters

request-body-parameters page anchor
UniqueNamestringrequired

A user-defined string that uniquely identifies the Service resource. It can be used as an alternative to the sid in the URL path to address the Service resource. This value must be 50 characters or less in length and be unique.


FriendlyNamestringrequired

A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters.


IncludeCredentialsboolean

Whether to inject Account credentials into a function invocation context. The default value is true.


UiEditableboolean

Whether the Service's properties and subresources can be edited via the UI. The default value is false.

Create Service

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

_14
// Download the helper library from https://www.twilio.com/docs/node/install
_14
// Find your Account SID and Auth Token at twilio.com/console
_14
// and set the environment variables. See http://twil.io/secure
_14
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14
const authToken = process.env.TWILIO_AUTH_TOKEN;
_14
const client = require('twilio')(accountSid, authToken);
_14
_14
client.serverless.v1.services
_14
.create({
_14
includeCredentials: true,
_14
uniqueName: 'my-new-app',
_14
friendlyName: 'My New App'
_14
})
_14
.then(service => console.log(service.sid));

Output

_18
{
_18
"sid": "ZS00000000000000000000000000000000",
_18
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"friendly_name": "My New App",
_18
"unique_name": "my-new-app",
_18
"include_credentials": true,
_18
"ui_editable": false,
_18
"domain_base": "service-unique-1234",
_18
"date_created": "2018-11-10T20:00:00Z",
_18
"date_updated": "2018-11-10T20:00:00Z",
_18
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000",
_18
"links": {
_18
"environments": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments",
_18
"functions": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Functions",
_18
"assets": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets",
_18
"builds": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Builds"
_18
}
_18
}


Fetch a Service resource

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

Sidstringrequired

The sid or unique_name 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.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.fetch()
_10
.then(service => console.log(service.friendlyName));

Output

_18
{
_18
"sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"friendly_name": "test-service",
_18
"unique_name": "test-service-1",
_18
"include_credentials": true,
_18
"ui_editable": false,
_18
"domain_base": "test-service-1-1234",
_18
"date_created": "2018-11-10T20:00:00Z",
_18
"date_updated": "2018-11-10T20:00:00Z",
_18
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000",
_18
"links": {
_18
"environments": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments",
_18
"functions": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Functions",
_18
"assets": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets",
_18
"builds": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Builds"
_18
}
_18
}


Read multiple Service resources

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

PageSizeinteger

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

Minimum: 1Maximum: 1000

Pageinteger

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

Minimum: 0

PageTokenstring

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.serverless.v1.services
_10
.list({limit: 20})
_10
.then(services => services.forEach(s => console.log(s.sid)));

Output

_12
{
_12
"services": [],
_12
"meta": {
_12
"first_page_url": "https://serverless.twilio.com/v1/Services?PageSize=50&Page=0",
_12
"key": "services",
_12
"next_page_url": "https://serverless.twilio.com/v1/Services?PageSize=50&Page=1",
_12
"page": 0,
_12
"page_size": 50,
_12
"previous_page_url": "https://serverless.twilio.com/v1/Services?PageSize=50&Page=0",
_12
"url": "https://serverless.twilio.com/v1/Services?PageSize=50&Page=0"
_12
}
_12
}


Update a Service resource

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

Sidstringrequired

The sid or unique_name of the Service resource to update.

IncludeCredentialsboolean

Whether to inject Account credentials into a function invocation context.


FriendlyNamestring

A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters.


UiEditableboolean

Whether the Service resource's properties and subresources can be edited via the UI. The default value is false.

Update a Service to be editable in the Console UI

update-a-service-to-be-editable-in-the-console-ui 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.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.update({uiEditable: true})
_10
.then(service => console.log(service.friendlyName));

Output

_18
{
_18
"sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"friendly_name": "service-friendly-update",
_18
"unique_name": "service-unique-update",
_18
"include_credentials": true,
_18
"ui_editable": true,
_18
"domain_base": "service-unique-update-1234",
_18
"date_created": "2018-11-10T20:00:00Z",
_18
"date_updated": "2018-11-10T20:00:00Z",
_18
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000",
_18
"links": {
_18
"environments": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments",
_18
"functions": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Functions",
_18
"assets": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets",
_18
"builds": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Builds"
_18
}
_18
}


Delete a Service resource

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

Sidstringrequired

The sid or unique_name 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.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove();


Rate this page: