KinesteX

Configuration

Initialize the SDK with your credentials: your company name, a unique user ID, and either your API key or a short-lived session minted by your backend. Regional deployments and warm-up are covered below.

Step 1: Initialize the SDK
Swift example:
1import KinesteXAIKit
2
3@State var showKinesteX = false // Controls KinesteX SDK visibility
4@State var isLoading = false    // Optional: Controls custom loading screen
5
6// Initialize with your API key, company name, and unique user ID
7let kinestex = KinesteXAIKit(
8    apiKey: "YOUR_API_KEY",
9    companyName: "YOUR_COMPANY",
10    userId: "unique-user-id"
11)
12
13// Optional: UserDetails to customize workout intensity
14let user = UserDetails(
15    age: 20,
16    height: 170,
17    weight: 70,
18    gender: .Male,
19    lifestyle: .Active
20)

Session auth (API key stays on your server)

Instead of shipping your API key inside the app, your backend mints a short-lived session with it (POST https://data.kinestex.com/api/sessions, see Session Auth & Managed Subscriptions) and the app launches KinesteX with the session id. Leave the API key out and pass session instead. When both are sent, the session wins. userId and company are still required.


PlatformHow to pass the session
SwiftCreate KinesteXAIKit without apiKey and add "session" to customParams on every view
KotlinKinesteXSDK.initialize without apiKey (2.2.0+) and "session" in customParams
FlutterKinesteXAIFramework.initialize without apiKey (1.5.0+) and 'session' in customParams
React Nativedata.session instead of data.key (1.5.0+). customParameters.session works too
React TSNot supported. kinestex-sdk-react-ts 0.0.3 requires key and renders nothing without it. Use the API key, or the HTML/JS iframe with session
HTML/JSsession instead of key in postData

The SDK Content API helpers (Swift fetchContent, Kotlin KinesteXSDK.api, Flutter apiService) still need an API key. With session auth, call the Content API from your backend instead.

Launch with a session
Swift example:
1// No apiKey: the session your backend minted authenticates the launch
2let kinestex = KinesteXAIKit(
3    companyName: "YOUR_COMPANY",
4    userId: "unique-user-id"
5)
6
7kinestex.createTrainerChatView(
8    user: nil,
9    style: nil,
10    isLoading: $isLoading,
11    customParams: ["session": sessionId],
12    onMessageReceived: handleMessage
13)

Regional deployments

If KinesteX runs your company in a regional deployment, point the SDK at the host your KinesteX contact gives you (the examples use https://ksa-ai.kinestex.com). The default host is https://ai.kinestex.com.


PlatformSetting
SwiftKinesteXAIKit(baseURL:). It moves the views only: the Content API helpers and the admin editor stay on admin.kinestex.com
KotlinKinesteXSDK.initialize(baseUrl = ..., apiBaseUrl = ...) (2.5.0+). apiBaseUrl moves the Content API (KinesteXSDK.api) and the admin editor. Both must be https URLs, otherwise initialize throws IllegalArgumentException
FlutterNot supported. kinestex_sdk_flutter 1.5.1 always loads ai.kinestex.com
React NativebaseUrl prop on KinestexSDK (and KinestexWarmup). Messages from other hosts are ignored
React TSbaseUrl prop on KinesteXSDK
HTML/JSLoad the iframe from the regional host and use that origin for postMessage and your event.origin check
Use a regional host
Swift example:
1let kinestex = KinesteXAIKit(
2    baseURL: URL(string: "https://ksa-ai.kinestex.com"),
3    apiKey: "YOUR_API_KEY",
4    companyName: "YOUR_COMPANY",
5    userId: "unique-user-id"
6)

Warm-up

Warming up loads the KinesteX app, your theme and the pose model before the user opens a view, so the first view starts faster.


  • Kotlin and Flutter: automatic. initialize loads the /warmup page in a hidden WebView, so call it once, early (Application class, main()). KinesteXSDK.dispose() / KinesteXAIFramework.dispose() release it.
  • React Native (1.4.0+): render <KinestexWarmup data={postData} /> (for example after login) and unmount it before you show KinesteX, or render KinestexSDK with visible={false} and set visible to true when the user opens it. onWarmupStateChange reports "loading", "ready" or "failed".
  • Swift, React TS, HTML/JS: no built-in warm-up.