OpenLeague

API Reference - OpenLeague Documentation

Understand the current API route surface and Server Action integration model.

API Reference

OpenLeague uses Server Actions for first-party mutations. API routes are reserved for file-style downloads, authentication, cron jobs, and integration-oriented endpoints.

Current route surface

Integration guidance

Prefer Server Actions for application forms and user-initiated mutations. Use API routes when a browser needs a downloadable response or when an external service cannot call a Server Action.

const response = await fetch('/api/roster/export?teamId=team_123');

if (!response.ok) {
  throw new Error('Unable to export roster');
}

Security expectations

Every route and action must authenticate the current user, authorize the target team or league, validate input with Zod, and avoid exposing sensitive roster fields to non-admins.

Planned reference areas