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?

Variable

Variables are key/value pairs that you can add to a specific Environment. Use these for storing configuration like API keys rather than hardcoding them into your Functions.

Variable properties

Names in PHP format
sid
sid<ZV> Not PII

The unique string that we created to identify the Variable resource.

accountSid
sid<AC> Not PII

The SID of the Account that created the variable resource.

serviceSid
sid<ZS> Not PII

The SID of the Service that the Variable resource is associated with.

environmentSid
sid<ZE> Not PII

The SID of the environment in which the variable exists.

key

A string by which the Variable resource can be referenced.

value

A string that contains the actual value of the variable.

dateCreated
date_time<iso8601> Not PII

The date and time in GMT when the Variable resource was created specified in ISO 8601 format.

dateUpdated
date_time<iso8601> Not PII

The date and time in GMT when the Variable resource was last updated specified in ISO 8601 format.

url
url Not PII

The absolute URL of the Variable resource.

Create a Variable resource

post
https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables
Parameters
Names in None format
service_sid
Required
post sid_like<ZS> Not PII

The SID of the Service to create the Variable resource under.

environment_sid
Required
post sid<ZE> Not PII

The SID of the environment in which the variable exists.

key
Required
post string PII MTL: 7 DAYS

A string by which the Variable resource can be referenced. Must be less than 128 characters long.

value
Required
post string PII MTL: 7 DAYS

A string that contains the actual value of the variable. Must have less than 450 bytes.

Example
        
        
        
        

        Fetch a Variable resource

        get
        https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}
        Parameters
        Names in None format
        service_sid
        Required
        get sid_like<ZS> Not PII

        The SID of the Service to fetch the Variable resource from.

        environment_sid
        Required
        get sid<ZE> Not PII

        The SID of the environment with the Variable resource to fetch.

        sid
        Required
        get sid<ZV> Not PII

        The SID of the Variable resource to fetch.

        Example
              
              
              
              

              Read multiple Variable resources

              get
              https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables
              Parameters
              Names in None format
              service_sid
              Required
              get sid_like<ZS> Not PII

              The SID of the Service to read the Variable resources from.

              environment_sid
              Required
              get sid<ZE> Not PII

              The SID of the environment with the Variable resources to read.

              Example
                    
                    
                    
                    

                    Update a Variable resource

                    post
                    https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}
                    Parameters
                    Names in None format
                    service_sid
                    Required
                    post sid_like<ZS> Not PII

                    The SID of the Service to update the Variable resource under.

                    environment_sid
                    Required
                    post sid<ZE> Not PII

                    The SID of the environment with the Variable resource to update.

                    sid
                    Required
                    post sid<ZV> Not PII

                    The SID of the Variable resource to update.

                    key
                    Optional
                    post string PII MTL: 7 DAYS

                    A string by which the Variable resource can be referenced. Must be less than 128 characters long.

                    value
                    Optional
                    post string PII MTL: 7 DAYS

                    A string that contains the actual value of the variable. Must have less than 450 bytes.

                    Example
                          
                          
                          
                          

                          Delete a Variable resource

                          delete
                          https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}
                          Parameters
                          Names in None format
                          service_sid
                          Required
                          delete sid_like<ZS> Not PII

                          The SID of the Service to delete the Variable resource from.

                          environment_sid
                          Required
                          delete sid<ZE> Not PII

                          The SID of the environment with the Variables to delete.

                          sid
                          Required
                          delete sid<ZV> Not PII

                          The SID of the Variable resource to delete.

                          Example
                                
                                
                                
                                
                                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.