Skip to main content
The Python and TypeScript SDKs provide typed clients for the Arct Cloud API. Source, examples and changelogs are in ArctCloud/sdk. The Python package also includes arct and python -m arct for terminal automation; see the CLI installation guide, including the macOS/Linux shell installer.

Install the Preview

Install an exact preview from PyPI or npm:

Install from Source

The datacenter examples below require the merged source versions: Python 0.1.0rc4 or TypeScript 0.1.0-rc.5. Those versions are not yet published to PyPI or npm; the published previews above do not include datacenter support.
With Git installed, clone the source into your project directory:
The TypeScript commands build the local package before adding it to your application. Keep that checkout while using a local file dependency.

Authenticate and Read Resources

Create a token in Settings > API Tokens. Choose Read only for queries and Read & write for mutations. Supply it through your environment or secret manager:
Explicit token= in Python or { token } in TypeScript overrides ARCT_TOKEN. Both SDKs use https://api.arct.cloud/v1 by default. Keep tokens server-side; never embed them in browser code.
list() lazily retrieves every page, using 100 items per page by default and preserving filters. Python list_page() and TypeScript listPage() return one page with its pagination metadata. Page-number results can change while resources are being added or removed. See Pagination. Discover codes with datacenters.list(). Datacenter codes are case-insensitive and match ^[A-Za-z]{2,5}[0-9]{1,2}$. Server, plan and image lists accept datacenter; a plan’s in_stock reflects the selected datacenter when that filter is supplied. locations.list() remains available. Legacy location fields and filters remain accepted but deprecated; Python emits DeprecationWarning when they are supplied.

Create and Wait for a Server

These examples charge the saved card and require a read_write token. SDK methods do not prompt. Review the datacenter, plan and billing period before running a creation example.
These examples use datacenter ams2 and plan hvm.nano. Confirm the plan is available with plans.list(datacenter="ams2") in Python or plans.list({ datacenter: 'ams2' }) in TypeScript. Choose a compatible image filtered by the same datacenter and a saved public key matching your local private key. These examples use the saved key name my-laptop; add your public key in SSH Keys first. Replace TARGET_PLAN below with the target resize plan. Creation requires hostname, plan, image_id, and at least one of datacenter or legacy location. Both placement fields may be supplied when they agree. An unavailable plan/datacenter combination returns 400 datacenter_unavailable; conflicting placement fields return 422 datacenter_mismatch.
Run the printed SSH command using the private key matching the selected public key. Creation returns HTTP 201 with an order and a server that may still be provisioning or null. Waiters resolve acknowledged delayed creations and return the final server. Pre-orders can outlive the default 600-second deadline. Python async resource calls use the same arguments with await; list() remains an async iterator. Use async with AsyncArct() to close the client. Keep the original result: waiting does not overwrite its order or one-time password. Passwords are masked in normal representations and JSON. Deliberately unwrap a non-null password with Python result.password.get_secret_value() or TypeScript result.password.getSecretValue() only when needed. Omitted ssh_key_ids uses saved keys; an explicit empty array requests password access where supported. See Creating Servers.

Lifecycle and Completion

Start, stop, restart and reinstall return accepted HTTP 202 responses. Pass the original action result to a waiter: a bare server ID checks current status, while the original restart/reinstall result retains transition tracking. An initial stale running observation cannot prove those operations completed; a missed transition can time out as unverified. Waiters poll every 5 seconds by default. Python uses timeout in seconds; TypeScript uses timeoutMs in milliseconds. Timeouts expose last_state in Python or lastState in TypeScript. Cancellation stops waiting and does not cancel an accepted remote operation. Cancel an async Python task or pass an AbortSignal in the final TypeScript request/wait options.

Resize Safely

Stop the server and wait for stopped before resizing. resize() obtains an eligible quote and sends its exact amount_due_today as expected_amount. To retain an already reviewed quote, supply that amount explicitly. A price_changed conflict requires a new decision; it is never silently re-quoted. Python servers.wait_resize(id, resize_result) and TypeScript servers.waitUntil(id, 'stopped', { plan: 'TARGET_PLAN' }) check resize completion. HTTP 200 applied and 202 pending_payment are distinct. A pending payment may need dashboard action. Start the server only after the requested plan is confirmed applied; resizing and waiting never start it automatically. Python monetary responses use Decimal. TypeScript monetary responses are JavaScript numbers, while automatic resize quoting preserves the original numeric text. Use a decimal string for an explicit TypeScript amount. Explicit Python expected_amount=None or TypeScript expected_amount: null opts out of price protection and accepts the current API price.

Errors and Retry Safety

Both SDKs export APIError and typed errors including AuthenticationError, PaymentRequiredError, PermissionDeniedError, NotFoundError, ConflictError, ValidationError, RateLimitError, ChargeUnknownError, UncertainOperationError, WaitTimeoutError and OperationFailedError. API errors expose status, code and redacted details; validation errors also expose fields. Unknown error codes fall back to their HTTP status class. See the error reference for codes.
  • Reads and eligible creation failures have at most three total attempts; creation retries retain the identical body and hostname. Other uncertain mutations are not blindly repeated.
  • 429 honors Retry-After within the operation deadline. Local scheduling complements the server’s rate limits.
  • details.order_intent_id or 409 payment_pending raises ChargeUnknownError without retrying. Keep support identifiers and verify billing before another purchase.
  • A lost response or a matching hostname cannot prove a successful order or recover its one-time password. UncertainOperationError requires reconciliation before repeating the action.
Creation reconciliation compares placement without case sensitivity. Legacy location="LON" matches the location lon; a numbered alias such as location="lon1" matches server.datacenter. A missing or null datacenter cannot confirm that alias match. Candidate matches remain uncertain and never fabricate a successful order or trigger another create after a hostname conflict.

Available Resources and Limits

Shared resources are account, servers, datacenters, locations, plans, images, invoices, and Python ssh_keys / TypeScript sshKeys. New response fields and enum strings are accepted. Server.datacenter may be null until placement is known and absent from older responses; additive Location.datacenters and Plan.datacenters may also be absent. You can enable automatic backups during server creation with Python enable_backups=True or TypeScript enable_backups: true, where the selected plan supports them. There are no backup/snapshot management endpoints or SDK management methods. Use the dashboard for backup and snapshot management. Token issuance/revocation, cards, password resets and VNC also remain dashboard operations. For API invoice payment with account credit, see Account Credit; the source Python SDK exposes invoices.pay(id, payment_method="credit"), while that method is not part of the shared TypeScript SDK surface.