API access to Intervals.icu

If you look in the record dataframe within the returned list you should see columns for Speed, long, Lat etc.

1 Like

Yes. Here is the complete list. As Ben said you can find out this sort of thing by looking at the calls made by Intervals.icu web app. Most can just have a /v1/ inserted to use from the API.

public static final List<String> STRAVA_TYPES = Arrays.asList("time", "watts", "cadence", "heartrate", "distance",
        "altitude", "latlng", "velocity_smooth", "moving", "grade_smooth", "temp");

public static final List<String> TYPES = new ArrayList<>(STRAVA_TYPES);
static {
    TYPES.add("torque");
    TYPES.add("fixed_watts");
    TYPES.add("fixed_heartrate");
    TYPES.add("raw_watts");
    TYPES.add("raw_heartrate");
    TYPES.add("left_right_balance");
    TYPES.add("smo2");
    TYPES.add("thb");
    TYPES.add("smo2_2");
    TYPES.add("thb_2");
    TYPES.add("dfa_a1");
    TYPES.add("epoc");
    TYPES.add("hrv");
    TYPES.add("ga_velocity");
    TYPES.add("fixed_altitude");
    TYPES.add("corrupt_time");
    TYPES.add("core_temperature");
    TYPES.add("skin_temperature");
    TYPES.add("stride_length");
    TYPES.add("w_bal");
    TYPES.add("respiration");
    TYPES.add("watts_alt");
    TYPES.add("watts_alt_acc");
}
1 Like

Hello, first of all thank you for this fantastic website!
Than I would like to ask how if there is a API method to get the distance I did during the activities starting from a specific date up to the current day.

Thank you

You can easily do this in python.

Something like this (pseudocode as I’m not near a python console or the api documentation at the moment):

workouts = requests.get(‘/workouts’, …)
dist = sum([x[‘icu_distance’] for x in workouts])

You might want to filter specific types and correct for errors regarding None values in icu_distance (which is the distance icu calculated)

Edit: you’d filter start and end date in the api call and if necessary the workout type in the list comprehension)

curl.exe -u API_KEY:**APIKEY** https://intervals.icu/api/v1/athlete/**AthleteID**/activities?oldest=2022-11-15^&newest=2022-11-21 -o activities.json

This will give you a JSON file with a record for each activity in the specified date range. Filter out the value-pairs you need.

@david

Hi David
When trying to import wellness.csv into excel, custom columns are omitted (only default columns are imported). Do know why this is and if it’ll be possible to pull in custom columns?

https://intervals.icu/api/v1/athlete/xxxxxx/wellness.csv is the address I use

Hmm I just tested that and “it worked for me”. The athlete does need to have the custom column configured.

1 Like

Not sure if I understand what you mean…
Do we need to change the config in Options/Wellness to get the custom fields with an API call?
Because this isn’t influencing the fact that you get all standard columns even those not selected. That is, when getting wellness.csv through the API. If you do a manual csv download, you only get what is configured.
Or is Excel doing this differently?
I found a solution by making an API call by date and specified columns, which gives me a csv with everything I need.

I deleted the connection (in Excel) and reconnected; all fields come through, including custom fields.

I’ve read that in your other post and tried it out but nothing changed. Might have to retry it and let you know.

1 Like

I see I used the URL from the wellness download, and removed the date

https://intervals.icu/api/v1/athlete/[athleteID]/wellness.csv?cols=weight,restingHR,hrv,hrvSDNN,readiness,sleep,sleepScore,sleepQuality,avgSleepingHR,soreness,fatigue,stress,mood,injury,motivation,bloodPressure,hydration,comments,vo2max,SweatRate,SodiumLoss,ctl,atl,rampRate,ctlLoad,atlLoad,eftp

This way I only get the data that I need/want.
I removed the date, but had to add /v1 after /api

2 Likes

Yes, that is working. If you specify the columns you want, it gives you exactly that. If you don’t use the ‘cols’ statement it gives you all the standard Wellness fields but not the custom ones.

I accidentally delete the tabs, when setting up a new athlete’s file, but actually working on my master. Then I forgot how I did it before and ended up with this method to download… would that be considered trial and error? :rofl:

I have been doing that a lot lately, and I call it ‘learning’ :joy:

1 Like

Thanks! That works. Trying to think what was different about the URL I was using. I think it was the date. I had a date in mine.

Great that it’s working for you.

The date in the normal wellness download, in the activities page, has dates in the future. It’s easy to ignore it in Excel, but it’s easier without future dates.

1 Like

@Gerald
Hmmm
I spoke too soon. Some custom columns import. Others do not.

This is my url:
https://intervals.icu/api/v1/athlete/xxxxxx/wellness.csv?cols=weight,restingHR,hrv,hrvSDNN,LFPower,HFPower,EliteHRV,comments,sleep,sleepQuality,soreness,fatigue,stress,mood,injury,motivation,bloodPressure,ctl,atl,rampRate,ctlLoad,atlLoad

LFPower and EliteHRV data imports. HFPower does not.
They’re all configured the same way, although I don’t know what ‘format’ .1f means. I just left it as default.



Same result when I add a date to the query (this is preferrable as I don’t want to import rows older than Oct 25th 2019

https://intervals.icu/api/v1/athlete/xxxxxx/wellness.csv?oldest=2019-10-25&cols=weight,restingHR,hrv,hrvSDNN,LFPower,HFPower,EliteHRV,comments,sleep,sleepQuality,soreness,fatigue,stress,mood,injury,motivation,bloodPressure,ctl,atl,rampRate,ctlLoad,atlLoad

Are you able to input data in the custom fields?
There seems to be missing fields, Units of Measure, Min and Max values, etc.

Here’s the Sweat Rate field

Once that is working, then I select the fields in the Welllness settings

Tick the health box, as it isn’t showing in the list of fields that will download.

Once ticked, Health then shows in the list, and will show in the URL.

1 Like

Thanks @Gerald
I will try this later. Gent

The CSV upload is now fussy about custom wellness column names. If the athlete doesn’t have that wellness field configured it will return a 422 error with a message.

If you want the old behaviour (missing custom wellness fields ignored) then specify ignoreMissingFields=true as a query parameter.