PlatformXeDocs
Get API Key

Documents

API reference for creating, managing, and organizing fixed-storage documents.

The Documents service provides fixed storage for structured documents -- contracts, identity documents, policies, invoices, and other files that need access control, versioning, and retention management. Unlike media storage (for images and transient files), fixed storage is designed for documents with compliance and governance requirements.

Base URL

All document endpoints are under /api/v1/storage/fixed/documents.

Every document endpoint reaches the documents of a caller service within the key's organisation: those your key's caller service filed with your organisation, and those filed before PlatformXe recorded organisations (until Caldera assigns them). Another organisation's document is never listed, and reading, updating or deleting it answers 404 NOT_FOUND, even under the same caller service name. A folderId on create must be such a folder too: another organisation's folder is 404 NOT_FOUND ("Folder not found") and nothing is created.

Scope: storage:upload for every document route — reads, creates, updates and deletes alike (all /api/v1/storage/* paths map to it). Correction (2026-11-20): storage:read for a GET (list, get, stream, folders), storage:delete for a DELETE, storage:upload for every other call (create, update, overrides). 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. Keys with no scopes have full access. Correction (2026-11-01): a key with no scopes passes the document routes, but not every route — workflow writes and the permissions:manage / permissions:audit routes refuse it (see Keys with no scopes).

Create a document

POST /api/v1/storage/fixed/documents

Request body

FieldTypeRequiredDescription
titlestringYesDocument title
descriptionstringNoDocument description
categorystringYesDocument category (see categories below)
fileTypestringYesFile type: MD, PDF, DOCX, XLSX, IMAGE, or OTHER
spacestringYesPERSONAL or INTERNAL
folderIdstringNoID of the folder to place the document in
contentstringNoMarkdown content (for MD file type)
fileUrlstringNoURL of the uploaded file
fileNamestringNoOriginal filename
fileMimeTypestringNoMIME type of the file
fileSizenumberNoFile size in bytes: a non-negative whole number, at most 2,199,023,254,528 (2^31 - 1 KiB; a string of digits is read as its number). Anything else answers 400 VALIDATION_ERROR, on create and on update. On update, null clears the size. It is what your organisation's storage usage records
entityTypestringNoRelated entity type (e.g., BOOKING, PROPERTY)
entityIdstringNoRelated entity ID
accessLevelstringNoAccess level: SUPER_ADMIN, MANAGEMENT, FINANCE, OPERATIONS, STAFF, STAKEHOLDER, or CUSTOM. Default: STAKEHOLDER
visibilitystringNoVisibility: PRIVATE, SHARED, or PORTAL. Default: PRIVATE
allowedGroupsstring[]NoGroups that can access this document
allowedEntitiesstring[]NoSpecific entity IDs with access
retentionTypestringNoNONE, STANDARD, EXTENDED, LEGAL, or PERMANENT. Default: STANDARD
retentionUntilstringNoISO 8601 date for retention expiry
deletableBystringNoWho can delete: OWNER, ADMIN, SUPER_ADMIN, or NONE

Document categories

IDENTITY_DOCUMENT, CONTRACT, INVOICE, RECEIPT, POLICY, REPORT, CERTIFICATE, LICENSE, INSURANCE, TAX_DOCUMENT, BANK_DOCUMENT, PAYSLIP, OFFER_LETTER, NDA, MEMO, TRAINING_MATERIAL, SOP, MEETING_NOTES, LEGAL, COMPLIANCE, OTHER

Response

{
  "success": true,
  "data": {
    "id": "doc_abc123",
    "title": "Employment Contract - Ade Bakare",
    "category": "CONTRACT",
    "fileType": "PDF",
    "space": "INTERNAL",
    "accessLevel": "STAFF",
    "visibility": "SHARED",
    "version": 1,
    "retentionType": "LEGAL",
    "deletableBy": "SUPER_ADMIN",
    "isLatest": true,
    "canDelete": false,
    "deletionRequiresOverride": true,
    "createdAt": "2026-04-05T10:00:00.000Z",
    "updatedAt": "2026-04-05T10:00:00.000Z"
  }
}

List documents

GET /api/v1/storage/fixed/documents

Query parameters

ParameterTypeDescription
ownerTypestringFilter by owner type: ADMIN, AGENT, PARTNER, SYSTEM
ownerIdstringFilter by owner ID
spacestringFilter by space: PERSONAL or INTERNAL
categorystringFilter by document category
fileTypestringFilter by file type
visibilitystringFilter by visibility
folderIdstringFilter by folder
searchstringFull-text search on title and description
pagenumberPage number (default: 1)
limitnumberResults per page (default: 20, max: 100)

Response

{
  "success": true,
  "data": {
    "documents": [...],
    "total": 42,
    "page": 1,
    "limit": 20,
    "totalPages": 3
  }
}

Get a document

GET /api/v1/storage/fixed/documents/:documentId

Returns the full document record including metadata, access counts, and retention information.

Stream a document for viewing

GET /api/v1/storage/fixed/stream?id={documentId}

Returns the document's bytes inline, for a view-only viewer, with an optional watermark burned in on PlatformXe's side. The storage URL never reaches the browser: your server calls this route and passes the bytes on.

ParameterInRequiredDescription
idqueryYesThe document's id (or its slug)
x-caldera-watermarkheaderNoThe watermark text, UTF-8, base64-encoded (a header rather than the query string, so the viewer's name or email stays out of access logs). A missing, blank or undecodable value streams the document without a watermark

A PDF is stamped on every page and stays a PDF; an image is stamped and returned as PNG; any other type is streamed unchanged. A file that cannot be stamped (a malformed or encrypted PDF, an unreadable image) is streamed without the watermark rather than refused.

curl "https://api.platformxe.com/api/v1/storage/fixed/stream?id=doc_abc123" \
  -H "x-api-key: pxk_live_your_api_key_here" \
  -H "x-caldera-watermark: $(printf 'Viewed by ade@example.com' | base64)" \
  -o view.pdf

The 200 answer is the file itself, not the JSON envelope, with Content-Type (the document's, or image/png for a stamped image), Content-Disposition: inline; filename="…", Cache-Control: no-store, no-cache, must-revalidate, private and X-Content-Type-Options: nosniff. Errors use the JSON envelope:

CodeStatusDescription
VALIDATION_ERROR400id is missing
NOT_FOUND404No such document for your key (another organisation's included), it has no file, or its bytes are not in storage
DOCUMENT_UNAVAILABLE409The document's file cannot be read (it predates the current storage, or its URL cannot be resolved); the message says which
INTERNAL_ERROR500The file could not be streamed

Update a document

PATCH /api/v1/storage/fixed/documents/:documentId

Request body

FieldTypeDescription
titlestringUpdated title
descriptionstringUpdated description
categorystringUpdated category
contentstringUpdated markdown content (MD files)
accessLevelstringUpdated access level
visibilitystringUpdated visibility
retentionTypestringUpdated retention type
retentionUntilstringUpdated retention expiry
isArchivedbooleanArchive or unarchive the document

All fields are optional. Only provided fields are updated.

Delete a document

DELETE /api/v1/storage/fixed/documents/:documentId

Performs a soft delete. Documents with deletableBy: "NONE" or restricted deletableBy settings may require a deletion override before deletion is permitted.

Examples

Create a contract document

curl

curl -X POST https://api.platformxe.com/api/v1/storage/fixed/documents \
  -H "Content-Type: application/json" \
  -H "x-api-key: pxk_live_your_api_key_here" \
  -d '{
    "title": "Employment Contract - Ade Bakare",
    "category": "CONTRACT",
    "fileType": "PDF",
    "space": "INTERNAL",
    "fileUrl": "https://cdn.platformxe.com/org_123/contracts/ade-bakare.pdf",
    "fileName": "ade-bakare-contract.pdf",
    "fileMimeType": "application/pdf",
    "fileSize": 245760,
    "accessLevel": "STAFF",
    "visibility": "SHARED",
    "retentionType": "LEGAL",
    "deletableBy": "SUPER_ADMIN"
  }'

TypeScript SDK

import { PlatformXeClient } from '@caldera/platformxe-sdk';

const px = new PlatformXeClient({ apiKey: 'pxk_live_your_api_key_here' });

const doc = await px.documents.create({
  title: 'Employment Contract - Ade Bakare',
  category: 'CONTRACT',
  fileType: 'PDF',
  space: 'INTERNAL',
  fileUrl: 'https://cdn.platformxe.com/org_123/contracts/ade-bakare.pdf',
  fileName: 'ade-bakare-contract.pdf',
  fileMimeType: 'application/pdf',
  fileSize: 245760,
  accessLevel: 'STAFF',
  visibility: 'SHARED',
  retentionType: 'LEGAL',
  deletableBy: 'SUPER_ADMIN',
});

console.log(doc.id);
// "doc_abc123"

Python SDK

from platformxe import PlatformXeClient

px = PlatformXeClient(api_key="pxk_live_your_api_key_here")

doc = px.documents.create({
    "title": "Employment Contract - Ade Bakare",
    "category": "CONTRACT",
    "fileType": "PDF",
    "space": "INTERNAL",
    "fileUrl": "https://cdn.platformxe.com/org_123/contracts/ade-bakare.pdf",
    "accessLevel": "STAFF",
    "visibility": "SHARED",
    "retentionType": "LEGAL",
    "deletableBy": "SUPER_ADMIN"
})

List documents in a folder

const result = await px.documents.list({
  folderId: 'fld_contracts',
  category: 'CONTRACT',
  page: 1,
  limit: 50,
});

console.log(result.total);
// 12

Search documents

curl "https://api.platformxe.com/api/v1/storage/fixed/documents?search=employment&category=CONTRACT" \
  -H "x-api-key: pxk_live_your_api_key_here"

Update access level

await px.documents.update('doc_abc123', {
  accessLevel: 'MANAGEMENT',
  visibility: 'PORTAL',
});

Error responses

CodeStatusDescription
BAD_REQUEST400Missing required fields (title, category, fileType, space, ownerType, ownerId)
VALIDATION_ERROR400fileType, space, ownerType, accessLevel, or visibility is not one of its allowed values — the response names the field and lists the allowed values
INVALID_CATEGORY400category isn't registered for this caller service in your organisation (only when your organisation has opted into category enforcement for it; the category registry and its settings are per organisation, so another organisation using the same caller name never affects yours; see Document Categories & Settings)
FORBIDDEN403API key lacks required scope, or the actor's access level/role is insufficient for this action (e.g. only Super Admins may set accessLevel: "SUPER_ADMIN" or change retention settings)
NOT_FOUND404Document (or its folder, for folderId) does not exist, has been deleted, or is another organisation's
DELETE_BLOCKED403Document cannot be deleted without an approved deletion override — the response names the reason (e.g. active legal retention)
QUOTA_EXCEEDED422Uploading to folderId would exceed that folder's file-count or storage-byte limit
RATE_LIMITED429Rate limit exceeded