Set service always on
curl --request PUT \
--url https://api.instacloud.com/projects/{projectId}/services/{serviceId}/always-on \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true
}
'import requests
url = "https://api.instacloud.com/projects/{projectId}/services/{serviceId}/always-on"
payload = { "enabled": True }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({enabled: true})
};
fetch('https://api.instacloud.com/projects/{projectId}/services/{serviceId}/always-on', 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.instacloud.com/projects/{projectId}/services/{serviceId}/always-on",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => 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.instacloud.com/projects/{projectId}/services/{serviceId}/always-on"
payload := strings.NewReader("{\n \"enabled\": true\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.instacloud.com/projects/{projectId}/services/{serviceId}/always-on")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.instacloud.com/projects/{projectId}/services/{serviceId}/always-on")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"service": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "postgres",
"name": "<string>",
"spec": {},
"machine_count": 123,
"desired_state": "running",
"always_on": true,
"websocket": true,
"region": "<string>",
"domain": "<string>",
"public": true,
"image": "<string>",
"port": 123,
"start_command": "<string>",
"volume_applied_mount_path": "<string>",
"volume_mount_path": "<string>",
"volume_gib": 123,
"pg_version": 123,
"template_deployment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"template_modified": true,
"template_code": "<string>",
"template_logo_url": "<string>",
"source": {
"type": "image",
"owner": "<string>",
"repo": "<string>",
"branch": "<string>",
"auto_deploy": true
},
"status": "creating",
"created_at": "2023-11-07T05:31:56Z"
}
}{
"status": "<string>",
"approvalId": "<string>",
"action": "<string>",
"actions": [
"<string>"
],
"message": "<string>",
"url": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Services
Set service always on
Token scope: account · org · project — read-only tokens refused (not a GET).
Set a compute or managed-database service always-on (never scale to zero, the platform default for new compute services) or scale-to-zero. All plans; billing is actual usage either way.
PUT
/
projects
/
{projectId}
/
services
/
{serviceId}
/
always-on
Set service always on
curl --request PUT \
--url https://api.instacloud.com/projects/{projectId}/services/{serviceId}/always-on \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true
}
'import requests
url = "https://api.instacloud.com/projects/{projectId}/services/{serviceId}/always-on"
payload = { "enabled": True }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({enabled: true})
};
fetch('https://api.instacloud.com/projects/{projectId}/services/{serviceId}/always-on', 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.instacloud.com/projects/{projectId}/services/{serviceId}/always-on",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => 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.instacloud.com/projects/{projectId}/services/{serviceId}/always-on"
payload := strings.NewReader("{\n \"enabled\": true\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.instacloud.com/projects/{projectId}/services/{serviceId}/always-on")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.instacloud.com/projects/{projectId}/services/{serviceId}/always-on")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"service": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "postgres",
"name": "<string>",
"spec": {},
"machine_count": 123,
"desired_state": "running",
"always_on": true,
"websocket": true,
"region": "<string>",
"domain": "<string>",
"public": true,
"image": "<string>",
"port": 123,
"start_command": "<string>",
"volume_applied_mount_path": "<string>",
"volume_mount_path": "<string>",
"volume_gib": 123,
"pg_version": 123,
"template_deployment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"template_modified": true,
"template_code": "<string>",
"template_logo_url": "<string>",
"source": {
"type": "image",
"owner": "<string>",
"repo": "<string>",
"branch": "<string>",
"auto_deploy": true
},
"status": "creating",
"created_at": "2023-11-07T05:31:56Z"
}
}{
"status": "<string>",
"approvalId": "<string>",
"action": "<string>",
"actions": [
"<string>"
],
"message": "<string>",
"url": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Session access JWT or an API token (insta_<prefix>_<secret>).
Body
application/json
true = machines never autostop (the default for new compute services); false = idle machines suspend and wake on request
Response
Default Response
A project-level service (postgres | storage | compute | redis | mysql | mongodb).
Show child attributes
Show child attributes