Environment
Environments define the different domains your Functions and Assets are available under. You can have one environment, or you can have many, e.g., a dev, stage, and prod. You can deploy a Build to any of your Environments.
Resource properties The unique string that we created to identify the Environment resource.
The SID of the Service that the Environment resource is associated with.
The SID of the build deployed in the environment.
A user-defined string that uniquely identifies the Environment resource.
A URL-friendly name that represents the environment and forms part of the domain name.
The domain name for all Functions and Assets deployed in the Environment, using the Service unique name, a randomly-generated Service suffix, and an optional Environment domain suffix.
date_created
type: string<DATE TIME> Not PIIdate_updated
type: string<DATE TIME> Not PIIThe absolute URL of the Environment resource.
The URLs of the Environment resource's nested resources.
POST https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments
URI parameters Path Parameter
The SID of the Service to create the Environment resource under.
Request body parameters Required
A user-defined string that uniquely identifies the Environment resource. It can be a maximum of 100 characters.
A URL-friendly name that represents the environment and forms part of the domain name. It can be a maximum of 16 characters.
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .create({domainSuffix: 'stage', uniqueName: 'staging'})
_11 .then(environment => console.log(environment.domainName));
_18 "sid": "ZE00000000000000000000000000000000",
_18 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18 "unique_name": "staging",
_18 "domain_suffix": "stage",
_18 "domain_name": "foobar-1234-stage.twil.io",
_18 "custom_domain_name": null,
_18 "date_created": "2018-11-10T20:00:00Z",
_18 "date_updated": "2018-11-10T20:00:00Z",
_18 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000",
_18 "variables": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables",
_18 "deployments": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Deployments",
_18 "logs": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Logs"
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{Sid}
URI parameters Path Parameter
The SID of the Service to fetch the Environment resource from.
Path Parameter
The SID of the Environment resource to fetch.
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .then(environment => console.log(environment.uniqueName));
_18 "sid": "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18 "build_sid": "ZB00000000000000000000000000000000",
_18 "unique_name": "testing-environment",
_18 "domain_suffix": "testing",
_18 "domain_name": "foobar-1234-testing.twil.io",
_18 "custom_domain_name": null,
_18 "date_created": "2018-11-10T20:00:00Z",
_18 "date_updated": "2018-11-10T20:00:00Z",
_18 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000",
_18 "variables": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables",
_18 "deployments": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Deployments",
_18 "logs": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Logs"
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments
URI parameters Path Parameter
The SID of the Service to read the Environment resources from.
Query Parameter
How many resources to return in each list page. The default is 50, and the maximum is 1000.
Query Parameter
The page index. This value is simply for client state.
Query Parameter
The page token. This is provided by the API.
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .then(environments => environments.forEach(e => console.log(e.sid)));
_12 "first_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments?PageSize=50&Page=0",
_12 "key": "environments",
_12 "next_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments?PageSize=50&Page=1",
_12 "previous_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments?PageSize=50&Page=0",
_12 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments?PageSize=50&Page=0"
DELETE https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{Sid}
URI parameters Path Parameter
The SID of the Service to delete the Environment resource from.
Path Parameter
The SID of the Environment resource to delete.
_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 client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10 .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')