Get Help

set_instance

Stores the Enterprise license key on this machine — or removes it. Works without sign-in.

Signature

cat.set_instance(license_key: str, logging_level: LoggingLevel = None) -> None

Parameters

Parameter Type Default Meaning
license_key str required The key to store. An empty string, whitespace or None removes the stored key.
logging_level LoggingLevel None cat.LoggingLevel member; used only when this is the first call of the process. See Logging.

What it does

Writes the key to %APPDATA%\CAT\.catconfig (~/.config/CAT/.catconfig on Linux), the file that identifies this installation and is shared by every CAT tool on the machine. It does not sign in — a key can be installed on a machine that has no portal access and no token. Setting a key is how the Enterprise plan is activated; once a valid key is stored, every function works offline and CAT_PORTAL_TOKEN is no longer read. The key takes effect immediately for the next call.

The key is checked before it is stored: a genuine CAT key is stored even when it is expired or not yet valid (what it unlocks is decided at every use, and a future key starts working the day its window opens); anything that is not a CAT key — a typo, a truncated paste — is refused and the stored key is left unchanged.

Returns

None.

Raises

ValueError: The license key was not set. <reason> when the key is not a CAT key. Removing a key never fails.

Examples

# activate the Enterprise plan on this machine
cat.set_instance("your-license-key")
print(cat.get_instance().LicenseKey)

# go back to no key (sign-in with CAT_PORTAL_TOKEN applies again)
cat.set_instance("")