Environments
Update Chain environment
Updates a chain environment’s settings and returns the chain environment.
PATCH
/
v1
/
chains
/
{chain_id}
/
environments
/
{env_name}
cURL
curl --request PATCH \
--url https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name} \
--header "Authorization: Bearer $BASETEN_API_KEY" \
--data '{
"promotion_settings": {
"promotion_cleanup_strategy": null,
"ramp_up_duration_seconds": 600,
"ramp_up_while_promoting": true,
"redeploy_on_promotion": null,
"rolling_deploy": null,
"rolling_deploy_config": null
}
}'import requests
import os
API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
url = "https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}"
headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.request(
"PATCH",
url,
headers=headers,
json={'promotion_settings': {'promotion_cleanup_strategy': None, 'ramp_up_duration_seconds': 600, 'ramp_up_while_promoting': True, 'redeploy_on_promotion': None, 'rolling_deploy': None, 'rolling_deploy_config': None}}
)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
promotion_settings: {
promotion_cleanup_strategy: null,
ramp_up_duration_seconds: 600,
ramp_up_while_promoting: true,
redeploy_on_promotion: null,
rolling_deploy: null,
rolling_deploy_config: null
}
})
};
fetch('https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}', 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.baseten.co/v1/chains/{chain_id}/environments/{env_name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'promotion_settings' => [
'promotion_cleanup_strategy' => null,
'ramp_up_duration_seconds' => 600,
'ramp_up_while_promoting' => true,
'redeploy_on_promotion' => null,
'rolling_deploy' => null,
'rolling_deploy_config' => null
]
]),
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.baseten.co/v1/chains/{chain_id}/environments/{env_name}"
payload := strings.NewReader("{\n \"promotion_settings\": {\n \"promotion_cleanup_strategy\": null,\n \"ramp_up_duration_seconds\": 600,\n \"ramp_up_while_promoting\": true,\n \"redeploy_on_promotion\": null,\n \"rolling_deploy\": null,\n \"rolling_deploy_config\": null\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"promotion_settings\": {\n \"promotion_cleanup_strategy\": null,\n \"ramp_up_duration_seconds\": 600,\n \"ramp_up_while_promoting\": true,\n \"redeploy_on_promotion\": null,\n \"rolling_deploy\": null,\n \"rolling_deploy_config\": null\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"promotion_settings\": {\n \"promotion_cleanup_strategy\": null,\n \"ramp_up_duration_seconds\": 600,\n \"ramp_up_while_promoting\": true,\n \"redeploy_on_promotion\": null,\n \"rolling_deploy\": null,\n \"rolling_deploy_config\": null\n }\n}"
response = http.request(request)
puts response.read_body{
"ok": true
}Authorizations
Send Authorization: Bearer <api_key>. The legacy Authorization: Api-Key <api_key> scheme is also accepted.
Body
application/json
A request to update a chain environment.
Promotion settings for the environment
Show child attributes
Show child attributes
Example:
{
"promotion_cleanup_strategy": null,
"ramp_up_duration_seconds": 600,
"ramp_up_while_promoting": true,
"redeploy_on_promotion": null,
"rolling_deploy": null,
"rolling_deploy_config": null
}
Response
200 - application/json
A response to update a chain environment.
Whether the update was successful
Was this page helpful?
Previous
Chainlet environmentUpdates a chainlet environment's autoscaling settings and returns the updated chainlet environment settings.
Next
⌘I
cURL
curl --request PATCH \
--url https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name} \
--header "Authorization: Bearer $BASETEN_API_KEY" \
--data '{
"promotion_settings": {
"promotion_cleanup_strategy": null,
"ramp_up_duration_seconds": 600,
"ramp_up_while_promoting": true,
"redeploy_on_promotion": null,
"rolling_deploy": null,
"rolling_deploy_config": null
}
}'import requests
import os
API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
url = "https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}"
headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.request(
"PATCH",
url,
headers=headers,
json={'promotion_settings': {'promotion_cleanup_strategy': None, 'ramp_up_duration_seconds': 600, 'ramp_up_while_promoting': True, 'redeploy_on_promotion': None, 'rolling_deploy': None, 'rolling_deploy_config': None}}
)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
promotion_settings: {
promotion_cleanup_strategy: null,
ramp_up_duration_seconds: 600,
ramp_up_while_promoting: true,
redeploy_on_promotion: null,
rolling_deploy: null,
rolling_deploy_config: null
}
})
};
fetch('https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}', 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.baseten.co/v1/chains/{chain_id}/environments/{env_name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'promotion_settings' => [
'promotion_cleanup_strategy' => null,
'ramp_up_duration_seconds' => 600,
'ramp_up_while_promoting' => true,
'redeploy_on_promotion' => null,
'rolling_deploy' => null,
'rolling_deploy_config' => null
]
]),
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.baseten.co/v1/chains/{chain_id}/environments/{env_name}"
payload := strings.NewReader("{\n \"promotion_settings\": {\n \"promotion_cleanup_strategy\": null,\n \"ramp_up_duration_seconds\": 600,\n \"ramp_up_while_promoting\": true,\n \"redeploy_on_promotion\": null,\n \"rolling_deploy\": null,\n \"rolling_deploy_config\": null\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"promotion_settings\": {\n \"promotion_cleanup_strategy\": null,\n \"ramp_up_duration_seconds\": 600,\n \"ramp_up_while_promoting\": true,\n \"redeploy_on_promotion\": null,\n \"rolling_deploy\": null,\n \"rolling_deploy_config\": null\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"promotion_settings\": {\n \"promotion_cleanup_strategy\": null,\n \"ramp_up_duration_seconds\": 600,\n \"ramp_up_while_promoting\": true,\n \"redeploy_on_promotion\": null,\n \"rolling_deploy\": null,\n \"rolling_deploy_config\": null\n }\n}"
response = http.request(request)
puts response.read_body{
"ok": true
}