Skip to content
You are reading the HappyView v2 docs, which are no longer updated. Read the v3 docs.

Script Variables

Script variables are encrypted key/value pairs available to Lua scripts via the env global. Use them for secrets like API tokens.

const TOKEN = "hv_..."; // your API key
const headers = { Authorization: `Bearer ${TOKEN}` };
GET /admin/script-variables

Requires script-variables:read. Returns a list of variable keys (values are not returned).

POST /admin/script-variables

Requires script-variables:create.

const response = await fetch("http://127.0.0.1:3000/admin/script-variables", {
method: "POST",
headers: {
...headers,
"Content-Type": "application/json",
},
body: JSON.stringify({ key: "ALGOLIA_API_KEY", value: "..." }),
});

The value is encrypted at rest using TOKEN_ENCRYPTION_KEY.

DELETE /admin/script-variables/{key}

Requires script-variables:delete.