icPlanner Partner API

icPlanner API v1

Technical documentation for integration partners. After OAuth consent, the API gives read-only access to the connected athlete's active icPlanner training plan.

Last updated: 2026-11-06

Base URL https://icplanner.de
OAuth Authorization Code + PKCE S256
Scopes read:athlete read:events write:events
MVP Active plan + completion reports

v1 Scope

  • Workout completion reports are accepted for the connected athlete's active plan.
  • Only the connected athlete's active icPlanner plan is exposed.
  • Activity and FIT uploads are not available yet.
  • planned_workout_id identifies one planned event within the active plan. A new plan generation creates new IDs.
  • The v1 API can still change slightly based on integration feedback.

OAuth2 Flow

The partner application starts the connection flow. icPlanner is the OAuth provider; the partner application is the OAuth client. Each integration partner receives a dedicated client ID after the development redirect URI is confirmed.

Authorize

GET https://icplanner.de/oauth/authorize
  ?response_type=code
  &client_id=<your_client_id>
  &redirect_uri=<your_redirect_uri>
  &scope=read:athlete read:events write:events
  &code_challenge=<s256_code_challenge>
  &code_challenge_method=S256
  &state=<opaque_state>

Token Exchange

POST https://icplanner.de/oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code
code=<authorization_code>
redirect_uri=<your_redirect_uri>
client_id=<your_client_id>
client_secret=<client_secret>
code_verifier=<pkce_code_verifier>

Refresh Token

POST https://icplanner.de/oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=refresh_token
refresh_token=<refresh_token>
client_id=<your_client_id>
client_secret=<client_secret>

Token Response

{
  "access_token": "opaque_access_token",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "opaque_refresh_token",
  "scope": "read:athlete read:events write:events"
}

API Endpoints

All API requests use Bearer authentication: Authorization: Bearer <access_token>

GET /api/v1/athlete

{
  "id": "dm_athlete_123",
  "username": "sven",
  "display_name": "Sven",
  "language": "de",
  "timezone": "Europe/Berlin"
}

GET /api/v1/athlete/{athlete_id}/events

GET https://icplanner.de/api/v1/athlete/dm_athlete_123/events?oldest=2026-05-01&newest=2026-05-31
Parameter Required Format Description
oldest Yes YYYY-MM-DD Inclusive start date. Events with start_date_local on or after this date are returned.
newest Yes YYYY-MM-DD Inclusive end date. Events with start_date_local on or before this date are returned. Must be equal to or after oldest.

Both parameters are required. If either is missing the API returns 400 invalid_request. A typical integration fetches a rolling window, e.g. today through the next 60 days.

The response is always a JSON array — even if only one event falls within the date range or no events exist. Do not use this endpoint to fetch a single event by ID; use GET /events/{event_id} for that.

[
  {
    "id": "dm_event_20260505_060611_2026-05-12_001",
    "planned_workout_id": "dm_pw_7f93f11f0a041f4b2a0d930c53f25f00",
    "plan_id": "20260505_060611",
    "name": "Build - VO2max",
    "type": "WORKOUT",
    "sport": "Ride",
    "start_date_local": "2026-05-12T09:00:00",
    "duration": 3600,
    "planned_load": null,
    "description": "Planned icPlanner workout",
    "has_workout": true,
    "status": null
  }
]

Key fields

Field Description
planned_workout_id Stable identifier for this event within the active plan. Use it to report completion; it is independent of provider activity IDs.
id Identifier for the event detail endpoint. Use planned_workout_id as the stable identity for completion reports.
start_date_local Local start time of the event. Use this field for calendar display.
sport Sport type: Ride, Run, Swim, Rowing, WeightTraining, or Other. Omitted values default to Ride on completion uploads.
status Completion state, currently null or completed.
has_workout true if structured workout steps are available via the detail endpoint. false for rest days, races, or notes without steps. Only fetch the detail endpoint when this is true.
duration Planned duration in seconds.
planned_load Planned training load (TSS). Currently null in the MVP.

GET /api/v1/athlete/{athlete_id}/events/{event_id}

Returns a single event object (not an array) including full workout.steps. Use the id field from the events list to construct the URL.

Workout steps are returned in the structured format and supported ON/OFF repeats are preserved.

For icTrainer, the cadence target is named target_cadence. If a workout step has no explicit cadence, the athlete's preferred cadence is used (default: 85 rpm). Other API clients use cadence for explicitly defined workout targets.

GET https://icplanner.de/api/v1/athlete/dm_athlete_123/events/dm_event_..._001
{
  "id": "dm_event_20260505_060611_2026-05-12_001",
  "planned_workout_id": "dm_pw_7f93f11f0a041f4b2a0d930c53f25f00",
  "plan_id": "20260505_060611",
  "name": "Build - VO2max",
  "type": "WORKOUT",
  "sport": "Ride",
  "start_date_local": "2026-05-12T09:00:00",
  "duration": 3600,
  "planned_load": null,
  "description": "Planned icPlanner workout",
  "has_workout": true,
  "status": "completed",
  "workout": {
    "format": "workout-structured-v1",
    "repeat_depth": 1,
    "repeat_mode": "on_off",
    "steps": [
      {
        "duration": 300,
        "ramp": true,
        "power": { "start": 45.0, "end": 60.0, "units": "%ftp" },
        "target_cadence": { "value": 85, "units": "rpm" }
      },
      {
        "repeat": {
          "count": 2,
          "steps": [
            {
              "duration": 600,
              "power": { "value": 115.0, "units": "%ftp" },
              "target_cadence": { "value": 85, "units": "rpm" }
            },
            {
              "duration": 240,
              "power": { "value": 60.0, "units": "%ftp" },
              "target_cadence": { "value": 85, "units": "rpm" }
            }
          ]
        }
      }
    ]
  }
}

