Back to Documentation

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

GET/user_profiles
GET/user_profiles?id=eq.{id}
PATCH/user_profiles?id=eq.{id}
GET/roles
GET/user_roles
POST/user_roles
DELETE/user_roles?id=eq.{id}

Client Accounts

GET/accounts
POST/accounts
PATCH/accounts?id=eq.{id}
DELETE/accounts?id=eq.{id}
GET/account_members
POST/account_members

Projects

GET/projects
POST/projects
PATCH/projects?id=eq.{id}
DELETE/projects?id=eq.{id}
GET/project_assignments
POST/project_assignments
GET/project_updates
POST/project_updates
GET/project_issues

Tasks

GET/tasks
POST/tasks
PATCH/tasks?id=eq.{id}
DELETE/tasks?id=eq.{id}
GET/task_dependencies
GET/task_week_allocations

Time Tracking

GET/time_entries
POST/time_entries
PATCH/time_entries?id=eq.{id}
DELETE/time_entries?id=eq.{id}
GET/clock_sessions
POST/clock_sessions
GET/user_availability

Capacity Planning

GET/weekly_capacity_summary
GET/department_capacity_summary
GET/project_capacity_summary
POST/user_availability

Departments

GET/departments
POST/departments
PATCH/departments?id=eq.{id}
DELETE/departments?id=eq.{id}

Workflows

GET/workflow_templates
POST/workflow_templates
GET/workflow_instances
GET/workflow_node_transitions

Rate Limiting

Production deployments with Upstash Redis enforce rate limiting to prevent abuse.

Endpoint TypeLimitWindow
API Routes100 requests15 minutes
Auth Endpoints5 requests15 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

OperatorDescriptionExample
eqEqualsstatus=eq.active
neqNot equalsstatus=neq.deleted
gt, gteGreater than (or equal)hours=gt.40
lt, lteLess than (or equal)priority=lt.3
inIn liststatus=in.(a,b,c)
isIs null/true/falsedeleted_at=is.null
ilikeCase-insensitive searchname=ilike.*test*

Error Codes

CodeDescription
400Bad Request - Invalid query parameters or body
401Unauthorized - Missing or invalid API key/token
403Forbidden - RLS policy denied access
404Not Found - Resource doesn't exist
409Conflict - Unique constraint violation
429Too Many Requests - Rate limit exceeded
500Internal 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.