Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Serverless API


The Serverless API lets you deploy Twilio Functions and Assets programmatically.


Getting started

getting-started page anchor

To deploy Functions and Assets, use the Serverless Toolkit, which gives you an installable development Environment from which to build and deploy everything you need.

To test out the API, see the Quickstart guide.


The API includes the following resources:

The following animation shows the relationship and purpose for each resource:

Animation showing serverless API services as containers for functions and assets.

The API gives you control over the domains that serve your Functions and Assets after deployment. The domain structure is as follows:

https://[service unique name]-[random characters]-[optional domain suffix].twil.io/

For example, a Service with the unique name thanos can create the following domains by specifying a domain suffix (or leaving it blank) when creating an Environment:

1
https://thanos-3432.twil.io/ // Environment domain suffix left blank
2
https://thanos-3432-dev.twil.io/ // Environment domain suffix = dev
3
https://thanos-3432-test.twil.io/ // Environment domain suffix = test
4
https://thanos-3432-stage.twil.io/ // Environment domain suffix = stage

The following entities are retained for up to 7 days and then deleted:

The following entities are retained for up to 30 days and then deleted:

  • Logs, including those generated by the console.log(), console.info(), console.warn(), and console.error() methods
(information)

Retention policy for API-generated entities

This policy doesn't affect active Deployments. It only applies to users working with the API, Serverless Toolkit, or the UI editor. It does not apply to Functions (Classic) and Assets (Classic).

Data generated by the underlying Twilio products that you invoke using Functions, such as SMS or Voice calls, is retained or deleted according to each product's data-retention policy. For details, refer to the individual product documentation, such as the SMS developer quickstart and call resource retention for Voice.


Limitations

limitations page anchor
  • Functions and Assets created by the API are not reflected in the Classic UI for those products. You cannot use the API to read Functions or Assets created with the Classic UI. The two systems are separate.
  • There is no GET operation for Asset Versions. You cannot retrieve the asset file content itself through the API.
  • GET requests to functions that include a body are rejected with a 403 status code.

Maximum file size per asset when using the API:

Asset typeMaximum size
Public25MB
Protected25MB
Private10MB