Announcing the Variables API: Manage function, site, and project variables from your Server SDKs_
Environment variables for functions, sites, and projects can now be created, updated, and deleted programmatically through the Appwrite Server SDKs. Provision configuration as code, rotate secrets in scripts, and bootstrap new environments without touching the Console.

Environment variables have always been part of Appwrite. You could set them on a function, on a site, or on the project as a whole, and your code would pick them up at build and runtime. The catch was that all of this lived inside the Appwrite Console. If you wanted to provision configuration as part of a script, rotate a secret across environments, or bootstrap a new project from a template, you had to click through the UI.
Today, we are announcing the Variables API, a unified set of endpoints for managing environment variables on functions, sites, and projects programmatically through the Appwrite Server SDKs.
This is part of a wider effort to make everything in Appwrite accessible through the API. Anything you can do in the Console should be doable from code, and variables are now a first-class part of that surface.
Why this matters
Configuration drift, manual secret rotation, and click-ops bootstrapping are some of the easiest ways to break a production environment. The Variables API removes them from the loop:
- Provision configuration as code as part of CI/CD, infrastructure scripts, or project templates.
- Rotate secrets across environments without opening the Console for each function, site, and project.
- Bootstrap new projects with the same baseline of variables every time.
- Build internal tooling that lets your team manage shared configuration in one place.
- Audit and reconcile what is set against what should be set, programmatically.
Three scopes, one API surface
The Variables API covers all three scopes Appwrite already supported in the Console:
- Function variables live on a single function and are set on the
Functionsservice. - Site variables live on a single site and are set on the
Sitesservice. - Project variables are shared across every function and site in the project and are set on the
Projectservice.
Each scope exposes the same five operations: create, list, get, update, and delete. At build and runtime, project variables load first, function or site variables override matching keys, and Appwrite-injected variables (those prefixed with APPWRITE_) take final precedence.
How it works
The relevant API key scopes are:
functions.read/functions.writefor function variablessites.read/sites.writefor site variablesproject.read/project.writefor project variables
Create a project variable
The new Project service exposes createVariable for shared configuration:
import { Client, Project, ID } from 'node-appwrite';
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your API key
const project = new Project(client);
const result = await project.createVariable({
variableId: ID.unique(),
key: 'STRIPE_KEY',
value: 'sk_live_...',
secret: true // optional
});
import { Client, Project, ID } from "npm:node-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your API key
const project = new Project(client);
const result = await project.createVariable({
variableId: ID.unique(),
key: 'STRIPE_KEY',
value: 'sk_live_...',
secret: true // optional
});
<?php
use Appwrite\Client;
use Appwrite\ID;
use Appwrite\Services\Project;
$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your API key
$project = new Project($client);
$result = $project->createVariable(
variableId: ID::unique(),
key: 'STRIPE_KEY',
value: 'sk_live_...',
secret: true // optional
);
from appwrite.client import Client
from appwrite.id import ID
from appwrite.services.project import Project
from appwrite.models import Variable
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your API key
project = Project(client)
result: Variable = project.create_variable(
variable_id = ID.unique(),
key = 'STRIPE_KEY',
value = 'sk_live_...',
secret = True # optional
)
print(result.model_dump())
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your API key
project = Project.new(client)
result = project.create_variable(
variable_id: ID.unique(),
key: 'STRIPE_KEY',
value: 'sk_live_...',
secret: true # optional
)
using Appwrite;
using Appwrite.Models;
using Appwrite.Services;
Client client = new Client()
.SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("<YOUR_PROJECT_ID>") // Your project ID
.SetKey("<YOUR_API_KEY>"); // Your API key
Project project = new Project(client);
Variable result = await project.CreateVariable(
variableId: ID.Unique(),
key: "STRIPE_KEY",
value: "sk_live_...",
secret: true // optional
);
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your API key
Project project = Project(client);
Variable result = await project.createVariable(
variableId: ID.unique(),
key: 'STRIPE_KEY',
value: 'sk_live_...',
secret: true, // (optional)
);
import io.appwrite.Client
import io.appwrite.ID
import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Project
val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>") // Your API key
val project = Project(client)
val response = project.createVariable(
variableId = ID.unique(),
key = "STRIPE_KEY",
value = "sk_live_...",
secret = true // optional
)
import io.appwrite.Client;
import io.appwrite.ID;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Project;
Client client = new Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>"); // Your API key
Project project = new Project(client);
project.createVariable(
ID.unique(), // variableId
"STRIPE_KEY", // key
"sk_live_...", // value
true, // secret (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}
System.out.println(result);
})
);
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>") // Your API key
let project = Project(client)
let variable = try await project.createVariable(
variableId: ID.unique(),
key: "STRIPE_KEY",
value: "sk_live_...",
secret: true // optional
)
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go/appwrite"
"github.com/appwrite/sdk-for-go/id"
)
client := appwrite.NewClient(
appwrite.WithEndpoint("https://<REGION>.cloud.appwrite.io/v1"),
appwrite.WithProject("<YOUR_PROJECT_ID>"),
appwrite.WithKey("<YOUR_API_KEY>"),
)
project := appwrite.NewProject(client)
response, error := project.CreateVariable(
id.Unique(),
"STRIPE_KEY",
"sk_live_...",
appwrite.WithCreateVariableSecret(true),
)
use appwrite::Client;
use appwrite::id::ID;
use appwrite::services::Project;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
client.set_endpoint("https://<REGION>.cloud.appwrite.io/v1"); // Your API Endpoint
client.set_project("<YOUR_PROJECT_ID>"); // Your project ID
client.set_key("<YOUR_API_KEY>"); // Your API key
let project = Project::new(&client);
let result = project.create_variable(
&ID::unique(),
"STRIPE_KEY",
"sk_live_...",
Some(true) // optional
).await?;
let _ = result;
Ok(())
}
Create a function variable
The same shape applies on the Functions service for variables scoped to a single function:
import { Client, Functions } from 'node-appwrite';
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your API key
const functions = new Functions(client);
const result = await functions.createVariable({
functionId: '<FUNCTION_ID>',
key: 'OPENAI_API_KEY',
value: 'sk-...',
secret: true // optional
});
import { Client, Functions } from "npm:node-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your API key
const functions = new Functions(client);
const result = await functions.createVariable({
functionId: '<FUNCTION_ID>',
key: 'OPENAI_API_KEY',
value: 'sk-...',
secret: true // optional
});
<?php
use Appwrite\Client;
use Appwrite\Services\Functions;
$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your API key
$functions = new Functions($client);
$result = $functions->createVariable(
functionId: '<FUNCTION_ID>',
key: 'OPENAI_API_KEY',
value: 'sk-...',
secret: true // optional
);
from appwrite.client import Client
from appwrite.services.functions import Functions
from appwrite.models import Variable
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your API key
functions = Functions(client)
result: Variable = functions.create_variable(
function_id = '<FUNCTION_ID>',
key = 'OPENAI_API_KEY',
value = 'sk-...',
secret = True # optional
)
print(result.model_dump())
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your API key
functions = Functions.new(client)
result = functions.create_variable(
function_id: '<FUNCTION_ID>',
key: 'OPENAI_API_KEY',
value: 'sk-...',
secret: true # optional
)
using Appwrite;
using Appwrite.Models;
using Appwrite.Services;
Client client = new Client()
.SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("<YOUR_PROJECT_ID>") // Your project ID
.SetKey("<YOUR_API_KEY>"); // Your API key
Functions functions = new Functions(client);
Variable result = await functions.CreateVariable(
functionId: "<FUNCTION_ID>",
key: "OPENAI_API_KEY",
value: "sk-...",
secret: true // optional
);
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your API key
Functions functions = Functions(client);
Variable result = await functions.createVariable(
functionId: '<FUNCTION_ID>',
key: 'OPENAI_API_KEY',
value: 'sk-...',
secret: true, // (optional)
);
import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Functions
val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>") // Your API key
val functions = Functions(client)
val response = functions.createVariable(
functionId = "<FUNCTION_ID>",
key = "OPENAI_API_KEY",
value = "sk-...",
secret = true // optional
)
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Functions;
Client client = new Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>"); // Your API key
Functions functions = new Functions(client);
functions.createVariable(
"<FUNCTION_ID>", // functionId
"OPENAI_API_KEY", // key
"sk-...", // value
true, // secret (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}
System.out.println(result);
})
);
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>") // Your API key
let functions = Functions(client)
let variable = try await functions.createVariable(
functionId: "<FUNCTION_ID>",
key: "OPENAI_API_KEY",
value: "sk-...",
secret: true // optional
)
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go/appwrite"
)
client := appwrite.NewClient(
appwrite.WithEndpoint("https://<REGION>.cloud.appwrite.io/v1"),
appwrite.WithProject("<YOUR_PROJECT_ID>"),
appwrite.WithKey("<YOUR_API_KEY>"),
)
functions := appwrite.NewFunctions(client)
response, error := functions.CreateVariable(
"<FUNCTION_ID>",
"OPENAI_API_KEY",
"sk-...",
appwrite.WithCreateVariableSecret(true),
)
use appwrite::Client;
use appwrite::services::Functions;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
client.set_endpoint("https://<REGION>.cloud.appwrite.io/v1"); // Your API Endpoint
client.set_project("<YOUR_PROJECT_ID>"); // Your project ID
client.set_key("<YOUR_API_KEY>"); // Your API key
let functions = Functions::new(&client);
let result = functions.create_variable(
"<FUNCTION_ID>",
"OPENAI_API_KEY",
"sk-...",
Some(true) // optional
).await?;
let _ = result;
Ok(())
}
Create a site variable
And on the Sites service for variables scoped to a single site:
import { Client, Sites } from 'node-appwrite';
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your API key
const sites = new Sites(client);
const result = await sites.createVariable({
siteId: '<SITE_ID>',
key: 'NEXT_PUBLIC_ANALYTICS_ID',
value: 'G-XXXXXXX',
secret: false // optional
});
import { Client, Sites } from "npm:node-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your API key
const sites = new Sites(client);
const result = await sites.createVariable({
siteId: '<SITE_ID>',
key: 'NEXT_PUBLIC_ANALYTICS_ID',
value: 'G-XXXXXXX',
secret: false // optional
});
<?php
use Appwrite\Client;
use Appwrite\Services\Sites;
$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your API key
$sites = new Sites($client);
$result = $sites->createVariable(
siteId: '<SITE_ID>',
key: 'NEXT_PUBLIC_ANALYTICS_ID',
value: 'G-XXXXXXX',
secret: false // optional
);
from appwrite.client import Client
from appwrite.services.sites import Sites
from appwrite.models import Variable
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your API key
sites = Sites(client)
result: Variable = sites.create_variable(
site_id = '<SITE_ID>',
key = 'NEXT_PUBLIC_ANALYTICS_ID',
value = 'G-XXXXXXX',
secret = False # optional
)
print(result.model_dump())
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your API key
sites = Sites.new(client)
result = sites.create_variable(
site_id: '<SITE_ID>',
key: 'NEXT_PUBLIC_ANALYTICS_ID',
value: 'G-XXXXXXX',
secret: false # optional
)
using Appwrite;
using Appwrite.Models;
using Appwrite.Services;
Client client = new Client()
.SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("<YOUR_PROJECT_ID>") // Your project ID
.SetKey("<YOUR_API_KEY>"); // Your API key
Sites sites = new Sites(client);
Variable result = await sites.CreateVariable(
siteId: "<SITE_ID>",
key: "NEXT_PUBLIC_ANALYTICS_ID",
value: "G-XXXXXXX",
secret: false // optional
);
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your API key
Sites sites = Sites(client);
Variable result = await sites.createVariable(
siteId: '<SITE_ID>',
key: 'NEXT_PUBLIC_ANALYTICS_ID',
value: 'G-XXXXXXX',
secret: false, // (optional)
);
import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Sites
val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>") // Your API key
val sites = Sites(client)
val response = sites.createVariable(
siteId = "<SITE_ID>",
key = "NEXT_PUBLIC_ANALYTICS_ID",
value = "G-XXXXXXX",
secret = false // optional
)
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Sites;
Client client = new Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>"); // Your API key
Sites sites = new Sites(client);
sites.createVariable(
"<SITE_ID>", // siteId
"NEXT_PUBLIC_ANALYTICS_ID", // key
"G-XXXXXXX", // value
false, // secret (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}
System.out.println(result);
})
);
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>") // Your API key
let sites = Sites(client)
let variable = try await sites.createVariable(
siteId: "<SITE_ID>",
key: "NEXT_PUBLIC_ANALYTICS_ID",
value: "G-XXXXXXX",
secret: false // optional
)
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go/appwrite"
)
client := appwrite.NewClient(
appwrite.WithEndpoint("https://<REGION>.cloud.appwrite.io/v1"),
appwrite.WithProject("<YOUR_PROJECT_ID>"),
appwrite.WithKey("<YOUR_API_KEY>"),
)
sites := appwrite.NewSites(client)
response, error := sites.CreateVariable(
"<SITE_ID>",
"NEXT_PUBLIC_ANALYTICS_ID",
"G-XXXXXXX",
appwrite.WithCreateVariableSecret(false),
)
use appwrite::Client;
use appwrite::services::Sites;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
client.set_endpoint("https://<REGION>.cloud.appwrite.io/v1"); // Your API Endpoint
client.set_project("<YOUR_PROJECT_ID>"); // Your project ID
client.set_key("<YOUR_API_KEY>"); // Your API key
let sites = Sites::new(&client);
let result = sites.create_variable(
"<SITE_ID>",
"NEXT_PUBLIC_ANALYTICS_ID",
"G-XXXXXXX",
Some(false) // optional
).await?;
let _ = result;
Ok(())
}
Update a project variable
updateVariable exists on all three services with the same shape. Updating a variable lets you rotate a value or change its secret flag without recreating it. Marking a variable as secret cannot be reversed. To replace a secret value, delete the variable and create a new one with the same key.
import { Client, Project } from 'node-appwrite';
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your API key
const project = new Project(client);
const result = await project.updateVariable({
variableId: '<VARIABLE_ID>',
key: 'STRIPE_KEY', // optional
value: 'sk_live_rotated_...', // optional
secret: false // optional
});
import { Client, Project } from "npm:node-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your API key
const project = new Project(client);
const result = await project.updateVariable({
variableId: '<VARIABLE_ID>',
key: 'STRIPE_KEY', // optional
value: 'sk_live_rotated_...', // optional
secret: false // optional
});
<?php
use Appwrite\Client;
use Appwrite\Services\Project;
$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your API key
$project = new Project($client);
$result = $project->updateVariable(
variableId: '<VARIABLE_ID>',
key: 'STRIPE_KEY', // optional
value: 'sk_live_rotated_...', // optional
secret: false // optional
);
from appwrite.client import Client
from appwrite.services.project import Project
from appwrite.models import Variable
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your API key
project = Project(client)
result: Variable = project.update_variable(
variable_id = '<VARIABLE_ID>',
key = 'STRIPE_KEY', # optional
value = 'sk_live_rotated_...', # optional
secret = False # optional
)
print(result.model_dump())
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your API key
project = Project.new(client)
result = project.update_variable(
variable_id: '<VARIABLE_ID>',
key: 'STRIPE_KEY', # optional
value: 'sk_live_rotated_...', # optional
secret: false # optional
)
using Appwrite;
using Appwrite.Models;
using Appwrite.Services;
Client client = new Client()
.SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("<YOUR_PROJECT_ID>") // Your project ID
.SetKey("<YOUR_API_KEY>"); // Your API key
Project project = new Project(client);
Variable result = await project.UpdateVariable(
variableId: "<VARIABLE_ID>",
key: "STRIPE_KEY", // optional
value: "sk_live_rotated_...", // optional
secret: false // optional
);
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your API key
Project project = Project(client);
Variable result = await project.updateVariable(
variableId: '<VARIABLE_ID>',
key: 'STRIPE_KEY', // (optional)
value: 'sk_live_rotated_...', // (optional)
secret: false, // (optional)
);
import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Project
val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>") // Your API key
val project = Project(client)
val response = project.updateVariable(
variableId = "<VARIABLE_ID>",
key = "STRIPE_KEY", // optional
value = "sk_live_rotated_...", // optional
secret = false // optional
)
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Project;
Client client = new Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>"); // Your API key
Project project = new Project(client);
project.updateVariable(
"<VARIABLE_ID>", // variableId
"STRIPE_KEY", // key (optional)
"sk_live_rotated_...", // value (optional)
false, // secret (optional)
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}
System.out.println(result);
})
);
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>") // Your API key
let project = Project(client)
let variable = try await project.updateVariable(
variableId: "<VARIABLE_ID>",
key: "STRIPE_KEY", // optional
value: "sk_live_rotated_...", // optional
secret: false // optional
)
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go/appwrite"
)
client := appwrite.NewClient(
appwrite.WithEndpoint("https://<REGION>.cloud.appwrite.io/v1"),
appwrite.WithProject("<YOUR_PROJECT_ID>"),
appwrite.WithKey("<YOUR_API_KEY>"),
)
project := appwrite.NewProject(client)
response, error := project.UpdateVariable(
"<VARIABLE_ID>",
appwrite.WithUpdateVariableKey("STRIPE_KEY"),
appwrite.WithUpdateVariableValue("sk_live_rotated_..."),
appwrite.WithUpdateVariableSecret(false),
)
use appwrite::Client;
use appwrite::services::Project;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
client.set_endpoint("https://<REGION>.cloud.appwrite.io/v1"); // Your API Endpoint
client.set_project("<YOUR_PROJECT_ID>"); // Your project ID
client.set_key("<YOUR_API_KEY>"); // Your API key
let project = Project::new(&client);
let result = project.update_variable(
"<VARIABLE_ID>",
Some("STRIPE_KEY"), // optional
Some("sk_live_rotated_..."), // optional
Some(false) // optional
).await?;
let _ = result;
Ok(())
}
Delete a project variable
deleteVariable is available on each service. Once deleted, the variable stops appearing in subsequent function and site deployments.
import { Client, Project } from 'node-appwrite';
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your API key
const project = new Project(client);
const result = await project.deleteVariable({
variableId: '<VARIABLE_ID>'
});
import { Client, Project } from "npm:node-appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your API key
const project = new Project(client);
const result = await project.deleteVariable({
variableId: '<VARIABLE_ID>'
});
<?php
use Appwrite\Client;
use Appwrite\Services\Project;
$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your API key
$project = new Project($client);
$result = $project->deleteVariable(
variableId: '<VARIABLE_ID>'
);
from appwrite.client import Client
from appwrite.services.project import Project
client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your API key
project = Project(client)
result = project.delete_variable(
variable_id = '<VARIABLE_ID>'
)
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your API key
project = Project.new(client)
result = project.delete_variable(
variable_id: '<VARIABLE_ID>'
)
using Appwrite;
using Appwrite.Models;
using Appwrite.Services;
Client client = new Client()
.SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("<YOUR_PROJECT_ID>") // Your project ID
.SetKey("<YOUR_API_KEY>"); // Your API key
Project project = new Project(client);
await project.DeleteVariable(
variableId: "<VARIABLE_ID>"
);
import 'package:dart_appwrite/dart_appwrite.dart';
Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your API key
Project project = Project(client);
await project.deleteVariable(
variableId: '<VARIABLE_ID>',
);
import io.appwrite.Client
import io.appwrite.coroutines.CoroutineCallback
import io.appwrite.services.Project
val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>") // Your API key
val project = Project(client)
val response = project.deleteVariable(
variableId = "<VARIABLE_ID>"
)
import io.appwrite.Client;
import io.appwrite.coroutines.CoroutineCallback;
import io.appwrite.services.Project;
Client client = new Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>"); // Your API key
Project project = new Project(client);
project.deleteVariable(
"<VARIABLE_ID>", // variableId
new CoroutineCallback<>((result, error) -> {
if (error != null) {
error.printStackTrace();
return;
}
System.out.println(result);
})
);
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("<YOUR_PROJECT_ID>") // Your project ID
.setKey("<YOUR_API_KEY>") // Your API key
let project = Project(client)
let result = try await project.deleteVariable(
variableId: "<VARIABLE_ID>"
)
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go/appwrite"
)
client := appwrite.NewClient(
appwrite.WithEndpoint("https://<REGION>.cloud.appwrite.io/v1"),
appwrite.WithProject("<YOUR_PROJECT_ID>"),
appwrite.WithKey("<YOUR_API_KEY>"),
)
project := appwrite.NewProject(client)
response, error := project.DeleteVariable(
"<VARIABLE_ID>",
)
use appwrite::Client;
use appwrite::services::Project;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
client.set_endpoint("https://<REGION>.cloud.appwrite.io/v1"); // Your API Endpoint
client.set_project("<YOUR_PROJECT_ID>"); // Your project ID
client.set_key("<YOUR_API_KEY>"); // Your API key
let project = Project::new(&client);
project.delete_variable(
"<VARIABLE_ID>"
).await?;
Ok(())
}
Get started
The Variables API is available on Appwrite Cloud today, across every Appwrite Server SDK. Complete code examples for every supported language and every operation live in the documentation:





