How to assign a plan to an athlete by API?

Hello all,

I know to do it directly on the web interface, but I would like to automatize it by using API.

I understand I will have:

  1. Register an OAuth app in intervals.icu.
  2. Athlete wanting to follow my plan have to give me the access by using my OAuth intervals.icu sign-in form on my website.
  3. All the OAuth flow to get technically the token.
  4. With the token I can call the correct endpoints to apply the training plan to this athlete.

I read the Swagger API doc, but it’s not very clear for me what endpoints I should use for that.

I get my training plans and their respective ids with the folders endpoints?
https://intervals.icu/api/v1/athlete/{{MY_ID}}/folders

How to apply it then to an athlete with a starting date?
What endpoints should I use for that?

Thanks for your help

You need to use this endpoint:

PUT /v1/athlete/{id}/training-plan
{ "training_plan_id": 1234, "training_plan_start_date": "2023-11-06" }

The training_plan_start_date must be a Monday. The plan will be applied to the athlete immediately if it has changed.

I need to put some effort into improving those Swagger docs.

1 Like

I did a test, it works.
Thanks David !

1 Like