Build for your users
Onboarding flow
Send users to a hosted page where they create their own Kyara API key, then come back to your app.
If your app needs each user to bring their own Kyara API key, send them to the hosted onboarding page instead of walking them through the dashboard. Kyara signs them in, explains what the key is for, creates it, and sends them back to you. Their requests then run on their own plan and credits.
Onboarding URL
Link users to the onboarding page with your own redirect value:
https://kyara-intelligence.com/onboard?redirect=https%3A%2F%2Fapp.example.com%2Fsettings%2Fkyararedirect string, query Where the user goes after creating the key. It must be an absolute http or https URL;
anything else makes the page answer with a 400 error. The page shows its domain to the user, so they
always know where they are going.
Without redirect, the user lands on a plain key generation page that leads back to the dashboard.
Build the URL with a URL API so the value is encoded correctly:
const onboarding = new URL('https://kyara-intelligence.com/onboard');
onboarding.searchParams.set('redirect', 'https://app.example.com/settings/kyara');
// Link or redirect the user to onboarding.hrefWhat the user sees
Sign in or create an account
Users who aren't signed in go to the Kyara login page first, where they can also sign up, and return to the flow afterwards.
Read what they are granting
Three short screens name your domain and explain what an API key is, how the connection works, and that usage from your app counts toward their plan and credits.
Generate the key
The user generates a key and copies it; it is shown once. Each run of the flow creates an additional key, and existing keys keep working until the user regenerates from the dashboard, which revokes all of them.
If the user has no active plan, the page says so and links to the pricing page. The key is still created, but requests with it return
403 no_active_planwhile the account has neither a plan nor top-up credits. If their last payment failed, the page offers a link to fix it.Return to your app
A Return to button sends the user to your
redirectURL. The key is not added to the redirect, so ask the user to paste it into your app to finish connecting.
After the user connects
Store the key on your server and send it as the bearer token on that user's requests. To show the user what they have
left, call GET /v1/balance with their key. If their
requests start failing with 401, they probably regenerated their key: send them through the flow again.