Skip to content

Users API

Access user information, team membership, and office details.


Overview

Users API Features

  • Current User Info: Get authenticated user's profile and details
  • User Lookup: Find users by ID
  • Team Information: Access user's team and office membership
  • Keymaker IDs: Retrieve associated agent IDs for users
  • Office Details: Get user's office information

New API Addition

The Users API was added to support owner agent functionality in transactions.


Quick Start

from rezen import RezenClient

client = RezenClient()

# Get current authenticated user
current_user = client.users.get_current_user()
print(f"User: {current_user['firstName']} {current_user['lastName']}")
print(f"Team ID: {current_user['team']['id']}")
print(f"Office ID: {current_user['office']['id']}")

# In ReZEN, the user ID is the agent ID used for owner-agent setup.
agent_id = client.users.get_agent_id_for_current_user()
print(f"Agent ID: {agent_id}")

Core Methods

Get Current User

Get current authenticated user information from Yenta.

This returns more detailed user information than the keymaker endpoint, including team and office details.

Returns:

Show table
Type Description
Dict[str, Any]

Dictionary containing current user's agent information including:

Dict[str, Any]
  • Basic user info (id, name, email, etc.)
Dict[str, Any]
  • Team information (teamId, teamName, etc.)
Dict[str, Any]
  • Office information (officeId, officeName, etc.)
Dict[str, Any]
  • License details
Dict[str, Any]
  • And more agent-specific fields

Raises:

Show table
Type Description
AuthenticationError

If not authenticated

RezenError

If the API request fails

Example
# Get current user with full agent details
user = client.users.get_current_user()
print(f"User ID: {user.get('id')}")
print(f"Name: {user.get('firstName')} {user.get('lastName')}")
print(f"Team ID: {user.get('teamId')}")
print(f"Office ID: {user.get('officeId')}")

Current User Information

from typing import Dict, Any

from rezen import RezenClient

client: RezenClient = RezenClient()

# Get current authenticated user details
user: Dict[str, Any] = client.users.get_current_user()

print(f"Name: {user['firstName']} {user['lastName']}")
print(f"Email: {user['email']}")
print(f"User ID: {user['id']}")

# Access team information
if 'team' in user:
    print(f"Team: {user['team']['name']}")
    print(f"Team ID: {user['team']['id']}")

# Access office information
if 'office' in user:
    print(f"Office: {user['office']['name']}")
    print(f"Office ID: {user['office']['id']}")

Get User by ID

Get user information by ID.

Parameters:

Show table
Name Type Description Default
user_id str

UUID of the user to retrieve

required

Returns:

Show table
Type Description
Dict[str, Any]

Dictionary containing user's agent information

Raises:

Show table
Type Description
NotFoundError

If user not found

RezenError

If the API request fails

Example
# Get user by ID
user = client.users.get_user_by_id("550e8400-e29b-41d4-a716-446655440000")
print(f"Name: {user.get('firstName')} {user.get('lastName')}")

Get Keymaker IDs

Get keymaker IDs for the given Yenta IDs.

Note: For owner agent setup in transactions, you typically don't need this method. The user ID from get_current_user() can be used directly as the agent ID.

Parameters:

Show table
Name Type Description Default
yenta_ids Union[str, List[str]]

A single Yenta user ID (UUID) or a list of Yenta user IDs.

required

Returns:

Show table
Type Description
List[str]

List of Keymaker user IDs corresponding to the provided Yenta IDs.

Raises:

Show table
Type Description
ValidationError

If yenta_ids is empty or invalid

RezenError

If the API request fails

ValueError

If the API response payload is not recognized.

Example
# Get keymaker IDs for Yenta users
yenta_ids = ["id1", "id2", "id3"]
keymaker_ids = client.users.get_keymaker_ids(yenta_ids)

Agent ID for Transactions

