Python guide
This page walks through the whole Python SDK in the order you would use it. Each step starts with the shortest code that works, then shows the other ways to write it.
Download the Python SDK or install it from PyPI if you have not done so yet.
Requirements
On Linux and macOS, pass your own systemId and storage when you create the client.
Add the SDK to your project
If you copied AuthlyX.py into your project instead, install aiohttp and cryptography and import from the file:
Create the client
The first value is your app’s AppKey. Find it in the dashboard under your application’s credentials. The second is the version of the program you are building. AuthlyX compares it with the versions you allow in the dashboard, so raise it each time you ship a new build. See Allowed Versions.
Create one client for the whole program, at module level or on your main app object, and import it wherever you need it. Creating it does not connect; nothing is sent until you call init.
Optional settings go after the version as keywords:
All of them are listed in Options.
Three ways to call the SDK
The SDK is built on asyncio. You can use it in three ways. Pick one for your program and stay with it, because the client stays attached to the event loop it first ran on.
await
Blocking
If you do not want async in your code, give the SDK its own event loop on a background thread and wait on each call with a small helper:
run(...) waits for the reply and returns the result, or raises the error. Every example on this page that uses await works the same with run(...) around the call instead.
Callback
This returns straight away and calls on_started when the reply arrives. A callback never raises: if something goes wrong, the result it receives has ok set to False with a code and message. Callbacks run on the SDK’s background thread unless you set a callback_dispatcher (see GUI apps).
Callbacks exist for init, initialize, login, registerUser, changePassword, redeemLicense, log, getVariable, updateVariable, getScript, getFeatures, getFeature, getAllMetadata, getMetadata, checkMetadata, checkFeature and sendWebhook. The rest (deviceLogin, checkSession, onResume, setMetadata, saveOfflineAccess, hasAccess, hasOfflineAccess, logout and close) are async only.
Start the SDK
Call init once, before signing in. initialize is the same method with a longer name.
init gives you a result even when something is wrong, instead of raising:
Sign in
One value is a license key, two values are a username and password, and deviceLogin signs in the current Windows user with no form. Device login only works for devices you approved first; see Device login.
When AuthlyX refuses a sign-in, await raises AuthlyXError:
str(error) is a message you can show to the user. error.code is a fixed code for your own checks, such as INVALID_CREDENTIALS, LICENSE_NOT_FOUND, LICENSE_EXPIRED, LICENSE_BANNED, DEVICE_NOT_ALLOWED or DEVICE_LIMIT_REACHED. error.kind says what sort of problem it was:
All codes are on the Errors page.
With a callback, no try is needed:
A sign-in function you can reuse:
Create an account, change the password, add time
registerUser creates a user account and signs it in. The other two need a signed-in user. All three raise AuthlyXError when they fail, and all three also accept a callback as their last value.
Read the account
After sign-in, app.userData holds the account details. You can read them as attributes or as keys:
A field that does not exist returns None as an attribute, so app.userData.Username is safe even for a license sign-in. With keys, use user.get("Plan", "") if the key may be missing. Before sign-in and after sign-out, app.userData is empty.
Functions that return text, numbers and yes/no
days_left() rounds up, so one hour left counts as 1 day.
Features and metadata
Features come from the plan and the account. Some are on/off, some carry a value such as "high" or 90. Metadata is extra information attached to accounts. See Features and metadata.
Read them from the account
These do not contact AuthlyX:
The values refresh on every heartbeat, so dashboard changes show up without signing in again. Helpers for text, numbers and yes/no values:
Copy the same three functions with metadata in place of featureValues for metadata.
Ask AuthlyX directly
getMetadata() with no key returns all metadata, like getAllMetadata().
Save metadata
Only keys you allowed for SDK writes in the dashboard can be changed.
Cloud variables
For getVariable, data is the value itself. See Cloud variables.
Scripts
The SDK checks the script’s signature before returning it. It does not run the script. See Scripts.
Logs and webhooks
log writes a line to your app’s logs in the dashboard. sendWebhook sends an event to a webhook you set up in the dashboard; the second value is any JSON-compatible dictionary.
Staying signed in
After sign-in the SDK checks in with AuthlyX in the background (a heartbeat), by default about every 10 minutes, and refreshes features and metadata each time. If you ban, pause or expire the account, the next heartbeat ends the session.
To be told when the session ends, pass a function when you create the client:
on_connection receives online, disconnected, untrusted or disposed. To check right away, call await app.checkSession(); await app.onResume() does the same and is meant for when your app wakes from sleep. To run the heartbeat yourself, pass heartbeat="manual" and call checkSession() from your own timer. More in Sessions and heartbeats.
Offline access
Later, without internet, init returns OFFLINE_MODE with ok true, and the user signs in with the same license key or username and password. The SDK checks them against the saved permit and the sign-in succeeds with the code OFFLINE_ACCESS. await app.hasOfflineAccess() tells you whether this PC has a valid saved permit. Signing out deletes it. See Offline access.
Updates
When this version is not allowed, init fails with UPDATE_REQUIRED or VERSION_MISMATCH and the SDK shows a message box with the new version, release notes and a button to open your download page. To show your own window, pass updatePrompt=False and read the details:
See Automatic updates.
Sign out and shut down
logout ends the session, clears userData and deletes saved offline access on this PC. close stops the background work; call it when your program exits. A closed client cannot be used again.
GUI apps
In a GUI, waiting on the UI thread freezes the window. Use callbacks, and pass callback_dispatcher so the SDK hands each callback to your UI thread. With Tkinter:
With PySide or PyQt, use callback_dispatcher=lambda run: QTimer.singleShot(0, run).
For the async-only calls, keep the background loop from Blocking and run them on a worker thread, or schedule them with asyncio.run_coroutine_threadsafe(app.logout(), loop).
Results and errors
Every call returns, or passes to your callback, a Result:
AuthlyXError has code, kind, status, request_id and data, and str(error) is the message.
Options
A complete program
Each method also has its own page with every language side by side under SDK methods.

