Auth API
POST /api/auth/register
Section titled “POST /api/auth/register”Create a new user and organization.
{ "email": "user@example.com", "password": "SecurePassword123!", "name": "John Doe", "organization_name": "My Company", "organization_website": "https://example.com" // optional}{ "access_token": "eyJ...", "refresh_token": "eyJ...", "user": { "id": "uuid", "email": "user@example.com", "name": "John Doe", "role": "owner", "has_password": true, "linked_providers": [] }, "organization": { "id": "uuid", "name": "My Company", "slug": "my-company-abc123", "plan": "free" }}POST /api/auth/login
Section titled “POST /api/auth/login”Authenticate with email and password.
{ "email": "user@example.com", "password": "SecurePassword123!"}{ "access_token": "eyJ...", "refresh_token": "eyJ...", "user": { ... }, "organization": { ... }}POST /api/auth/refresh
Section titled “POST /api/auth/refresh”Exchange refresh token for new access/refresh tokens.
{ "refresh_token": "eyJ..."}{ "access_token": "eyJ...", "refresh_token": "eyJ...", "user": { ... }, "organization": { ... }}GET /api/auth/me
Section titled “GET /api/auth/me”Get current user and organization. Requires authentication.
{ "user": { "id": "uuid", "email": "user@example.com", "name": "John Doe", "avatar_url": null, "role": "owner", "needs_org_setup": false, "has_password": true, "linked_providers": ["google"] }, "organization": { "id": "uuid", "name": "My Company", "slug": "my-company-abc123", "website": "https://example.com", "plan": "free" }}PUT /api/auth/me
Section titled “PUT /api/auth/me”Update current user profile. Requires authentication.
{ "name": "Jane Doe", "avatar_url": "https://example.com/avatar.jpg"}PUT /api/auth/password
Section titled “PUT /api/auth/password”Change password. Requires authentication.
{ "current_password": "OldPassword123!", "new_password": "NewPassword456!"}Returns 204 No Content on success.
POST /api/auth/logout
Section titled “POST /api/auth/logout”Logout (client should discard tokens). Requires authentication.
Returns 204 No Content.
GET /api/auth/setup-status
Section titled “GET /api/auth/setup-status”Check if initial platform setup is needed. Public endpoint.
{ "needs_setup": true, "has_users": false}Google OAuth
Section titled “Google OAuth”GET /api/auth/google
Section titled “GET /api/auth/google”Redirect to Google OAuth login page. Returns 302 Redirect.
GET /api/auth/google/callback
Section titled “GET /api/auth/google/callback”OAuth callback handler. Redirects to frontend with tokens:
{frontend_url}/auth/callback?access_token=...&refresh_token=...GET /api/auth/link/google
Section titled “GET /api/auth/link/google”Initiate Google account linking. Requires authentication.
{ "redirect_url": "https://accounts.google.com/..."}DELETE /api/auth/unlink/{provider}
Section titled “DELETE /api/auth/unlink/{provider}”Unlink OAuth provider. Requires authentication.
Returns 204 No Content.
POST /api/auth/complete-setup
Section titled “POST /api/auth/complete-setup”Complete organization setup for OAuth users. Requires authentication.
{ "organization_name": "My Company", "organization_website": "https://example.com" // optional}