Env vars
Update
Partial update of an agent's environment variable.
Partial update. Send only the field(s) you want to change.
PATCH /api/public/v1/agents/{agent_id}/env-vars/{env_var_id}{agent_id} accepts either the ULID (cci_...) or the human-readable slug (the agent's agent_id field).
Request body
Prop
Type
Example
curl -X PATCH https://api.nairi.ai/api/public/v1/agents/AGENT_ID/env-vars/ENV_VAR_ID \
-H "Authorization: Bearer $NAIRI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"value": "staging"
}'const res = await fetch(
`https://api.nairi.ai/api/public/v1/agents/${agentId}/env-vars/${envVarId}`,
{
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.NAIRI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ value: "staging" }),
},
);
const data = await res.json();require "net/http"
require "json"
require "uri"
uri = URI("https://api.nairi.ai/api/public/v1/agents/#{agent_id}/env-vars/#{env_var_id}")
req = Net::HTTP::Patch.new(uri)
req["Authorization"] = "Bearer #{ENV['NAIRI_API_KEY']}"
req["Content-Type"] = "application/json"
req.body = { value: "staging" }.to_json
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
data = JSON.parse(res.body)import os
import requests
res = requests.patch(
f"https://api.nairi.ai/api/public/v1/agents/{agent_id}/env-vars/{env_var_id}",
headers={
"Authorization": f"Bearer {os.environ['NAIRI_API_KEY']}",
"Content-Type": "application/json",
},
json={"value": "staging"},
)
data = res.json()package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
)
func main() {
agentID := os.Getenv("AGENT_ID")
envVarID := os.Getenv("ENV_VAR_ID")
body, _ := json.Marshal(map[string]any{"value": "staging"})
req, _ := http.NewRequest(
"PATCH",
"https://api.nairi.ai/api/public/v1/agents/"+agentID+"/env-vars/"+envVarID,
bytes.NewReader(body),
)
req.Header.Set("Authorization", "Bearer "+os.Getenv("NAIRI_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
raw, _ := io.ReadAll(res.Body)
var data map[string]any
json.Unmarshal(raw, &data)
fmt.Println(data)
}Response
{
"id": "cev_01KHGX61ZCCN8M1SG0VMSGRAAB",
"container_id": "cci_01KEQ6963XS96YDP3NF9NKB7QJ",
"key": "NODE_ENV",
"value": "staging",
"created_at": "2026-02-15T15:02:26.000Z",
"updated_at": "2026-04-12T19:00:00.000Z"
}