Authorized iframe Access
Get New Access Token from Refresh Token
POST
Get New Access Token from Refresh Token
Generate a new short-lived
Your client application (the host of the iframe) must listen for this
The Chatzy AI iframe will update the token internally and continue to make secure API calls using the new token.
access_token using a valid refresh_token previously issued.
⚠️ Important: This endpoint must be called from your server. Never expose refresh_token or any sensitive token logic to the frontend or the iframe.
When the access_token passed in the iframe query params expires, the Chatzy AI iframe will send a postMessage event to the parent window with following JSON payload:
postMessage event, and call this /ai_agent/refresh_token API from your server to get a new access_token using the stored refresh_token.
Once you get the new token, respond back to the iframe with following JSON payload:
⚠️ Do not sendrefresh_tokento the iframe or store it in localStorage/cookies on the client. Chatzy AI iframe only needsaccess_tokento make authorized API calls.
Body
application/json
Response
200 - application/json
New access token issued successfully
Get New Access Token from Refresh Token