Recommended Integration Pattern

A typical integration fetches the event list for a rolling window and only requests workout details on demand.

  1. Call GET /events?oldest=<today>&newest=<today+60d> to get the planned events for the next 60 days.
  2. Use start_date_local to place events on a calendar.
  3. Check has_workout: true before fetching details — events without steps (rest days, races, notes) do not need a detail call.
  4. When the user opens an event, call GET /events/{id} using the id from the list to load the full workout.steps.
# 1. Fetch event list
GET /api/v1/athlete/dm_athlete_123/events?oldest=2026-05-13&newest=2026-07-12

# 2. For each event where has_workout is true, fetch details on demand
GET /api/v1/athlete/dm_athlete_123/events/dm_event_20260505_060611_2026-05-12_001

Workout Steps

The step format is aligned with the intervals.icu native format. duration is always in seconds. Power is the primary workout target and is expressed as percent of FTP via the power object. A step may also include an optional cadence target in rpm.

Steady-state step

{
  "duration": 240,
  "power": { "value": 115.0, "units": "%ftp" },
  "cadence": { "value": 90, "units": "rpm" }
}

cadence is optional and does not replace the power target. Other API clients receive it when the workout step has an explicit target. In icTrainer responses, the field is named target_cadence; missing workout targets use the athlete's preferred cadence (default: 85 rpm).

Ramp step (warmup / cooldown)

{
  "duration": 300,
  "ramp": true,
  "power": { "start": 45.0, "end": 60.0, "units": "%ftp" },
  "target_cadence": { "value": 85, "units": "rpm" }
}

Structured ON/OFF repeat

This is the default representation of the event detail endpoint. It preserves exactly one repeat level with exactly two constant FTP steps: the first step is the ON phase and the The API exposes only this non-recursive ON/OFF representation.

"workout": {
  "format": "workout-structured-v1",
  "repeat_depth": 1,
  "repeat_mode": "on_off",
  "steps": [
    { "duration": 300, "power": { "value": 60.0, "units": "%ftp" }, "cadence": { "value": 85, "units": "rpm" } },
    {
      "repeat": {
        "count": 4,
        "steps": [
          { "duration": 120, "power": { "value": 95.0, "units": "%ftp" }, "cadence": { "value": 100, "units": "rpm" } },
          { "duration": 60, "power": { "value": 55.0, "units": "%ftp" }, "cadence": { "value": 100, "units": "rpm" } }
        ]
      }
    }
  ]
}

count is the total number of repetitions. Nested repeats, ramps, warmup/cooldown phases, and repeats with three or more child steps are returned flat in this structured response. Consumers only need to implement one non-recursive two-step repeat shape.

Migration from v1 (before 2026-05)

If you integrated before May 2026, you may have used the old format:

// OLD (deprecated)
{ "target_type": "percent_ftp", "target": 115, "duration": 240 }

// NEW
{ "duration": 240, "power": { "value": 115.0, "units": "%ftp" } }

Ramps were not available in the old format. The ramp: true flag and power.start / power.end are new fields.

Future extensions

Absolute watt support and HR-based targets (%hr, %lthr) are planned. Always read power.units rather than assuming %ftp — the exact format for future target types will be documented here when available.

Error Responses

{
  "error": "insufficient_scope",
  "message": "Scope read:events is required"
}
HTTP error Meaning
400 invalid_request A required parameter is missing or invalid.
401 invalid_token The token is missing, invalid, expired, or revoked.
403 insufficient_scope The access token does not include the required scope.
404 no_active_plan The athlete has no active icPlanner plan.
404 not_found The athlete or event was not found.

Current Test Status

  • A local partner simulator has completed the OAuth and API flow against icPlanner.
  • OAuth start, login, consent, callback, and token exchange are working.
  • Calendar and event detail responses include planned workouts and workout.steps.
  • Refresh-token rotation and core error cases are covered by route-level checks.

POST: Report a completed workout

POST /api/v1/athlete/{athlete_id}/events/completions

Requires the write:events scope. status must be completed and completed_at is required. planned_workout_id is optional: when it identifies a workout on the same date, that workout is marked complete; otherwise the activity is saved as a separate calendar entry. Activities are stored per athlete with the API client as their source.

{
  "planned_workout_id": "dm_pw_7f93f11f0a041f4b2a0d930c53f25f00",
  "status": "completed",
  "completed_at": "2026-11-11T09:30:00+01:00",
  "duration": 5400,
  "actual_load": 82.5,
  "load_type": "TSS",
  "sport": "Ride"
}

status and completed_at are required. planned_workout_id, sport, duration, actual_load, and load_type are optional. duration is a positive integer in seconds; when supplied, the calendar event uses the actual start and finish time. If sport is omitted, it defaults to Ride. Accepted values are Ride, Run, Swim, Rowing, WeightTraining, and Other. load_type is required when actual_load is provided. A standalone imported activity appears in the calendar and can be deleted there.