Change auto stop
Change a starting or running instance’s max runtime or idle stop. A key left out keeps its value; null turns it off. Max runtime counts from when the instance started running, and a change never stops it sooner than 2 minutes from now. id may be the instance id or its name if unique in the environment.
PATCH
/
instances
/
{id}
Change auto stop
curl --request PATCH \
--url https://www.runcrate.ai/api/v1/instances/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"max_runtime_minutes": 5042,
"idle_shutdown_minutes": 722
}
'import requests
url = "https://www.runcrate.ai/api/v1/instances/{id}"
payload = {
"max_runtime_minutes": 5042,
"idle_shutdown_minutes": 722
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({max_runtime_minutes: 5042, idle_shutdown_minutes: 722})
};
fetch('https://www.runcrate.ai/api/v1/instances/{id}', 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://www.runcrate.ai/api/v1/instances/{id}",
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([
'max_runtime_minutes' => 5042,
'idle_shutdown_minutes' => 722
]),
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://www.runcrate.ai/api/v1/instances/{id}"
payload := strings.NewReader("{\n \"max_runtime_minutes\": 5042,\n \"idle_shutdown_minutes\": 722\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://www.runcrate.ai/api/v1/instances/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"max_runtime_minutes\": 5042,\n \"idle_shutdown_minutes\": 722\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.runcrate.ai/api/v1/instances/{id}")
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 \"max_runtime_minutes\": 5042,\n \"idle_shutdown_minutes\": 722\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"status": "running",
"gpu_type": "<string>",
"gpu_count": 123,
"cpu_cores": 123,
"memory": 123,
"storage": 123,
"region": "<string>",
"ip": "<string>",
"os_image": "<string>",
"cost_per_hour": 123,
"deployed_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"max_runtime_minutes": 123,
"idle_shutdown_minutes": 123,
"auto_stop_at": "2023-11-07T05:31:56Z",
"stop_reason": "user",
"firewall": {
"status": "unmanaged",
"error": "<string>",
"rules": [
{
"protocol": "tcp",
"port_from": 123,
"port_to": 123,
"sources": [
"<string>"
]
}
]
},
"links": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"port": 32768,
"access": "workspace",
"sources": [
"<string>"
],
"url": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"warning": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}Authorizations
Use a Runcrate API key with the rc_live_* prefix as the bearer token. Create one at https://www.runcrate.ai/dashboard/api-keys.
Path Parameters
Body
application/json
Total minutes the instance may run, from when it started. null turns it off.
Required range:
5 <= x <= 10080Idle window in minutes. null turns it off. GPU instances launched with idle stop support only.
Required range:
5 <= x <= 1440Response
The instance with its new limits and auto_stop_at.
Show child attributes
Show child attributes
⌘I
Change auto stop
curl --request PATCH \
--url https://www.runcrate.ai/api/v1/instances/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"max_runtime_minutes": 5042,
"idle_shutdown_minutes": 722
}
'import requests
url = "https://www.runcrate.ai/api/v1/instances/{id}"
payload = {
"max_runtime_minutes": 5042,
"idle_shutdown_minutes": 722
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({max_runtime_minutes: 5042, idle_shutdown_minutes: 722})
};
fetch('https://www.runcrate.ai/api/v1/instances/{id}', 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://www.runcrate.ai/api/v1/instances/{id}",
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([
'max_runtime_minutes' => 5042,
'idle_shutdown_minutes' => 722
]),
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://www.runcrate.ai/api/v1/instances/{id}"
payload := strings.NewReader("{\n \"max_runtime_minutes\": 5042,\n \"idle_shutdown_minutes\": 722\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://www.runcrate.ai/api/v1/instances/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"max_runtime_minutes\": 5042,\n \"idle_shutdown_minutes\": 722\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.runcrate.ai/api/v1/instances/{id}")
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 \"max_runtime_minutes\": 5042,\n \"idle_shutdown_minutes\": 722\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"status": "running",
"gpu_type": "<string>",
"gpu_count": 123,
"cpu_cores": 123,
"memory": 123,
"storage": 123,
"region": "<string>",
"ip": "<string>",
"os_image": "<string>",
"cost_per_hour": 123,
"deployed_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"max_runtime_minutes": 123,
"idle_shutdown_minutes": 123,
"auto_stop_at": "2023-11-07T05:31:56Z",
"stop_reason": "user",
"firewall": {
"status": "unmanaged",
"error": "<string>",
"rules": [
{
"protocol": "tcp",
"port_from": 123,
"port_to": 123,
"sources": [
"<string>"
]
}
]
},
"links": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"port": 32768,
"access": "workspace",
"sources": [
"<string>"
],
"url": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"warning": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}