Promote
Promote to chain environment
Promotes an existing chain deployment to an environment and returns the promoted chain deployment.
POST
/
v1
/
chains
/
{chain_id}
/
environments
/
{env_name}
/
promote
cURL
curl --request POST \
--url https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/promote \
--header "Authorization: Bearer $BASETEN_API_KEY" \
--data '{
"scale_down_previous_deployment": true,
"deployment_id": 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}/promote"
headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.request(
"POST",
url,
headers=headers,
json={'scale_down_previous_deployment': True, 'deployment_id': None}
)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({deployment_id: '<string>', scale_down_previous_deployment: true})
};
fetch('https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/promote', 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}/promote",
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([
'deployment_id' => '<string>',
'scale_down_previous_deployment' => true
]),
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}/promote"
payload := strings.NewReader("{\n \"deployment_id\": \"<string>\",\n \"scale_down_previous_deployment\": true\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.baseten.co/v1/chains/{chain_id}/environments/{env_name}/promote")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"deployment_id\": \"<string>\",\n \"scale_down_previous_deployment\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/promote")
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 \"deployment_id\": \"<string>\",\n \"scale_down_previous_deployment\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"chain_id": "<string>",
"environment": "<string>",
"chainlets": [
{
"id": "<string>",
"name": "<string>",
"autoscaling_settings": {
"min_replica": 123,
"max_replica": 123,
"autoscaling_window": 123,
"scale_down_delay": 123,
"concurrency_target": 123,
"target_utilization_percentage": 123,
"target_in_flight_tokens": 123,
"max_scale_down_rate": 123
},
"instance_type_name": "<string>",
"active_replica_count": 123,
"status": "BUILDING"
}
],
"status": "BUILDING"
}Authorizations
Body
application/json
Response
200 - application/json
A deployment of a chain.
Was this page helpful?
⌘I
cURL
curl --request POST \
--url https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/promote \
--header "Authorization: Bearer $BASETEN_API_KEY" \
--data '{
"scale_down_previous_deployment": true,
"deployment_id": 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}/promote"
headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.request(
"POST",
url,
headers=headers,
json={'scale_down_previous_deployment': True, 'deployment_id': None}
)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({deployment_id: '<string>', scale_down_previous_deployment: true})
};
fetch('https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/promote', 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}/promote",
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([
'deployment_id' => '<string>',
'scale_down_previous_deployment' => true
]),
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}/promote"
payload := strings.NewReader("{\n \"deployment_id\": \"<string>\",\n \"scale_down_previous_deployment\": true\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.baseten.co/v1/chains/{chain_id}/environments/{env_name}/promote")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"deployment_id\": \"<string>\",\n \"scale_down_previous_deployment\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}/promote")
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 \"deployment_id\": \"<string>\",\n \"scale_down_previous_deployment\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"chain_id": "<string>",
"environment": "<string>",
"chainlets": [
{
"id": "<string>",
"name": "<string>",
"autoscaling_settings": {
"min_replica": 123,
"max_replica": 123,
"autoscaling_window": 123,
"scale_down_delay": 123,
"concurrency_target": 123,
"target_utilization_percentage": 123,
"target_in_flight_tokens": 123,
"max_scale_down_rate": 123
},
"instance_type_name": "<string>",
"active_replica_count": 123,
"status": "BUILDING"
}
],
"status": "BUILDING"
}