Skip to content

Storage

Overview

Centrali's Storage service provides secure file storage and management integrated with your workspace. Upload, download, and manage files that can be referenced from records and accessed by compute functions.

Key Features

  • Secure storage: Files are scoped to your workspace
  • Large file support: Upload files up to 5 GB
  • Access control: Workspace-level permissions
  • Integration: Reference files from records
  • CDN: Fast file delivery via Azure Blob Storage

Uploading Files

curl -X POST https://api.centrali.io/workspace/my-workspace/api/v1/storage/upload \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "file=@/path/to/file.pdf" \
  -F "path=documents/file.pdf"

Response:

{
  "id": "file_abc123",
  "path": "documents/file.pdf",
  "size": 1048576,
  "contentType": "application/pdf",
  "url": "https://storage.centrali.io/workspace/my-workspace/documents/file.pdf"
}

Downloading Files

curl -X GET https://api.centrali.io/workspace/my-workspace/api/v1/storage/download/documents/file.pdf \
  -H "Authorization: Bearer YOUR_TOKEN" \
  --output file.pdf

Listing Files

curl -X GET https://api.centrali.io/workspace/my-workspace/api/v1/storage/list?prefix=documents/ \
  -H "Authorization: Bearer YOUR_TOKEN"

Deleting Files

curl -X DELETE https://api.centrali.io/workspace/my-workspace/api/v1/storage/documents/file.pdf \
  -H "Authorization: Bearer YOUR_TOKEN"

Referencing Files in Records

Store file references in record properties:

{
  "name": "invoice",
  "properties": [
    { "name": "invoiceNumber", "type": "string" },
    { "name": "pdfFile", "type": "string" }
  ]
}

Create record with file reference:

{
  "invoiceNumber": "INV-001",
  "pdfFile": "documents/invoices/INV-001.pdf"
}

Using Storage in Functions

export async function handler(event, context) {
  // Upload file
  await context.storage.upload('reports/daily.csv', csvData);

  // Download file
  const data = await context.storage.download('reports/daily.csv');

  // List files
  const files = await context.storage.list('reports/');

  // Delete file
  await context.storage.delete('reports/old.csv');
}

Best Practices

  • Use organized folder structure (e.g., documents/invoices/, images/products/)
  • Include file type in path for easier management
  • Clean up unused files regularly
  • Use appropriate file names (no spaces, special characters)

Limits

  • Max file size: 5 GB
  • Storage quota: 100 GB per workspace (default)
  • Upload rate: 100 requests/minute