# Function Version Content

The `/Content` endpoint for each FunctionVersion lets you retrieve the code.

## Content Properties

```json
{"type":"object","refName":"serverless.v1.service.function.function_version.function_version_content","modelName":"serverless_v1_service_function_function_version_function_version_content","properties":{"sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^ZN[0-9a-fA-F]{32}$","nullable":true,"description":"The unique string that we created to identify the Function Version resource."},"account_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^AC[0-9a-fA-F]{32}$","nullable":true,"description":"The SID of the [Account](/docs/iam/api/account) that created the Function Version resource."},"service_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^ZS[0-9a-fA-F]{32}$","nullable":true,"description":"The SID of the Service that the Function Version resource is associated with."},"function_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^ZH[0-9a-fA-F]{32}$","nullable":true,"description":"The SID of the Function that is the parent of the Function Version."},"content":{"type":"string","nullable":true,"description":"The content of the Function Version resource."},"url":{"type":"string","format":"uri","nullable":true}}}
```

## Fetch a FunctionVersionContent resource

`GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Functions/{FunctionSid}/Versions/{Sid}/Content`

### Path parameters

```json
[{"name":"ServiceSid","in":"path","description":"The SID of the Service to fetch the Function Version content from.","schema":{"type":"string"},"required":true},{"name":"FunctionSid","in":"path","description":"The SID of the Function that is the parent of the Function Version content to fetch.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^ZH[0-9a-fA-F]{32}$"},"required":true},{"name":"Sid","in":"path","description":"The SID of the Function Version content to fetch.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^ZN[0-9a-fA-F]{32}$"},"required":true}]
```

Fetch a Content

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function fetchFunctionVersionContent() {
  const functionVersionContent = await client.serverless.v1
    .services("ServiceSid")
    .functions("ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .functionVersions("ZNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .functionVersionContent()
    .fetch();

  console.log(functionVersionContent.sid);
}

fetchFunctionVersionContent();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

function_version_content = (
    client.serverless.v1.services("ServiceSid")
    .functions("ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .function_versions("ZNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .function_version_content()
    .fetch()
)

print(function_version_content.sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Serverless.V1.Service.Function.FunctionVersion;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var functionVersionContent = await FunctionVersionContentResource.FetchAsync(
            pathServiceSid: "ServiceSid",
            pathFunctionSid: "ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
            pathSid: "ZNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        Console.WriteLine(functionVersionContent.Sid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.serverless.v1.service.function.functionversion.FunctionVersionContent;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        FunctionVersionContent functionVersionContent =
            FunctionVersionContent
                .fetcher("ServiceSid", "ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "ZNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
                .fetch();

        System.out.println(functionVersionContent.getSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	resp, err := client.ServerlessV1.FetchFunctionVersionContent("ServiceSid",
		"ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		"ZNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.Sid != nil {
			fmt.Println(*resp.Sid)
		} else {
			fmt.Println(resp.Sid)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$function_version_content = $twilio->serverless->v1
    ->services("ServiceSid")
    ->functions("ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->functionVersions("ZNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->functionVersionContent()
    ->fetch();

print $function_version_content->sid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

function_version_content = @client
                           .serverless
                           .v1
                           .services('ServiceSid')
                           .functions('ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
                           .function_versions('ZNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
                           .function_version_content
                           .fetch

puts function_version_content.sid
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:serverless:v1:services:functions:versions:content:fetch \
   --service-sid ServiceSid \
   --function-sid ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
   --sid ZNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
```

```bash
curl -X GET "https://serverless.twilio.com/v1/Services/ServiceSid/Functions/ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Versions/ZNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Content" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "sid": "ZNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "service_sid": "ServiceSid",
  "function_sid": "ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "content": "exports.handler = function (context, event, callback) {\n    const request = require(\"request\");\n    return request(\"http://www.google.com\", function (error, response, body) {\n        callback(null, response.statusCode);\n    });\n};",
  "url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Functions/ZH00000000000000000000000000000000/Versions/ZN00000000000000000000000000000000/Content"
}
```
