Skip to main content
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>"
}
'
{
  "name": "<string>",
  "size": 123,
  "mimetype": "<string>",
  "modified_at": "2023-11-07T05:31:56Z",
  "url": "<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 specified path 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"
  }'
Response (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

X-API-Key
string
header
required

Path Parameters

project_name
string
required

The name of the project

Query Parameters

path
string
required

Absolute path inside the project (leading slash optional, no .. segments)

Body

application/json
mimetype
enum<string>
required

the mimetype of the document being uploaded

Available options:
application/pdf,
application/json,
image/jpg,
image/jpeg,
image/png,
text/csv,
text/plain,
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
application/vnd.ms-excel,
video/mp4,
audio/mp3,
audio/wav,
audio/ogg,
multipart/related,
message/rfc822
filename
string
required

the name of the file being uploaded

file_type
enum<string>
required

Indicates whether the file is a binary upload or a signed link to the document.

Available options:
uri,
binary,
multipart
file
required

A signed URL to the file.

Response

File uploaded

A file object inside the filesystem

ftype
enum<string>
required
Available options:
file,
folder
name
string
required
size
integer

size in bytes

mimetype
string
modified_at
string<date-time>
url
string<uri>

Presigned download url. 15min TTL.