Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Functions & Assets (API-only)

Twilio Functions & Assets is a serverless environment to empower developers like you to quickly and easily 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.

Beta limitations, known issues and limits

  • Functions and Assets created by the API are not reflected in the console UI for those products. You cannot read Functions/Assets created via the console UX via the API. The two systems are separate. See this overview of the differences.
  • The API is not integrated elsewhere in Twilio. Examples:
    • 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.
    • To use it in a Studio flow, you'll need to use the HTTP Request widget, not the Functions widget.
  • There is no GET of Function Versions or Asset Versions - you cannot retrieve file content itself via the API at this time.

Limits

  • An account can have 10 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 1 hour.
  • Function execution time is limited to 10 seconds.

Getting started

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.

API reference

The API consists of the following resources:

The animation below shows the relationship and purpose for each resource.

Serverless API resource overview animation

Understanding domains

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/

So that means a service with the unique name called thanos can create the following domains by specifying domain suffix (or leaving it blank) when creating an environment.

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
Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.