PlatformXeDocs
Get API Key

Storage

SDK methods for media file uploads, management, and signed URL flows.

The client.storage namespace provides typed methods for uploading, listing, and managing media files through PlatformXe's storage service. Supports direct uploads, batch uploads, signed URL flows, and external URL registration. Available in TypeScript, Python, and Go SDKs.

SDKInstallNamespace
TypeScriptnpm install @caldera/platformxe-sdkclient.storage
Pythonpip install platformxeclient.storage
Gogo get github.com/calderaxe/platformxe-goclient.Storage

Upload a file

Upload a single file, base64-encoded in a JSON body (POST /api/v1/storage/media/upload, see Upload). The answer is the stored file (id, url, storagePath, mimeType, fileSize, …).

const file = await client.storage.upload({
  module: 'properties',
  entityId: 'prop-123',
  filename: 'exterior.jpg',
  mimeType: 'image/jpeg',
  content: base64EncodedContent,
});

console.log(file.id);  // the file id
console.log(file.url); // Public URL
result, err := client.Storage.Upload(map[string]interface{}{
    "module":   "properties",
    "entityId": "prop-123",
    "filename": "exterior.jpg",
    "mimeType": "image/jpeg",
    "content":  base64EncodedContent,
})

The route reads only this JSON body. The Python SDK's upload_file sends multipart form data, which the route refuses (400 BAD_REQUEST); until it is fixed, post the JSON body with client.post("/api/v1/storage/media/upload", json={...}). Go's Upload sends the map as given, but its UploadResult reads a file field the route does not send: read the answer with your own type until it is fixed.

Batch upload

Upload up to 20 files for one record in a single request (POST /api/v1/storage/media/upload/batch). The answer is { totalUploaded, uploaded, errors }: a file that fails does not stop the others, so check errors.

const result = await client.storage.batchUpload({
  module: 'properties',
  entityId: 'prop-123',
  files: [
    { filename: 'exterior.jpg', mimeType: 'image/jpeg', content: ext64 },
    { filename: 'interior.jpg', mimeType: 'image/jpeg', content: int64, category: 'interior' },
  ],
});

console.log(result.totalUploaded); // 2
console.log(result.errors);        // [] when every file was stored
result, err := client.Storage.BatchUpload(map[string]interface{}{
    "module":   "properties",
    "entityId": "prop-123",
    "files": []map[string]interface{}{
        {"filename": "exterior.jpg", "mimeType": "image/jpeg", "content": ext64},
        {"filename": "interior.jpg", "mimeType": "image/jpeg", "content": int64},
    },
})

As for a single upload, the Python SDK's batch_upload sends multipart form data, which the route refuses, and Go's BatchUploadResult reads files / succeeded / failed, which the route does not send.

Signed upload

For a large file from a browser, get a presigned URL, PUT the bytes to it from the client, then register the file. The routes are on Upload files: POST /api/v1/storage/media/sign-upload takes filename and mimeType (both required) plus optional module and entityId, and answers signedUrl, path, publicUrl, bucket, provider (an opaque label) and, on some storage tiers, requiredHeaders (send every entry on the PUT) or token. Upload within 15 minutes of signing.

// Step 1: get a signed upload URL
const signed = await client.storage.signUpload({
  filename: 'photo.jpg',
  mimeType: 'image/jpeg',
  module: 'properties',
  entityId: 'prop-123',
});

// Step 2: upload from the browser, with every required header
await fetch(signed.signedUrl, {
  method: 'PUT',
  headers: { 'Content-Type': 'image/jpeg', ...(signed.requiredHeaders ?? {}) },
  body: fileBlob,
});

// Step 3: register it (below)

The Python sign_upload(filename, content_type) and Go SignUpload(filename, contentType) send contentType, which the route does not read, so the route answers 400 BAD_REQUEST (mimeType missing). Go's SignUploadResult also reads uploadUrl / fileId, which the route does not send. Until the fix is released, call the route directly from Python or Go (client.post / an HTTP request with filename and mimeType).

Register a presigned upload

