Create a code upload
Somewhere to send a job’s code: answers a signed URL to PUT a tar.gz of at most 1 GB. Then submit a job with code: { upload_id }; the code is unpacked into /workspace/code before the command starts, and the command runs there. An upload belongs to the caller’s environment. Unused, it is deleted after 24 hours; a job using it keeps it 7 days. A workspace holds at most 50 uploads and 10 GB of them across its environments, and creates at most 60 an hour: past either the answer is 429. With no credit it is 402. The same sha256 and bytes again answer the same upload.
POST
/
jobs
/
uploads
Create a code upload
curl --request POST \
--url https://www.runcrate.ai/api/v1/jobs/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"bytes": 536870912,
"sha256": "<string>"
}
'import requests
url = "https://www.runcrate.ai/api/v1/jobs/uploads"
payload = {
"bytes": 536870912,
"sha256": "<string>"
}
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({bytes: 536870912, sha256: '<string>'})
};
fetch('https://www.runcrate.ai/api/v1/jobs/uploads', 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/jobs/uploads",
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([
'bytes' => 536870912,
'sha256' => '<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://www.runcrate.ai/api/v1/jobs/uploads"
payload := strings.NewReader("{\n \"bytes\": 536870912,\n \"sha256\": \"<string>\"\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://www.runcrate.ai/api/v1/jobs/uploads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"bytes\": 536870912,\n \"sha256\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.runcrate.ai/api/v1/jobs/uploads")
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 \"bytes\": 536870912,\n \"sha256\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"upload_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"url_expires_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"max_bytes": 123
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"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.
Body
application/json
Response
The upload.
Show child attributes
Show child attributes
⌘I
Create a code upload
curl --request POST \
--url https://www.runcrate.ai/api/v1/jobs/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"bytes": 536870912,
"sha256": "<string>"
}
'import requests
url = "https://www.runcrate.ai/api/v1/jobs/uploads"
payload = {
"bytes": 536870912,
"sha256": "<string>"
}
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({bytes: 536870912, sha256: '<string>'})
};
fetch('https://www.runcrate.ai/api/v1/jobs/uploads', 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/jobs/uploads",
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([
'bytes' => 536870912,
'sha256' => '<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://www.runcrate.ai/api/v1/jobs/uploads"
payload := strings.NewReader("{\n \"bytes\": 536870912,\n \"sha256\": \"<string>\"\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://www.runcrate.ai/api/v1/jobs/uploads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"bytes\": 536870912,\n \"sha256\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.runcrate.ai/api/v1/jobs/uploads")
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 \"bytes\": 536870912,\n \"sha256\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"upload_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"url_expires_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"max_bytes": 123
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}