API access to Intervals.icu

Thanks @MedTechCD
Still getting the 403 with this code. Have I something incorrect here?

import requests

API_KEY = “using correct api”
ATHLETE_ID = “using correct id”
URL = f"https://intervals.icu/api/v1/athlete/{ATHLETE_ID}"

# Use basic auth: API key as username, empty password
response = requests.get(URL, auth=(API_KEY, ‘’))

print(f"Status Code: {response.status_code}")
print(“Response Text:”)
print(response.text)

image

getting this error straight from the browser too.

I have regenerated the api key but get same error with new key

Moved it over here.
You probably just miss a correct end-point now.

The API key is literally “API_KEY” (username as string). The password is the String (API key) from the settings.

ya. I put my API Key in instead of “using correct api” - Just wasn’t post my API Key on the forum.
I can’t figure this out. I have no idea why I am getting the 403.
The code below should work

import requests

API_KEY = “xxxxxxxxxxxxxxxxxx”
ATHLETE_ID = “xxxxxx”
URL = f"https://intervals.icu/api/v1/athlete/{ATHLETE_ID}"

response = requests.get(URL, auth=(API_KEY, ‘’))

print(f"Status Code: {response.status_code}")
print(“Response Text:”)
print(response.text)

You have no password, and you use your api key as username.
It must be something like this

auth=('API_KEY', API_KEY)

The second argument is your long string from the settings as a variable

3 Likes

Thanks @R2Tom I’m in

1 Like

Hi, @stezz ! Did you ever get an Action from custom GPT working? I’m working with a hallucinating ChatGPT to sort it out, but as far as I understand the problem is with authentication. GPT cant set the username to ”API_KEY”, cause you can only set the password. Since I don’t trust my GPT I’m not sure about this.

It seems like it could be possible to use third party tools so GPT contacts them, they add the correct authentication and parses the query to Intervals and returns the answer to GPT. But didn’t get it working with the help of GPT, so kind of gave up again.

If anyone got ChatGPT+ to connect to Intervals I could document it on the forum for others to copy.

I have a python script which takes a cycling workout description from excel (something like 3x(8x(1m @ 105-110% @ 100 rpm, 2m @ 80-85% @ 70 rpm) , 4m rec) ), parses it and converts to a .zwo and then uploads it to a specific date in my calendar.

I’ve been trying to do the same via a .json for running workouts but I’m having zero luck. Can running workouts get sent to the calendar in a proper structured format (i.e. not just a line of text). Anyone else done this? Thanks

Edit - I found this thread. Thank you @Jonasdlm Super stuff.

is this flag intended to work with the https://intervals.icu/api/v1/athlete/${intervals_id}/wellness/${date} endpoint too?

I was having issues getting it to work, i keep getting a 422. I tried passing it in as a query string and also in the payload

Hi David!

Im planning to create an AI agente (yes i said Ai and agent in the same sentence :joy:). That consume information from some data points (garmin, my fitnespal, others) and can create training plans in base of objetives.

I would like to that plan store in intervals, so the people can upload to their garmin o apple watch.

I would research your api docs, any recomendation thinking in this use case?

Thanks!

Easiest would be to push events directly to the athletes calendar. There is some info here:

Otherwise you could create a plan in the athletes library but that is a bit more complicated.

Hi David,

I’m trying to use the Intervals.icu API, but I don’t see the “Allow API access” checkbox under Developer Settings on my Settings page. Could you please enable API access for my account?

My Athlete ID is: i334709

Thanks a lot!
Philippe

Everyone has access. Use basic authentication with athlete id in the link, API_KEY (this exact string) as user and your api-key (found on the settings page) as password.

1 Like

There should be a section that looks like this (with your own id, of course)
image

If you click on where it says “(view)” you should get a popup that looks like this:

The part I’ve scribbled out is my api key - you will see your own. If you click on it, it will copy it to the clipboard so you can paste it elsewhere

Hi everyone,
does someone know how to get the corebodytemp data?
Is it actually available?

cheers,
Roland

yes.. if it’s uploaded into intervals from te FIT file, then it’s available.
YOu access it using the same “code” as the custom field for core body temp

1 Like

I will give it another try.
Currently my code doesn’t fetch it.
But I do not know why. Maybe I should learn how to do it by myself instead of using Gemini CLI :sweat_smile:

API 404 Error for Garmin Activity i81043961

Hello @david,

I am consistently getting a 404 Not Found error when trying to fetch streams for my Garmin activity i81043961.

We have confirmed my API call is correct (/api/v1/activities/81043961/streams) and that I am using the correct authentication method. Since it is a Garmin activity, it should have streams.

Could you please investigate if there is an issue with this specific activity file on the server? Thank you!

Hello @david,

glad ICU offers bulk APIs.

Any plans for

  • PUT [/api/v1/athlete/{id}/events/bulk] to update multiple events?

  • PUT [/api/v1/athlete/{id}/activities/bulk] to update multiple activities?

Those are actually two ones I am missing most.