Record the uploaded file so PlatformXe serves, lists and deletes it like any other. POST /api/v1/storage/media/register requires url, originalFilename, fileSize (bytes) and mimeType; send storagePath (the path from the signed upload) unless the url is inside the storage container, and the same module / entityId. It answers 201 with the file record. A video is probed first (unless sourceProbed), and a video that fails the probe is 400 with the probe's code.

const file = await client.storage.register({
  url: signed.publicUrl,
  storagePath: signed.path,
  originalFilename: 'photo.jpg',
  fileSize: fileBlob.size,
  mimeType: 'image/jpeg',
  module: 'properties',
  entityId: 'prop-123',
});
console.log(file.id, file.displayOrder);

The Python register_url(url, filename=None) and Go RegisterURL(url) send only url (and Python a filename the route does not read), so the route answers 400 BAD_REQUEST. Until the fix is released, call the route directly from Python or Go with the four required fields.

List files

const files = await client.storage.list({
  module: 'properties',
  entityId: 'prop-123',
  page: 1,
  limit: 25,
});
files = client.storage.list_files(page=1, limit=25)
files, err := client.Storage.ListFiles(map[string]string{
    "module":   "properties",
    "entityId": "prop-123",
    "page":     "1",
})

Get a file

const file = await client.storage.get('file_abc123');
file = client.storage.get_file("file_abc123")
file, err := client.Storage.GetFile("file_abc123")

Delete a file

await client.storage.delete('file_abc123');
client.storage.delete_file("file_abc123")
result, err := client.Storage.DeleteFile("file_abc123")

Reorder files

Set the display order for a set of files: PATCH /api/v1/storage/media/files/reorder with { "fileIds": [...] }. The order is determined by the array index; the answer is { "reordered": true }. List every live file of one entity: a file left out, or files of two entities, can clash on a position, and the whole reorder is then refused with 403 REORDER_FAILED (see Manage Files).

const result = await client.storage.reorder({ fileIds: ['file_003', 'file_001', 'file_002'] });
console.log(result.reordered); // true
result = client.storage.reorder_files(["file_003", "file_001", "file_002"])
print(result["reordered"])  # True
result, err := client.Storage.ReorderFiles([]string{"file_003", "file_001", "file_002"})
fmt.Println(result.Reordered) // true

TypeScript 1.16.2 (pending release), Python 1.13.0 and Go v1.13.0 send PATCH to this path. Earlier Python and Go versions sent POST, which the route does not take; TypeScript before 1.16.2 posted to a reorder path the API does not have, so on an older TypeScript SDK call the route directly. The TypeScript result's updated field is deprecated: the route never sends it. A file id that is not one of your live files (another caller's or organisation's, missing or deleted) is 403 REORDER_FAILED.

Processor configuration

Get processor config

const config = await client.storage.getProcessor();
config = client.storage.get_processor()
config, err := client.Storage.GetProcessor()

Update processor config

Configure storage settings such as max file size, allowed MIME types, and moderation.

const updated = await client.storage.updateProcessor({
  enabled: true,
  config: {
    maxFileSizeMb: 25,
    allowedMimeTypes: ['image/jpeg', 'image/png', 'application/pdf'],
    moderationEnabled: true,
  },
});
updated = client.storage.update_processor(
    enabled=True,
    config={
        "maxFileSizeMb": 25,
        "allowedMimeTypes": ["image/jpeg", "image/png", "application/pdf"],
        "moderationEnabled": True,
    },
)
updated, err := client.Storage.UpdateProcessor(map[string]interface{}{
    "enabled": true,
    "config": map[string]interface{}{
        "maxFileSizeMb":      25,
        "allowedMimeTypes":   []string{"image/jpeg", "image/png", "application/pdf"},
        "moderationEnabled":  true,
    },
})

Scopes required

storage:upload also grants storage:read and storage:delete, so a key issued before the split (2026-11-20) keeps every storage route; a key that should only read, or read and delete, names those scopes without storage:upload.

MethodScope
storage.upload()storage:upload
storage.batchUpload()storage:upload
storage.signUpload()storage:upload
storage.register()storage:upload
storage.list()storage:read
storage.get()storage:read
storage.delete()storage:delete
storage.reorder() / storage.reorder_files() / Storage.ReorderFiles()storage:upload
storage.getProcessor()storage:read
storage.updateProcessor()storage:upload