Skip to contentSkip to navigationSkip to topbar
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 nameTypeRequiredDescriptionChild properties
sidSID<ZD>Optional
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>Optional

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>Optional

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>Optional

The SID of the Environment for the Deployment.

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

build_sidSID<ZB>Optional

The SID of the Build for the deployment.

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

date_createdstring<date-time>Optional

date_updatedstring<date-time>Optional

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>Optional

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
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
BuildSidSID<ZB>Optional

The SID of the Build for the Deployment.

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

IsPluginbooleanOptional

Whether the Deployment is a plugin.

Create a DeploymentLink to code sample: Create a Deployment
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createDeployment() {
11
const deployment = await client.serverless.v1
12
.services("ServiceSid")
13
.environments("ZEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
14
.deployments.create({ buildSid: "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" });
15
16
console.log(deployment.sid);
17
}
18
19
createDeployment();

Output

1
{
2
"sid": "ZD00000000000000000000000000000000",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"service_sid": "ServiceSid",
5
"environment_sid": "ZEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
6
"build_sid": "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
7
"date_created": "2018-11-10T20:00:00Z",
8
"date_updated": "2018-11-10T20:00:00Z",
9
"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.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createDeployment() {
11
const deployment = await client.serverless.v1
12
.services("ServiceSid")
13
.environments("ZEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
14
.deployments.create();
15
16
console.log(deployment.sid);
17
}
18
19
createDeployment();

Output

1
{
2
"sid": "ZD00000000000000000000000000000000",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"service_sid": "ServiceSid",
5
"environment_sid": "ZEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
6
"build_sid": "ZB00000000000000000000000000000000",
7
"date_created": "2018-11-10T20:00:00Z",
8
"date_updated": "2018-11-10T20:00:00Z",
9
"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
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchDeployment() {
11
const deployment = await client.serverless.v1
12
.services("ServiceSid")
13
.environments("ZEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
14
.deployments("ZDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
15
.fetch();
16
17
console.log(deployment.sid);
18
}
19
20
fetchDeployment();

Output

1
{
2
"sid": "ZDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"service_sid": "ServiceSid",
5
"environment_sid": "ZEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
6
"build_sid": "ZB00000000000000000000000000000000",
7
"date_created": "2018-11-10T20:00:00Z",
8
"date_updated": "2018-11-10T20:00:00Z",
9
"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.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function listDeployment() {
11
const deployments = await client.serverless.v1
12
.services("ServiceSid")
13
.environments("ZEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
14
.deployments.list({ limit: 20 });
15
16
deployments.forEach((d) => console.log(d.sid));
17
}
18
19
listDeployment();

Output

1
{
2
"deployments": [],
3
"meta": {
4
"first_page_url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments/ZE00000000000000000000000000000000/Deployments?PageSize=50&Page=0",
5
"key": "deployments",
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/ZS00000000000000000000000000000000/Environments/ZE00000000000000000000000000000000/Deployments?PageSize=50&Page=0"
11
}
12
}

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.