How the Plan API Works

A public, read-only JSON endpoint exposing the full training plan with every layer intact — built for AI agents and integrations.


Endpoint

GET https://app.pheidi.training/api/plans/{publicId}

Response Shape

The response is a single JSON object with five top-level sections plus identity fields. Each section corresponds to a real layer in Pheidi's plan model. Understanding the layers is the key to interpreting the data correctly.

1. Identity

2. raceGoal — the target

The race the plan is built around. distance is one of FiveK, TenK, HalfMarathon, FullMarathon. targetTime may be null if the runner hasn't set a goal time. planWeeks is the total length the plan was generated for.

3. summary — derived totals

Computed aggregates: totalWeeks, totalMiles, peakWeeklyMiles, longestRun, completedWorkouts, totalRunWorkouts, completionPercentage. Recomputed from the workout layer on every request — never stored. Use these instead of summing yourself.

4. vacations — time-off layer

Array of vacation periods with startDate, endDate, and loadPercent (0 = full rest, 80 = light reduction). Workouts inside these date ranges have already had this reduction applied to targetDistanceMiles in the workout layer below — do not apply it again. Vacations are shown so an agent can explain why a workout's distance dropped.

5. redistributions — load redistribution layer

When a vacation or day-off removes miles, those miles can be redistributed across future easy runs. Each entry records sourceType (Vacation or DayOff), milesRedistributed, and the scope (ThisWeek, NextNWeeks, UntilDate, RestOfPlan). Like vacations, the workouts in weeks already reflect the redistribution.

6. weeks — the plan itself

Ordered array. Each week has weekNumber, phase (BaseBuildPeakTaper), and a workouts array. The workout objects are the most important part of the response.

Workout fields

How to Read the Layers

Pheidi uses non-destructive layered overlays. The server applies layers in this order before serializing the response:

  1. Generated plan (base values from weeks)
  2. Vacation reductions
  3. Injury reductions
  4. User overrides
  5. Load redistribution

The workout fields you see are the final values after all layers are applied. The vacations, redistributions, and per-workout override fields are provenance — they tell you why a value differs from what generation alone would have produced.

Common Agent Tasks

What's Not Exposed

The endpoint is intentionally read-only and limited to plan data. It does not expose:

Error Responses

For AI Agents: Drop-In Skill

A ready-to-use agent skill is published at /.well-known/agent-skills/read-pheidi-plan/SKILL.md. It teaches a Claude (or any tool-using LLM) how to fetch a plan, interpret every layer, and answer common runner questions correctly. Discoverable via the api-catalog linkset (relation https://pheidi.training/rels/agent-skill).


See also