A variable set is a named group of environment variables, secret values included, that your organization saves once and attaches to a server in one go. Values are write-only: after you save a set, the console, the API and the CLI show only the names.
Create a set
- In the console, go to Variable sets.
- Select New variable set.
- Enter a name, then add each variable with its value.
- Select Create set.
Owners and admins create, change and delete sets. Members who can deploy servers see the names, so they can attach them.
Change a set
Select the edit button next to a set. A saved variable shows only its name. To change its value, select Replace value and enter the new one. To drop it, select Remove. Variables you leave alone keep their stored value.
Attach sets to a server
- In Deploy, go to the Configure step.
- Under Saved variable sets, attach up to 5 sets.
- Check the variable names the sets add.
The order matters. A later set wins over an earlier one, and a variable you set under Environment variables wins over every set. When two sets define the same name, the wizard warns you and names the set whose value is used. The review step lists the attached sets.
The values are added to the server as secret values. They are stored encrypted with the request and never shown.
Delete a set
Deleting a set erases its values. Servers already requested keep the values they were given. Launch files and scripts that name the set are not stored in your account, so check them yourself: a launch that attaches a deleted set is refused.
API and CLI
GET /api/v1/variable-sets lists the sets, POST /api/v1/variable-sets creates one, and PATCH or DELETE /api/v1/variable-sets/{id} changes or deletes it. Attach sets to a launch with variableSetIds on POST /api/v1/servers. In the CLI: apidly variable-sets and apidly deploy ... --var-set NAME. See also Environment variables and Secrets.
Manage sets from code
Create a set, drop one variable and attach the set to a launch. Every answer lists names only, never values, and {id} in the path can be the set's id or its name. Keep secret values out of commands and code: put them in a file of KEY=VALUE lines for --env-file, or read them from environment variables. Creating, changing and deleting sets needs a key with the full scope whose creator is an owner or an admin.
curl -X POST "https://apidly.com/api/v1/variable-sets" \
-H "Authorization: Bearer $APIDLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"prod","variables":{"MODEL":"llama-3.1-8b"}}'
curl -X PATCH "https://apidly.com/api/v1/variable-sets/prod" \
-H "Authorization: Bearer $APIDLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"variables":{"OLD_KEY":null}}'
apidly variable-sets create prod --env-file prod.env
apidly variable-sets update prod --unset OLD_KEY
apidly variable-sets show prod
apidly deploy --plan rtx-4090-1x --template pytorch --var-set prodimport { Apidly } from "@apidly/sdk";
const apidly = new Apidly({ apiKey: process.env.APIDLY_API_KEY });
await apidly.variableSets.create({
name: "prod",
variables: { HF_TOKEN: process.env.HF_TOKEN, MODEL: "llama-3.1-8b" },
});
await apidly.variableSets.update("prod", { variables: { OLD_KEY: null } });
const { variableSets } = await apidly.variableSets.list();
console.log(variableSets.map((s) => `${s.name}: ${s.variableNames.join(", ")}`));import os
from apidly import Client
client = Client(api_key=os.environ["APIDLY_API_KEY"])
client.variable_sets.create("prod", {"HF_TOKEN": os.environ["HF_TOKEN"], "MODEL": "llama-3.1-8b"})
client.variable_sets.update("prod", variables={"OLD_KEY": None})
print(client.variable_sets.get("prod"))Ready to try it?
Create a free account and add credit when you want to start a server. The smallest top-up is $10.
Was this helpful?