Deployments
List deployments
List all deployments in the organization.
GET
/
v1
/
deployments
Python
import os
import requests
response = requests.get(
"https://api.modular.com/v1/deployments",
headers={"Authorization": f"Bearer {os.environ['MODULAR_API_KEY']}"},
params={"status": "running"},
)
deployments = response.json()
for d in deployments["items"]:
print(d["name"], d["status"])curl https://api.modular.com/v1/deployments \
-H "Authorization: Bearer $MODULAR_API_KEY"const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.modular.com/v1/deployments', 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.modular.com/v1/deployments",
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.modular.com/v1/deployments"
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.modular.com/v1/deployments")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.modular.com/v1/deployments")
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{
"items": [
{
"name": "<string>",
"deployment_id": "<string>",
"model_id": "<string>",
"scaling": {
"min_replicas": 123,
"max_replicas": 123,
"behavior": {
"scale_up": {
"stabilization_window_seconds": 123
},
"scale_down": {
"stabilization_window_seconds": 123
}
}
},
"configuration": {
"model_path": "<string>",
"engine": "max",
"mode": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"display_name": "<string>",
"endpoint_url": "<string>",
"region_group": "<string>",
"replicas": {
"current": 123,
"desired": 123
}
}
],
"total": 123
}Authorizations
Modular Cloud API token. Obtain from the API Tokens page.
Query Parameters
Filter by deployment status. Current lifecycle status of a deployment.
Available options:
unknown, non-deployed, deploying, running, unhealthy, failed, updating, scaling, terminating, terminated, image-building, image-build-failed, model-seed-failed, image-build-succeeded, scaled-to-zero, scaling-up, scaling-down Filter by model identifier.
Sort field (e.g. -created_at for descending creation time).
Was this page helpful?
Previous
Get deploymentGet details for a single deployment, including current status and endpoint URL.
Next
⌘I
Python
import os
import requests
response = requests.get(
"https://api.modular.com/v1/deployments",
headers={"Authorization": f"Bearer {os.environ['MODULAR_API_KEY']}"},
params={"status": "running"},
)
deployments = response.json()
for d in deployments["items"]:
print(d["name"], d["status"])curl https://api.modular.com/v1/deployments \
-H "Authorization: Bearer $MODULAR_API_KEY"const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.modular.com/v1/deployments', 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.modular.com/v1/deployments",
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.modular.com/v1/deployments"
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.modular.com/v1/deployments")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.modular.com/v1/deployments")
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{
"items": [
{
"name": "<string>",
"deployment_id": "<string>",
"model_id": "<string>",
"scaling": {
"min_replicas": 123,
"max_replicas": 123,
"behavior": {
"scale_up": {
"stabilization_window_seconds": 123
},
"scale_down": {
"stabilization_window_seconds": 123
}
}
},
"configuration": {
"model_path": "<string>",
"engine": "max",
"mode": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"display_name": "<string>",
"endpoint_url": "<string>",
"region_group": "<string>",
"replicas": {
"current": 123,
"desired": 123
}
}
],
"total": 123
}