Architecture
DelightBridge uses Next.js 15 API Routes with the App Router convention. All API endpoints are defined asroute.ts files within the /src/app/api directory structure.
Base URL
The API is served from the same domain as your DelightBridge application:Request Format
HTTP Methods
DelightBridge API follows REST conventions:- GET - Retrieve resources
- POST - Create new resources
- PATCH - Update existing resources
- DELETE - Remove resources
Content Type
All request bodies must be sent as JSON:Example Request
Response Format
Success Responses
Successful requests return JSON data with appropriate HTTP status codes:- 200 OK - Request succeeded
- 201 Created - Resource created successfully
Example: Get Threads
Error Responses
Errors return JSON objects with anerror field and appropriate HTTP status codes:
Error Status Codes
| Status Code | Meaning | When It Occurs |
|---|---|---|
| 400 | Bad Request | Missing required parameters, invalid input |
| 401 | Unauthorized | No valid session (not logged in) |
| 403 | Forbidden | Insufficient permissions for the operation |
| 404 | Not Found | Resource doesn’t exist |
| 409 | Conflict | Duplicate action prevented (e.g., already sent) |
| 500 | Internal Server Error | Server-side error or external API failure |
Common Patterns
Query Parameters
Many GET endpoints accept query parameters for filtering and pagination:The ID of the service/account to filter by
Maximum number of results (1-200)
Set to
1 to include full message bodiesDynamic Routes
Resource-specific operations use dynamic route segments:Timestamps
All timestamps are returned as ISO 8601 strings in UTC:Rate Limiting
Currently, DelightBridge does not implement rate limiting on API endpoints. This may change in future versions for production deployments.
Available Endpoints
The API is organized into the following resource groups:Services
Manage email service accounts and their configurations
Threads
List and manage email conversation threads
Drafts
Create, update, and generate AI-powered draft responses
Members
Manage workspace members and permissions (admin only)