curl --request POST \
--url https://api.instabox.sh/v1/machines/{id}/files/upload-url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"path": "<string>",
"mode": "<string>",
"parents": true,
"expiresInSeconds": 1800
}
'import requests
url = "https://api.instabox.sh/v1/machines/{id}/files/upload-url"
payload = {
"path": "<string>",
"mode": "<string>",
"parents": True,
"expiresInSeconds": 1800
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({path: '<string>', mode: '<string>', parents: true, expiresInSeconds: 1800})
};
fetch('https://api.instabox.sh/v1/machines/{id}/files/upload-url', 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.instabox.sh/v1/machines/{id}/files/upload-url",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'path' => '<string>',
'mode' => '<string>',
'parents' => true,
'expiresInSeconds' => 1800
]),
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.instabox.sh/v1/machines/{id}/files/upload-url"
payload := strings.NewReader("{\n \"path\": \"<string>\",\n \"mode\": \"<string>\",\n \"parents\": true,\n \"expiresInSeconds\": 1800\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.instabox.sh/v1/machines/{id}/files/upload-url")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"path\": \"<string>\",\n \"mode\": \"<string>\",\n \"parents\": true,\n \"expiresInSeconds\": 1800\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.instabox.sh/v1/machines/{id}/files/upload-url")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"path\": \"<string>\",\n \"mode\": \"<string>\",\n \"parents\": true,\n \"expiresInSeconds\": 1800\n}"
response = http.request(request)
puts response.read_body{
"url": "<string>",
"method": "PUT",
"path": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"maxBytes": 123
}{
"error": {
"code": "unauthenticated",
"message": "<string>",
"requestId": "<string>",
"retryable": true,
"operationId": "<string>",
"reason": "missing_key",
"hint": "<string>",
"docs": "<string>",
"docs_url": "<string>",
"requiredScopes": [
"<string>"
],
"retryAfterSeconds": 2,
"at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "unauthenticated",
"message": "<string>",
"requestId": "<string>",
"retryable": true,
"operationId": "<string>",
"reason": "missing_key",
"hint": "<string>",
"docs": "<string>",
"docs_url": "<string>",
"requiredScopes": [
"<string>"
],
"retryAfterSeconds": 2,
"at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "unauthenticated",
"message": "<string>",
"requestId": "<string>",
"retryable": true,
"operationId": "<string>",
"reason": "missing_key",
"hint": "<string>",
"docs": "<string>",
"docs_url": "<string>",
"requiredScopes": [
"<string>"
],
"retryAfterSeconds": 2,
"at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "unauthenticated",
"message": "<string>",
"requestId": "<string>",
"retryable": true,
"operationId": "<string>",
"reason": "missing_key",
"hint": "<string>",
"docs": "<string>",
"docs_url": "<string>",
"requiredScopes": [
"<string>"
],
"retryAfterSeconds": 2,
"at": "2023-11-07T05:31:56Z"
}
}Get a short-lived signed URL that uploads one file.
Returns a URL on the API’s own origin that takes PUT of the file’s raw bytes to path (PUT /v1/machines//files with a signed token) with no other credential, until expiresAt: by default 15 minutes, at most 1 hour. Hand it to a tool that should not hold your API key, or use it for a long upload. The token is HMAC-signed and binds the sandbox, path, mode and parents; it may be used more than once until it expires. Each upload still acts as you: it fails once your account is gone, or the API key that made the URL is revoked or expired, or you lose access to the sandbox (org membership is checked on every upload). The sandbox need not be running to create a URL; the upload has the PUT route’s limits and errors (5 GiB). API keys: needs one of the scopes machines:write, machines:exec (legacy).
curl --request POST \
--url https://api.instabox.sh/v1/machines/{id}/files/upload-url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"path": "<string>",
"mode": "<string>",
"parents": true,
"expiresInSeconds": 1800
}
'import requests
url = "https://api.instabox.sh/v1/machines/{id}/files/upload-url"
payload = {
"path": "<string>",
"mode": "<string>",
"parents": True,
"expiresInSeconds": 1800
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({path: '<string>', mode: '<string>', parents: true, expiresInSeconds: 1800})
};
fetch('https://api.instabox.sh/v1/machines/{id}/files/upload-url', 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.instabox.sh/v1/machines/{id}/files/upload-url",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'path' => '<string>',
'mode' => '<string>',
'parents' => true,
'expiresInSeconds' => 1800
]),
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.instabox.sh/v1/machines/{id}/files/upload-url"
payload := strings.NewReader("{\n \"path\": \"<string>\",\n \"mode\": \"<string>\",\n \"parents\": true,\n \"expiresInSeconds\": 1800\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.instabox.sh/v1/machines/{id}/files/upload-url")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"path\": \"<string>\",\n \"mode\": \"<string>\",\n \"parents\": true,\n \"expiresInSeconds\": 1800\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.instabox.sh/v1/machines/{id}/files/upload-url")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"path\": \"<string>\",\n \"mode\": \"<string>\",\n \"parents\": true,\n \"expiresInSeconds\": 1800\n}"
response = http.request(request)
puts response.read_body{
"url": "<string>",
"method": "PUT",
"path": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"maxBytes": 123
}{
"error": {
"code": "unauthenticated",
"message": "<string>",
"requestId": "<string>",
"retryable": true,
"operationId": "<string>",
"reason": "missing_key",
"hint": "<string>",
"docs": "<string>",
"docs_url": "<string>",
"requiredScopes": [
"<string>"
],
"retryAfterSeconds": 2,
"at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "unauthenticated",
"message": "<string>",
"requestId": "<string>",
"retryable": true,
"operationId": "<string>",
"reason": "missing_key",
"hint": "<string>",
"docs": "<string>",
"docs_url": "<string>",
"requiredScopes": [
"<string>"
],
"retryAfterSeconds": 2,
"at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "unauthenticated",
"message": "<string>",
"requestId": "<string>",
"retryable": true,
"operationId": "<string>",
"reason": "missing_key",
"hint": "<string>",
"docs": "<string>",
"docs_url": "<string>",
"requiredScopes": [
"<string>"
],
"retryAfterSeconds": 2,
"at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "unauthenticated",
"message": "<string>",
"requestId": "<string>",
"retryable": true,
"operationId": "<string>",
"reason": "missing_key",
"hint": "<string>",
"docs": "<string>",
"docs_url": "<string>",
"requiredScopes": [
"<string>"
],
"retryAfterSeconds": 2,
"at": "2023-11-07T05:31:56Z"
}
}Authorizations
Opaque instabox access token (1 hour). Refresh with /v1/auth/refresh (refresh token valid 30 days, rotates on use).
Path Parameters
Sandbox ID (m_ + 26 lowercase base32 characters).
^m_[a-z2-7]{26}$Body
Was this page helpful?