API Reference
MovaLab provides 80+ REST API endpoints via Supabase, with automatic Row Level Security enforcement on all requests.
Overview
MovaLab uses Supabase as its backend, which provides auto-generated REST APIs for all database tables. Every table has full CRUD operations available via HTTP.
80+ Endpoints
Full CRUD on 48+ tables
Row Level Security
APIs respect RLS policies automatically
Rate Limiting
100 req/15min (API), 5 req/15min (auth)
Direct DB Access
PostgreSQL access for self-hosted
Base URL
Local Development:
http://localhost:54321/rest/v1/
Cloud Supabase:
https://your-project.supabase.co/rest/v1/
Authentication
All API requests require authentication headers. RLS policies automatically filter data based on the authenticated user.
Required Headers
{
"apikey": "your-supabase-publishable-key",
"Authorization": "Bearer <user-jwt-token>",
"Content-Type": "application/json"
}Example: Fetch Projects
const response = await fetch(
'http://localhost:54321/rest/v1/projects',
{
headers: {
'apikey': process.env.SUPABASE_ANON_KEY,
'Authorization': `Bearer ${session.access_token}`,
},
}
);
const projects = await response.json();Endpoints by Category
Users & Authentication
/user_profiles/user_profiles?id=eq.{id}/user_profiles?id=eq.{id}/roles/user_roles/user_roles/user_roles?id=eq.{id}Client Accounts
/accounts/accounts/accounts?id=eq.{id}/accounts?id=eq.{id}/account_members/account_membersProjects
/projects/projects/projects?id=eq.{id}/projects?id=eq.{id}/project_assignments/project_assignments/project_updates/project_updates/project_issuesTasks
/tasks/tasks/tasks?id=eq.{id}/tasks?id=eq.{id}/task_dependencies/task_week_allocationsTime Tracking
/time_entries/time_entries/time_entries?id=eq.{id}/time_entries?id=eq.{id}/clock_sessions/clock_sessions/user_availabilityCapacity Planning
/weekly_capacity_summary/department_capacity_summary/project_capacity_summary/user_availabilityDepartments
/departments/departments/departments?id=eq.{id}/departments?id=eq.{id}Workflows
/workflow_templates/workflow_templates/workflow_instances/workflow_node_transitionsRate Limiting
Production deployments with Upstash Redis enforce rate limiting to prevent abuse.
| Endpoint Type | Limit | Window |
|---|---|---|
| API Routes | 100 requests | 15 minutes |
| Auth Endpoints | 5 requests | 15 minutes |
Rate limited responses return 429 Too Many Requests with a Retry-After header.
Filtering & Pagination
Supabase REST APIs support powerful filtering via query parameters.
# Exact match GET /tasks?status=eq.in_progress # Multiple conditions (AND) GET /tasks?status=eq.in_progress&priority=eq.high # IN clause GET /tasks?status=in.(todo,in_progress,review) # Pagination GET /tasks?limit=20&offset=0 # Select specific columns GET /tasks?select=id,name,status,priority # Join related tables GET /tasks?select=*,project:projects(name,account_id) # Order results GET /tasks?order=created_at.desc # Full-text search GET /user_profiles?name=ilike.*john*
Filter Operators
| Operator | Description | Example |
|---|---|---|
| eq | Equals | status=eq.active |
| neq | Not equals | status=neq.deleted |
| gt, gte | Greater than (or equal) | hours=gt.40 |
| lt, lte | Less than (or equal) | priority=lt.3 |
| in | In list | status=in.(a,b,c) |
| is | Is null/true/false | deleted_at=is.null |
| ilike | Case-insensitive search | name=ilike.*test* |
Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request - Invalid query parameters or body |
| 401 | Unauthorized - Missing or invalid API key/token |
| 403 | Forbidden - RLS policy denied access |
| 404 | Not Found - Resource doesn't exist |
| 409 | Conflict - Unique constraint violation |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error |
Direct Database Access
Self-hosted instances can connect directly to PostgreSQL:
# Local development connection Host: localhost Port: 54322 Database: postgres User: postgres Password: postgres # Connect with psql psql -h localhost -p 54322 -U postgres -d postgres # Or use connection string postgresql://postgres:postgres@localhost:54322/postgres
Learn More
For complete API documentation and advanced features, see the Supabase docs.