Python SDK
The appliku package includes a Python SDK for programmatic access to the Appliku API. It uses the same token resolution as the CLI, so if you have already run appliku login you can use the SDK without any extra setup.
Quick start
Create a client using the saved token or the APPLIKU_TOKEN environment variable:
from appliku import Appliku
client = Appliku()
Or pass the token explicitly:
from appliku import Appliku
client = Appliku(token="YOUR_API_TOKEN")
List your teams and their apps:
from appliku import Appliku
client = Appliku()
for team in client.teams.list():
print(team.team_path, team.plan)
apps = client.apps.list(team.team_path)
for app in apps:
print(" ", app.id, app.name, app.last_deployment_status)
Resources
All resources are accessed as properties on the Appliku client instance:
| Property | What it manages |
|---|---|
client.apps | Applications and their logs, config vars |
client.teams | Teams you belong to |
client.deployments | Deployment history and build logs |
client.domains | Custom domains and DNS verification |
client.datastores | Attached databases, caches, etc. |
client.volumes | Persistent volumes |
client.cron_jobs | Scheduled cron jobs |
client.clusters | Docker Swarm clusters |
client.servers | Servers attached to a team |
client.invites | Team member invitations |
client.migrations | Database migration runs |
SDK Reference
apps
# List all applications in a team
client.apps.list("my-team")
# Get a single application
client.apps.get("my-team", app_id=42)
# Create an application
client.apps.create("my-team", name="my-app", branch="main")
# Update an application
client.apps.update("my-team", app_id=42, branch="develop")
# Delete an application
client.apps.delete("my-team", app_id=42)
# Trigger a deployment
client.apps.deploy("my-team", app_id=42)
# Read and write environment variables
vars = client.apps.get_config_vars("my-team", app_id=42)
client.apps.set_config_vars("my-team", app_id=42, vars={"DEBUG": "false", "LOG_LEVEL": "info"})
# Application-level logs (async fetch, one or more processes)
logs = client.apps.get_logs("my-team", app_id=42, process="web", tail=100)
print(logs)
# Service logs (direct single-request fetch)
logs = client.apps.get_service_logs("my-team", app_id=42, service="web", tail=100)
# Nginx access logs for a domain
logs = client.apps.get_nginx_logs("my-team", app_id=42, domain="example.com", tail=100)
# Load balancer logs for a domain
logs = client.apps.get_load_balancer_logs("my-team", app_id=42, domain="example.com", tail=100)
teams
# List all teams
client.teams.list()
# Get details for one team
client.teams.get("my-team")
deployments
# List deployments for an app
client.deployments.list("my-team", app_id=42)
# Get a specific deployment
client.deployments.get("my-team", app_id=42, deployment_id=1234)
# Get the latest deployment
latest = client.deployments.latest("my-team", app_id=42)
print(latest.status)
# Fetch build logs for a deployment
logs = client.deployments.logs("my-team", deployment_id=1234)
for entry in logs:
print(entry.log)
domains
# List domains for an app
client.domains.list("my-team", app_id=42)
# Get a single domain
client.domains.get("my-team", app_id=42, domain_id=7)
# Add a domain
client.domains.create("my-team", app_id=42, domain="example.com")
# Remove a domain
client.domains.delete("my-team", app_id=42, domain_id=7)
# Check DNS configuration
result = client.domains.check_dns("my-team", app_id=42, domain="example.com")
print(result.is_valid, result.a_records)
datastores
client.datastores.list("my-team", app_id=42)
client.datastores.get("my-team", app_id=42, datastore_id=5)
client.datastores.create("my-team", app_id=42, name="mydb", kind="postgresql")
client.datastores.delete("my-team", app_id=42, datastore_id=5)
client.datastores.start("my-team", app_id=42, datastore_id=5)
client.datastores.stop("my-team", app_id=42, datastore_id=5)
client.datastores.restart("my-team", app_id=42, datastore_id=5)
volumes
client.volumes.list("my-team", app_id=42)
client.volumes.get("my-team", app_id=42, volume_id=3)
client.volumes.create("my-team", app_id=42, name="uploads", mount_path="/app/uploads")
client.volumes.update("my-team", app_id=42, volume_id=3, mount_path="/app/media")
client.volumes.delete("my-team", app_id=42, volume_id=3)
cron_jobs
client.cron_jobs.list("my-team", app_id=42)
client.cron_jobs.create("my-team", app_id=42, schedule="0 * * * *", command="python manage.py clearsessions")
client.cron_jobs.update("my-team", app_id=42, cron_id=8, schedule="30 2 * * *")
client.cron_jobs.delete("my-team", app_id=42, cron_id=8)
clusters
client.clusters.list("my-team")
client.clusters.get("my-team", cluster_id=2)
client.clusters.create("my-team", name="prod-cluster")
client.clusters.delete("my-team", cluster_id=2)
servers
client.servers.list("my-team")
client.servers.get("my-team", server_id=10)
invites
client.invites.list("my-team")
client.invites.create("my-team", email="colleague@example.com")
client.invites.delete("my-team", invite_id=4)
migrations
client.migrations.list("my-team")
client.migrations.run("my-team", app_id=42, command="python manage.py migrate")
client.migrations.logs("my-team", migration_id=99)
Error handling
The SDK raises typed exceptions so you can handle specific failure cases:
from appliku import Appliku, AuthenticationError, NotFoundError, RateLimitError
client = Appliku()
try:
team = client.teams.get("missing-team")
except AuthenticationError:
print("Invalid or missing token — run `appliku login` or set APPLIKU_TOKEN")
except NotFoundError:
print("Team not found")
except RateLimitError:
print("Too many requests, back off and retry")
All exceptions inherit from AplikuError and include the HTTP status code and raw response. Available exception types:
| Exception | HTTP status | When raised |
|---|---|---|
AplikuError | any | Base class for all SDK exceptions |
AuthenticationError | 401 | Missing or invalid token |
AuthorizationError | 403 | Token lacks permission for the action |
NotFoundError | 404 | Resource does not exist |
ValidationError | 400 | Invalid request data |
RateLimitError | 429 | Too many requests |
ServerError | 5xx | Appliku API server error |
Import exceptions from the top-level package:
from appliku import AplikuError, AuthenticationError, AuthorizationError, NotFoundError, ValidationError, RateLimitError, ServerError