Twilio Functions & Assets is a serverless environment to empower developers like you to create production-grade, event-driven applications that scale with your business. Assets can be used to upload and host static files that support web, voice, and messaging applications.
The new Serverless API lets you deploy Twilio Functions & Assets.
If you would like to start deploying Functions & Assets right away, we suggest you look into the Serverless Toolkit, which gives you an installable development environment from which to build and deploy everything you need.
To start playing with the API itself, head over to our Quickstart.
The API consists of the following resources:
The animation below shows the relationship and purpose for each resource:
With the new API, we're giving you more control over the domains you serve your Functions and Assets from once deployed. Your domain structure looks like this:
https://[service unique name]-[random characters]-[optional domain suffix].twil.io/
https://thanos-3432.twil.io/ //Environment DomainSuffix left blank https://thanos-3432-dev.twil.io/ //Environment DomainSuffix=dev https://thanos-3432-test.twil.io/ //Environment DomainSuffix=test https://thanos-3432-stage.twil.io/ //Environment DomainSuffix=stage
The following will be retained for a maximum of 30 days and then deleted:
- Functions without any Function Versions.
- Assets without any Asset Versions.
- Function Versions or Asset Versions that are not part of a Build or an active Deployment.
- Logs, including those generated by the
This policy will not impact any active deployments at any point. This policy will only apply to users using the API, serverless toolkit or the new UI editor. This policy does not apply to Functions(Classic) and Assets(Classic).
Data generated by underlying products used via Functions, such as SMS or voice calls, is retained/deleted in line with those products' data policies. Details of individual product data retention policies can be found in the specific product documentation, such as here for SMS and here for voice calls.
- Functions and Assets created by the API are not reflected in the Classic UI for those products. You cannot read Functions/Assets created via the Classic UI via the API. The two systems are separate. See this overview of the differences.
- To set a Function created by this API to execute against a phone number, you must set the voice/SMS webhook to the full Function path, not try and select it in the Functions drop down on the phone numbers page.
- There is no GET of Asset Versions — you cannot retrieve the asset file content itself via the API at this time.
- An account can have 50 services.
- A service can have up to 25 environments.
- A build can contain up to 50 Function versions.
- A build can contain up to 1000 public/protected asset versions.
- A build can contain up to 50 private asset versions.
- An account can do up to 100 builds per hour.
- Builds without an active deployment are deleted after 24 hours.
- Function Versions that are not part of any builds and are older than 30 days will be deleted.
- Asset Versions that are not part of any build and are older than 30 days will be deleted.
- Functions that don’t have any Function Versions and are older than 30 days will be deleted.
- Assets that don’t have any Asset Versions and are older than 30 days will be deleted.
- Function execution time is limited to 10 seconds.
- An account can execute up to 30 functions concurrently.
Both public and private Assets have limitations on the maximum file size of each when using APIs.
|Asset Type||Maximum Size|
|Public and protected||25 MB|
The UI Editor can load up to 100 functions and 100 assets by default. If a service has more than 100 Functions or assets, you would need to click on "Load more" to view the rest of the resources. "Deploy All" button, "Save" button and making changes to dependencies would be disabled until all the functions and assets in service have been loaded.
Deleting functions/assets is disabled untill all functions/assets are loaded for view.