Upload a file to a path
curl --request PUT \
--url https://api.cloudsquid.io/api/projects/{project_name}/files \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"filename": "<string>",
"file": "<string>"
}
'import requests
url = "https://api.cloudsquid.io/api/projects/{project_name}/files"
payload = {
"filename": "<string>",
"file": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({filename: '<string>', file: '<string>'})
};
fetch('https://api.cloudsquid.io/api/projects/{project_name}/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.cloudsquid.io/api/projects/{project_name}/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'filename' => '<string>',
'file' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.cloudsquid.io/api/projects/{project_name}/files"
payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"file\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.put("https://api.cloudsquid.io/api/projects/{project_name}/files")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"file\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudsquid.io/api/projects/{project_name}/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filename\": \"<string>\",\n \"file\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ftype": "file",
"name": "<string>",
"size": 123,
"mimetype": "<string>",
"modified_at": "2023-11-07T05:31:56Z",
"url": "<string>"
}{
"errorMessage": "<string>"
}{
"errorMessage": "<string>"
}{
"errorMessage": "<string>"
}{
"errorMessage": "<string>"
}Filesystem
Upload File by Path
Upload a file to a path inside the project filesystem. Parent folders are created automatically.
PUT
/
projects
/
{project_name}
/
files
Upload a file to a path
curl --request PUT \
--url https://api.cloudsquid.io/api/projects/{project_name}/files \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"filename": "<string>",
"file": "<string>"
}
'import requests
url = "https://api.cloudsquid.io/api/projects/{project_name}/files"
payload = {
"filename": "<string>",
"file": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({filename: '<string>', file: '<string>'})
};
fetch('https://api.cloudsquid.io/api/projects/{project_name}/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.cloudsquid.io/api/projects/{project_name}/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'filename' => '<string>',
'file' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.cloudsquid.io/api/projects/{project_name}/files"
payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"file\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.put("https://api.cloudsquid.io/api/projects/{project_name}/files")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"file\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudsquid.io/api/projects/{project_name}/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filename\": \"<string>\",\n \"file\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ftype": "file",
"name": "<string>",
"size": 123,
"mimetype": "<string>",
"modified_at": "2023-11-07T05:31:56Z",
"url": "<string>"
}{
"errorMessage": "<string>"
}{
"errorMessage": "<string>"
}{
"errorMessage": "<string>"
}{
"errorMessage": "<string>"
}Conflict handling: If a file already exists at the target path, the request fails with
409 Conflict. Delete the existing file first if you need to overwrite it.What this does
Uploads a file to the project filesystem at the specifiedpath query parameter. Missing intermediate folders are created automatically (like mkdir -p). The request body uses the same Document schema as table file uploads.
Example
curl -X PUT \
"https://api.cloudsquid.io/api/projects/my-project/files?path=/invoices/2024/jan.pdf" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"file": "'$(base64 -i jan.pdf)'",
"filename": "jan.pdf",
"mimetype": "application/pdf",
"file_type": "binary"
}'
import requests, base64
with open("jan.pdf", "rb") as f:
encoded = base64.b64encode(f.read()).decode()
response = requests.put(
"https://api.cloudsquid.io/api/projects/my-project/files",
params={"path": "/invoices/2024/jan.pdf"},
headers={"X-API-Key": "YOUR_API_KEY"},
json={
"file": encoded,
"filename": "jan.pdf",
"mimetype": "application/pdf",
"file_type": "binary"
}
)
const response = await fetch(
"https://api.cloudsquid.io/api/projects/my-project/files?path=/invoices/2024/jan.pdf",
{
method: "PUT",
headers: {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
file: btoa(fileContent),
filename: "jan.pdf",
mimetype: "application/pdf",
file_type: "binary"
})
}
);
201 Created):
{
"ftype": "file",
"name": "jan.pdf",
"size": 48210,
"mimetype": "application/pdf",
"modified_at": "2026-06-01T12:00:00Z",
"url": "https://storage.googleapis.com/presigned?..."
}
Authorizations
Path Parameters
The name of the project
Query Parameters
Absolute path inside the project (leading slash optional, no .. segments)
Body
application/json
the mimetype of the document being uploaded
Available options:
application/pdf, application/json, application/xml, image/jpg, image/jpeg, image/png, text/csv, text/plain, text/xml, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, video/mp4, audio/mp3, audio/wav, audio/ogg, multipart/related, message/rfc822 the name of the file being uploaded
Indicates whether the file is a binary upload or a signed link to the document.
Available options:
uri, binary, multipart A signed URL to the file.
Was this page helpful?
