Skip to main content
v5 is a rewrite. The SDK is now synchronous by default (with an await facade), has zero dependencies, groups methods by resource, returns plain dicts (TypedDict) and raises a single exception type. It covers all 67 operations of the Square Cloud API.

At a glance

Construction and options

Method by method

Application methods map to the same calls with the id: app.logs() → client.apps.logs(app.id), app.files_list(path) → client.apps.files.list(app.id, path), and so on.

Types

Responses are TypedDicts in squarecloud.types, named as in the JS and Go SDKs: Account, User, Plan, AppSummary, DatabaseSummary, App, AppCreated, StatusListItem, RuntimeStats, MetricPoint, AppDomain, LoadBalancers, DeployEvent, DeployCurrent, DeployRepository, LinkedRepository, EnvVars, FileEntry, Snapshot, SnapshotCreated, SnapshotScope, AnalyticsFilters, NetworkAnalytics, NetworkErrors, NetworkLog, NetworkPerformance, DNSRecord, Database, DatabaseCreated, DatabaseType, Workspace, WorkspaceCreated, WorkspaceGroup, ServiceStatus, ServiceEntry, ChatRequest, ChatMessage, ChatCompletion, RealtimeEvent, RealtimeStatus. They replace the v4 data/* dataclasses (UserData, StatusData, AppData, …). squarecloud.Response is now the transport’s response protocol (see Custom transport); the v4 Response that mutations returned is gone, and they return None.

Errors

str(e) is '<METHOD> <path>: HTTP <status> <CODE>: <message>', without HTTP <status> when the status is 0 and without : <message> when it is empty. e.message is '' when the server sent only a code.

Behavior changes

  • Optional modifiers are keyword-only: account.snapshots(scope=), apps.status_all(workspace_id=), apps.status(id, raw=), databases.status(id, raw=), apps.commit(id, file, path=, filename=), apps.network.errors(..., include_4xx=), apps.network.analytics(...) filters, databases.update(id, name=, ram=) and databases.create(name, type=, version=, memory=). The optional path of apps.files.list stays positional.
  • A 2xx {"status": "error"} body raises. App and database start/stop refusals are 409 with only a code (CONTAINER_ALREADY_STARTED, ACTION_FAILED, …). A 202 SNAPSHOT_PROCESSING returns {'pending': True} instead of raising: poll list, never call create again.
  • Unset optional query values (and '') are omitted instead of being sent.
  • String results are never None: reset_credentials(id, 'certificate') and a removed webhook return ''.
  • apps.files.write sends a str as text and bytes base64-encoded; empty content creates an empty file; content over 1 MiB is sent without a timeout. apps.files.read always asks for base64 and returns the decoded bytes.
  • apps.files.list of a missing directory raises 404 FILE_NOT_FOUND.
  • 503 DATABASE_UNAVAILABLE is retried on GET only, since it can fire after a mutation was applied; retrying an idempotent mutation is up to the caller.
  • The realtime stream yields {'event', 'data', 'id', ...} events, reopens at most 3 times in a row at one open per 5.5 s, and raises when an open fails.

Async

v4 was async only. In v5, SquareCloud is synchronous and AsyncSquareCloud is the await facade: the same groups and methods, each call run in asyncio.to_thread, so the event loop is never blocked. The realtime stream becomes async for (a reader thread feeds the loop); close it with async with or close(). v4:
v5:

Next steps

Client

Install the SDK and create a client.

Errors

Error class, retries and rate limits.