Asset
Assets are static files that you can host at a particular domain in an Environment.
The steps to create Assets are as follows:
-
Create an Asset (this resource)
-
Create an
Asset Version
We will need the Asset Version SID to include this Asset in a Build.
Property nameTypePIIDescription
The unique string that we created to identify the Asset resource.
Pattern: ^ZH[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Account that created the Asset resource.
Pattern: ^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Service that the Asset resource is associated with.
Pattern: ^ZS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The string that you assigned to describe the Asset resource. It can be a maximum of 255 characters.
date_createdstring<date-time>
date_updatedstring<date-time>
The absolute URL of the Asset resource.
The URLs of the Asset resource's nested resources.
POST https://serverless.twilio.com/v1/Services/{ServiceSid}/Assets
Property nameTypeRequiredPIIDescription
The SID of the Service to create the Asset resource under.
Property nameTypeRequiredPIIDescription
FriendlyNamestringrequired A descriptive string that you create to describe the Asset resource. It can be a maximum of 255 characters.
_18// Download the helper library from https://www.twilio.com/docs/node/install
_18const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18// Find your Account SID and Auth Token at twilio.com/console
_18// and set the environment variables. See http://twil.io/secure
_18const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18const authToken = process.env.TWILIO_AUTH_TOKEN;
_18const client = twilio(accountSid, authToken);
_18async function createAsset() {
_18 const asset = await client.serverless.v1
_18 .services("ServiceSid")
_18 .assets.create({ friendlyName: "FriendlyName" });
_18 console.log(asset.sid);
_12 "sid": "ZH00000000000000000000000000000000",
_12 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12 "service_sid": "ServiceSid",
_12 "friendly_name": "FriendlyName",
_12 "date_created": "2018-11-10T20:00:00Z",
_12 "date_updated": "2018-11-10T20:00:00Z",
_12 "url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000",
_12 "asset_versions": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000/Versions"
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Assets/{Sid}
Property nameTypeRequiredPIIDescription
The SID of the Service to fetch the Asset resource from.
The SID that identifies the Asset resource to fetch.
Pattern: ^ZH[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
_19// Download the helper library from https://www.twilio.com/docs/node/install
_19const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19// Find your Account SID and Auth Token at twilio.com/console
_19// and set the environment variables. See http://twil.io/secure
_19const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19const authToken = process.env.TWILIO_AUTH_TOKEN;
_19const client = twilio(accountSid, authToken);
_19async function fetchAsset() {
_19 const asset = await client.serverless.v1
_19 .services("ServiceSid")
_19 .assets("ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19 console.log(asset.sid);
_12 "sid": "ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12 "service_sid": "ServiceSid",
_12 "friendly_name": "test-asset",
_12 "date_created": "2018-11-10T20:00:00Z",
_12 "date_updated": "2018-11-10T20:00:00Z",
_12 "url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000",
_12 "asset_versions": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000/Versions"
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Assets
Property nameTypeRequiredPIIDescription
The SID of the Service to read the Asset resources from.
Property nameTypeRequiredPIIDescription
How many resources to return in each list page. The default is 50, and the maximum is 1000.
Minimum: 1
Maximum: 1000
The page index. This value is simply for client state.
Minimum: 0
The page token. This is provided by the API.
_18// Download the helper library from https://www.twilio.com/docs/node/install
_18const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18// Find your Account SID and Auth Token at twilio.com/console
_18// and set the environment variables. See http://twil.io/secure
_18const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18const authToken = process.env.TWILIO_AUTH_TOKEN;
_18const client = twilio(accountSid, authToken);
_18async function listAsset() {
_18 const assets = await client.serverless.v1
_18 .services("ServiceSid")
_18 .assets.list({ limit: 20 });
_18 assets.forEach((a) => console.log(a.sid));
_12 "first_page_url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets?PageSize=50&Page=0",
_12 "next_page_url": null,
_12 "previous_page_url": null,
_12 "url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets?PageSize=50&Page=0"
POST https://serverless.twilio.com/v1/Services/{ServiceSid}/Assets/{Sid}
Property nameTypeRequiredPIIDescription
The SID of the Service to update the Asset resource from.
The SID that identifies the Asset resource to update.
Pattern: ^ZH[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Property nameTypeRequiredPIIDescription
FriendlyNamestringrequired A descriptive string that you create to describe the Asset resource. It can be a maximum of 255 characters.
_19// Download the helper library from https://www.twilio.com/docs/node/install
_19const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19// Find your Account SID and Auth Token at twilio.com/console
_19// and set the environment variables. See http://twil.io/secure
_19const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19const authToken = process.env.TWILIO_AUTH_TOKEN;
_19const client = twilio(accountSid, authToken);
_19async function updateAsset() {
_19 const asset = await client.serverless.v1
_19 .services("ServiceSid")
_19 .assets("ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19 .update({ friendlyName: "FriendlyName" });
_19 console.log(asset.sid);
_12 "sid": "ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12 "service_sid": "ServiceSid",
_12 "friendly_name": "FriendlyName",
_12 "date_created": "2018-11-10T20:00:00Z",
_12 "date_updated": "2018-11-10T20:00:00Z",
_12 "url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000",
_12 "asset_versions": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000/Versions"
DELETE https://serverless.twilio.com/v1/Services/{ServiceSid}/Assets/{Sid}
Property nameTypeRequiredPIIDescription
The SID of the Service to delete the Asset resource from.
The SID that identifies the Asset resource to delete.
Pattern: ^ZH[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
_17// Download the helper library from https://www.twilio.com/docs/node/install
_17const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_17// Find your Account SID and Auth Token at twilio.com/console
_17// and set the environment variables. See http://twil.io/secure
_17const accountSid = process.env.TWILIO_ACCOUNT_SID;
_17const authToken = process.env.TWILIO_AUTH_TOKEN;
_17const client = twilio(accountSid, authToken);
_17async function deleteAsset() {
_17 await client.serverless.v1
_17 .services("ServiceSid")
_17 .assets("ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")