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

Request Body
{
  "location": "Bali, Indonesia",
  "skills": ["marketing", "SEO", "content"],
  "userId": "user_2x4k..."
}
Response
{
  "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

Request Body
{
  "hostels": [
    { "name": "...", "website": "..." }
  ]
}
POST/api/hostels/dossier

Generate AI intelligence report + personalized pitch

Request Body
{
  "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"
}
Response
{
  "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)

Response
{
  "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

Request Body
{
  "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)

Request Body
{
  "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

Response
{
  "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

Request Body
{
  "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)

Request Body
{
  "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

HostelHack Documentation · March 2026
Built with Next.js 15 · Gemini 2.0 · Supabase