Mist apps
Add a user-managed env var
Adds an environment variable to the Mist’s deployment project. It
applies to all three targets (production, preview, and
development) unless you pass targets. The value takes effect on
the next deployment.
Returns 422 with error.details.type of managed_var if key
is a Mist-managed variable, such as DATABASE_URL or one of the
FLUID_* connection variables. Returns 409 while the Mist is
pending_destroy.
Requires a company admin token with the mist.env_vars permission.
POST
/
api
/
v202604
/
mists
/
{mist_id}
/
env_vars
Add a user-managed env var
curl --request POST \
--url https://api.fluid.app/api/v202604/mists/{mist_id}/env_vars \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"env_var": {
"key": "REWARDS_POINTS_PER_DOLLAR",
"value": "10",
"targets": [
"production",
"preview"
]
}
}
'import requests
url = "https://api.fluid.app/api/v202604/mists/{mist_id}/env_vars"
payload = { "env_var": {
"key": "REWARDS_POINTS_PER_DOLLAR",
"value": "10",
"targets": ["production", "preview"]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
env_var: {
key: 'REWARDS_POINTS_PER_DOLLAR',
value: '10',
targets: ['production', 'preview']
}
})
};
fetch('https://api.fluid.app/api/v202604/mists/{mist_id}/env_vars', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fluid.app/api/v202604/mists/{mist_id}/env_vars",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'env_var' => [
'key' => 'REWARDS_POINTS_PER_DOLLAR',
'value' => '10',
'targets' => [
'production',
'preview'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fluid.app/api/v202604/mists/{mist_id}/env_vars"
payload := strings.NewReader("{\n \"env_var\": {\n \"key\": \"REWARDS_POINTS_PER_DOLLAR\",\n \"value\": \"10\",\n \"targets\": [\n \"production\",\n \"preview\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.fluid.app/api/v202604/mists/{mist_id}/env_vars")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"env_var\": {\n \"key\": \"REWARDS_POINTS_PER_DOLLAR\",\n \"value\": \"10\",\n \"targets\": [\n \"production\",\n \"preview\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/v202604/mists/{mist_id}/env_vars")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"env_var\": {\n \"key\": \"REWARDS_POINTS_PER_DOLLAR\",\n \"value\": \"10\",\n \"targets\": [\n \"production\",\n \"preview\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"env_var": {
"key": "REWARDS_POINTS_PER_DOLLAR",
"value": "10",
"targets": [
"production",
"preview"
],
"managed_by": "user",
"pull_to_local": true
},
"status": 201,
"meta": {
"request_id": "6f1c2a9e-4b7d-4e8a-9c3f-2d5b8a1e7f40",
"timestamp": "2026-04-20T09:15:02Z"
}
}{
"error": {
"message": "<string>",
"details": {}
},
"status": 123,
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error": {
"message": "<string>",
"details": {}
},
"status": 123,
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}Authorizations
Bearer token authentication. Accepts company admin tokens with
the matching mist.* permission:
mist.viewto list and show Mistsmist.createto create and rename Mistsmist.destroyto delete and restore Mistsmist.codefor deployments and logsmist.env_varsto read and manage environment variables Droplet installation tokens are refused.
Path Parameters
UUID of the company-owned Mist app.
Body
application/json
Show child attributes
Show child attributes
Response
Env var added
Show child attributes
Show child attributes
⌘I
Add a user-managed env var
curl --request POST \
--url https://api.fluid.app/api/v202604/mists/{mist_id}/env_vars \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"env_var": {
"key": "REWARDS_POINTS_PER_DOLLAR",
"value": "10",
"targets": [
"production",
"preview"
]
}
}
'import requests
url = "https://api.fluid.app/api/v202604/mists/{mist_id}/env_vars"
payload = { "env_var": {
"key": "REWARDS_POINTS_PER_DOLLAR",
"value": "10",
"targets": ["production", "preview"]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
env_var: {
key: 'REWARDS_POINTS_PER_DOLLAR',
value: '10',
targets: ['production', 'preview']
}
})
};
fetch('https://api.fluid.app/api/v202604/mists/{mist_id}/env_vars', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fluid.app/api/v202604/mists/{mist_id}/env_vars",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'env_var' => [
'key' => 'REWARDS_POINTS_PER_DOLLAR',
'value' => '10',
'targets' => [
'production',
'preview'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fluid.app/api/v202604/mists/{mist_id}/env_vars"
payload := strings.NewReader("{\n \"env_var\": {\n \"key\": \"REWARDS_POINTS_PER_DOLLAR\",\n \"value\": \"10\",\n \"targets\": [\n \"production\",\n \"preview\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.fluid.app/api/v202604/mists/{mist_id}/env_vars")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"env_var\": {\n \"key\": \"REWARDS_POINTS_PER_DOLLAR\",\n \"value\": \"10\",\n \"targets\": [\n \"production\",\n \"preview\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/v202604/mists/{mist_id}/env_vars")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"env_var\": {\n \"key\": \"REWARDS_POINTS_PER_DOLLAR\",\n \"value\": \"10\",\n \"targets\": [\n \"production\",\n \"preview\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"env_var": {
"key": "REWARDS_POINTS_PER_DOLLAR",
"value": "10",
"targets": [
"production",
"preview"
],
"managed_by": "user",
"pull_to_local": true
},
"status": 201,
"meta": {
"request_id": "6f1c2a9e-4b7d-4e8a-9c3f-2d5b8a1e7f40",
"timestamp": "2026-04-20T09:15:02Z"
}
}{
"error": {
"message": "<string>",
"details": {}
},
"status": 123,
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error": {
"message": "<string>",
"details": {}
},
"status": 123,
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}