Belong.net Logo
Developer

API Reference

The serverless functions that power Belong CheckIn's AI chat, transcription, and tool discovery.

Overview

Belong CheckIn's app backend exposes serverless functions that handle AI chat, audio transcription, and MCP tool discovery. They complement the core Belong REST API; this page documents the CheckIn-specific functions.

All functions enable CORS and validate the caller's app session.

Edge functions

chat-with-claude

Processes a user message through the AI assistant with MCP tool integration.

Endpoint: POST /functions/v1/chat-with-claude

interface ChatRequest {
  roomId: string
  message: string
  messageId: string
  model?: string
  useMCP?: boolean
  aiProvider?: string
  audioData?: boolean
  imageData?: boolean
  textContent?: string
  originalType?: string
}

interface ChatResponse {
  success: boolean
  message?: string
  tool_results?: ToolResult[]
  session_id?: string
  error?: string
}
const response = await fetch('https://<app-host>/functions/v1/chat-with-claude', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: `Bearer ${sessionToken}`,
  },
  body: JSON.stringify({
    roomId: 'room-123',
    message: 'Create an NFT event for a music concert',
    messageId: 'msg-456',
    useMCP: true,
  }),
})

Responses stream via Server-Sent Events for real-time output.

transcribe-audio

Converts an audio message to text (used by Voice Mode).

Endpoint: POST /functions/v1/transcribe-audio

interface TranscriptionRequest {
  messageId: string
  audioData: string // base64-encoded audio
  roomId: string
}

interface TranscriptionResponse {
  success: boolean
  transcription?: string
  message_id: string
  error?: string
}

Supports common audio formats up to 25 MB and stores the transcription automatically.

discover-mcp-capabilities

Discovers and registers the available MCP tools.

Endpoint: POST /functions/v1/discover-mcp-capabilities

interface CapabilitiesResponse {
  success: boolean
  capabilities: MCPCapability[]
  total_discovered: number
  new_capabilities: number
}

rename-chat-for-event

Generates a meaningful chat-room name from event-creation context.

Endpoint: POST /functions/v1/rename-chat-for-event

interface RenameChatRequest {
  roomId: string
  eventTitle?: string
  context?: string
}

Security

  • Authentication — each function validates the app session token from the Authorization: Bearer <jwt> header
  • CORS — preflight OPTIONS requests are handled and standard CORS headers returned
  • Input validation — requests are validated and length-limited (for example, chat messages are capped) before processing

Error format

interface ErrorResponse {
  error: true
  message: string
  code?: string
  details?: unknown
  timestamp: string
  request_id: string
}

Functions use URL versioning (/functions/v1/...). Transient upstream errors are retried with exponential backoff.

Copyright © 2026