curl --request POST \
--url https://api.recoupable.dev/api/sandboxes/files \
--header 'Content-Type: application/json' \
--data '
{
"files": [
{
"url": "https://example.com/files/album-cover.png",
"name": "album-cover.png"
}
],
"path": "assets/images",
"message": "Add new album artwork"
}
'import requests
url = "https://api.recoupable.dev/api/sandboxes/files"
payload = {
"files": [
{
"url": "https://example.com/files/album-cover.png",
"name": "album-cover.png"
}
],
"path": "assets/images",
"message": "Add new album artwork"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
files: [{url: 'https://example.com/files/album-cover.png', name: 'album-cover.png'}],
path: 'assets/images',
message: 'Add new album artwork'
})
};
fetch('https://api.recoupable.dev/api/sandboxes/files', 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.recoupable.dev/api/sandboxes/files",
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([
'files' => [
[
'url' => 'https://example.com/files/album-cover.png',
'name' => 'album-cover.png'
]
],
'path' => 'assets/images',
'message' => 'Add new album artwork'
]),
CURLOPT_HTTPHEADER => [
"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.recoupable.dev/api/sandboxes/files"
payload := strings.NewReader("{\n \"files\": [\n {\n \"url\": \"https://example.com/files/album-cover.png\",\n \"name\": \"album-cover.png\"\n }\n ],\n \"path\": \"assets/images\",\n \"message\": \"Add new album artwork\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.recoupable.dev/api/sandboxes/files")
.header("Content-Type", "application/json")
.body("{\n \"files\": [\n {\n \"url\": \"https://example.com/files/album-cover.png\",\n \"name\": \"album-cover.png\"\n }\n ],\n \"path\": \"assets/images\",\n \"message\": \"Add new album artwork\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.recoupable.dev/api/sandboxes/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"files\": [\n {\n \"url\": \"https://example.com/files/album-cover.png\",\n \"name\": \"album-cover.png\"\n }\n ],\n \"path\": \"assets/images\",\n \"message\": \"Add new album artwork\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"uploaded": [
{
"path": "<string>",
"sha": "<string>"
}
]
}{
"error": "Failed to create sandbox"
}{
"error": "Failed to create sandbox"
}{
"error": "Failed to create sandbox"
}{
"error": "Failed to create sandbox"
}Upload Files
Upload one or more files to the authenticated account’s sandbox GitHub repository. Accepts an array of file URLs and commits each file to the specified directory path within the repository. Supports submodule resolution — if the target path falls within a git submodule, the file is committed to the submodule’s repository. Authentication is handled via the x-api-key header or Authorization Bearer token.
curl --request POST \
--url https://api.recoupable.dev/api/sandboxes/files \
--header 'Content-Type: application/json' \
--data '
{
"files": [
{
"url": "https://example.com/files/album-cover.png",
"name": "album-cover.png"
}
],
"path": "assets/images",
"message": "Add new album artwork"
}
'import requests
url = "https://api.recoupable.dev/api/sandboxes/files"
payload = {
"files": [
{
"url": "https://example.com/files/album-cover.png",
"name": "album-cover.png"
}
],
"path": "assets/images",
"message": "Add new album artwork"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
files: [{url: 'https://example.com/files/album-cover.png', name: 'album-cover.png'}],
path: 'assets/images',
message: 'Add new album artwork'
})
};
fetch('https://api.recoupable.dev/api/sandboxes/files', 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.recoupable.dev/api/sandboxes/files",
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([
'files' => [
[
'url' => 'https://example.com/files/album-cover.png',
'name' => 'album-cover.png'
]
],
'path' => 'assets/images',
'message' => 'Add new album artwork'
]),
CURLOPT_HTTPHEADER => [
"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.recoupable.dev/api/sandboxes/files"
payload := strings.NewReader("{\n \"files\": [\n {\n \"url\": \"https://example.com/files/album-cover.png\",\n \"name\": \"album-cover.png\"\n }\n ],\n \"path\": \"assets/images\",\n \"message\": \"Add new album artwork\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.recoupable.dev/api/sandboxes/files")
.header("Content-Type", "application/json")
.body("{\n \"files\": [\n {\n \"url\": \"https://example.com/files/album-cover.png\",\n \"name\": \"album-cover.png\"\n }\n ],\n \"path\": \"assets/images\",\n \"message\": \"Add new album artwork\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.recoupable.dev/api/sandboxes/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"files\": [\n {\n \"url\": \"https://example.com/files/album-cover.png\",\n \"name\": \"album-cover.png\"\n }\n ],\n \"path\": \"assets/images\",\n \"message\": \"Add new album artwork\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"uploaded": [
{
"path": "<string>",
"sha": "<string>"
}
]
}{
"error": "Failed to create sandbox"
}{
"error": "Failed to create sandbox"
}{
"error": "Failed to create sandbox"
}{
"error": "Failed to create sandbox"
}Body
JSON body containing file URLs and target path
Array of files to upload, each with a URL and target filename
Show child attributes
Show child attributes
The target directory path within the repository to upload files to. Defaults to the repository root if omitted.
"assets/images"
Optional commit message. Defaults to 'Upload files via API'.
"Add new album artwork"
Was this page helpful?
