Menu

Expand
Rate this page:

Secret Subresource

You can provide secret data for specific Microvisor-empowered IoT devices using the Secret subresource. Secrets are intended as a way to upload data such as PKI keys and other confidential items to the Twilio cloud so they need not be baked into application code. Instead, the application code running on the device retrieves the Secret when it needs the information.

Unlike Device Configs, Device Secrets’ values cannot be accessed via the API once they have been created. The retrieval actions listed below will return Secrets’ metadata, not their values.

Each Secret is a key:value pair which your application code can access using Microvisor System Calls.

Keys are text identifiers of up to 100 characters in length. They must be unique for a given device. For example, devices A and B can both have Secret with the key wifi_password, but each device can have only one Secret with that key.

Values must also be supplied as text, of up to 4096 characters in length. If you wish to make binary data available to your devices, you will need to encode it as text before creating the Secret. For example, you might used base64 encoding. Your application must decode the value back to binary after acquiring it from the Twilio cloud.

Secret subresources are accessed at these endpoints:

https://microvisor.twilio.com/v1/Devices/{sid}/Secrets
https://microvisor.twilio.com/v1/Devices/{UniqueName}/Secrets

Device Secrets are accessible only by the specified device. For Secrets that are made available to all devices associated with a given account, please see Account-level Secrets.

Secrets can’t yet be updated. If you need to change a Secret’s value, delete it, and then create a new Secret with the same key.

Device Secret properties

Resource Properties in REST API format
device_sid
sid<UV> Not PII

A 34-character string that uniquely identifies the parent Device.

key
string Not PII

The secret key; up to 100 characters.

date_rotated
date_time<iso8601> Not PII

url
url Not PII

The absolute URL of the Secret.

Create a Device Secret

post
https://microvisor.twilio.com/v1/Devices/{DeviceSid}/Secrets
Parameters
Parameters in REST API format
device_sid
Path
post sid_like<UV> Not PII

A 34-character string that uniquely identifies the Device.

key
Required
post string Not PII

The secret key; up to 100 characters.

value
Required
post string Not PII

The secret value; up to 4096 characters.

Example 1
Loading Code Sample...
        
        

        Create a Device Secret

        Read a single Device Secret’s metadata

        get
        https://microvisor.twilio.com/v1/Devices/{DeviceSid}/Secrets/{Key}
        Parameters
        Parameters in REST API format
        device_sid
        Path
        get sid_like<UV> Not PII

        A 34-character string that uniquely identifies the Device.

        key
        Path
        get string Not PII

        The secret key; up to 100 characters.

        Example 1
        Loading Code Sample...
              
              

              Read a single Device Secret’s metadata

              List all of a Device’s Secrets

              get
              https://microvisor.twilio.com/v1/Devices/{DeviceSid}/Secrets
              Parameters
              Parameters in REST API format
              device_sid
              Path
              get sid_like<UV> Not PII

              A 34-character string that uniquely identifies the Device.

              Example 1
              Loading Code Sample...
                    
                    

                    List all of a Device’s Secrets

                    Delete a Device Secret

                    delete
                    https://microvisor.twilio.com/v1/Devices/{DeviceSid}/Secrets/{Key}
                    Parameters
                    Parameters in REST API format
                    device_sid
                    Path
                    delete sid_like<UV> Not PII

                    A 34-character string that uniquely identifies the Device.

                    key
                    Path
                    delete string Not PII

                    The secret key; up to 100 characters.

                    Example 1
                    Loading Code Sample...
                          
                          

                          Delete a Device Secret

                          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 by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                          Loading Code Sample...
                                
                                
                                

                                Thank you for your feedback!

                                Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                                Sending your feedback...
                                🎉 Thank you for your feedback!
                                Something went wrong. Please try again.

                                Thanks for your feedback!

                                thanks-feedback-gif