API access to Intervals.icu

Think I have a solution to minimise the api calls by storing data locally so will only need to pull the latest data rather than last 30 days.

@david
Are these colour Settings exposed anywhere? (I tried searching the userPreferences at - https://intervals.icu/api/v1/athlete/(athleteId) and it’s not there)

Tx…

If it’s not exposed, it’s Fine also.

Those settings are exposed per sport:

GET /v1/athlete/{athleteId}/sport-settings/{id}

The id parameter can be an activity type (“Ride” etc.) and the settings for the sport for that activity are returned.

The “display” field has the settings:

{
  "id": 28723,
  ...
  "types": [
    "Ride",
    "VirtualRide"
  ],
  "display": {
    "color": "#0863b2",
    "color2": "#0a76d5",
    "lowLoad": 25,
    "showGAP": false,
    "showRPE": true,
    "highLoad": 260,
    "showFeel": true,
    "showLoad": true,
    "showName": true,
    "showPace": true,
    "colorScheme": "LOAD",
    "lowIntensity": 50,
    "highIntensity": 90,
    "showAverageHR": true,
    "showIntensity": true,
    "showIntervals": true,
    "showDescription": false,
    "showAveragePower": false,
    "showWeightLifted": true,
    "ignoreWorkoutColors": true,
    "showNormalizedWatts": true,
    "usePairedWorkoutColor": false
  },
  ...
}
2 Likes

Hi David,

Is it possible to pull Rider comments from an activity over the API? Some of our riders are now entering race comments directly into Intervals so we’d like to be able to pull them into the Hub to align against race plan and DS comments.

Hope you’re well. Might be getting more teams interested in this whole system over the next few months following the Copenhagen presentation.

Cheers

John

Cool! You can tell if an activity has messages by looking for ‘icu_chat_id’. If this is not null then it has an associated chat and messages. I added an endpoint to list the messages (if any):

GET /api/v1/activity/{id}/messages

Messages are returned in chronological order. You can supply a ‘sinceId’ parameter to get only newer messages.

1 Like

Awesome. I’ll have a play with that today. Thanks

Works perfectly. Thanks again

1 Like

Hi. I was wondering if there was an API call to pull out peak power numbers for a given time duration? Basically I wanted to do some playing around with different power curve models.
Thanks

Yep, can be found here in the documentation.

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

Thanks! Missed that one. Is there any guidance on what the difference parameter in the api call are referring too? i.e. what is the required filter parameter expecting?

Thanks

I usually have a look at what the network inspector is doing when the website is pulling the data.

In this case the power page calls this api, so you could set the filters you want there and copy the api call

1 Like

Sorry the API docs are a bit sparse. The Swagger docs are misleading re required parameters so it is best to use the UI as Ben suggests to see what to pass in.

1 Like

Am I reading the swagger/openapi wrong, or does it also not contain the correct response types? I haven’t been through them all so maybe you’re working on it and just not done :slight_smile: E.g. GET /api/v1/athlete/{id}/activities claims to return “object” but does in fact return an array (presumably of type “Activity”).

Also, is there no (defined in the docs) method for creating intervals? Looks like the website does PUT on /api/activity/{activityId}/intervals/{negative value?} with a body of {start_index: int, end_index: int}, but I’m trying to use a client generated from the openapi spec (with very minor changes) and it’s not in there.

Yes that activities endpoint returns an array of activities “streamed” one per line so you can process them as they come in. I have updated the signature.

[
{'id": ..., "name": ... },
{'id": ..., "name": ... }]

I added the “update intervals” and related endpoints to the API.

Fantastic! That works just peach.

Two bits I’m getting pushback on from the openapi-generator generated python API (for my data and the few operations I’m calling) are:

  • Activity.icu_sync_date appears to be returned as a ‘date’ not ‘date-time’
  • Activity.pace_load_type should have 'nullable': true (or a value for NONE, I guess). Lots of things should - seems like a huge task to go through it all so I certainly have sympathy for not doing that! The client can luckily be configured to ignore most of them - just not this one. Apparently it gets upset when there’s a list of allowed values but none is returned.

Hmm not sure what to do about these. Activity.icu_sync_date is a java.util.Date which has millisecond precision. Activity.pace_load_type is a reference to an enum and allows nulls.

Hello David,

how to get Bearer token for other users from their username and password input with API calls?

Or is it possible to generate API key for user from their username and password input? I can get userID from API call but can not get to api key or bearer token.

For OAuth, you would need to contact david directly and he will get you set-up. (You can also search the forum for the oAuth thread)

Hi david,

You know if its possible to send via push the weight data to garmin, when we put the weight via manual or from the icu API. For the moment not appear on garmin.

Many Thanks!

As far as I know you can’t push anything to Garmin Connect other then workouts.

2 Likes