Company Bootstrap API Routes
Company Bootstrap API Routes
When the myProp portal loads, it needs to resolve the correct company configuration before rendering any UI. Version 0.1.11 introduces a suite of Next.js API routes — collectively referred to as the Company Bootstrap API — that fetch all required company-level data at startup.
Overview
These routes are called once on app initialisation (typically in a server component, middleware, or getServerSideProps / App Router layout) to hydrate the application with agency-specific settings. Each route connects to the AgentOS (letmc.com) API as the data source.
Routes
GET /api/company/verify
Verifies that a company exists and is reachable in the AgentOS system.
Use case: Called first during bootstrap to short-circuit the load if the company slug is invalid or the account is inactive. Returns an error state that can be rendered as a branded 404 or maintenance page.
Typical response:
{
"exists": true,
"companyId": "acme-lettings"
}
GET /api/company/theme
Returns the Tailwind CSS and shadcn/ui theme configuration for the agency's white-label portal.
Use case: Consumed by the portal's theme provider to inject CSS custom properties and Tailwind design tokens at runtime. Allows each agency to have a fully branded experience without redeployment.
Typical response:
{
"primaryColor": "#1a56db",
"accentColor": "#f59e0b",
"borderRadius": "0.5rem",
"fontFamily": "Inter, sans-serif"
}
GET /api/company/urls
Returns the set of portal URLs configured for the company, mapped by client type.
Use case: The portal uses these URLs for navigation links, deep-links shared via email, and redirect logic after login.
Typical response:
{
"landlord": "https://landlord.acme-lettings.com",
"tenant": "https://tenant.acme-lettings.com",
"buyer": "https://buyer.acme-lettings.com",
"vendor": "https://vendor.acme-lettings.com",
"contractor": "https://contractor.acme-lettings.com"
}
GET /api/company/currency
Returns currency and locale settings for the company.
Use case: Used by formatting utilities throughout the portal to display monetary values (rent amounts, fees, payments) in the correct currency and locale format.
Typical response:
{
"currencyCode": "GBP",
"currencySymbol": "£",
"locale": "en-GB"
}
GET /api/company/enums
Returns enumerated values for dropdown and select form fields.
Use case: Populates form inputs across the portal — such as maintenance job categories, property types, tenancy status options, and more — ensuring the portal's form values stay in sync with the AgentOS data model.
Typical response:
{
"maintenanceCategories": ["Plumbing", "Electrical", "Structural", "Other"],
"propertyTypes": ["Flat", "House", "Bungalow", "Commercial"],
"tenancyStatuses": ["Active", "Pending", "Expired"]
}
Bootstrap Sequence
The recommended order for calling these routes on app load is:
/api/company/verify— Confirm the company is valid before proceeding./api/company/theme— Load branding so the UI renders correctly from first paint./api/company/urls— Resolve portal URLs for navigation./api/company/currency— Load currency settings for formatting./api/company/enums— Fetch form enums for any interactive forms.
Steps 2–5 can be fetched in parallel once step 1 has confirmed the company exists.
// Example parallel fetch after verification
const [theme, urls, currency, enums] = await Promise.all([
fetch('/api/company/theme').then(r => r.json()),
fetch('/api/company/urls').then(r => r.json()),
fetch('/api/company/currency').then(r => r.json()),
fetch('/api/company/enums').then(r => r.json()),
]);
Error Handling
All bootstrap routes return standard HTTP status codes:
| Status | Meaning |
|---|---|
200 | Success — data returned |
404 | Company not found or not configured |
502 | Upstream AgentOS API unreachable |
500 | Unexpected server error |
If /api/company/verify returns 404, the portal should display an appropriate error page rather than attempting to call the remaining routes.