PyPI installation
Install the published package from PyPI, then let the client load credentials from .env by default.
SDK library
Python, TypeScript, and PHP are live now. Each route documents the same Dilnaka upload lifecycle in the conventions of its own runtime.
Environment-driven setup, direct-to-S3 uploads, and the current Python reference implementation.
Node 18+ uploads, typed file helpers, and fetch injection for tests or custom runtimes.
Composer installation, PHP 8.1+, Guzzle transport, and the same Dilnaka file lifecycle.
Documentation
Python SDK for uploading files through the Dilnaka Upload API. The SDK reads the API key from .env by default, asks your Dilnaka backend for a presigned S3 upload URL, uploads the file directly to S3, and then calls the completion endpoint.
Install the published package from PyPI, then let the client load credentials from .env by default.
Files go straight to S3 using a temporary presigned URL, while your backend remains the source of truth.
The SDK expects a small set of file-management endpoints from your Caspian backend.
Setup
Install the published Dilnaka Python SDK from PyPI. The package is available online now, so the old editable test install flow is no longer part of the docs.
Package: pypi.org/project/dilnaka
pip install dilnaka
Configuration
The SDK only needs your API key in .env. It is built specifically for Dilnaka Storage.
DILNAKA_API_KEY=dlk_dev_your_api_key_here
DILNAKA_TIMEOUT=60
Optional: set DILNAKA_TIMEOUT if you want a custom request timeout.
Core flow
Instantiate the client with environment defaults and upload a file with a single method call.
from dilnaka import Dilnaka
client = Dilnaka()
uploaded = client.upload("./test-upload.txt")
print(uploaded.id)
print(uploaded.key)
print(uploaded.status)
Alternate setup
Pass values directly only when you want to avoid environment variables.
from dilnaka import Dilnaka
client = Dilnaka(
api_key="dlk_dev_your_api_key_here",
)
uploaded = client.upload("./avatar.png", folder="avatars")
print(uploaded)
Quota model
Storage is the total size of the files you keep in Dilnaka. Bandwidth is the total amount of file data downloaded or served by users and applications during the current billing month.
Uploads do not count toward bandwidth. Reads and downloads do count because Dilnaka is authorizing delivery from your S3-backed file store.
Free accounts stop serving files after the included monthly bandwidth is exhausted. Paid plans can continue serving files with storage and bandwidth overage billing until the plan safety cap is reached.
Free
2 GB storage and 5 GB/month bandwidth. Best for testing and small prototypes. No overage. File serving pauses when the monthly bandwidth limit is reached.
Pro
100 GB storage and 50 GB/month bandwidth. Extra storage is billed at $0.08/GB and extra bandwidth at $0.12/GB. Service keeps running until the 500 GB monthly safety cap.
Usage-Based
250 GB storage and 150 GB/month bandwidth. Extra storage is billed at $0.08/GB and extra bandwidth at $0.12/GB. Service keeps running until the 1 TB monthly safety cap.
Backend contract
The SDK expects your Caspian backend to expose the following endpoints.
POST /v1/uploads/presign
POST /v1/uploads/complete
GET /v1/files
GET /v1/files/{file_id}
GET /v1/files/{file_id}/access-url?expiresIn=1200
DELETE /v1/files/{file_id}
Use the access-url endpoint when you need a temporary read URL for one file. Pass expiresIn in seconds to request a shorter or longer lifetime. When omitted, Dilnaka uses the app default signed URL TTL.
API payloads
{
"fileId": "clx_file_id",
"fileKey": "uploads/2026/05/clx_file_id-test.txt",
"uploadUrl": "https://s3-presigned-url",
"expiresIn": 300,
"method": "PUT",
"headers": {
"Content-Type": "text/plain"
}
}
{
"fileId": "clx_file_id",
"status": "uploaded",
"key": "uploads/2026/05/clx_file_id-test.txt",
"originalName": "test.txt",
"contentType": "text/plain",
"size": 94,
"publicUrl": null
}
{
"fileId": "clx_file_id",
"url": "https://s3-presigned-url",
"expiresIn": 1200,
"isTemporary": true
}
{
"success": false,
"error": "bandwidth_limit_exceeded",
"message": "Monthly bandwidth limit exceeded. Upgrade your plan or wait until the next billing cycle."
}
{
"success": true,
"warning": "bandwidth_overage_active",
"message": "This account has exceeded included bandwidth. Extra usage will be billed."
}
{
"success": false,
"error": "bandwidth_hard_cap_reached",
"message": "Monthly bandwidth hard cap reached. Contact Dilnaka support to continue serving files."
}
Examples
from dilnaka import Dilnaka
client = Dilnaka()
access = client.get_file_access_url(
"maext0cfjsquw2mu9o597fb9",
expires_in=1200,
)
print(access.url)
print(access.expires_in)
from dilnaka import Dilnaka
client = Dilnaka()
file_id = "maext0cfjsquw2mu9o597fb9"
result = client.delete_file(file_id)
print(result)
from dilnaka import Dilnaka
client = Dilnaka()
uploaded = client.upload("./test-upload.txt", folder="uploads")
print("Uploaded file:")
print(f" id: {uploaded.id}")
print(f" key: {uploaded.key}")
print(f" status: {uploaded.status}")
print(f" size: {uploaded.size}")
print(f" content_type: {uploaded.content_type}")
from dilnaka import Dilnaka
client = Dilnaka()
for file in client.list_files():
print(f"{file.id} | {file.status} | {file.key}")
Pricing example
Pro plan example: you get 100 GB of storage and 50 GB/month of included bandwidth. If your app serves 70 GB in one month, the extra 20 GB is billed as bandwidth overage and service keeps running. Dilnaka only blocks delivery if the plan later reaches its 500 GB monthly safety cap.
Security
The SDK never receives AWS credentials. It only receives a temporary presigned upload URL from your Dilnaka backend.
Your backend remains responsible for API key validation, scope checking, file validation, S3 key generation, metadata persistence, upload completion verification, and temporary read URL expiration.