Training plan generation requires the Coach Agent feature on your organization’s plan. Contact your account manager if this feature isn’t available in your dashboard.
How the two-step process works
The generation process is intentionally split so you can apply your coaching judgment before committing to a full set of workouts.Generate a draft
Send the basic plan parameters — number of weeks, athlete level, and any specific requirements — and the AI produces a readable training plan draft in text form.
Review and edit the draft
Read the draft in the app. You can edit the text directly to adjust volume, tweak the structure, add notes, or change the emphasis before moving on.
Step 1: Generate a draft
Endpoint:POST /api/v1/ai-coach/generate-draft
Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
weeks | integer | Yes | Length of the plan in weeks. Must be between 1 and 52. |
level | string | Yes | Athlete level: beginner, intermediate, or advanced. |
org_id | string | Yes | Your organization ID. Used to fetch your configured training principle. |
additional_prompt | string | No | Free-text field for specific requirements, e.g. “athlete is targeting a sub-4 hour marathon” or “include one trail run per week”. |
training_principle | string | No | Override your organization’s default training principle for this request only. |
start_date | string | No | ISO date for the first day of the plan (YYYY-MM-DD). If omitted, workouts are scheduled relative to week/day numbers. |
workout_preference | string | No | How the AI sources workouts. See workout preference options below. Defaults to ai_generate. |
Workout preference options
| Value | Behavior |
|---|---|
ai_generate | AI creates all workouts from scratch (default). |
prefer_existing | AI reuses existing workouts from your library where possible, generating new ones when there’s no match. |
strict_existing | AI only uses workouts already in your library. No new workouts are generated. |
Example request
Example response
Step 2: Generate the full plan
Once you’ve reviewed and optionally edited the draft text, submit it back to convert it into structured workouts. Endpoint:POST /api/v1/ai-coach/generate-plan
Request parameters
All parameters from the draft request, plus:| Parameter | Type | Required | Description |
|---|---|---|---|
refined_draft | string | Yes | The draft text from step 1, with any edits you’ve made. Must be at least 10 characters. |
The
refined_draft field is where your edits matter. If you added a race-day workout, removed a rest day, or changed the weekly structure, make those changes in the draft text before sending this request.Example request
Example response
Streaming endpoints
For long plans, the standard endpoints wait until generation is complete before returning a response. The streaming endpoints let you show progress in real time.- Draft streaming
- Plan streaming (batch)
- Plan streaming (incremental)
Endpoint:
POST /api/v1/ai-coach/generate-draft/streamSame request body as /generate-draft. Returns a Server-Sent Events (SSE) stream.SSE event types:| Type | Payload |
|---|---|
progress | { "type": "progress", "status": "thinking", "message": "...", "progress": 50 } |
result | { "type": "result", "data": { ... } } — the complete draft result |
error | { "type": "error", "error": "..." } |
done | { "type": "done" } |
Training principles
The AI uses your organization’s training principle when writing the plan — this is the coaching philosophy that shapes how volume, intensity, and recovery are structured across the weeks. You can view or update your organization’s training principle viaGET /api/v1/ai-coach/training-principle/{org_id}.
To override the training principle for a single request without changing your organization’s default, pass the training_principle field in the request body.
Access requirements
- You must be authenticated as a coach role
- Your organization must have the Coach Agent feature enabled
403 response.