Skip to content

Users

The Users resource provides methods to retrieve information about the authenticated user.

Initialization

Before using any resource, initialize the TallyClient:

from tally import Tally

client = Tally(api_key="tly_your_api_key_here")

Get Current User

Retrieve information about the authenticated user.

Method

client.users.me() -> User

Returns

User object containing:

  • id (str): User ID
  • email (str): User email address
  • full_name (str): User's full name
  • organization_id (str): Associated organization ID
  • subscription_plan (SubscriptionPlan): Current subscription plan
  • created_at (str): Account creation timestamp

Example

from tally import Tally

client = Tally(api_key="tly_your_api_key_here")

# Get current user information
user = client.users.me()

print(f"User ID: {user.id}")
print(f"Name: {user.full_name}")
print(f"Email: {user.email}")
print(f"Organization: {user.organization_id}")
print(f"Plan: {user.subscription_plan.value}")
print(f"Member since: {user.created_at}")

Errors

Exception Status Code Description
UnauthorizedError 401 Invalid or missing API key
TallyConnectionError - Network connection error
TallyTimeoutError - Request timeout

Example with Error Handling

from tally import Tally, UnauthorizedError, TallyAPIError

client = Tally(api_key="tly_your_api_key_here")

try:
    user = client.users.me()
    print(f"Welcome, {user.full_name}!")
except UnauthorizedError:
    print("Invalid API key. Please check your credentials.")
except TallyAPIError as e:
    print(f"API error: {e.message}")

Models

User Model

User dataclass

Represents a Tally user.

Example:

User(
    id="usr_abc123",
    email="[email protected]",
    full_name="John Doe",
    organization_id="org_xyz789",
    subscription_plan=SubscriptionPlan.PRO,
    created_at="2024-01-15T10:30:00Z"
)

SubscriptionPlan

SubscriptionPlan

Bases: str, Enum

Tally subscription plans.

Values:

  • FREE: Free plan
  • PRO: Professional plan
  • BUSINESS: Business plan

Official API Reference

For more details, see the Official Tally API Documentation.

Next Steps