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/calderax/platformxe-goclient.Storage

Upload a file

Upload a single file. The TypeScript and Go SDKs accept base64-encoded payloads; the Python SDK accepts a local file path.

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

console.log(result.file.id);  // "file_abc123"
console.log(result.file.url); // Public URL
result = client.storage.upload_file(
    "/path/to/exterior.jpg",
    module="properties",
    entity_id="prop-123",
)
result, err := client.Storage.Upload(map[string]interface{}{
    "filename":    "exterior.jpg",
    "contentType": "image/jpeg",
    "data":        base64EncodedContent,
    "module":      "properties",
    "entityId":    "prop-123",
})

Batch upload

Upload multiple files in a single request.

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

console.log(result.files.length);  // 2
console.log(result.failed.length); // 0
result = client.storage.batch_upload(
    ["/path/to/exterior.jpg", "/path/to/interior.jpg"],
    module="properties",
    entity_id="prop-123",
)
result, err := client.Storage.BatchUpload(map[string]interface{}{
    "files": []map[string]interface{}{
        {"filename": "exterior.jpg", "contentType": "image/jpeg", "data": ext64},
        {"filename": "interior.jpg", "contentType": "image/jpeg", "data": int64},
    },
    "module":   "properties",
    "entityId": "prop-123",
})

Signed upload

For browser-based uploads, request a presigned URL and upload directly from the client.

// Step 1: Get a signed upload URL
const signed = await client.storage.signUpload({
  filename: 'photo.jpg',
  contentType: 'image/jpeg',
});

console.log(signed.uploadUrl);   // Presigned PUT URL
console.log(signed.publicUrl);   // Final public URL after upload

// Step 2: Upload from the browser using the signed URL
await fetch(signed.uploadUrl, {
  method: 'PUT',
  headers: { 'Content-Type': 'image/jpeg' },
  body: fileBlob,
});
signed = client.storage.sign_upload("photo.jpg", "image/jpeg")
# Use signed["uploadUrl"] to PUT the file from your client
signed, err := client.Storage.SignUpload("photo.jpg", "image/jpeg")
// Use signed.UploadURL to PUT the file from your client

Register an external URL

Register a file hosted externally so it appears in your PlatformXe file inventory.

const file = await client.storage.register({
  url: 'https://cdn.example.com/images/photo.jpg',
});
file = client.storage.register_url("https://cdn.example.com/images/photo.jpg")
file, err := client.Storage.RegisterURL("https://cdn.example.com/images/photo.jpg")

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. The order is determined by the array index.

const result = await client.storage.reorder({
  fileIds: ['file_003', 'file_001', 'file_002'],
});

console.log(result.updated); // 3
result = client.storage.reorder_files(["file_003", "file_001", "file_002"])
result, err := client.Storage.ReorderFiles([]string{"file_003", "file_001", "file_002"})

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

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:upload
storage.getProcessor()storage:read
storage.updateProcessor()storage:upload