# API access to Intervals.icu

**URL:** <https://forum.intervals.icu/t/api-access-to-intervals-icu/609>\
**Category:** Guide\
**Created:** [1 April 2020 16:18 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609 "2020-04-01T16:18:59Z")\
**Posts on this page:** 20\
**Page:** 6

<div class="post-metadata">

**Author:** ![david](https://forum.intervals.icu/user_avatar/forum.intervals.icu/david/32/30189_2.png) [@david](https://forum.intervals.icu/u/david)\
**Post date:** [4 January 2022 14:29 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/101 "2022-01-04T14:29:28Z")

</div>

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

```auto
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?

---

<div class="post-metadata">

**Author:** ![Rohan\_EnduroCo](https://forum.intervals.icu/letter_avatar_proxy/v4/letter/r/5f9b8f/32.png) [@Rohan\_EnduroCo](https://forum.intervals.icu/u/Rohan_EnduroCo)\
**Post date:** [9 January 2022 14:31 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/102 "2022-01-09T14:31:28Z")

</div>

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

> [@david](#):
>
> 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?

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

---

<div class="post-metadata">

**Author:** ![david](https://forum.intervals.icu/user_avatar/forum.intervals.icu/david/32/30189_2.png) [@david](https://forum.intervals.icu/u/david)\
**Post date:** [9 January 2022 15:16 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/103 "2022-01-09T15:16:58Z")

</div>

Done:

 ![Screen Shot 2022-01-09 at 17.16.37](https://forum.intervals.icu/uploads/default/original/2X/e/ea7141062e6da949772b066ce1b5e99af6b0eae8.png)

---

<div class="post-metadata">

**Author:** ![snoopy](https://forum.intervals.icu/user_avatar/forum.intervals.icu/snoopy/32/27139_2.png) [@snoopy](https://forum.intervals.icu/u/snoopy)\
**Post date:** [1 February 2022 23:29 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/104 "2022-02-01T23:29:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![david](https://forum.intervals.icu/user_avatar/forum.intervals.icu/david/32/30189_2.png) [@david](https://forum.intervals.icu/u/david)\
**Post date:** [2 February 2022 03:55 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/105 "2022-02-02T03:55:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Rohan\_EnduroCo](https://forum.intervals.icu/letter_avatar_proxy/v4/letter/r/5f9b8f/32.png) [@Rohan\_EnduroCo](https://forum.intervals.icu/u/Rohan_EnduroCo)\
**Post date:** [14 February 2022 09:13 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/106 "2022-02-14T09:13:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![david](https://forum.intervals.icu/user_avatar/forum.intervals.icu/david/32/30189_2.png) [@david](https://forum.intervals.icu/u/david)\
**Post date:** [14 February 2022 14:58 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/107 "2022-02-14T14:58:20Z")

</div>

Yes there is: icu\_last\_seen on Athlete is what you are looking for.

---

<div class="post-metadata">

**Author:** ![Ben](https://forum.intervals.icu/user_avatar/forum.intervals.icu/ben/32/28464_2.png) [@Ben](https://forum.intervals.icu/u/Ben)\
**Post date:** [4 March 2022 15:37 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/108 "2022-03-04T15:37:28Z")

</div>

+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

---

<div class="post-metadata">

**Author:** ![david](https://forum.intervals.icu/user_avatar/forum.intervals.icu/david/32/30189_2.png) [@david](https://forum.intervals.icu/u/david)\
**Post date:** [4 March 2022 20:35 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/109 "2022-03-04T20:35:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ben](https://forum.intervals.icu/user_avatar/forum.intervals.icu/ben/32/28464_2.png) [@Ben](https://forum.intervals.icu/u/Ben)\
**Post date:** [5 March 2022 19:35 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/110 "2022-03-05T19:35:06Z")

</div>

> [@david](#):
>
> ext

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

---

<div class="post-metadata">

**Author:** ![Jules\_Cusson-Fradet](https://forum.intervals.icu/user_avatar/forum.intervals.icu/jules_cusson-fradet/32/39735_2.png) [@Jules\_Cusson-Fradet](https://forum.intervals.icu/u/Jules_Cusson-Fradet)\
**Post date:** [7 March 2022 21:29 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/111 "2022-03-07T21:29:57Z")

</div>

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

 ![Capture d’écran, le 2022-03-07 à 16.28.44](https://forum.intervals.icu/uploads/default/original/2X/3/31e8036b6fd57ec0d279428d17bf6f5e4e6d303b.png)

---

<div class="post-metadata">

**Author:** ![david](https://forum.intervals.icu/user_avatar/forum.intervals.icu/david/32/30189_2.png) [@david](https://forum.intervals.icu/u/david)\
**Post date:** [8 March 2022 06:51 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/112 "2022-03-08T06:51:47Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Jules\_Cusson-Fradet](https://forum.intervals.icu/user_avatar/forum.intervals.icu/jules_cusson-fradet/32/39735_2.png) [@Jules\_Cusson-Fradet](https://forum.intervals.icu/u/Jules_Cusson-Fradet)\
**Post date:** [8 March 2022 16:17 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/113 "2022-03-08T16:17:16Z")

</div>

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 😉

---

<div class="post-metadata">

**Author:** ![david](https://forum.intervals.icu/user_avatar/forum.intervals.icu/david/32/30189_2.png) [@david](https://forum.intervals.icu/u/david)\
**Post date:** [8 March 2022 19:23 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/114 "2022-03-08T19:23:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jules\_Cusson-Fradet](https://forum.intervals.icu/user_avatar/forum.intervals.icu/jules_cusson-fradet/32/39735_2.png) [@Jules\_Cusson-Fradet](https://forum.intervals.icu/u/Jules_Cusson-Fradet)\
**Post date:** [8 March 2022 19:45 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/115 "2022-03-08T19:45:43Z")

</div>

That’s sound reasonable! Thanks David.

---

<div class="post-metadata">

**Author:** ![Rohan\_EnduroCo](https://forum.intervals.icu/letter_avatar_proxy/v4/letter/r/5f9b8f/32.png) [@Rohan\_EnduroCo](https://forum.intervals.icu/u/Rohan_EnduroCo)\
**Post date:** [14 March 2022 10:02 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/116 "2022-03-14T10:02:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rohan\_EnduroCo](https://forum.intervals.icu/letter_avatar_proxy/v4/letter/r/5f9b8f/32.png) [@Rohan\_EnduroCo](https://forum.intervals.icu/u/Rohan_EnduroCo)\
**Post date:** [14 March 2022 10:24 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/117 "2022-03-14T10:24:49Z")

</div>

Hi @david

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

```auto
{
    "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

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

```

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

---

<div class="post-metadata">

**Author:** ![Ben](https://forum.intervals.icu/user_avatar/forum.intervals.icu/ben/32/28464_2.png) [@Ben](https://forum.intervals.icu/u/Ben)\
**Post date:** [14 March 2022 15:40 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/118 "2022-03-14T15:40:16Z")

</div>

Looks like it should be `activities` rather than `events`.

> [@API access to Intervals.icu](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/85):
>
> I added: GET /api/v1/athlete/{athleteID}/activities/{id1},{id2},.. which returns a JSON array of activities. Add ?intervals=true to include the interval data. The activities are streamed back one per line so you can parse them one at a time if you like: [{"id": "i2132160", "start\_date\_local": "2021-10-02T08:07:53",..}, {"id": "i2155441", "start\_date\_local": "2021-10-05T06:53:52",...}]

---

<div class="post-metadata">

**Author:** ![Rohan\_EnduroCo](https://forum.intervals.icu/letter_avatar_proxy/v4/letter/r/5f9b8f/32.png) [@Rohan\_EnduroCo](https://forum.intervals.icu/u/Rohan_EnduroCo)\
**Post date:** [14 March 2022 15:55 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/119 "2022-03-14T15:55:06Z")

</div>

As per this post here

> [@API access to Intervals.icu](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/4):
>
> I have added REST JSON endpoints for calendar access. If you have a clever way of generating training plans you can now get those into Intervals.icu easily. GET /api/v1/athlete/{id}/calendars List all calendars GET /api/v1/athlete/{id}/events List all calendar events. Requires parameters oldest and newest in yyyy-MM-dd format (local dates i.e. no timezone). The range may be expanded if oldest and/or newest fall inside a multiday event to include the whole event. Only events from enabled calend…

It should be **events**.

I am trying to post a workout

---

<div class="post-metadata">

**Author:** ![david](https://forum.intervals.icu/user_avatar/forum.intervals.icu/david/32/30189_2.png) [@david](https://forum.intervals.icu/u/david)\
**Post date:** [14 March 2022 17:43 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/120 "2022-03-14T17:43:52Z")

</div>

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.

> [@Rohan\_EnduroCo](#):
>
> GET `https://intervals.icu/api/v1/athlete/{{athleteid}}/events/6790756750`

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

[Previous page](https://forum.intervals.icu/t/api-access-to-intervals-icu/609.md?page=5)

[Next page](https://forum.intervals.icu/t/api-access-to-intervals-icu/609.md?page=7)
