Skip to main content
POST
Get Access Token
Securely generate short-lived access_token and long-lived refresh_token for authorized iframe access.
⚠️ Important: This endpoint must be called from your server, not from the client side. The client_api_key is sensitive and should never be exposed on the client side.
Once you obtain the tokens, pass the access_token to the client-side where the iframe will be embedded.

Embed URL for Iframe

Use the following format to embed the iframe securely:
Chatzy AI will validate the token from query params for every API call made within the iframe, ensuring the user is authorized to access the AI Agent. ⚠️ Important
  • Ensure tokens are stored securely, as refresh token will be used to retrieve a new access token when the old one expires.
  • Refresh token logic is explained in the next API endpoint: /ai-agent/refresh_token.
  • Never expose the client_api_key on the frontend.

Body

application/json
user_id
string
required
Example:

"user123 // client's customer id"

chatbot_id
string<uuid>
required
Example:

"8a1e3f18-991b-4a2e-9973-f53e7fc94ff1"

client_api_key
string
required

AI Agent Auth Key - Can be retrieved from https://app.chatzy.ai/profile

Example:

"ak-xxxxxxxxxxx"

Response

200 - application/json

Access and refresh token response

data
object