Client REST API Reference & Examples
All client endpoints are prefixed with /v1 and accept either X-API-Key: <api_key> or Authorization: Bearer <jwt>.
1. Upload & Encrypt File Stream (POST /v1/files/upload)
Streams a file in multipart/form-data format, encrypting it in O(1) RAM with AES-256-GCM.
Always place metadata fields (logical_path, custom_metadata, retain_days, expires_in_days) before the binary file part in your multipart/form-data request so Arkhos can stream the file body immediately without buffering.
Request (cURL)
curl -sS -X POST "http://127.0.0.1:8080/v1/files/upload" \
-H "X-API-Key: ${ARKHOS_API_KEY}" \
-F "logical_path=finance/2026/q4-audit-report.pdf" \
-F 'custom_metadata={"category":"invoice","author":"cfo@acme.corp"}' \
-F "retain_days=365" \
-F "file=@./q4-audit-report.pdf"
Response (201 Created)
{
"id": "01a2228e-13ac-76d9-bd11-3c1779edf8b9",
"client_id": "01a2228d-1613-7278-9c5a-b889d838662b",
"logical_path": "finance/2026/q4-audit-report.pdf",
"version": 1,
"is_latest": true,
"original_filename": "q4-audit-report.pdf",
"mime_type": "application/pdf",
"size_plaintext_bytes": 123,
"size_encrypted_bytes": 139,
"sha256_plaintext": "de8d44bedb90951c4c57e3a4202960e5c828416337b59a7a42c5742c1a036c6e",
"upload_mode": "STREAM_ENVELOPE",
"status": "AVAILABLE",
"custom_metadata": {
"author": "cfo@acme.corp",
"category": "invoice"
},
"retain_until": "2027-11-28T14:27:47Z",
"created_at": "2026-11-28T14:27:46Z"
}
2. List & Filter Files (GET /v1/files)
Lists files in the client's Big Bucket with support for folder prefix filtering, JSONB custom metadata filtering (metadata.<key>=<value>), version history toggle, and cursor pagination.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
prefix | string | Filter by logical_path folder prefix (e.g., finance/2026/). |
include_versions | boolean | When true, returns all versions (v1, v2...). Defaults to false (only is_latest = true). |
metadata.<key> | string | Filter by any JSONB key inside custom_metadata (e.g., metadata.category=invoice). |
limit | int | Maximum items per page (1..100, default 50). |
cursor | string | Opaque pagination cursor returned in next_cursor. |
Request (cURL)
curl -sS "http://127.0.0.1:8080/v1/files?prefix=finance/2026/&metadata.category=invoice&include_versions=true&limit=20" \
-H "X-API-Key: ${ARKHOS_API_KEY}"
Response (200 OK)
{
"items": [
{
"id": "01a2228e-19a9-7a44-94c9-27e9a35c563c",
"client_id": "01a2228d-1613-7278-9c5a-b889d838662b",
"logical_path": "finance/2026/q4-audit-report.pdf",
"version": 2,
"is_latest": true,
"original_filename": "q4-audit-report.pdf",
"mime_type": "application/pdf",
"size_plaintext_bytes": 145,
"size_encrypted_bytes": 161,
"sha256_plaintext": "7fdea68f5dc3cc0e3d03f8c264927a92140119a92a54b2f45c6782d88e2524a1",
"upload_mode": "STREAM_ENVELOPE",
"status": "AVAILABLE",
"custom_metadata": {
"author": "cfo@acme.corp",
"category": "invoice"
},
"created_at": "2026-11-28T14:27:47Z"
}
],
"next_cursor": ""
}
3. Get File Metadata (GET /v1/files/{id})
Returns metadata for a specific file version by UUIDv7. Also triggers a Lazy Status Check if the file was in PENDING_UPLOAD past its upload_expires_at deadline.
curl -sS "http://127.0.0.1:8080/v1/files/01a2228e-19a9-7a44-94c9-27e9a35c563c" \
-H "X-API-Key: ${ARKHOS_API_KEY}"
4. Download Decrypted Content & Byte Ranges (GET /v1/files/{id}/content)
Streams the decrypted file payload (200 OK) or decrypts only the requested byte slice (206 Partial Content when Range: bytes=start-end is sent).
# Full decrypted stream download
curl -sS "http://127.0.0.1:8080/v1/files/01a2228e-19a9-7a44-94c9-27e9a35c563c/content" \
-H "X-API-Key: ${ARKHOS_API_KEY}" \
-o q4-audit-report.pdf
# Partial byte-range download (HTTP 206 Partial Content)
curl -i "http://127.0.0.1:8080/v1/files/01a2228e-19a9-7a44-94c9-27e9a35c563c/content" \
-H "X-API-Key: ${ARKHOS_API_KEY}" \
-H "Range: bytes=0-63"
5. Generate Temporary Download URL (POST /v1/files/{id}/presign-download)
Generates a temporary download link (HMAC-SHA256 token URL for STREAM_ENVELOPE files, or native cloud pre-signed GET URL for PRESIGNED_CLOUD files).
Request (cURL)
curl -sS -X POST "http://127.0.0.1:8080/v1/files/01a2228e-19a9-7a44-94c9-27e9a35c563c/presign-download" \
-H "X-API-Key: ${ARKHOS_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"ttl_seconds": 300,
"disposition": "inline"
}'
Response (200 OK)
{
"file_id": "01a2228e-19a9-7a44-94c9-27e9a35c563c",
"download_url": "/v1/files/01a2228e-19a9-7a44-94c9-27e9a35c563c/download?token=eyJmaWxlX2lkI...",
"expires_at": "2026-11-28T14:32:49Z"
}
6. Pre-Sign Direct Cloud Upload (POST /v1/files/presign-upload) & Confirm (POST /v1/files/{id}/confirm)
Step A: Request Pre-Signed Upload Slot
curl -sS -X POST "http://127.0.0.1:8080/v1/files/presign-upload" \
-H "X-API-Key: ${ARKHOS_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"logical_path": "backups/2026-11/db-snapshot.tar.zst",
"content_type": "application/zstd",
"max_size_bytes": 104857600,
"ttl_seconds": 900,
"custom_metadata": {"env": "production"}
}'
Response (201 Created)
{
"file_id": "01a22300-44b1-7c10-8a11-90123456789a",
"logical_path": "backups/2026-11/db-snapshot.tar.zst",
"version": 1,
"status": "PENDING_UPLOAD",
"method": "PUT",
"upload_url": "https://...",
"required_headers": {
"Content-Type": "application/zstd"
},
"max_size_bytes": 104857600,
"upload_expires_at": "2026-11-28T14:45:00Z"
}
Step B: Confirm Completed Upload
curl -sS -X POST "http://127.0.0.1:8080/v1/files/01a22300-44b1-7c10-8a11-90123456789a/confirm" \
-H "X-API-Key: ${ARKHOS_API_KEY}"
7. Soft Delete & Crypto-Shredding (DELETE /v1/files/{id})
?shred=false(default): Logical soft-delete (status = DELETED).?shred=true: Crypto-Shredding — overwritesencrypted_dekandnonce_prefixwithNULL, setsstatus = SHREDDED, and deletes the physical ciphertext object from the storage bucket.- If the file has an active WORM retention lock (
retain_until > NOW()), Arkhos rejects both operations withHTTP 423 Locked(WORM_LOCKED).
curl -sS -X DELETE "http://127.0.0.1:8080/v1/files/01a2228e-19a9-7a44-94c9-27e9a35c563c?shred=true" \
-H "X-API-Key: ${ARKHOS_API_KEY}"
8. Query & Verify Hash-Chained Audit Trail (GET /v1/audit-logs)
Returns the client's immutable audit events and optionally verifies the cryptographic SHA-256 hash chain (verify=true).
curl -sS "http://127.0.0.1:8080/v1/audit-logs?limit=10&verify=true" \
-H "X-API-Key: ${ARKHOS_API_KEY}"
Response (200 OK)
{
"items": [
{
"id": 8,
"chain_key": "01a2228d-1613-7278-9c5a-b889d838662b",
"seq_num": 8,
"client_id": "01a2228d-1613-7278-9c5a-b889d838662b",
"actor": "apikey:01a2228d-162f-7ab2-8988-21f53128dbc5",
"action": "FILE_SHREDDED",
"resource_type": "FILE",
"resource_id": "01a2228e-19a9-7a44-94c9-27e9a35c563c",
"prev_hash": "61e5d2ff31a1e39983...",
"entry_hash": "a576ad45ebca3bf8a1...",
"created_at": "2026-11-28T14:27:51Z"
}
],
"verification": {
"chain_key": "01a2228d-1613-7278-9c5a-b889d838662b",
"valid": true,
"entries_checked": 8
}
}