API access to Intervals.icu

Tx. Yes you need to update the athlete’s settings for the sport:

PUT /api/v1/athlete/{athleteId}/sport-settings/{id/type}
{ "ftp": 300, "indoor_ftp": 280 }

You can find the current settings in the sportSettings field on athlete.

You can supply an activity type (e.g. “Ride”, “Run”) instead of an ID to update settings for the matching sport.

You need to have SETTINGS:WRITE scope for the athlete.

I see you app is not displayed on the “apps that can integrate with Intervals.icu” section on the /settings page. I can enable this for your app if you like?

1 Like

Hi David. Thanks for the prompt reply. I will update the app as per the settings write API. This is very useful.

This would be absolute honor. Please add it to the apps that can integrate section.

Done:

1 Like

Hi @david have you had any luck with adding support to import FIT planned workout files or importing ZWO files created for runs?

Nothing on .fit import yet. Could you please email me (david@intervals.icu) a zwo for a Run. I should be able to get that to work easily. Tx.

Hi @david. Is there a way to get users last active date on intervals?

I want to tell inactive users to regularly log in to intervals so that they don’t lose data sync with strava.

Yes there is: icu_last_seen on Athlete is what you are looking for.

1 Like

+1 for this, would like to be able to compare power curve between different dates. Will probably put it in a R shiny site or python streamlit

You can do this: GET /v1/athlete/{id}/power-curves{ext}

Its not very well documented (need to get on that!) but you see what to send using the inspector on the /power page.

1 Like

Oh excellent, got that working okay. The Response is so detailed so a huge thank you once again.

1 Like

Is there a way to download old data with the API?

Not at the moment but you can list and download old activities that are already on Intervals.icu. What would be the use-case for having “download old data” part of the API?

Some athletes I coach on Intervals.icu don’t log into the app regularly, so I sometimes miss their data (but only if data come from Strava of course). It’s a bit of a pain having to go to their profile settings to update the data :wink:

They only have to use Intervals.icu every 28 days or subscribe :slight_smile:

That’s sound reasonable! Thanks David.

Hi @Jules_Cusson-Fradet

In the API there is icu_last_seen field

Using this you can query and find out athletes who have not logged in for a while

1 Like

Hi @david

GET https://intervals.icu/api/v1/athlete/{{athleteid}}/events/6790756750 is giving

{
    "status": 500,
    "error": "org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: \"6790756750\""
}

and POST https://intervals.icu/api/v1/athlete/{{athleteid}}/events is giving

{
    "status": 403,
    "error": "Access denied"
}

I feel I am making some silly mistake here. Please help me out.

Looks like it should be activities rather than events.

As per this post here

It should be events.

I am trying to post a workout

Are you trying to upload a completed activity or creating a planned workout?

You need to have asked for CALENDAR:WRITE scope to be able to upload planned workouts.

That looks like an activity ID. It’s too big for an event id.