Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now

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 SID identifier of this Variable.

accountSid
sid<AC> Not PII

The unique SID identifier of the Account that owns this Variable.

serviceSid
sid<ZS> Not PII

The unique SID identifier of the Service for this Variable.

environmentSid
sid<ZE> Not PII

The unique SID identifier of the Environment in which this Variable exists.

key

A string by which this Variable can be referenced, fewer than 128 characters.

value

A string that contains the actual value of this Variable, less than 450 bytes.

dateCreated
date_time<iso8601> Not PII

The date that this Variable was created, given in ISO 8601 format.

dateUpdated
date_time<iso8601> Not PII

The date that this Variable was updated, given in ISO 8601 format.

url
url Not PII

The URL of this Variable.

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 unique SID identifier of the Service for this Variable.

environment_sid
Required
post sid<ZE> Not PII

The unique SID identifier of the Environment in which this Variable exists.

key
Required
post string PII MTL: 7 DAYS

A string by which this Variable can be referenced, fewer than 128 characters. Required.

value
Required
post string PII MTL: 7 DAYS

A string that contains the actual value of this Variable, less than 450 bytes. Required.

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 unique SID identifier of the Service for this Variable.

        environment_sid
        Required
        get sid<ZE> Not PII

        The unique SID identifier of the Environment in which this Variable exists.

        sid
        Required
        get sid<ZV> Not PII

        The unique SID identifier of this Variable.

        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 unique SID identifier of the Service for these Variables.

              environment_sid
              Required
              get sid<ZE> Not PII

              The unique SID identifier of the Environment in which these Variables exist.

              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 unique SID identifier of the Service for this Variable.

                    environment_sid
                    Required
                    post sid<ZE> Not PII

                    The unique SID identifier of the Environment in which this Variable exists.

                    sid
                    Required
                    post sid<ZV> Not PII

                    The unique SID identifier of this Variable.

                    key
                    Optional
                    post string PII MTL: 7 DAYS

                    A string by which this Variable can be referenced, fewer than 128 characters. Optional.

                    value
                    Optional
                    post string PII MTL: 7 DAYS

                    A string that contains the actual value of this Variable, less than 450 bytes. Optional.

                    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 unique SID identifier of the Service for this Variable.

                          environment_sid
                          Required
                          delete sid<ZE> Not PII

                          The unique SID identifier of the Environment in which this Variable exists.

                          sid
                          Required
                          delete sid<ZV> Not PII

                          The unique SID identifier of this Variable.

                          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.