Base URL (local):
http://localhost:1609
Notes:
- Use
Content-Type: application/jsonforPOST/PUTrequests with a JSON body. - Most endpoints return JSON.
- UI pages (
/dashboard,/plan,/editor,/setup,/control) return HTML.
- Purpose: Liveness probe.
- Example:
curl http://localhost:1609/health- Purpose: Readiness probe (includes worker heartbeat checks).
- Example:
curl http://localhost:1609/ready- Purpose: Latest generated activity payload.
- Example:
curl http://localhost:1609/latest- Purpose: Service-call metrics from the most recent processing cycle.
- Example:
curl http://localhost:1609/service-metrics- Purpose: Redirects to dashboard.
- Purpose: View page (heatmaps/trends UI).
- Purpose: Build page (template editor UI).
- Purpose: Sources page (credentials/OAuth UI).
- Purpose: Control page (GUI for API operations).
- Purpose: Canonical Sources journey route.
- Purpose: Canonical Build journey route.
- Purpose: Canonical View journey route.
- Purpose: Dashboard JSON payload.
- Query params:
force=true(optional) to force rebuild.mode=full|summary|year(optional, defaultfull)year=YYYY(required whenmode=year)
- Response notes:
mode=summaryomits theactivitiesarray and returnsactivity_countto reduce payload size.mode=yearscopesaggregates,intervals_year_type_metrics,activities, andtypesto one year.- Invalid
mode/yearvalues return400. - Includes stale-while-revalidate hints when serving stale cache:
cache_state(staleorstale_revalidating)revalidating(boolean)
- Includes Intervals metrics sections:
intervals(enabled/records/matched_activities)intervals_year_type_metrics(year/type aggregate averages)
type_metais the canonical source for activity-type labels/accents used by frontend rendering.- Daily
aggregatesentries may include optional metric keys:avg_pace_mpsavg_efficiency_factoravg_fitnessavg_fatigue
- Examples:
curl http://localhost:1609/dashboard/data.json
curl "http://localhost:1609/dashboard/data.json?force=true"
curl "http://localhost:1609/dashboard/data.json?mode=summary"
curl "http://localhost:1609/dashboard/data.json?mode=year&year=2026"- Purpose: Plan sheet payload (rows + weekly/monthly/trailing metrics).
- Query params:
center_date=YYYY-MM-DD(optional, defaults to today in configured timezone)window_days(optional, clamped to7..56, default14)
- Response notes:
- Includes
run_type_options,summary, androws. rowsinclude editable fields (planned_input,run_type,is_complete,notes) and computed metrics.- Invalid
center_datereturns400.
- Includes
- Examples:
curl http://localhost:1609/plan/data.json
curl "http://localhost:1609/plan/data.json?center_date=2026-02-22&window_days=14"- Purpose: Lightweight payload for today's planned run only (widget/mobile companion usage).
- Response fields:
date_local:YYYY-MM-DDrun_type: stringmiles: number (sum of planned sessions for today, orplanned_total_milesfallback)workout_shorthand: optional string (included when present, typically forSOS)
- Example:
curl http://localhost:1609/plan/today.json- Purpose: Upsert one plan day and optional sessions.
- Path param:
date_localinYYYY-MM-DDformat.
- Accepted JSON fields:
distance: string ("6","6.5","6+4").planned_total_miles: number or distance string.sessions: array of numbers/objects (replaces all sessions for the day).run_type: string.notes: string.is_complete:true,false, ornull(nullresets to auto mode).
- Response notes:
- Returns saved
planned_total_miles, normalizeddistance_saved,session_count,sessions, and effective completion state.
- Returns saved
- Examples:
curl -X PUT http://localhost:1609/plan/day/2026-02-22 \
-H "Content-Type: application/json" \
-d '{"distance":"6+4","run_type":"Easy","is_complete":false}'
curl -X PUT http://localhost:1609/plan/day/2026-02-23 \
-H "Content-Type: application/json" \
-d '{"sessions":[6,4],"run_type":"SOS","is_complete":null}'- Purpose: Read effective setup config (secrets masked in response).
- Example:
curl http://localhost:1609/setup/api/config- Purpose: Save setup values.
- Behavior:
- Updates
.env(canonical persisted config). - Mirrors values into runtime overrides so changes apply immediately.
- Updates
- Example:
curl -X PUT http://localhost:1609/setup/api/config \
-H "Content-Type: application/json" \
-d '{"values":{"TIMEZONE":"America/New_York","ENABLE_WEATHER":true,"WEATHER_API_KEY":"your_key"}}'- Purpose: Render generated
.envsnippet. - Example:
curl http://localhost:1609/setup/api/env- Purpose: Strava OAuth/token status.
- Example:
curl http://localhost:1609/setup/api/strava/status- Purpose: Start Strava OAuth flow (returns authorize URL).
- Optional JSON body:
redirect_uri
- Example:
curl -X POST http://localhost:1609/setup/api/strava/oauth/start \
-H "Content-Type: application/json" \
-d '{"redirect_uri":"http://localhost:1609/setup/strava/callback"}'- Purpose: Strava OAuth callback endpoint.
- Called by Strava after authorization.
- Purpose: Clear saved Strava access/refresh tokens.
- Example:
curl -X POST http://localhost:1609/setup/api/strava/disconnect- Purpose: Reprocess latest activity.
- Example:
curl -X POST http://localhost:1609/rerun/latest- Purpose: Reprocess a specific activity.
- Example:
curl -X POST http://localhost:1609/rerun/activity/17455368360- Purpose: Reprocess latest, or optionally pass an activity id.
- Optional JSON body:
activity_id(integer)
- Example:
curl -X POST http://localhost:1609/rerun \
-H "Content-Type: application/json" \
-d '{"activity_id":17455368360}'- Purpose: List template profiles + working profile.
- Purpose: Update profile settings (enabled/priority/etc).
- Purpose: Set working profile.
- Example:
curl -X POST http://localhost:1609/editor/profiles/working \
-H "Content-Type: application/json" \
-d '{"profile_id":"default"}'- Purpose: Get active template.
- Query params:
profile_id(optional)
- Purpose: Save active template.
- Purpose: Get factory default template.
- Purpose: List template versions.
- Query params:
profile_id(optional)limit(optional)
- Purpose: Fetch a specific template version.
- Query params:
profile_id(optional)
- Purpose: Export active template bundle.
- Query params:
profile_id(optional)
- Purpose: Import a template bundle.
- Purpose: Roll back to a saved version.
- Purpose: Validate template syntax/contract.
- Purpose: Render preview from template and context.
- Purpose: Report whether the local Codex-backed editor assistant is available on this machine.
- Purpose: Send a customization request plus the current template to the local Codex CLI and receive paste-ready text back.
- Body:
{
"request": "Make the readiness line shorter.",
"template": "Current Jinja template text",
"context_mode": "sample",
"fixture_name": "default",
"profile_id": "default",
"preview_text": "Optional current preview text",
"selected_text": "Optional selected text from the editor"
}- Purpose: List sample fixture names.
- Purpose: Return sample context payload.
- Query params:
fixture(optional)
- Purpose: Context schema for selected mode.
- Query params:
context_mode(latest,sample,latest_or_sample,fixture)
- Purpose: Catalog of fields/groups for the editor.
- Query params:
context_modefixture_name(when mode isfixture)
- Purpose: Snippet catalog for editor insertion.
- Purpose: Starter templates.
- Purpose: List saved repository templates.
- Purpose: Get one repository template.
- Purpose: Update repository template metadata/content.
- Purpose: Save current template as a new repository template.
- Purpose: Duplicate an existing repository template.
- Purpose: Load repository template into active editor template.
- Purpose: Export one repository template bundle.
- Purpose: Import repository template bundle.
These endpoints expose stable, resource-oriented APIs for remote Codex companions and future agent tooling. They are intentionally draft-oriented instead of allowing unrestricted direct writes.
Auth model:
- local requests can use the API without keys when
ENABLE_AGENT_CONTROL_APIis false and the caller is local - remote read access uses
X-Chronicle-Agent-Key: <AGENT_CONTROL_READ_API_KEY> - remote apply access uses
X-Chronicle-Agent-Key: <AGENT_CONTROL_WRITE_API_KEY>
- Purpose: Protocol/version handshake plus assistant/provider summary.
- Purpose: Return supported resources and task names.
- Purpose: Get the active template and current base version.
- Query params:
profile_id(optional)
- Purpose: List profiles and working profile.
- Purpose: Get one profile document and base version.
- Purpose: List workout definitions.
- Purpose: Get one workout document and base version.
- Purpose: Return one plan week plus its base version.
- Query params:
week_start_local(optional, defaults to the next local week start)
- Purpose: Return focused planning context for
plan-next-weektasks. - Query params:
week_start_local(optional)
- Purpose: List durable drafts.
- Query params:
resource_kind(optional)
- Purpose: Create a durable draft and optionally validate it immediately.
- Body fields:
resource_kind:template|profile|workout|plan_weekpayload: resource payload objecttitle(optional)base_version(optional)metadata(optional object)validate(optional, defaulttrue)
- Purpose: Get one durable draft.
- Purpose: Update a draft payload/title/metadata before validation/apply.
- Purpose: Validate a draft and store the validation result.
- Purpose: Dry-run or apply a validated draft through Chronicle’s live save paths.
- Body fields:
dry_run(optional boolean)expected_version(optional optimistic-lock version)
- Purpose: List durable jobs.
- Query params:
task_kind(optional)
- Purpose: Get one durable job.
- Purpose: Return recent audit events.
- Query params:
limit(optional, default100, max500)
These endpoints create Codex-backed jobs that return reviewable drafts instead of applying changes immediately.
- Purpose: Ask the configured Codex provider to draft the next week’s plan.
- Body fields:
request(required)week_start_local(optional)source(optional)
Response notes:
- creates a durable
job - creates a
plan_weekdraft - returns
awaiting_approvalwhen the draft is ready for review
- Purpose: Ask the configured Codex provider to draft a related bundle of profile/template/workout assets.
- Body fields:
request(required)profile_id(optional target profile id)workout_id(optional target workout id)source(optional)
Response notes:
- creates a durable
job - may create multiple drafts
- template drafts targeting a not-yet-applied profile are allowed, but publishing still requires the profile to exist first
curl http://localhost:1609/health
curl http://localhost:1609/ready
curl -X POST http://localhost:1609/rerun/latest
curl -X POST http://localhost:1609/rerun/activity/17455368360
curl http://localhost:1609/dashboard/data.json
curl "http://localhost:1609/plan/data.json?center_date=2026-02-22&window_days=14"
curl -X PUT http://localhost:1609/plan/day/2026-02-22 -H "Content-Type: application/json" -d '{"distance":"6+4","run_type":"Easy"}'
curl "http://localhost:1609/dashboard/data.json?force=true"
curl http://localhost:1609/setup/api/config
curl http://localhost:1609/editor/profiles
curl "http://localhost:1609/editor/template?profile_id=default"