Account Discovery API Routes
Account Discovery API Routes
Introduced in: v0.1.10
Overview
The Account Discovery API route is the first call the portal makes immediately after a user logs in. It queries the AgentOS API using the authenticated user's email address and returns every portal account — across all supported roles — that is linked to that email.
This single lookup drives the entire post-login experience: which dashboards are displayed, which data is fetched, and which actions are available.
Supported Account Types
| Role | Description |
|---|---|
| Landlord | Property owner accounts managed by a letting agency |
| Tenant | Active or prospective tenants with a linked tenancy |
| Buyer | Purchasers engaged in a sale through an estate agency |
| Vendor | Sellers with a property listed through an estate agency |
| Contractor | Maintenance and trades professionals linked to the agency |
A single email address can be associated with multiple account types simultaneously. For example, the same user can be both a landlord and a contractor.
How It Works
- Authentication — The user logs in to the portal via the standard authentication flow.
- Discovery Call — The portal immediately calls the Next.js Account Discovery API route, passing the authenticated user's email address.
- AgentOS Lookup — The route proxies the request to the AgentOS (letmc.com) API, which searches for all accounts linked to that email across all five role types.
- Response — The API returns the matching account types and their associated IDs.
- Portal Routing — The portal uses the discovery response to determine which dashboards and features to render for the user.
API Route
Endpoint
GET /api/account-discovery
Authentication
This route requires the user to be authenticated. The user's email address is derived from the active session — no additional parameters are required in the request body.
Response
The response contains the list of account types and IDs linked to the authenticated user.
{
"accounts": [
{
"type": "landlord",
"id": "<account-id>"
},
{
"type": "tenant",
"id": "<account-id>"
}
]
}
| Field | Type | Description |
|---|---|---|
accounts | array | List of accounts linked to the user's email |
accounts[].type | string | Role type: landlord, tenant, buyer, vendor, or contractor |
accounts[].id | string | Unique account identifier from AgentOS |
No Accounts Found
If no accounts are linked to the authenticated email address, the accounts array will be empty.
{
"accounts": []
}
Notes
- This route is a prerequisite for all subsequent account-scoped API calls within the portal.
- The discovery route talks directly to the AgentOS (letmc.com) API and reflects real-time data.
- Users with multiple account types will have access to all corresponding portal sections without needing to log in separately for each role.