API Reference
Complete endpoint documentation — 20+ routes
All API routes are Next.js 15 App Router API handlers. Authentication is enforced via Clerk middleware. Click any endpoint to expand request/response details.
Hostel Intelligence
AI-powered discovery, enrichment, and intelligence generation.
POST/api/hostels/search
AI-powered hostel discovery with verification pipeline
{
"location": "Bali, Indonesia",
"skills": ["marketing", "SEO", "content"],
"userId": "user_2x4k..."
}{
"hostels": [
{
"name": "The Mad Monkey",
"location": "Ubud, Bali",
"website": "https://themadmonkey.com",
"websiteVerified": true,
"contactEmail": "info@themadmonkey.com",
"emailVerified": true,
"matchScore": 87,
"needs": ["social media", "SEO"]
}
],
"cached": false
}POST/api/hostels/search/enrich
Verify and enrich hostel contact information
{
"hostels": [
{ "name": "...", "website": "..." }
]
}POST/api/hostels/dossier
Generate AI intelligence report + personalized pitch
{
"hostelName": "The Mad Monkey",
"hostelWebsite": "https://themadmonkey.com",
"userName": "Jaryd",
"userHeadline": "Full-Stack Developer & AI Engineer",
"userSkills": ["SEO", "Web Dev", "AI Automation"],
"userBio": "...",
"userLocation": "Cape Town, SA"
}{
"dossier": "## Market Snapshot\n...",
"pitch": "Hi [Name],\n...",
"verifiedEmails": ["info@themadmonkey.com"],
"scrapedEmails": ["bookings@themadmonkey.com"]
}Proposals
Create, manage, and track skill-exchange proposals.
GET/api/proposals
List user's proposals (as nomad or hostel)
{
"proposals": [
{
"id": "uuid",
"hostel_name": "The Mad Monkey",
"status": "pending",
"terms": { "duration": "2 weeks", "accommodation": "private room" },
"created_at": "2026-03-26T..."
}
]
}POST/api/proposals
Create proposal and send email to hostel
{
"hostel_name": "The Mad Monkey",
"hostel_id": "hostel-slug",
"terms": {
"duration": "2 weeks",
"deliverables": ["Social media audit", "30 posts"],
"accommodation": "private room"
},
"initial_message": "Hi, I'd love to...",
"recipient_email": "info@themadmonkey.com",
"send_email": true
}PATCH/api/proposals
Update proposal status (accept, reject, negotiate)
{
"id": "uuid",
"status": "accepted"
}Unified Inbox
Full email lifecycle — connect, sync, read, compose, reply.
GET/api/inbox/accounts
List connected email accounts for the authenticated user
POST/api/inbox/connect/:provider/start
Initiate OAuth flow — redirects to Google/Microsoft consent screen
GET/api/inbox/connect/:provider/callback
Handle OAuth callback — exchanges code for tokens, stores in DB
POST/api/inbox/sync
Trigger email synchronization (kicks off Inngest job)
GET/api/inbox/threads
List email threads with pagination, filtering, and sorting
{
"threads": [
{
"id": "uuid",
"subject": "Re: Marketing Proposal",
"snippet": "Thanks for reaching out...",
"is_unread": true,
"last_message_at": "2026-03-26T..."
}
]
}GET/api/inbox/threads/:id
Get full thread with all messages, attachments, and metadata
POST/api/inbox/threads/:id/reply
Reply to a thread via connected email account
{
"body": "Thanks for getting back to me...",
"accountId": "uuid"
}POST/api/inbox/threads/:id/archive
Archive a thread
POST/api/inbox/threads/:id/star
Star or unstar a thread
POST/api/inbox/threads/:id/mark-read
Mark thread as read
POST/api/inbox/send
Send a new email (used by proposal system)
{
"to": "hostel@example.com",
"subject": "Marketing Proposal — HostelHack",
"body": "<html>...</html>",
"accountId": "uuid"
}POST/api/inbox/draft
Save an email draft
GET/api/inbox/unread-count
Get count of unread emails across all connected accounts
GET/api/inbox/search
Full-text search across email threads
Webhooks
Real-time push notifications from email providers.
POST/api/webhooks/gmail
Gmail Pub/Sub push notification handler — triggers delta sync
POST/api/webhooks/microsoft-graph
Microsoft Graph change notification handler — validates subscription + triggers delta sync