Documentation
Just like our system has pages you can click around on in your browser, it also has "doors" in the background where other computers talk to us. These are called API Endpoints. When a tenant calls Twil
Just like our system has pages you can click around on in your browser, it also has "doors" in the background where other computers talk to us. These are called API Endpoints. When a tenant calls Twil
API Endpoints Reference — Unified Gateway & Endpoint Catalog
Just as our system has visual pages for users, it also has machine-readable 'doors' called API Endpoints — the secure channels through which Twilio calls, Gmail emails, and nightly cron jobs all communicate with our database.
Just like our system has pages you can click around on in your browser, it also has "doors" in the background where other computers talk to us. These are called API Endpoints. When a tenant calls Twilio, when a landlord emails our Gmail inbox, or when our server runs a nightly check on rents—the computers use these specific endpoints to share and save data inside our secure database.
3.15 Unified API Gateway & Endpoint Reference
Interface Specification (API-REF)The EstateAigents Next.js Portal serves as both our administrative interface and our **Sovereign API Gateway**. Every event in the Single Journey Tenancy (SJT) lifecycle—from initial telephony triage and webhook signals to scheduled database synchronization crons—is routed securely through optimized backend API endpoints.
This specification catalogs our active endpoints, detailing their authentication requirements, expected payloads, and internal transactional pipelines to support scalable third-party integrations and developer auditing.
1. Telephony & Communication Webhooks
These endpoints handle asynchronous communication inputs from external networks, converting them into structured database logs inside tbl_conversations.
1.1 Twilio Inbound Voice Gateway
Point of entry for all incoming telephony. Initiates caller ID database lookup and dynamically answers with a customized TwiML speech-gathering prompt.
{
"From": "+447400473888", // Caller CLI Number
"CallSid": "CAxxxxxxxxxxxx", // Unique Twilio Call ID
"To": "+447123456789" // Target Bridge Number
}
Generates Polly neural audio. Prompts matched contacts by name; falls back to generic greeting, launching <Gather input="speech"> to capture spoken intent.
1.2 Telephony AI Intent Classifier & Sandbox Router
Triggered asynchronously once the caller finishes speaking. Submits spoken text to DeepSeek-V4-Flash for intent classification, processes spam rejection, and writes valid logs to Supabase.
{
"SpeechResult": "The kitchen ceiling is leaking water under the pipe.",
"Confidence": "0.98",
"CallSid": "CAxxxxxxxxxxxx"
}
- Extracts
SpeechResultand feeds it into the DeepSeek structured classification prompt. - If classified as
spamorsales_call, returns a polite dismissal TwiML and hangs up. - If valid, creates a ticket row inside
tbl_conversationsmapped under the matching caller's person ID. - Dispatches a real-time event notification to the Sandbox staff panel.
1.3 Telegram Bot Ingress & Chat Gateway
Repository Code
The live codebase implementation for this specification sits within the following repository folder:
@raia_robot).
Enforces cryptographic token validation via query param (?token=TELEGRAM_BOT_SECRET) to guarantee payload origin.
2. Background Synchronization & Chronology Crons
These endpoints are triggered by automated cron schedulers to process background syncs, pull data from legacy databases, and update system state.
2.1 Daily GMail Ingestion & Triage Sync
Nightly cron executing at 04:00 UTC. Connects to our Google Workspace service accounts, scans new inbound customer and supplier correspondence, filters out transactional noise, and logs business-critical items.
Requires a secure bearer token in the headers: Authorization: Bearer CRON_SECRET_KEY.
3. Property Records, Snapshots & Billing API
These routes are utilized by the administrative portal frontend to power real-time dashboards, search for assets, and query billing data.
3.1 Property Dynamic Asset Snapshot Endpoint
Generates and serves the dynamic state snapshot for a specific managed asset. Pulls current rent status, occupancy data, and upcoming safety compliance dates.
3.2 B2B Property Portfolio Usage & SaaS Billing Ledger
Calculates the active property portfolio size for the billing period and generates the dynamic billing total under our flat £1.00 per property per month module pricing.