API access to Intervals.icu

@David @app4g Thanks both.I knew it would be something stupid. Apologies

1 Like

Hey @david, thank you for such an amazing product and this API. Is there any way to update profile info such as name, email, avatar etc?

I can send there “name” and server even answers 200 code, but name seems unchanged

Currently you can only update name, email and some other personal settings if you are calling using the API key for the athlete being modified. You can’t update these using a bearer token from OAuth. I could change this for name and profile pic?

I’m using API key for request above. I didn’t know that there is a possibility to authorize user with OAuth :slight_smile:
Can I use bearer token to update weight and resting HR as well?

Yes you can. You need WELLNESS:WRITE scope.

Many thanks @Andrii_Magalich for sharing this, really low effort way in to having a play with this excellent API.

In case of interest or helps anyone else, here’s a link to the doc I built based on what you shared:

Main thing the sheet is for is to suggest what your next activity could be to achieve a user specified Form value - in the sheet imaginatively called “Next Activity”. Also recreates the fitness/fatigue chart.

To make it work take a copy, then your details (user number and API key) simply need to be entered in the red cells near the top of the sheet called "Daily Record’, which also has the button to manually trigger pulling data from intervals.

3 Likes

You’re welcome!

Is there a way to pull the compliance to plan % over the API? and what are the rules for colouring this. Using the API more and more now to integrate with our Pro Cycling Team Hub image

Unfortunately that is currently done client side so its not in the API. Would be nice if it was though.

There is a field on activity “paired_event_id” that is the ID of the paired workout if any. Pairing is done automatically if the workout matches the activity closely enough (sport and load/time) and can also be done manually (drag and drop). So you might be able to use that.

The colours are as follows:

if (p >= 80 && p <= 120) return "good"
if (p >= 50 && p <= 150) return "poor"
return "bad"

.good {  color: #2ca02c; }
.poor {  color: #ff7f0e; }
.bad {  color: #d62728; }

I will see what I can do about getting compliance into the API. It’s a bit complicated and a big advantage of doing it “client side” on demand is that it is always up to date. I would need to store compliance for the week on the wellness record for the Sunday or something.

1 Like

Thanks David. Not a problem I can pull both the event and activity and do the comparison.

Makes sense to keep it client side as you say.

Cheers

John

Just after the key ‘current’ values for an athlete’s fitness, fatigue, form and eFTP. Am I right in thinking that these are not available from the wellness endpoint?

I have looked at the summary endpoint but this returns data for multiple athletes and is proving a nightmare to parse in my app.

Thanks

You can get CTL, ATL, eFTP etc from the wellness endpoint GET /api/v1/athlete/{id}/wellness?cols=ctl,atl,rampRate,ctlLoad,atlLoad,eftp

https://intervals.icu/api/v1/docs/swagger-ui/index.html#/wellness-controller/listWellnessRecords

1 Like

Great. I was thinking these were something else :man_facepalming:

what does athlete tags mean here? Is there any way to only bring back info for yourself from the summary endpoint?

Those are the tags as attached to athletes on the /athletes page. I just added a special one “self”. If you use that only your own data will be returned.

Thank you - is the ‘self’ tag auto applied to all users, so my code will work for everyone?

Yes if you use tags=self then only the calling athletes data is returned. So this will be the athlete for the bearer token for oauth or the athlete for the API key.

1 Like

Perfect, exactly what I was after. Thanks

I changed it a little bit. Now if you do tags=self then the data for the athlete id in the path is returned.

1 Like

I have a question. I am trying to pull the future events on the athlete calendar with an API. I get all the training plan data that I need but I am missing average power, normalised power and variability index. Is it possible to get at least variability index of a calendar event with API and if it is how?

Thank you