API access to Intervals.icu

How can I create an “external” URL to point to a specific note (note, holiday, etc.)?

This is for hyperlinks from my more-prose logbooks to the appropriate i.icu content for further inspection or modification …

Thank you, boundsOnly works perfectly and is enough for me.

FYI request http://intervals.icu/api/v1/activity/i47602392/map?boundsOnly=true&bounds=left returns

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

and for http://intervals.icu/api/v1/activity/i47602392/map?boundsOnly=true&bounds=0

{
    "status": 422,
    "error": "Expected left, top, right, bottom for bounds"
}

Am I doing smth wrong?

You need to supply a list of coordinates for bounds e.g. bounds=-34,18.35,-33.950452,18.36. So left=-34, top=18.35 etc.

I often get these when I request messages for many activities, i.e., repeated

https://intervals.icu/api/v1/activity/{id}/messages

What’s the actual rate limit or what’s the suggested approach of throttling requests?

PS: Retrying the request after a 0.1 s sleep seems to work for now, but I am happy to handle this better;-)

The limit is currently 10/s per IP address with a short bust multiplier so your 0.1 sleep is perfect. That limit is mostly to protect the servers from Intervals.icu web app bugs.

1 Like

Hi guys. I am really bad with this kind of stuff, and i would like to get some help.

I tried to get my fitness data with curl, i get that to json file with raspberry pi. Problem is currently, that my json file is quite empty:
{“timestamp”:“2024-10-27T14:46:12.535+00:00”,“status”:404,“error”:“Not Found”,“path”:“/api/v1/athlete/15071938/fitness”}

Can someone help me out, how to get daily fitness with this curl command and get it to json file? I am mostly looking for only fitness, fatigue and form data

You need to use the wellness endpoint: GET /api/v1/athlete/{id}/wellness{ext}

curl -u API_KEY:xxx ‘https://intervals.icu/api/v1/athlete/2049151/wellness?oldest=2024-10-01&newest=2024-10-30

1 Like

Hello,

I have been trying to use the api but I keep running into 403s with basically every single endpoint.

I have tried using the API docs and Postman, but they seem to give me 403(Access denied) as well. I have tried two different accounts(one with data, one fresh), both seem to behave the same way.

For example, I am trying to access this one:
https://intervals.icu/api/v1/activity/{athlete id}/hr-histogram

Using curl(or anything else) I get this:

Any ideas as to what I am doing wrong?

Thanks!

I think you’re using athlete_id when it should be activity_id. Though how you get the activity_id for the activity you’re interested in is another question.

I am trying to get and update wellness records in my profile but I keep getting the 403: Access denied error.

curl -X GET "https://intervals.icu/api/v1/athlete/iXXXXX/wellness/2024-11-14" \
 -H 'accept: */*'\
 -H 'authorization: Bearer MYCURRENTAPIKEY'

Response:

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

Sorry if I’m making some really basic mistake.

you’re using bearer instead of API_KEY

Bearer is for OAuth and you need to get an oAuth Token for that.

Refer to above thread (the 1st post) to use the API_KEY username and where to get the password.

1 Like

That seems to be it, this expects an activity ID, thanks!

In case someone looks this up later, one way to get a list of activities is using the /api/v1/athlete/{id}/activities endpoint.

1 Like

You can now use “0” for the athlete id for endpoints that accept an athlete id in the path. This will use the athlete for the API key or bearer token used to make the call.

Example:

$ curl -u API_KEY:1l0nlqjq3j1obdhg08rz5rfhx \
    https://intervals.icu/api/v1/athlete/0/activities.csv

That will return activity data for whoever’s API_KEY that is.

Hi David - the new API capability is brilliant. It’s so great to see this feature!

is there any documentation for what the fields in the API responses mean? Some are obvious but others aren’t (to me at least)

I looked at the Swagger docs and the OpenAPI doc, but when checking the doc for "$ref": "#/components/schemas/Activity" (for example), there doesn’t seem to be any explanation of the field values

Did you check if your answer is in here somewhere?

There isn’t much of that yet. You can figure some of it out using the dom inspector and watching what the web app does. I will get to it for the main things eventually. At least the endpoints have docs now!

1 Like

Just an FYI @david that the schema and response for
https://intervals.icu/api-docs.html#get-/api/v1/athlete/-id-/weather-forecast is incorrect as it returns the set of daily forecasts and not the weather config/settings

Just an fyi that /api/v1/athlete/{id}/athlete-summary returns 500
If there is some other way that you would like to know about these or would prefer us not to let you know, please say. Thanks

I just tested that one and it did return the config info. The field is named “forecasts” but just includes the lat, lng etc:

curl 'https://intervals.icu/api/v1/athlete/0/weather-config' -u API_KEY:xxx
{
  "forecasts": [
    {
      "id": 1,
      "provider": "OPEN_WEATHER",
      "location": "Cape Town,Western Cape,ZA",
      "label": "Cape Town",
      "lat": -33.928993,
      "lon": 18.417397,
      "enabled": true
    },
 ...

This is the best place to post issues. I have fixed that 500 and added some docs for that endpoint. Will deploy Monday AM (GMT+2).

So using postman, this endpoint
https://{{server}}/api/v1/athlete/{{id}}/weather-config
returns

"forecasts": [
        {
            "id": 1,
            "provider": "OPEN_WEATHER",
            "location": "London,England,GB",
            "label": "London",
            "lat": 51.50853,
            "lon": -0.12574,
            "enabled": true
        }
    ]
}

While this one
https://{{server}}/api/v1/athlete/{{id}}/weather-forecast
returns

{
    "forecasts": [
        {
            "id": 1,
            "provider": "OPEN_WEATHER",
            "location": "London,England,GB",
            "label": "London",
            "lat": 51.50853,
            "lon": -0.12574,
            "error": null,
            "daily": [
                {
                    "id": "2024-11-23",
                    "pressure": 1003.0,
                    "humidity": 87.0,
                    "dew_point": 12.167119,
                    "clouds": 100.0,
                    "wind_speed": 11.41,
                    "wind_deg": 202.0,
                    "wind_gust": 24.11,
                    "rain": 9.66,
                    "snow": 0.0,
                    "weather": [
                        {
                            "id": 501,
                            "main": null,
                            "description": "moderate rain",
                            "icon": "10d"
                        }
                    ],
                    "sunrise": "07:32",
                    "sunset": "16:01",
                    "moon_phase": 0.0,
                    "temp": {
                        "day": 9.08,
                        "night": 14.3,
                        "eve": 12.96,
                        "morn": 4.07,
                        "min": 3.31,
                        "max": 14.3
                    },
                    "feels_like": {
                        "day": 5.15,
                        "night": 14.11,
                        "eve": 12.71,
                        "morn": 2.11
                    }
                }, ...

So I think the endpoints work as intended it’s just the the docs for the latter endpoint are incorrect