# 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:** 1\
**Showing post:** 433

<div class="post-metadata">

**Author:** ![app4g](https://forum.intervals.icu/user_avatar/forum.intervals.icu/app4g/32/41800_2.png) [@app4g](https://forum.intervals.icu/u/app4g)\
**Post date:** [7 June 2024 13:06 UTC](https://forum.intervals.icu/t/api-access-to-intervals-icu/609/433 "2024-06-07T13:06:59Z")

</div>

@david let me know if i’m doing something wrong. I’m trying to improve the [workout library sync.](https://forum.intervals.icu/t/breakaway-indoor-training-now-supports-intervals-icu-workout-library/48341/4)

For workouts which I created by myself (either created by hand or dragging existing workouts to the library folder), I have no issues using the API to download the JSON it.

basically sending a GET to  
let url = “[https://intervals.icu/api/v1/athlete/\(athleteId)/workouts/\(workout.id)](https://intervals.icu/api/v1/athlete/%5C(athleteId)/workouts/%5C(workout.id))”

then POST to  
“[https://intervals.icu/api/v1/athlete/\(athleteId)/download-workoutjson](https://intervals.icu/api/v1/athlete/%5C(athleteId)/download-workoutjson)”

However, when i copy any workouts that is available from the public workout library into my own Library,

eg: Gerries Workout

 ![Screenshot 2024-06-07 at 8.55.13 PM](https://forum.intervals.icu/uploads/default/original/3X/7/2/7258b6e2773ae6813176e1e74e23011818a7e510.png)

Doing the same process, it will fail with the error:

```auto
Download Error: requestError[Error Domain=OAuthSwiftError Code=400 "Required request body is missing" UserInfo={NSLocalizedDescription=Required request body is missing, Response-Headers={
    "Access-Control-Allow-Origin" = "*";
    "Content-Length" = 57;
    "Content-Type" = "application/json;charset=UTF-8";
    Date = "Fri, 07 Jun 2024 13:03:29 GMT";
    "Strict-Transport-Security" = "max-age=15724800; includeSubDomains";
}, OAuthSwiftError.response=<NSHTTPURLResponse: 0x6000037f99c0> { URL: https://intervals.icu/api/v1/athlete/{athleteId}/download-workoutjson } { Status Code: 400, Headers {
    "Access-Control-Allow-Origin" = (
        "*"
    );
    "Content-Length" = (
        57
    );
    "Content-Type" = (
        "application/json;charset=UTF-8"
    );
    Date = (
        "Fri, 07 Jun 2024 13:03:29 GMT"
    );
    "Strict-Transport-Security" = (
        "max-age=15724800; includeSubDomains"
    );
} }, OAuthSwiftError.response.data={length = 57, bytes = 0x7b227374 61747573 223a3430 302c2265 ... 69737369 6e67227d }, NSErrorFailingURLKey=https://intervals.icu/api/v1/athlete/{athleteId}/download-workoutjson, Response-Body={"status":400,"error":"Required request body is missing"}}]

```

when issuing a GET to one of my own libraries, i will get a response which can then be converted to JSON. But for the shared libraries, copied to my own library, nothing gets returned.

---

_[View the full topic](https://forum.intervals.icu/t/api-access-to-intervals-icu/609)._
