Lumera Cascade
Reference

SN-API Reference

REST API endpoints for the Supernode API (SN-API) that handles Cascade file operations.

Base URLs

NetworkEndpoint
Testnethttps://snapi.testnet.lumera.io
Mainnethttps://snapi.lumera.io

The SDK client automatically selects the correct endpoint based on your preset configuration.

Authentication

All endpoints require an ADR-036 signature for authentication. The SDK handles this automatically, but if you are calling the API directly:

  1. Sign the relevant data (action ID for downloads, data hash for uploads) using ADR-036 signArbitrary
  2. Include the base64-encoded signature in the request body

Upload Endpoints

Start Cascade Upload

POST /api/v1/actions/cascade
Content-Type: multipart/form-data

Form Fields:

FieldTypeDescription
action_idstringAction ID from on-chain registration
signaturestringBase64 ADR-036 auth signature
filebinaryFile data

Response:

{
  "task_id": "uuid-task-id"
}

Status Codes:

CodeMeaning
200Upload started
400Invalid request (missing fields, bad signature)
404Action not found (may need retry — eventual consistency)
500Server error

The SDK retries this endpoint up to 5 times with 3-second delays. After on-chain registration, Supernodes need time to index the action.


Get Task Details

GET /api/v1/actions/cascade/tasks/{task_id}

Response:

{
  "task_id": "uuid",
  "status": "processing",
  "progress": 45,
  "created_at": "2024-01-01T00:00:00Z"
}

Get Task Status

GET /api/v1/actions/cascade/tasks/{task_id}/status

Returns a simplified status response for lightweight polling.


Download Endpoints

Request Download

POST /api/v1/actions/cascade/{action_id}/downloads
Content-Type: application/json

Request Body:

{
  "signature": "base64-encoded ADR-036 signature of the action_id"
}

Response:

{
  "task_id": "uuid-download-task-id"
}

Watch Download Status (SSE)

GET /api/v1/downloads/cascade/{task_id}/status
Accept: text/event-stream

Server-Sent Events stream with progress updates:

data: {"status": "processing", "progress": 0}

data: {"status": "processing", "progress": 50}

data: {"status": "completed", "progress": 100}

In browser environments, use EventSource:

const es = new EventSource(
  `https://snapi.testnet.lumera.io/api/v1/downloads/cascade/${taskId}/status`
);
 
es.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log(`Progress: ${data.progress}%`);
  if (data.status === "completed") {
    es.close();
  }
};

Download File

GET /api/v1/downloads/cascade/{task_id}/file

Response:

  • Content-Type: application/octet-stream
  • Binary file data (streamed)

The response can be consumed as a ReadableStream for efficient memory usage with large files.


Version Fallback

The SDK tries versioned endpoints first (/api/v1/...), then falls back to legacy paths (/api/...) on 404 responses. This ensures compatibility across SN-API versions.

If calling the API directly, prefer the /api/v1/ prefix.

Error Handling

Common error responses:

{
  "error": "action not found",
  "code": "NOT_FOUND"
}
{
  "error": "invalid signature",
  "code": "UNAUTHORIZED"
}
{
  "error": "supernodes unavailable",
  "code": "SERVICE_UNAVAILABLE"
}

Rate Limits

The public SN-API endpoints may have rate limits during high traffic. For production applications with high throughput, consider running your own Supernode.

Next Steps

On this page