Skip to content

Web SDK ​

TrainingKit Web SDK lets you launch a workout experience in a web page with a hosted SDK script and a trainingkit.start() call.

Use this section when you need to:

  • load the SDK from the TrainingKit CDN
  • initialize it with your TrainingKit base URL
  • start a workout from a workout identifier
  • provide a backend-issued access token when API authentication is enabled
  • react to workout lifecycle events in your application

Integration flow ​

  1. Load the SDK script in your page.
  2. Call trainingkit.init() with your TrainingKit base URL.
  3. Call trainingkit.start() with a workoutId and optional callbacks.
  4. If your API perimeter requires JWT authentication, implement getAccessToken() to fetch a short-lived token from your backend.
  5. Listen to workout events to handle quit, save, or custom tracking behavior.

In this section ​

Security note ​

If you use API authentication, keep JWT signing and private keys on your backend only. The web client should only request a token from your server and pass it to the SDK.