API access to Intervals.icu

Hi guys,

I feel like I am going crazy just trying to Auth and use my API key - I constantly get 403 or 422 errors when using what appears to be a valid API key an Athlete ID - Would it be possible to just post what you are using in Python to simply authorize and call a list of your last 5 workouts? I tried the below but I feel like a moron it’s not working - all my other API auths seem to work pretty easily this one I just can’t figure out (newbie scripter)

import requests

api_key = “my_api_key”
headers = {“Authorization”: "Bearer " + api_key}
url = “https://intervals.icu/api/v1/athlete/ATHLETE_ID/activities

response = requests.get(url, headers=headers)

if response.status_code == 200:
data = response.json()
print(data)
else:
print(“Error retrieving data:”, response.status_code)

Maybe this post can help

You need to use basic with with your API key, not Bearer … thats only for oauth.

1 Like

I have a customfield for alcohol from the fieldsearch (gerald m) which is set up to dropdown and the values 1-4.
It is customized for every status which shows only the symbol and none, a liitle …
The standard symbolisation shows the number instead.
When i push a value over api to the field it shows the standard (number) on calendar. If i open wellnessdata and save with ok (nothing changed) it shows the correct dropdown value.
Seems to be a bug?

When you say standard number, what number is that? If it’s not selected, it will remain blank. The symbol A is there to identify the field.

Standard : image
number is 1 not 42

after open wellness and save with ok: image

I send 1 to the wellness field via api

Okay, now I understand.

Seem that 42 is a default value; like the answer to life’s question.

i think the wellnessfield is correct. but the value is not correct interpreted via the api / not processed through the select option.

the 42 is the number of the example in the wellnessfield dialog. When i push the 1 to intervals, in the calendar is the standardsymbol with the 1 as value. (have no screenshot for the status after pushing via api, so i used the example with 42)

David, do you have a rate limit on the Intervals.ICU API?

Yes there are rate limits but you shouldn’t bump into those. I have had some problems in the past with the Intervals.icu web app suddenly generating a lot of requests (maybe when it “wakes up” on a mobile device or something?) and the rate limits protected against that.

@david now there are some new devices, it’s time to do a bit of work on my Garmin Glance app.

Is it possible to retrieve the rolling ramp rate (as shown on the fitness chart) from an endpoint? Many users have contacted me confused by the static (week-on-week) ramp rate that is shown on the athlete page.

Thanks!

3 Likes

Yes. Look for “rampRate” on the wellness record for each day. This is what is displayed on the fitness chart.

    @Export public Float ctl;
    @Export public Float atl;
    @Export public Float rampRate;
    @Export public Float ctlLoad;
    @Export public Float atlLoad;

1 Like

Hi David

Which API should I use to post a workout in ICU? Also what would be format ?

Thanks,
Rohan

https://intervals.icu/api/v1/athlete/(athleteId)/activities

FIT / TCX

1 Like

Just to add to app4g’s answer:

Thanks David for the complete and comprehensive answer. I was looking for completed activities.

Hi @david ,
I am thinking about creating Android widget that shows current Load/Fitness/Fatigue/Form and maybe some more stats on home screen.

For that I would need some kind of Auth flow for users ( similar to Strava ), is there an API for that, I couldn’t find anything like it in swagger

Thanks

search for oAuth

I did a search, and the only thing I see is o-auth-server-controller which returns all apps the user is authorized

2 Likes