Organizations
Read and manage your organization: its details, members, invitations and credits.
Access it as client.organizations on a Strongly client, or the same path on AsyncStrongly with await. All methods exist on both with identical signatures.
Quick start
from strongly import Strongly
client = Strongly()
# List (auto-paginates as you iterate) # filters: status
for organization in client.organizations.list():
print(organization.id)
# Retrieve one by id
item = client.organizations.retrieve("<id>")
Methods
Core
list
list(*, status: str | None = None, limit: int | None = None) -> SyncPaginator[Organization]
List organizations, newest first.
A platform admin sees every organization; anyone else the organizations they are an active member of.
Parameters
status(str | None, optional): Only organizations with this status:"active"or"suspended". An archived organization is never listed.limit(int | None, optional): The most organizations to return;Nonereturns every one.
Returns
SyncPaginator[Organization]: The organizations, fetched a page at a time.
retrieve
retrieve(org_id: str) -> Organization
Retrieve an organization you are a member of.
Parameters
org_id(str): The organization's id.
Returns
Organization: The organization.
Raises
PermissionDeniedError: You are not a member of the organization (also when it does not exist) and not a platform admin.
update
update(org_id: str, *, name: str | None = None, description: str | None = None, status: str | None = None, billing_email: str | None = None, settings: Mapping[str, Any] | None = None, alert_thresholds: Sequence[int] | None = None) -> Organization
Update an organization (its owners and admins, or a platform admin).
Only the fields you give change.
Parameters
org_id(str): The organization's id.name(str | None, optional): The organization's name: never empty or an email address. Names need not be unique;labelshows each as its owner and id.description(str | None, optional): Its description.status(str | None, optional):"active","suspended"or"archived". On Strongly Cloud only a platform admin may change it. An archived organization is never shown or changed through the API again.billing_email(str | None, optional): Where billing email goes.settings(Mapping[str, Any] | None, optional): Settings merged into the current ones: any oftimezone,currencyandfiscalYearStart.alert_thresholds(Sequence[int] | None, optional): Balances, in credits ($1 = 100 credits), at which an alert is sent. Billing-enabled platforms only.
Returns
Organization: The updated organization.
Raises
PermissionDeniedError: You are not an owner or admin of the organization.ConflictError: A credit setting was given and billing is not enabled (error_codebilling-disabled); nothing was changed.
Other
add_credits
add_credits(org_id: str, *, credits: int, note: str | None = None) -> CreditTransaction
Add additional credits to an organization (platform admins).
Additional credits never expire while the organization has a subscription, and pay off any overdraft first.
Parameters
org_id(str): The organization's id.credits(int): How many credits to add, a positive whole number ($1 = 100 credits).note(str | None, optional): Why they were added; shown on the transaction.
Returns
CreditTransaction: Theadmin_allocationtransaction.
Raises
ConflictError: Billing is not enabled (error_codebilling-disabled).PermissionDeniedError: You are not a platform admin.ValidationError:creditsis not a positive whole number.
apply_credit_reset
apply_credit_reset(org_id: str, reset_id: str) -> CreditReset
Apply an available allowance reset (the organization's owner or an admin; Strongly Cloud).
Refills this month's allowance (the plan's monthly credits plus active grant months) to its full amount, once. If the balance is overdrawn, the reset pays what is owed first.
Parameters
org_id(str): The organization's id.reset_id(str): The reset's id.
Returns
CreditReset: The reset as applied, withrestored_credits(what it added) andoverdraft_paid_credits(what of that paid an overdrawn balance first).
Raises
ConflictError: The reset is expired, revoked or already applied, or nothing of the allowance is used.PermissionDeniedError: You are not the organization's owner or an admin.
cancel_invitation
cancel_invitation(org_id: str, invitation_id: str) -> None
Cancel a pending invitation.
Parameters
org_id(str): The organization's id.invitation_id(str): The invitation's id.
Raises
NotFoundError: There is no pending invitation with this id.PermissionDeniedError: You are not an owner or admin of the invitation's organization.
create_credit_grant
create_credit_grant(org_id: str, *, label: str, amount_credits: int, starts_at: datetime | str, period_count: int | None = None, ends_at: datetime | str | None = None) -> CreditGrant
Give an organization a credit grant (platform admins).
A grant adds a set amount of credit every month for a number of months. Each month's credit is added to the organization's balance when the month starts (paying off any overdraft first) and expires at the month's end; it never rolls over. Plan and grant credit is used first, the soonest-expiring first; additional credits are used only after it runs out.
Parameters
org_id(str): The organization's id.label(str): Why the organization receives the grant, shown on each ledger entry.amount_credits(int): Credits each month receives, a whole number ($1 = 100 credits: 50,000 credits = $500).starts_at(datetime | str): When the first month starts: a UTC midnight (a naive datetime is UTC), or an ISO 8601 string.period_count(int | None, optional): How many months; give this orends_at.ends_at(datetime | str | None, optional): The end of the last month, instead ofperiod_count.
Returns
CreditGrant: The grant with its monthly schedule.
Raises
PermissionDeniedError: You are not a platform admin.ValidationError: A term is invalid (starts_atnot a UTC midnight, months that ended already, anends_atthat is not a month boundary).ConflictError: Billing is not enabled (error_codebilling-disabled).
create_credit_reset
create_credit_reset(org_id: str, *, note: str, expires_at: datetime | str) -> CreditReset
Issue an organization an allowance reset (platform admins; Strongly Cloud).
Parameters
org_id(str): The organization's id.note(str): Why the organization receives it (at most 200 characters).expires_at(datetime | str): When it can no longer be applied, in the future.
Returns
CreditReset: The reset,available.
Raises
PermissionDeniedError: You are not a platform admin.ValidationError:noteorexpires_atis invalid.
credits
credits(org_id: str) -> OrganizationCredits
Return an organization's credits (its owner, or a platform admin).
Plan and grant credit is used first, the soonest-expiring first; additional credits are used only after it runs out, and never expire while the organization has a subscription (when it ends, every credit left is forfeited).
Parameters
org_id(str): The organization's id.
Returns
OrganizationCredits: The balance, this month's plan credits, each grant month held, additional credits and any overdraft, in credits ($1 = 100 credits). On Strongly Cloud,allowanceis this month's allowance (allowance_credits,used_credits,remaining_credits,renews_at,lots).
Raises
ConflictError: Billing is not enabled on this platform (error_codebilling-disabled).PermissionDeniedError: You are not a member of the organization.
end_credit_grant
end_credit_grant(org_id: str, grant_id: str) -> CreditGrant
End a credit grant early (platform admins).
No month after the current one is issued; the current month's credit stays until the month ends.
Parameters
org_id(str): The organization's id.grant_id(str): The grant's id.
Returns
CreditGrant: The grant as ended.
Raises
ConflictError: The grant was already ended or has run all its months.PermissionDeniedError: You are not a platform admin.
get_credit_grant
get_credit_grant(org_id: str, grant_id: str) -> CreditGrant
Return one of an organization's credit grants with its months.
Parameters
org_id(str): The organization's id.grant_id(str): The grant's id.
Returns
CreditGrant: The grant.
Raises
NotFoundError: The organization has no such grant.PermissionDeniedError: You are not the organization's owner or a platform admin.
get_credit_settings
get_credit_settings(org_id: str) -> CreditSettings
Return an organization's low-balance alert and auto-refill (on Strongly Cloud).
Both thresholds are a percent of the plan's monthly credits. Purchased
credits expire 12 months after their purchase. Readable by the
organization's owner, its admins and platform admins; can_change
says whether you may change them.
Parameters
org_id(str): The organization's id.
Returns
CreditSettings: The low-balance alert, auto-refill and the plan's monthly credits (base_credits) the thresholds are a percent of.
Raises
ConflictError: Billing is not enabled (error_codebilling-disabled), or the organization has no plan (no-subscription).PermissionDeniedError: You are not the organization's owner, an admin or a platform admin.
invite
invite(org_id: str, *, email: str, role: str, platform_role: str | None = None, name: str | None = None) -> Invitation
Invite someone to join an organization by email.
The invitation expires after 7 days. It is emailed when the platform sends mail.
Parameters
org_id(str): The organization's id.email(str): The invitee's email address.role(str): Their organization role:"admin"or"member", or (not on Strongly Cloud)"viewer".platform_role(str | None, optional): On Strongly Cloud (required there): their platform role,"developer"or"app".name(str | None, optional): On Strongly Cloud: the invitee's display name.
Returns
Invitation: The invitation just sent.
Raises
PermissionDeniedError: You are not an owner or admin of the organization.ConflictError: The address already has a pending invitation or is already a member.ValidationError:role(orplatform_role) is not a valid one.
list_credit_grants
list_credit_grants(org_id: str, *, limit: int | None = None) -> SyncPaginator[CreditGrant]
List an organization's credit grants, newest first (its owner, or a platform admin).
A credit grant gives the organization a set amount of credit every month for a number of months, e.g. 50,000 credits ($500) a month for 12 months. Each grant carries its months with the credit issued, used, expired and remaining in each.
Parameters
org_id(str): The organization's id.limit(int | None, optional): The most grants to return;Nonereturns every one.
Returns
SyncPaginator[CreditGrant]: The grants, fetched a page at a time.
Raises
ConflictError: Billing is not enabled (error_codebilling-disabled).PermissionDeniedError: You are not the organization's owner or a platform admin.
list_credit_purchases
list_credit_purchases(org_id: str, *, limit: int | None = None) -> SyncPaginator[CreditPurchaseLot]
List an organization's credit purchases that have not expired (on Strongly Cloud).
Purchases bought or auto-refilled, the soonest-expiring first: the order they are used in, after plan and grant credit. Each expires 12 months after it was made. Readable by the organization's owner, its admins and platform admins.
Parameters
org_id(str): The organization's id.limit(int | None, optional): The most purchases to return;Nonereturns every one.
Returns
SyncPaginator[CreditPurchaseLot]: The purchases, fetched a page at a time.
Raises
ConflictError: Billing is not enabled (error_codebilling-disabled).PermissionDeniedError: You are not the organization's owner, an admin or a platform admin.
list_credit_resets
list_credit_resets(org_id: str, *, limit: int | None = None) -> SyncPaginator[CreditReset]
List an organization's allowance resets, newest first (its owner or admins, or a platform admin; Strongly Cloud).
Each reset carries its note, expiry and status (available,
applying, applied, expired or revoked) and, once applied,
restored_credits and overdraft_paid_credits.
Parameters
org_id(str): The organization's id.limit(int | None, optional): The most resets to return;Nonereturns every one.
Returns
SyncPaginator[CreditReset]: The resets, fetched a page at a time.
Raises
PermissionDeniedError: You are not the organization's owner or an admin, or a platform admin.
list_invitations
list_invitations(org_id: str, *, limit: int | None = None) -> SyncPaginator[Invitation]
List an organization's pending invitations, newest first.
Parameters
org_id(str): The organization's id.limit(int | None, optional): The most to return; all of them when omitted.
Returns
SyncPaginator[Invitation]: The pending invitations.
Raises
PermissionDeniedError: You are not an owner or admin of the organization.
list_members
list_members(org_id: str, *, limit: int | None = None) -> SyncPaginator[Member]
List an organization's active members.
Parameters
org_id(str): The organization's id.limit(int | None, optional): The most to return; all of them when omitted.
Returns
SyncPaginator[Member]: The members, with their email addresses, names and roles.
Raises
PermissionDeniedError: You are not a member of the organization.
list_transactions
list_transactions(org_id: str, *, type: str | None = None, search: str | None = None, sort: str | None = None, limit: int | None = None) -> SyncPaginator[CreditTransaction]
List an organization's credit transactions, newest first.
Parameters
org_id(str): The organization's id.type(str | None, optional): Only transactions of this type (for example"usage_charge"or"overdraft_payoff"). The API's default is every type.search(str | None, optional): Only transactions whose description or type contains this text.sort(str | None, optional):-createdAt(default),createdAt,type,description,amountCreditsorbalanceAfterCredits(-for descending).limit(int | None, optional): The most transactions to return;Nonereturns every one.
Returns
SyncPaginator[CreditTransaction]: The transactions, fetched a page at a time.
Raises
ConflictError: Billing is not enabled (error_codebilling-disabled).PermissionDeniedError: You are not a member of the organization.
purchase_credits
purchase_credits(org_id: str, *, credits: int, payment_method: str | None = None, idempotency_key: str | None = None) -> CreditPurchase
Buy additional credits (the organization's owner or admin).
You can buy any whole number of credits from 1,000 ($1 = 100 credits,
so 1,000 credits cost $10.00); they pay off any overdraft first. With
Stripe Checkout (the default) open the returned url to pay; the
credits are added once the payment succeeds. On Strongly Cloud,
payment_method="saved-card" charges the organization's saved card
now instead, and each purchase expires 12 months after it was made.
When the subscription ends, every credit left is forfeited.
Parameters
org_id(str): The organization's id.credits(int): How many credits to buy, a whole number, at least 1,000.payment_method(str | None, optional):"checkout"(the API's default): a Stripe Checkouturlto pay at."saved-card"(on Strongly Cloud): charge the saved card now.idempotency_key(str | None, optional): The purchase'sIdempotency-Key(8 to 255 characters for a saved-card purchase, a UUID is right): sending the purchase again with the same key charges the card once. Omitted, a fresh key for this call, which its retries reuse.
Returns
CreditPurchase: The credits bought (amount_credits) and what Stripe charges for them (charge_cents, US cents). With Checkout, theurlto pay at; with the saved card, thepurchase_id,statusandexpires_atof the purchase.
Raises
ConflictError: Billing is not enabled (error_codebilling-disabled).PermissionDeniedError: You are not the organization's owner or an admin.ValidationError:creditsis not a whole number from 1,000, orpayment_methodis not one this platform takes.
remove_member
remove_member(org_id: str, user_id: str) -> MemberRemoval
Remove a member from an organization.
The member's resources in the organization are transferred to its owner. On Strongly Cloud the member's account is also archived.
Parameters
org_id(str): The organization's id.user_id(str): The member's user id; not the owner.
Returns
MemberRemoval: What was transferred, and to whom.
Raises
PermissionDeniedError: You are not an owner or admin of the organization.NotFoundError: There is no such organization.
resend_invitation
resend_invitation(org_id: str, invitation_id: str) -> None
Send a pending invitation again, with a new link and a fresh 7 days.
Strongly Cloud only.
Parameters
org_id(str): The organization's id.invitation_id(str): The invitation's id.
Raises
NotFoundError: There is no pending invitation with this id.PermissionDeniedError: You may not manage the organization's invitations.ConflictError: The platform is not Strongly Cloud (error_codenot-supported).
revoke_credit_reset
revoke_credit_reset(org_id: str, reset_id: str) -> CreditReset
Revoke an allowance reset that has not been applied (platform admins; Strongly Cloud).
Parameters
org_id(str): The organization's id.reset_id(str): The reset's id.
Returns
CreditReset: The reset as revoked.
Raises
ConflictError: The reset was already applied, expired or revoked.PermissionDeniedError: You are not a platform admin.
update_credit_grant
update_credit_grant(org_id: str, grant_id: str, *, label: str | None = None, amount_credits: int | None = None, starts_at: datetime | str | None = None, period_count: int | None = None) -> CreditGrant
Change a credit grant (platform admins).
Months that have started keep their credit; the change applies to the
months still to come. starts_at changes only before the first month
starts.
Parameters
org_id(str): The organization's id.grant_id(str): The grant's id.label, amount_credits, starts_at, period_count: The terms to change; each left out stays as it is.
Returns
CreditGrant: The grant as changed.
Raises
ConflictError: The grant has started (forstarts_at), was ended, or changed concurrently.PermissionDeniedError: You are not a platform admin.ValidationError: A term is invalid, orperiod_countis below the started months.
update_credit_settings
update_credit_settings(org_id: str, *, low_balance_alert: Mapping[str, Any] | None = None, auto_refill: Mapping[str, Any] | None = None) -> CreditSettings
Change an organization's low-balance alert and auto-refill (on Strongly Cloud).
Only the fields given change. The organization's owner or an admin. Both thresholds are a percent (1 to 100) of the plan's monthly credits.
Parameters
org_id(str): The organization's id.low_balance_alert(Mapping[str, Any] | None, optional):enabled(bool) andthreshold_percent(int): the owner and admins are notified once each time the balance falls to that percent (in the app always, by email if their email setting is on), and 14 days before a purchase's credit expires.auto_refill(Mapping[str, Any] | None, optional):enabled(bool),threshold_percent(int),amount_credits(int, a whole number of credits, at least 1,000; $1 = 100 credits) andmax_per_day(int, 1 to 10): below the thresholdamount_creditsare bought with the saved card, at mostmax_per_daytimes a day. A failed charge turns it off until it is turned on again. Refilled credits expire 12 months after their purchase.
Returns
CreditSettings: The settings as changed.
Raises
ConflictError: Billing is not enabled (error_codebilling-disabled), or the organization has no plan (no-subscription).PermissionDeniedError: You are not the organization's owner or an admin.ValidationError: A percent, amount ormax_per_dayis out of range.
update_member
update_member(org_id: str, user_id: str, *, role: str | None = None, platform_role: str | None = None, active: bool | None = None) -> Member
Change a member's organization role, platform role or activity.
On Strongly Cloud give any of the three. Elsewhere the API reads only
role, which is then required (platform_role and active are
not applied).
Parameters
org_id(str): The organization's id.user_id(str): The member's user id.role(str | None, optional): Their organization role:"admin","member"or (not on Strongly Cloud)"viewer".platform_role(str | None, optional): On Strongly Cloud: their platform role,"developer"or"app".active(bool | None, optional): On Strongly Cloud:Falsedeactivates the member (their sessions end and their API keys are revoked);Truereactivates them.
Returns
Member: The member as changed.
Raises
PermissionDeniedError: You may not change this member (except on Strongly Cloud, only an owner changes roles).NotFoundError: The user is not an active member.ValidationError: Nothing to change was given (not on Strongly Cloud: norole), or a role is not a valid one.