Skip to contentSkip to navigationSkip to topbar
On this page

Config resource


You can provide configuration data for multiple Microvisor-empowered IoT devices using the Config resource. Configs are intended as a way to upload data such as API keys, PKI certificates, and other items to the Twilio cloud so they need not be baked into application code. Instead, the application code running on the device retrieves the Config when it needs the information.

Each Config 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 account.

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 Config. For example, you might used base64 encoding. Your application must decode the value back to binary after acquiring it from the Twilio cloud.

Config resources are accessed at this endpoint:

https://microvisor.twilio.com/v1/Configs

Config resources are accessible from all devices associated with an account. For Configs that are made available to specific devices, please see Device Configs.

It is possible for anyone with account access to read back the value of any Config. If you have information which, once created, you would not like to be accessible to other account holders, use Secrets, which are, from the API perspective, write- and delete-only.


Config Properties

config-properties page anchor
Property nameTypeRequiredDescriptionChild properties
keystring

Optional

Not PII

The config key; up to 100 characters.


date_updatedstring<date-time>

Optional


valuestring

Optional

The config value; up to 4096 characters.


urlstring<uri>

Optional

The absolute URL of the Config.


Create an account-level Config

create-an-account-level-config page anchor
POST https://microvisor.twilio.com/v1/Configs

Request body parameters

request-body-parameters page anchor
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
Keystringrequired

The config key; up to 100 characters.


Valuestringrequired

The config value; up to 4096 characters.

Create an account-level ConfigLink to code sample: Create an account-level Config
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createAccountConfig() {
11
const accountConfig = await client.microvisor.v1.accountConfigs.create({
12
key: "key_name",
13
value: "value",
14
});
15
16
console.log(accountConfig.key);
17
}
18
19
createAccountConfig();

Output

1
{
2
"key": "key_name",
3
"value": "value",
4
"date_updated": "2021-01-01T12:34:56Z",
5
"url": "https://microvisor.twilio.com/v1/Configs/first"
6
}

Retrieve an account-level Config

retrieve-an-account-level-config page anchor
GET https://microvisor.twilio.com/v1/Configs/{Key}

Property nameTypeRequiredPIIDescription
Keystringrequired

The config key; up to 100 characters.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchAccountConfig() {
11
const accountConfig = await client.microvisor.v1
12
.accountConfigs("Key_name")
13
.fetch();
14
15
console.log(accountConfig.key);
16
}
17
18
fetchAccountConfig();

Output

1
{
2
"key": "Key_name",
3
"value": "place",
4
"date_updated": "2021-01-01T12:34:57Z",
5
"url": "https://microvisor.twilio.com/v1/Configs/first"
6
}

Delete an account-level Config

delete-an-account-level-config page anchor
DELETE https://microvisor.twilio.com/v1/Configs/{Key}

Property nameTypeRequiredPIIDescription
Keystringrequired

The config key; up to 100 characters.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function deleteAccountConfig() {
11
await client.microvisor.v1.accountConfigs("key_name").remove();
12
}
13
14
deleteAccountConfig();

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.