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

Deployment


Deployments let you set a particular Build to be live on a particular Environment.


Deployment Properties

deployment-properties page anchor
Property nameTypePIIDescription
sidSID<ZD>
Not PII

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

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

account_sidSID<AC>

The SID of the Account that created the Deployment resource.

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

service_sidSID<ZS>

The SID of the Service that the Deployment resource is associated with.

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

environment_sidSID<ZE>

The SID of the Environment for the Deployment.

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

build_sidSID<ZB>

The SID of the Build for the deployment.

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

date_updatedstring<date-time>

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


urlstring<uri>

The absolute URL of the Deployment resource.


Create a Deployment resource

create-a-deployment-resource page anchor
POST https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Deployments

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
ServiceSidstringrequired

The SID of the Service to create the Deployment resource under.


EnvironmentSidSID<ZE>required

The SID of the Environment for the Deployment.

Pattern: ^ZE[0-9a-fA-F]{32}$Min length: 34Max length: 34
Property nameTypeRequiredPIIDescription
BuildSidSID<ZB>Optional

The SID of the Build for the Deployment.

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

Create a Deployment

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

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function createDeployment() {
_19
const deployment = await client.serverless.v1
_19
.services("ServiceSid")
_19
.environments("ZEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.deployments.create({ buildSid: "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" });
_19
_19
console.log(deployment.sid);
_19
}
_19
_19
createDeployment();

Output

_10
{
_10
"sid": "ZD00000000000000000000000000000000",
_10
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"service_sid": "ServiceSid",
_10
"environment_sid": "ZEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"build_sid": "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"date_created": "2018-11-10T20:00:00Z",
_10
"date_updated": "2018-11-10T20:00:00Z",
_10
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments/ZE00000000000000000000000000000000/Deployments/ZD00000000000000000000000000000000"
_10
}

(information)

Info

POSTing to the deployment endpoint without a Build SID will delete any existing deployments in that Environment. Calls to Functions & Assets that were hosted by that Environment will result in 404s.

Clear all Deployments from an Environment

clear-all-deployments-from-an-environment page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function createDeployment() {
_19
const deployment = await client.serverless.v1
_19
.services("ServiceSid")
_19
.environments("ZEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.deployments.create();
_19
_19
console.log(deployment.sid);
_19
}
_19
_19
createDeployment();

Output

_10
{
_10
"sid": "ZD00000000000000000000000000000000",
_10
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"service_sid": "ServiceSid",
_10
"environment_sid": "ZEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"build_sid": "ZB00000000000000000000000000000000",
_10
"date_created": "2018-11-10T20:00:00Z",
_10
"date_updated": "2018-11-10T20:00:00Z",
_10
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments/ZE00000000000000000000000000000000/Deployments/ZD00000000000000000000000000000000"
_10
}


Fetch a Deployment resource

fetch-a-deployment-resource page anchor
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Deployments/{Sid}

Property nameTypeRequiredPIIDescription
ServiceSidstringrequired

The SID of the Service to fetch the Deployment resource from.


EnvironmentSidSID<ZE>required

The SID of the Environment used by the Deployment to fetch.

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

SidSID<ZD>required

The SID that identifies the Deployment resource to fetch.

Pattern: ^ZD[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_20
// Download the helper library from https://www.twilio.com/docs/node/install
_20
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_20
_20
// Find your Account SID and Auth Token at twilio.com/console
_20
// and set the environment variables. See http://twil.io/secure
_20
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_20
const authToken = process.env.TWILIO_AUTH_TOKEN;
_20
const client = twilio(accountSid, authToken);
_20
_20
async function fetchDeployment() {
_20
const deployment = await client.serverless.v1
_20
.services("ServiceSid")
_20
.environments("ZEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_20
.deployments("ZDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_20
.fetch();
_20
_20
console.log(deployment.sid);
_20
}
_20
_20
fetchDeployment();

Output

_10
{
_10
"sid": "ZDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"service_sid": "ServiceSid",
_10
"environment_sid": "ZEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"build_sid": "ZB00000000000000000000000000000000",
_10
"date_created": "2018-11-10T20:00:00Z",
_10
"date_updated": "2018-11-10T20:00:00Z",
_10
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments/ZE00000000000000000000000000000000/Deployments/ZD00000000000000000000000000000000"
_10
}


Read multiple Deployment resources

read-multiple-deployment-resources page anchor
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Deployments

Property nameTypeRequiredPIIDescription
ServiceSidstringrequired

The SID of the Service to read the Deployment resources from.


EnvironmentSidSID<ZE>required

The SID of the Environment used by the Deployment resources to read.

Pattern: ^ZE[0-9a-fA-F]{32}$Min length: 34Max length: 34
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.

List multiple Deployments

list-multiple-deployments page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function listDeployment() {
_19
const deployments = await client.serverless.v1
_19
.services("ServiceSid")
_19
.environments("ZEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.deployments.list({ limit: 20 });
_19
_19
deployments.forEach((d) => console.log(d.sid));
_19
}
_19
_19
listDeployment();

Output

_12
{
_12
"deployments": [],
_12
"meta": {
_12
"first_page_url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments/ZE00000000000000000000000000000000/Deployments?PageSize=50&Page=0",
_12
"key": "deployments",
_12
"next_page_url": null,
_12
"page": 0,
_12
"page_size": 50,
_12
"previous_page_url": null,
_12
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments/ZE00000000000000000000000000000000/Deployments?PageSize=50&Page=0"
_12
}
_12
}


Rate this page: