Variable
Variables are key/value pairs that you can add to a specific Environment. Use these for storing configuration like API keys rather than hardcoding them into your Functions. Environment Variables are encrypted, so they are the preferred way to store API keys, passwords, and any other secrets that your Function needs to use.
Resource properties
sid
type: SID<ZV>
The unique string that we created to identify the Variable resource.
Pattern:
^ZV[0-9a-fA-F]{32}$
service_sid
type: SID<ZS>
The SID of the Service that the Variable resource is associated with.
Pattern:
^ZS[0-9a-fA-F]{32}$
environment_sid
type: SID<ZE>
The SID of the Environment in which the Variable exists.
Pattern:
^ZE[0-9a-fA-F]{32}$
key
type: string
A string by which the Variable resource can be referenced.
value
type: string
A string that contains the actual value of the Variable.
date_created
type: string<date-time>
date_updated
type: string<date-time>
url
type: string<uri>
The absolute URL of the Variable resource.
POST https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables
URI parameters
ServiceSid
type: string
The SID of the Service to create the Variable resource under.
EnvironmentSid
type: SID<ZE>
The SID of the Environment in which the Variable resource exists.
Pattern:
^ZE[0-9a-fA-F]{32}$
Request body parameters
Key
type: stringRequired
A string by which the Variable resource can be referenced. It can be a maximum of 128 characters.
Value
type: stringRequired
A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size.
_12// Download the helper library from https://www.twilio.com/docs/node/install
_12// Find your Account SID and Auth Token at twilio.com/console
_12// and set the environment variables. See http://twil.io/secure
_12const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12const authToken = process.env.TWILIO_AUTH_TOKEN;
_12const client = require('twilio')(accountSid, authToken);
_12client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .create({key: 'key', value: 'value'})
_12 .then(variable => console.log(variable.sid));
_11 "sid": "ZV00000000000000000000000000000000",
_11 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "environment_sid": "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "value": "new-value",
_11 "date_created": "2018-11-10T20:00:00Z",
_11 "date_updated": "2018-11-10T20:00:00Z",
_11 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables/ZV00000000000000000000000000000000"
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}
URI parameters
ServiceSid
type: string
The SID of the Service to fetch the Variable resource from.
EnvironmentSid
type: SID<ZE>
The SID of the Environment with the Variable resource to fetch.
Pattern:
^ZE[0-9a-fA-F]{32}$
Sid
type: SID<ZV>
The SID of the Variable resource to fetch.
Pattern:
^ZV[0-9a-fA-F]{32}$
_12// Download the helper library from https://www.twilio.com/docs/node/install
_12// Find your Account SID and Auth Token at twilio.com/console
_12// and set the environment variables. See http://twil.io/secure
_12const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12const authToken = process.env.TWILIO_AUTH_TOKEN;
_12const client = require('twilio')(accountSid, authToken);
_12client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .variables('ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .then(variable => console.log(variable.sid));
_11 "sid": "ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "environment_sid": "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "value": "test-value",
_11 "date_created": "2018-11-10T20:00:00Z",
_11 "date_updated": "2018-11-10T20:00:00Z",
_11 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables/ZV00000000000000000000000000000000"
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables
URI parameters
ServiceSid
type: string
The SID of the Service to read the Variable resources from.
EnvironmentSid
type: SID<ZE>
The SID of the Environment with the Variable resources to read.
Pattern:
^ZE[0-9a-fA-F]{32}$
PageSize
type: integer
How many resources to return in each list page. The default is 50, and the maximum is 1000.
Page
type: integer
The page index. This value is simply for client state.
PageToken
type: string
The page token. This is provided by the API.
_12// Download the helper library from https://www.twilio.com/docs/node/install
_12// Find your Account SID and Auth Token at twilio.com/console
_12// and set the environment variables. See http://twil.io/secure
_12const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12const authToken = process.env.TWILIO_AUTH_TOKEN;
_12const client = require('twilio')(accountSid, authToken);
_12client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .then(variables => variables.forEach(v => console.log(v.sid)));
_12 "first_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables?PageSize=50&Page=0",
_12 "next_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables?PageSize=50&Page=1",
_12 "previous_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables?PageSize=50&Page=0",
_12 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables?PageSize=50&Page=0"
POST https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}
URI parameters
ServiceSid
type: string
The SID of the Service to update the Variable resource under.
EnvironmentSid
type: SID<ZE>
The SID of the Environment with the Variable resource to update.
Pattern:
^ZE[0-9a-fA-F]{32}$
Sid
type: SID<ZV>
The SID of the Variable resource to update.
Pattern:
^ZV[0-9a-fA-F]{32}$
Request body parameters
Key
type: string
A string by which the Variable resource can be referenced. It can be a maximum of 128 characters.
Value
type: string
A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size.
_12// Download the helper library from https://www.twilio.com/docs/node/install
_12// Find your Account SID and Auth Token at twilio.com/console
_12// and set the environment variables. See http://twil.io/secure
_12const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12const authToken = process.env.TWILIO_AUTH_TOKEN;
_12const client = require('twilio')(accountSid, authToken);
_12client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .variables('ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .update({key: 'key'})
_12 .then(variable => console.log(variable.sid));
_11 "sid": "ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "environment_sid": "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "value": "update-value",
_11 "date_created": "2018-11-10T20:00:00Z",
_11 "date_updated": "2018-11-11T20:00:00Z",
_11 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables/ZV00000000000000000000000000000000"
DELETE https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}
URI parameters
ServiceSid
type: string
The SID of the Service to delete the Variable resource from.
EnvironmentSid
type: SID<ZE>
The SID of the Environment with the Variables to delete.
Pattern:
^ZE[0-9a-fA-F]{32}$
Sid
type: SID<ZV>
The SID of the Variable resource to delete.
Pattern:
^ZV[0-9a-fA-F]{32}$
_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
_11const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11const authToken = process.env.TWILIO_AUTH_TOKEN;
_11const client = require('twilio')(accountSid, authToken);
_11client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .variables('ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')