For owner-agent operations in transactions, you typically do not need to call get_keymaker_ids(). In ReZEN, the authenticated user's id is the agent ID used in owner-agent payloads.


Working with Owner Agents

Owner Agent Integration

The Users API is essential for setting up owner agents in transactions. Here's the complete workflow:

Get Required IDs for Owner Agent

from typing import Dict, Any

from rezen import RezenClient

client: RezenClient = RezenClient()

# Step 1: Get current user info
user: Dict[str, Any] = client.users.get_current_user()
team_id: str = user['team']['id']
office_id: str = user['office']['id']

# Step 2: In ReZEN, user ID = agent ID for owner-agent payloads
agent_id: str = str(user['id'])

# Step 3: Use in transaction owner agent setup
owner_data: Dict[str, Any] = {
    "ownerAgent": {
        "agentId": agent_id,
        "role": "BUYERS_AGENT"  # or "SELLERS_AGENT"
    },
    "officeId": office_id,
    "teamId": team_id
}

# Apply to transaction (after required setup steps)
client.transaction_builder.update_owner_agent_info(builder_id, owner_data)

Convenience Method

Simplified Approach

The Transaction Builder provides a convenience method that handles all the Users API calls for you:

# Instead of manual steps above, use:
client.transaction_builder.set_current_user_as_owner_agent(
    builder_id,
    role="BUYERS_AGENT"
)

Response Structures

User Object

{
    "id": "user-uuid",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@example.com",
    "phone": "+1234567890",
    "team": {
        "id": "team-uuid",
        "name": "Team Excellence",
        "status": "ACTIVE"
    },
    "office": {
        "id": "office-uuid", 
        "name": "Main Office",
        "address": "123 Main St",
        "city": "Salt Lake City",
        "state": "UT"
    },
    "role": "AGENT",
    "status": "ACTIVE"
}

Keymaker IDs Response

get_keymaker_ids() returns a list of UUID strings:

[
    "keymaker-uuid-1",
    "keymaker-uuid-2",
]

Common Use Cases

User Information Workflows

from typing import Dict, Any

from rezen import RezenClient

client: RezenClient = RezenClient()

# Get all required info for owner agent
user: Dict[str, Any] = client.users.get_current_user()
agent_id: str = str(user["id"])

owner_info = {
    "agent_id": agent_id,
    "team_id": user['team']['id'],
    "office_id": user['office']['id'],
    "user_name": f"{user['firstName']} {user['lastName']}"
}

print("Owner agent info collected:")
print(f"  Agent: {owner_info['user_name']}")
print(f"  Agent ID: {owner_info['agent_id']}")
print(f"  Team ID: {owner_info['team_id']}")
print(f"  Office ID: {owner_info['office_id']}")
# Get team member details
team_member_id = "member-user-uuid"
member = client.users.get_user_by_id(team_member_id)

# In ReZEN, a user's ID is the agent ID used in transaction payloads.
agent_id = str(member["id"])

print(f"Team member: {member['firstName']} {member['lastName']}")
print(f"Agent ID: {agent_id}")

Error Handling

Common Errors

from rezen import RezenClient
from rezen.exceptions import NotFoundError, UnauthorizedError

client = RezenClient()

try:
    user = client.users.get_current_user()
except UnauthorizedError:
    print("Invalid or missing API key")
except Exception as e:
    print(f"Error getting user info: {e}")

# If you need Keymaker IDs for other systems, `get_keymaker_ids()` returns a list:
# keymaker_ids = client.users.get_keymaker_ids(user_id)

Integration with Transaction Builder

Critical Sequence for Owner Agents

When using Users API data for owner agents, you MUST follow this sequence:

  1. Create transaction (create_transaction_builder)
  2. Add location info (update_location_info)
  3. Add price/date info (update_price_and_date_info)
  4. Add buyers/sellers (add_buyer/add_seller)
  5. THEN add owner agent using Users API data

See Transaction Builder - Owner Agents for complete details.


Next Steps