CoachMate agent API: templates and tournament drafts

Let a coach's assistant find a teaching pack and prepare a tournament draft. The API uses the coach's existing authenticated session and never exposes student rosters.

By CoachMate. Published: .

On this page

API contract

GET /api/agent/templates

POST /api/agent/tournament-draft

Send an Authorization: Bearer header with the coach's valid Supabase access token. Never use a service-role key. Access is restricted to confirmed teachers with an active session.

Prepare a draft, then review it

{"pack":"opposition","format":"round_robin","rounds":3,"timeControl":"5+3"}

The response includes starting FENs, teaching prompts and a link to the coach's tournament form. It does not create a tournament, send invitations, publish student information or start a live room. The coach reviews the form and chooses students before saving.

Predictable errors and limits

  • 401: authentication required
  • 400: invalid draft input
  • 404: unknown teaching pack
  • 413: request exceeds 4 KB
  • The API is a stateless preparation tool. It does not accept student names, emails, invitation tokens or arbitrary URLs.
CoachMate agent API: templates and tournament drafts