Authentication
Manage your API keys and the apps signed in as you.
Access it as client.auth on a Strongly client, or the same path on AsyncStrongly with await. All methods exist on both with identical signatures.
Methods
All methods
create_key
create_key(*, name: str, scopes: Sequence[str], expires_in_days: int | None = None) -> ApiKeyCreateResponse
Create an API key for yourself.
The key belongs to you and your organization. Its secret is returned only in this response.
Parameters
name(str): The key's name, unique among your active keys (surrounding spaces are trimmed).scopes(Sequence[str]): What the key may do: at least one scope, such as"apps:read"or"workflows:write", or a bundle ("read-only","developer","ci-cd","ml-ops","full-access") or"*".expires_in_days(int | None, optional): Days until the key expires. The API's default is a key that never expires.
Returns
ApiKeyCreateResponse: The new key, with its secret inkey.
Raises
ValidationError:scopesis empty or names an unknown scope, ornameis blank.ConflictError: You already have an active key with this name (error_codeduplicate).
Examples
>>> created = client.auth.create_key(name="ci", scopes=["apps:read"]) >>> ci_client = Strongly(api_key=created.key, base_url="https://strongly.example.com")
delete_key
delete_key(key_id: str) -> None
Delete one of your API keys that no longer works (revoked or expired).
It leaves your list. A key that still works is refused: revoke it first.
Parameters
key_id(str): The key's id.
Raises
NotFoundError: You have no key with this id.ConflictError: The key still works.
list_app_sign_ins
list_app_sign_ins(*, limit: int | None = None) -> SyncPaginator[AppSignIn]
List the apps signed in as you, most recently used first.
Each install of the Strongly iPhone app, and of a connected app (an app's own native app), holds its own credential: signing in on one never signs out another app, device or browser. Browsers are not listed.
Parameters
limit(int | None, optional): The most installs to return;Nonereturns every one.
Returns
SyncPaginator[AppSignIn]: The signed-in installs, fetched a page at a time.
list_keys
list_keys(*, status: str | None = None, sort: str | None = None, limit: int | None = None) -> SyncPaginator[ApiKey]
List your API keys, newest first.
Parameters
status(str | None, optional): Only keys with this status:"active"or"revoked". The API's default is every key.sort(str | None, optional): The order, as comma-separated wire field names, each prefixed with-for descending (for example"name"or"-lastUsedAt"). The API's default is"-createdAt".limit(int | None, optional): The most keys to return;Nonereturns every one.
Returns
SyncPaginator[ApiKey]: The keys, fetched a page at a time.
remove_app_sign_in
remove_app_sign_in(install_id: str) -> None
Sign one app install out.
Its key and sessions stop working at once; every other app, device and browser stays signed in. The app signs in again to be used.
Parameters
install_id(str): The install (anAppSignIn'sid).
Raises
NotFoundError: No app is signed in with this install.
retrieve_key
retrieve_key(key_id: str) -> ApiKey
Retrieve one of your API keys.
Parameters
key_id(str): The key's id.
Returns
ApiKey: The key's metadata.
Raises
NotFoundError: You have no key with this id.
revoke_key
revoke_key(key_id: str) -> ApiKey
Revoke one of your API keys.
A revoked key stops authenticating at once. It stays listed, with the
status "revoked", until you delete it (delete_key).
Parameters
key_id(str): The key's id.
Returns
ApiKey: The key, revoked.
Raises
NotFoundError: You have no key with this id.ConflictError: The key is already revoked.
rotate_key
rotate_key(key_id: str) -> ApiKeyRotateResponse
Replace one of your API keys with a new secret.
A new key is created with the old key's name, scopes and expiry, and the old key is revoked.
Parameters
key_id(str): The id of the key to replace.
Returns
ApiKeyRotateResponse: The new key (a new id), with its secret inkey.
Raises
NotFoundError: You have no key with this id.