Update box
curl --request PATCH \
--url https://ascii.dev/api/box/v1/boxes/{boxId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"ttlSeconds": 1296000,
"subdomain": "<string>"
}
'import requests
url = "https://ascii.dev/api/box/v1/boxes/{boxId}"
payload = {
"name": "<string>",
"ttlSeconds": 1296000,
"subdomain": "<string>"
}
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({name: '<string>', ttlSeconds: 1296000, subdomain: '<string>'})
};
fetch('https://ascii.dev/api/box/v1/boxes/{boxId}', 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://ascii.dev/api/box/v1/boxes/{boxId}",
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([
'name' => '<string>',
'ttlSeconds' => 1296000,
'subdomain' => '<string>'
]),
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://ascii.dev/api/box/v1/boxes/{boxId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"ttlSeconds\": 1296000,\n \"subdomain\": \"<string>\"\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://ascii.dev/api/box/v1/boxes/{boxId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"ttlSeconds\": 1296000,\n \"subdomain\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ascii.dev/api/box/v1/boxes/{boxId}")
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 \"name\": \"<string>\",\n \"ttlSeconds\": 1296000,\n \"subdomain\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"type": "box.info",
"box": {
"id": "<string>",
"name": "<string>",
"desktopAvailable": true,
"snapshotAvailable": true,
"vcpu": 123,
"memoryGB": 123,
"billingMultiplier": 123,
"url": "<string>",
"ip": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"archiveAfter": "2023-11-07T05:31:56Z",
"desktopUrl": "<string>",
"snapshotCompletedAt": "2023-11-07T05:31:56Z",
"subdomain": "<string>",
"lastSnapshotAttemptAt": "2023-11-07T05:31:56Z",
"setupError": "<string>",
"environment": "<string>",
"environmentVersion": 123
}
}{
"ok": false,
"type": "box.error",
"status": 400,
"code": "invalid_json",
"message": "Request body must be valid JSON.",
"error": {
"code": "invalid_json",
"message": "Request body must be valid JSON.",
"status": 400
},
"requestId": "req_01HX..."
}{
"ok": false,
"type": "box.error",
"status": 401,
"code": "unauthorized",
"message": "Unauthorized",
"error": {
"code": "unauthorized",
"message": "Unauthorized",
"status": 401
},
"requestId": "req_01HX..."
}{
"ok": true,
"type": "<string>",
"status": 123,
"code": "<string>",
"message": "<string>",
"requestId": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"details": {}
}
}Authorizations
Box bearer token in the form box_.... Service API keys authenticate Box operations.
Path Parameters
Public Box id returned by create/list/get box calls.
^bx_[23456789abcdefghjkmnpqrstuvwxyz]{8}$Body
New display name. Empty strings are rejected; longer names are truncated to 120 chars by the backend.
1 - 120New archival TTL. null disables auto-stop.
1 <= x <= 2592000Rename the Box's stable subdomain (the <subdomain>.on.ascii.dev label). Lowercase letters, digits and hyphens; no leading/trailing/double hyphens; cannot end in -desktop or -<number> (reserved for the desktop and hosted-port URLs). Must be globally unique. The base URL, desktop URL and every live host <port> URL are re-pointed to the new name with no downtime and their access tokens preserved; the old URLs stop resolving. On a transient routing error the rename is saved but returns 502 gateway_error - retry with the same value to finish activating routes.
3 - 40^[a-z0-9]([a-z0-9-]*[a-z0-9])?$curl --request PATCH \
--url https://ascii.dev/api/box/v1/boxes/{boxId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"ttlSeconds": 1296000,
"subdomain": "<string>"
}
'import requests
url = "https://ascii.dev/api/box/v1/boxes/{boxId}"
payload = {
"name": "<string>",
"ttlSeconds": 1296000,
"subdomain": "<string>"
}
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({name: '<string>', ttlSeconds: 1296000, subdomain: '<string>'})
};
fetch('https://ascii.dev/api/box/v1/boxes/{boxId}', 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://ascii.dev/api/box/v1/boxes/{boxId}",
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([
'name' => '<string>',
'ttlSeconds' => 1296000,
'subdomain' => '<string>'
]),
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://ascii.dev/api/box/v1/boxes/{boxId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"ttlSeconds\": 1296000,\n \"subdomain\": \"<string>\"\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://ascii.dev/api/box/v1/boxes/{boxId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"ttlSeconds\": 1296000,\n \"subdomain\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ascii.dev/api/box/v1/boxes/{boxId}")
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 \"name\": \"<string>\",\n \"ttlSeconds\": 1296000,\n \"subdomain\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"type": "box.info",
"box": {
"id": "<string>",
"name": "<string>",
"desktopAvailable": true,
"snapshotAvailable": true,
"vcpu": 123,
"memoryGB": 123,
"billingMultiplier": 123,
"url": "<string>",
"ip": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"archiveAfter": "2023-11-07T05:31:56Z",
"desktopUrl": "<string>",
"snapshotCompletedAt": "2023-11-07T05:31:56Z",
"subdomain": "<string>",
"lastSnapshotAttemptAt": "2023-11-07T05:31:56Z",
"setupError": "<string>",
"environment": "<string>",
"environmentVersion": 123
}
}{
"ok": false,
"type": "box.error",
"status": 400,
"code": "invalid_json",
"message": "Request body must be valid JSON.",
"error": {
"code": "invalid_json",
"message": "Request body must be valid JSON.",
"status": 400
},
"requestId": "req_01HX..."
}{
"ok": false,
"type": "box.error",
"status": 401,
"code": "unauthorized",
"message": "Unauthorized",
"error": {
"code": "unauthorized",
"message": "Unauthorized",
"status": 401
},
"requestId": "req_01HX..."
}{
"ok": true,
"type": "<string>",
"status": 123,
"code": "<string>",
"message": "<string>",
"requestId": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"status": 123,
"details": {}
}
}