Documents
SDK methods for fixed-storage documents, folders, and deletion overrides.
The client.documents namespace provides typed methods for managing fixed-storage documents, organizing them into folders, and handling deletion override workflows. Available in TypeScript, Python, and Go SDKs.
| SDK | Install | Namespace |
|---|---|---|
| TypeScript | npm install @caldera/platformxe-sdk | client.documents |
| Python | pip install platformxe | client.documents |
| Go | go get github.com/calderax/platformxe-go | client.Documents |
Create a document
const doc = await client.documents.create({
name: 'Lease Agreement - Unit 4B',
folderId: 'fld_abc123',
fileUrl: 'https://storage.example.com/lease-4b.pdf',
mimeType: 'application/pdf',
metadata: { unitId: 'unit-4b', year: 2026 },
});
console.log(doc.id); // "doc_xyz789"
doc = client.documents.create_document(
name="Lease Agreement - Unit 4B",
folder_id="fld_abc123",
file_url="https://storage.example.com/lease-4b.pdf",
mime_type="application/pdf",
metadata={"unitId": "unit-4b", "year": 2026},
)
doc, err := client.Documents.CreateDocument(map[string]interface{}{
"name": "Lease Agreement - Unit 4B",
"folderId": "fld_abc123",
"fileUrl": "https://storage.example.com/lease-4b.pdf",
"mimeType": "application/pdf",
"metadata": map[string]interface{}{"unitId": "unit-4b", "year": 2026},
})
List documents
Retrieve documents with optional filters for folder and pagination.
const result = await client.documents.list({
folderId: 'fld_abc123',
page: 1,
limit: 25,
});
for (const doc of result.documents) {
console.log(`${doc.id}: ${doc.name}`);
}
result = client.documents.list_documents(folder_id="fld_abc123", page=1)
result, err := client.Documents.ListDocuments(map[string]string{
"folderId": "fld_abc123",
"page": "1",
})
Get a document
const doc = await client.documents.get('doc_xyz789');
doc = client.documents.get_document("doc_xyz789")
doc, err := client.Documents.GetDocument("doc_xyz789")
Update a document
const updated = await client.documents.update('doc_xyz789', {
name: 'Lease Agreement - Unit 4B (Renewed)',
metadata: { unitId: 'unit-4b', year: 2026, renewed: true },
});
updated = client.documents.update_document(
"doc_xyz789",
name="Lease Agreement - Unit 4B (Renewed)",
)
updated, err := client.Documents.UpdateDocument("doc_xyz789", map[string]interface{}{
"name": "Lease Agreement - Unit 4B (Renewed)",
})
Delete a document
Deleting a protected document returns an error indicating that an override is required. Use the deletion override workflow below.
await client.documents.delete('doc_xyz789');
client.documents.delete_document("doc_xyz789")
result, err := client.Documents.DeleteDocument("doc_xyz789")
Folders
Create a folder
const folder = await client.documents.createFolder({
name: 'Contracts',
description: 'Active lease contracts',
});
folder = client.documents.create_folder(
name="Contracts",
description="Active lease contracts",
)
folder, err := client.Documents.CreateFolder(map[string]interface{}{
"name": "Contracts",
"description": "Active lease contracts",
})
Get a folder
Returns the folder record along with its child documents.
const folder = await client.documents.getFolder('fld_abc123');
folder = client.documents.get_folder("fld_abc123")
folder, err := client.Documents.GetFolder("fld_abc123")
Deletion overrides
Protected documents cannot be deleted without an approved override. The two-step flow is: request an override, then process (approve or reject) it.
Request an override
const override = await client.documents.requestOverride({
documentId: 'doc_xyz789',
reason: 'Superseded by renewed lease agreement',
requestedBy: 'admin_001',
});
console.log(override.id); // "ovr_abc123"
console.log(override.status); // "PENDING"
override = client.documents.request_override(
document_id="doc_xyz789",
reason="Superseded by renewed lease agreement",
requested_by="admin_001",
)
override, err := client.Documents.RequestOverride(map[string]interface{}{
"documentId": "doc_xyz789",
"reason": "Superseded by renewed lease agreement",
"requestedBy": "admin_001",
})
Process an override
Approve or reject a pending deletion override request.
const processed = await client.documents.processOverride('ovr_abc123', {
action: 'APPROVE',
reviewedBy: 'admin_002',
});
processed = client.documents.process_override(
"ovr_abc123",
action="APPROVE",
reviewed_by="admin_002",
)
processed, err := client.Documents.ProcessOverride("ovr_abc123", map[string]interface{}{
"action": "APPROVE",
"reviewedBy": "admin_002",
})
Scopes required
| Method | Scope |
|---|---|
documents.create() | storage:upload |
documents.list() | storage:read |
documents.get() | storage:read |
documents.update() | storage:upload |
documents.delete() | storage:delete |
documents.createFolder() | storage:upload |
documents.getFolder() | storage:read |
documents.requestOverride() | storage:delete |
documents.processOverride() | storage:delete |