Upload File
curl --request POST \
--url https://api.sublay.io/api/v6/:projectId/api/v7/storage \
--header 'Content-Type: application/json' \
--data '
{
"pathParts": [
{}
],
"entityId": "<string>",
"commentId": "<string>",
"spaceId": "<string>",
"position": 123,
"metadata": {},
"userId": "<string>"
}
'import requests
url = "https://api.sublay.io/api/v6/:projectId/api/v7/storage"
payload = {
"pathParts": [{}],
"entityId": "<string>",
"commentId": "<string>",
"spaceId": "<string>",
"position": 123,
"metadata": {},
"userId": "<string>"
}
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({
pathParts: [{}],
entityId: '<string>',
commentId: '<string>',
spaceId: '<string>',
position: 123,
metadata: {},
userId: '<string>'
})
};
fetch('https://api.sublay.io/api/v6/:projectId/api/v7/storage', 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.sublay.io/api/v6/:projectId/api/v7/storage",
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([
'pathParts' => [
[
]
],
'entityId' => '<string>',
'commentId' => '<string>',
'spaceId' => '<string>',
'position' => 123,
'metadata' => [
],
'userId' => '<string>'
]),
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.sublay.io/api/v6/:projectId/api/v7/storage"
payload := strings.NewReader("{\n \"pathParts\": [\n {}\n ],\n \"entityId\": \"<string>\",\n \"commentId\": \"<string>\",\n \"spaceId\": \"<string>\",\n \"position\": 123,\n \"metadata\": {},\n \"userId\": \"<string>\"\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.sublay.io/api/v6/:projectId/api/v7/storage")
.header("Content-Type", "application/json")
.body("{\n \"pathParts\": [\n {}\n ],\n \"entityId\": \"<string>\",\n \"commentId\": \"<string>\",\n \"spaceId\": \"<string>\",\n \"position\": 123,\n \"metadata\": {},\n \"userId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/api/v6/:projectId/api/v7/storage")
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 \"pathParts\": [\n {}\n ],\n \"entityId\": \"<string>\",\n \"commentId\": \"<string>\",\n \"spaceId\": \"<string>\",\n \"position\": 123,\n \"metadata\": {},\n \"userId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyStorage Endpoints
Upload File
Upload a generic file without server-side processing
POST
/
:projectId
/
api
/
v7
/
storage
Upload File
curl --request POST \
--url https://api.sublay.io/api/v6/:projectId/api/v7/storage \
--header 'Content-Type: application/json' \
--data '
{
"pathParts": [
{}
],
"entityId": "<string>",
"commentId": "<string>",
"spaceId": "<string>",
"position": 123,
"metadata": {},
"userId": "<string>"
}
'import requests
url = "https://api.sublay.io/api/v6/:projectId/api/v7/storage"
payload = {
"pathParts": [{}],
"entityId": "<string>",
"commentId": "<string>",
"spaceId": "<string>",
"position": 123,
"metadata": {},
"userId": "<string>"
}
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({
pathParts: [{}],
entityId: '<string>',
commentId: '<string>',
spaceId: '<string>',
position: 123,
metadata: {},
userId: '<string>'
})
};
fetch('https://api.sublay.io/api/v6/:projectId/api/v7/storage', 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.sublay.io/api/v6/:projectId/api/v7/storage",
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([
'pathParts' => [
[
]
],
'entityId' => '<string>',
'commentId' => '<string>',
'spaceId' => '<string>',
'position' => 123,
'metadata' => [
],
'userId' => '<string>'
]),
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.sublay.io/api/v6/:projectId/api/v7/storage"
payload := strings.NewReader("{\n \"pathParts\": [\n {}\n ],\n \"entityId\": \"<string>\",\n \"commentId\": \"<string>\",\n \"spaceId\": \"<string>\",\n \"position\": 123,\n \"metadata\": {},\n \"userId\": \"<string>\"\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.sublay.io/api/v6/:projectId/api/v7/storage")
.header("Content-Type", "application/json")
.body("{\n \"pathParts\": [\n {}\n ],\n \"entityId\": \"<string>\",\n \"commentId\": \"<string>\",\n \"spaceId\": \"<string>\",\n \"position\": 123,\n \"metadata\": {},\n \"userId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/api/v6/:projectId/api/v7/storage")
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 \"pathParts\": [\n {}\n ],\n \"entityId\": \"<string>\",\n \"commentId\": \"<string>\",\n \"spaceId\": \"<string>\",\n \"position\": 123,\n \"metadata\": {},\n \"userId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyUploads a file directly to storage without processing. Suitable for PDFs, videos, Office documents, and other non-image assets. The file type is inferred automatically from the MIME type.
This endpoint accepts
The
multipart/form-data. Requires an authenticated user.
Rate limit: 10 requests per 5 minutes.
Body Parameters
file
required
The file to upload. Maximum 50 MB.
array
required
JSON-encoded array of path segments. The file is stored under the joined path with a UUID sub-folder appended. Example:
["documents", "user-123"] → documents/user-123/<uuid>/<filename>.string
Associates the file with an entity for cascade deletion.
string
Associates the file with a comment for cascade deletion.
string
Associates the file with a space.
number
Display order when a record has multiple attachments. Defaults to
0.object
Custom key-value data stored alongside the file record.
string
Attribute the upload to a specific user. With a user token the upload is
already attributed to the caller; only service/master keys may name a
different user. Omit for a backend/project-owned file (no owning user).
Response
{
"fileId": "uuid",
"type": "document",
"relativePath": "documents/user-123/uuid/report.pdf",
"publicPath": "/internal/files/documents/user-123/uuid/report.pdf",
"size": 102400,
"mimeType": "application/pdf",
"createdAt": "2025-01-01T00:00:00.000Z"
}
type field is one of: image, video, document, other. It is inferred from the MIME type.
Error Responses
No File — 400 Bad Request
No File — 400 Bad Request
{ "error": "No file provided", "code": "storage/no-file" }
File Too Large — 413
File Too Large — 413
{ "error": "File size exceeds the allowed limit of 50MB", "code": "storage/file-too-large" }

