The URL-friendly string by which the Function Version resource can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash ('/'). If a Function Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one.
The following example creates a Function Version resource using the language of your choice (or curl) and an external file, firstfunc.js, which contains the function body.
Upload Function body
Node.js
Python
Java
PHP
Ruby
curl
_36
const fs = require('fs');
_36
// Before running this code, install "form-data" and "axios" using `npm install form-data axios`
_36
const FormData = require('form-data');
_36
const axios = require('axios');
_36
_36
// Provision API Keys at twilio.com/console/runtime/api-keys
_36
// and set the environment variables. See http://twil.io/secure
Note that the Serverless upload endpoint is on a different subdomain from the rest of the Serverless API (serverless-upload.twilio.com instead of serverless.twilio.com), and is not supported by the Twilio Helper Libraries at this time.
The create action accepts these parameters:
Parameter
Description
Content
The Function code to upload as a JavaScript file.
FunctionSid
The SID of the Function resource to upload this code to.
Path
The path to assign the Function. Must be URL Friendly, without fragments, and the characters ;,?:@+&$()' " are disallowed.
ServiceSid
The SID of the Function's Service.
Visibility
The visibility of the Function. Can be public, protected, or private.
Fetch a FunctionVersion resource
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Functions/{FunctionSid}/Versions/{Sid}
There is no API endpoint for deleting a Function Version, only Functions. Function Versions are automatically purged if they are not used by a Build for 30 days. See our retention policy to learn more.