# API Reference (v1)

Base URL: `/api/v1`

## Health & Diagnostics
- `GET /health` — Liveness check. Returns status `healthy`.
- `GET /health/detailed` — Readiness check. Verifies PostgreSQL and Redis latency and connectivity.

## Authentication
- `POST /auth/register` — Registers a new user. Returns JWT access & refresh tokens.
- `POST /auth/login` — Authenticates user using Argon2id. Returns tokens.
- `POST /auth/refresh` — Rotates refresh token and issues new access token.
- `POST /auth/logout` — Revokes session refresh token.
- `GET /auth/me` — Retrieves current user profile.

## Tenants (Workspaces)
- `POST /tenants` — Creates a new tenant workspace and assigns current user as `owner`.
- `GET /tenants` — Lists workspaces the user is a member of.
- `GET /tenants/{tenant_id}` — Gets workspace details (requires membership or superadmin).
- `PATCH /tenants/{tenant_id}` — Updates workspace settings (requires `owner` or `admin`).
- `GET /tenants/{tenant_id}/members` — Lists active members in the workspace.
- `DELETE /tenants/{tenant_id}/members/{user_id}` — Removes a member from the workspace.

## Headers
- `Authorization: Bearer <access_token>` — Required for protected endpoints.
- `X-Tenant-ID: <uuid>` — Required for tenant-scoped operations.
- `X-Request-ID: <string>` — Optional client correlation ID (automatically injected if omitted).
