Environments
Get Chain environment
Gets a chain environment’s details and returns the chain environment.
GET
/
v1
/
chains
/
{chain_id}
/
environments
/
{env_name}
cURL
curl --request GET \
--url https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name} \
--header "Authorization: Bearer $BASETEN_API_KEY"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(
"GET",
url,
headers=headers,
json={}
)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
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 => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}")
.header("Authorization", "Bearer <token>")
.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::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"chain_id": "<string>",
"promotion_settings": {
"redeploy_on_promotion": true,
"rolling_deploy": true,
"promotion_cleanup_strategy": "SCALE_TO_ZERO",
"rolling_deploy_config": {
"rolling_deploy_strategy": "REPLICA",
"max_surge_percent": 25,
"max_unavailable_percent": 0,
"stabilization_time_seconds": 0,
"replica_overhead_percent": 0
},
"ramp_up_while_promoting": true,
"ramp_up_duration_seconds": 600
},
"chainlet_settings": [
{
"chainlet_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": {
"id": "<string>",
"name": "<string>",
"memory_limit_mib": 123,
"millicpu_limit": 123,
"gpu_count": 123,
"gpu_type": "<string>",
"gpu_memory_limit_mib": 123
}
}
],
"current_deployment": {
"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
}
]
},
"candidate_deployment": {
"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
}
]
}
}Authorizations
Send Authorization: Bearer <api_key>. The legacy Authorization: Api-Key <api_key> scheme is also accepted.
Response
200 - application/json
Environment for oracles.
Name of the environment
Time the environment was created in ISO 8601 format
Unique identifier of the chain
Promotion settings for the environment
Show child attributes
Show child attributes
Environment settings for the chainlets
Show child attributes
Show child attributes
Current chain deployment of the environment
Show child attributes
Show child attributes
Candidate chain deployment being promoted to the environment, if a promotion is in progress
Show child attributes
Show child attributes
Was this page helpful?
Previous
Update Chain environmentUpdates a chain environment's settings and returns the chain environment.
Next
⌘I
cURL
curl --request GET \
--url https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name} \
--header "Authorization: Bearer $BASETEN_API_KEY"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(
"GET",
url,
headers=headers,
json={}
)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
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 => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.baseten.co/v1/chains/{chain_id}/environments/{env_name}")
.header("Authorization", "Bearer <token>")
.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::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"chain_id": "<string>",
"promotion_settings": {
"redeploy_on_promotion": true,
"rolling_deploy": true,
"promotion_cleanup_strategy": "SCALE_TO_ZERO",
"rolling_deploy_config": {
"rolling_deploy_strategy": "REPLICA",
"max_surge_percent": 25,
"max_unavailable_percent": 0,
"stabilization_time_seconds": 0,
"replica_overhead_percent": 0
},
"ramp_up_while_promoting": true,
"ramp_up_duration_seconds": 600
},
"chainlet_settings": [
{
"chainlet_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": {
"id": "<string>",
"name": "<string>",
"memory_limit_mib": 123,
"millicpu_limit": 123,
"gpu_count": 123,
"gpu_type": "<string>",
"gpu_memory_limit_mib": 123
}
}
],
"current_deployment": {
"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
}
]
},
"candidate_deployment": {
"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
}
]
}
}