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.
The unique name of your service forms the first part of your Serverless domain and cannot be updated.
The unique string that we created to identify the Service resource.
^ZS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Account that created the Service resource.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The string that you assigned to describe the Service resource.
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.
Whether to inject Account credentials into a function invocation context.
Whether the Service resource's properties and subresources can be edited via the UI.
The base domain name for this Service, which is a combination of the unique name and a randomly generated string.
The date and time in GMT when the Service resource was created specified in ISO 8601 format.
The date and time in GMT when the Service resource was last updated specified in ISO 8601 format.
The URLs of the Service's nested resources.
POST https://serverless.twilio.com/v1/Services
application/x-www-form-urlencoded
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.
A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters.
Whether to inject Account credentials into a function invocation context. The default value is true
.
Whether the Service's properties and subresources can be edited via the UI. The default value is false
.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createService() {11const service = await client.serverless.v1.services.create({12friendlyName: "My New App",13includeCredentials: true,14uniqueName: "my-new-app",15});1617console.log(service.sid);18}1920createService();
1{2"sid": "ZS00000000000000000000000000000000",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"friendly_name": "My New App",5"unique_name": "my-new-app",6"include_credentials": true,7"ui_editable": false,8"domain_base": "service-unique-1234",9"date_created": "2018-11-10T20:00:00Z",10"date_updated": "2018-11-10T20:00:00Z",11"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000",12"links": {13"environments": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments",14"functions": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Functions",15"assets": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets",16"builds": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Builds"17}18}
GET https://serverless.twilio.com/v1/Services/{Sid}
The sid
or unique_name
of the Service resource to fetch.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchService() {11const service = await client.serverless.v1.services("Sid").fetch();1213console.log(service.sid);14}1516fetchService();
1{2"sid": "Sid",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"friendly_name": "test-service",5"unique_name": "test-service-1",6"include_credentials": true,7"ui_editable": false,8"domain_base": "test-service-1-1234",9"date_created": "2018-11-10T20:00:00Z",10"date_updated": "2018-11-10T20:00:00Z",11"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000",12"links": {13"environments": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments",14"functions": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Functions",15"assets": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets",16"builds": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Builds"17}18}
GET https://serverless.twilio.com/v1/Services
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The page token. This is provided by the API.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listService() {11const services = await client.serverless.v1.services.list({ limit: 20 });1213services.forEach((s) => console.log(s.sid));14}1516listService();
1{2"services": [],3"meta": {4"first_page_url": "https://serverless.twilio.com/v1/Services?PageSize=50&Page=0",5"key": "services",6"next_page_url": null,7"page": 0,8"page_size": 50,9"previous_page_url": null,10"url": "https://serverless.twilio.com/v1/Services?PageSize=50&Page=0"11}12}
POST https://serverless.twilio.com/v1/Services/{Sid}
The sid
or unique_name
of the Service resource to update.
application/x-www-form-urlencoded
Whether to inject Account credentials into a function invocation context.
A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters.
Whether the Service resource's properties and subresources can be edited via the UI. The default value is false
.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function updateService() {11const service = await client.serverless.v112.services("Sid")13.update({ uiEditable: true });1415console.log(service.sid);16}1718updateService();
1{2"sid": "Sid",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"friendly_name": "service-friendly-update",5"unique_name": "service-unique-update",6"include_credentials": true,7"ui_editable": true,8"domain_base": "service-unique-update-1234",9"date_created": "2018-11-10T20:00:00Z",10"date_updated": "2018-11-10T20:00:00Z",11"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000",12"links": {13"environments": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments",14"functions": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Functions",15"assets": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets",16"builds": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Builds"17}18}
DELETE https://serverless.twilio.com/v1/Services/{Sid}
The sid
or unique_name
of the Service resource to delete.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function deleteService() {11await client.serverless.v1.services("Sid").remove();12}1314deleteService();