API access to Intervals.icu

You need to use this endpoint: GET /api/v1/athlete/{id}/events{format}

If you add resolve=true then all the workout step targets will be expanded into actual watts/bpm/pace values using the athlete’s zones and other settings.

Thanks, sadly I can’t use raw values (watts\bpm). I push these values to TrainingPeaks, and it accepts only percentage of ftp\lthr\etc.

Hmm. For power the athlete’s FTP is included in the workout_doc field:

    "workout_doc": {
      "duration": 3600,
      "distance": 0.0,
      "ftp": 290,
      "target": "POWER",
      "steps": [
        {
          "duration": 3600,
          "power": {
            "value": 2.0,
            "units": "power_zone"
          },
          "_power": {
            "start": 162.0,
            "end": 217.0
          }
        }
      ],
      "zoneTimes": [..],
      "options": {},
      "locales": []
    },

So you can use that to translate the _power step into % of FTP. If that works I can add lthr and threshold_pace as well.

It actually looks nice. I’m gonna try this out and will get back.

Works great. Thanks for the idea!

Yes, please. I would appreciate that.

Also, I’ve found resolved object have start and end fields even if step has no range.

{
  "duration": 600,
  "power": {
    "value": 40.0,
    "units": "%ftp"
  },
  "_power": {
    "value": 96.0,
    "start": 93.0,
    "end": 99.0
  }
},

Is this correct behavior?

Yes, Intervals.icu translates fixed power (and other) targets into a range. For power this is only done for outdoor workouts. The default range for power and pace is 2.5%. For HR it is 1.5%. If the athlete has changed Garmin stuff in /settings then these are the defaults:

You can also supply powerRange, hrRange and paceRange query parameters to the call (e.g. powerRange=5.0) for 5%. Use 0.0 to disable range. I am going to update the docs.

Devices beep and so on if you aren’t in the range and this is impossible outdoors and for HR and pace if there isn’t some spread.

I have added these fields to workout_doc and will deploy Thurs AM (GMT+2):

public Integer lthr;
public Float threshold_pace;
public String pace_units;
2 Likes

Is it possible to get activity HR curves via the API in the same way that I can get activity power curves. I could call the hr-curves end point multiple times, i.e. for every day in the date range of concern, but wondering if there’s a more efficient way of doing this?

Cheers

John

Looks like I missed that one. I have to go out now but will add an endpoint on Sunday.

2 Likes

Thanks David. No rush.

Delete a range of events from the athlete’s calendar

DELETE /api/v1/athlete/{id}/events/…

…/api/v1/athlete/i56789/events?oldest=2023-12-10&category=WORKOUT&created_by_id=i123456

would be great to get a query param created_by_id added @david

I added a createdById parameter to that endpoint: Intervals.icu API docs

I have added GET /api/v1/athlete/{id}/activity-hr-curves{ext}

2 Likes

Thanks David. Works perfectly.

Cheers

John

very quick one. thanks, it works as it should

@David I’m not sure why/what is happening. I record my outdoor ride on 2 Garmins (and then delete one after, keeping only 1).

The name, as an example is named the same here. (note: When I go into the activity detail, the Garmin Link and Strava Link are different for both activity so it’s 2 separate activity)

When I use the API to rename the activity:

curl -u API_KEY:XXXX -H ‘Content-Type: application/json’ -X PUT -d ‘{“name”:“BBBB” }’ https://intervals.icu/api/v1/activity/i33936243

This Happens. Both activity got the new name.

When I use the web-interface to rename the activity, it’s OK

I’ll keep the activity there so you can have a look. Tx

Getting an exception since some hours: DNS error: https://intervals.icu/api/v1/athlete/i123456/events.csv?oldest=2012-01-28&newest=2025-02-28 @david

Main intervals.icu site is also not reachable for me (Forums is on another server is what I’ve been told)

An athlete sent me something about Google blocking Intervals. It’s working fine for me.

I haven’t been able to reach the forum the whole day. Intervals.icu was no problem.

You can read the story here. I will do a post soon.

“Google closed my cloud account without warning. I eventually found out they require verification of my identity and home address. I have submitted the docs.”

I have moved DNS already so things should start mostly working. It’s just so Google to close an account without even sending a warning email.

https://www.reddit.com/r/cycling/comments/1b2zg09/intervalsicu_is_down_temporary/

1 Like

Must have been a stressy day…