Base URL
Available endpoints
Authentication
Better Auth provides a complete authentication API at/api/auth/[...all].
See the Authentication API documentation for detailed endpoint information.
Base path: /api/auth/
Key endpoints:
POST /api/auth/sign-in/email- User loginPOST /api/auth/sign-up/email- User registrationGET /api/auth/session- Get current sessionPOST /api/auth/sign-out- User logout
Waitlist
Register users for early access or beta features. POST /api/waitlistValid email address (unique constraint)
Either “professional” or “empresa”
User’s full name
Scientific field (for professionals)
Company name (for organizations)
Invalid data format or missing required fields
Email already registered in waitlist
Rate limit exceeded (includes Retry-After header)
Server error during processing
OpenGraph Images
Generate optimized social media preview images. GET /api/og Returns a JPEG image optimized for social media sharing (WhatsApp, Facebook, Twitter). Features:- Generated from PNG and converted to JPEG for smaller file size
- Quality: 80 with mozjpeg optimization
- Maximum 600KB for WhatsApp compatibility
- Cached for 1 year (immutable)
Cron Jobs
Scheduled background tasks endpoint (protected). POST /api/cron This endpoint is used by external cron services (like Vercel Cron or similar) to trigger scheduled tasks. Common use cases:- Send daily job alert emails
- Clean up expired sessions
- Update job posting statistics
- Generate weekly reports
- Archive old applications
Rate limiting
API endpoints implement rate limiting to prevent abuse and ensure fair usage.Implementation
Rate limiting is applied per IP address using thex-forwarded-for or x-real-ip headers:
lib/rate-limit.ts
Rate limits by endpoint
| Endpoint | Limit | Window |
|---|---|---|
/api/waitlist | 5 requests | 1 minute |
/api/auth/* | 10 requests | 1 minute (configured in Better Auth) |
/api/cron | Unlimited | Token-protected |
/api/og | Unlimited | Cached response |
Handling rate limits
When a rate limit is exceeded:- Response status:
429 Too Many Requests Retry-Afterheader indicates seconds to wait- Error message in Spanish for user-facing endpoints
Error handling
All API endpoints follow consistent error response patterns:Standard error format
Common HTTP status codes
- 200 OK: Successful request
- 201 Created: Resource successfully created
- 400 Bad Request: Invalid request data
- 401 Unauthorized: Authentication required
- 403 Forbidden: Insufficient permissions
- 404 Not Found: Resource doesn’t exist
- 409 Conflict: Resource conflict (e.g., duplicate email)
- 429 Too Many Requests: Rate limit exceeded
- 500 Internal Server Error: Server-side error
CORS policy
API endpoints are configured for same-origin requests by default. For cross-origin requests from approved domains, CORS headers are configured innext.config.ts.
Authentication
Most endpoints require authentication via Better Auth session cookies. See Authentication Flow for implementation details. Protected endpoints:- All
/dashboard/*routes - Job application endpoints
- Messaging endpoints
- Profile management
/api/auth/*(except session validation)/api/waitlist/api/og
Next steps
Authentication API
Detailed authentication endpoint documentation
Waitlist feature
Learn about the waitlist feature and user flows
Rate limiting
Security and rate limiting implementation
Environment variables
Configure API endpoints for production