Authentication
Kynasmith uses short-lived bearer access tokens for API calls. The SDKs handle token management for you.Server-side authentication
Use your project-bound API key to initialize the Python SDK. The SDK automatically exchanges your credentials for a short-lived access token and refreshes it as needed.api_key value combines your key ID and secret in the format key_id:key_secret. You can find both values in the portal under Settings > API Keys.
Alternative credential formats
Alternative credential formats
You can also bootstrap with separate key ID and secret fields, or with a service account:
Browser authentication
Do not embed long-lived API keys or service-account secrets in the browser. Instead, expose a backend endpoint that exchanges your API key for a short-lived Kynasmith access token, then pass it through atokenProvider:
Backend token endpoint example
Your backend endpoint should call the Kynasmith token exchange API:access_token field with the short-lived bearer token your frontend needs.
Advanced: static access token
Advanced: static access token
If you already have a short-lived bearer token, you can pass it directly instead of a When using a static
tokenProvider:accessToken, you are responsible for refresh and rotation.Access token scopes
When minting an access token, you can restrict its capabilities with scopes. If no scopes are specified, the token inherits the full scope of the credential that minted it.
Use the narrowest scope set that your integration requires. Browser integrations typically need only
sessions:write (and optionally movespecs:read).
Token lifetime notes
- Browser integrations should treat
tokenProvideras a refresh hook, not as one-time bootstrap. The SDK may call it before each authenticated request. - The Python SDK automatically refreshes access tokens as they approach expiry.
- If you pass a bearer token directly through
accessTokenoraccess_token, you are responsible for refresh and rotation.
Direct API integration
If you are integrating without an official SDK, use:POST /api/auth/access-tokensto mint a bearer access tokenAuthorization: Bearer <access_token>header on all subsequent API callsPOST /api/detection/sessionsto create a session