Skip to main content
Use POST /v1/embed/sessions to create an iframe session. The request must be signed with the same HMAC headers as other Public API requests.
Create embed sessions on your backend. Do not call this endpoint from browser code because it requires the API secret.
{
  "employeeId": "64f000000000000000000001",
  "chatId": "64f000000000000000000002",
  "capabilities": ["showChatPage"]
}
Request fields:
FieldTypeRequiredDescription
employeeIdstringYesActive YoLead employee id that will act inside the iframe.
chatIdstringNoChat to open or restrict the iframe session to. Required when showChatPage is requested without showChatsList.
capabilitiesarrayYesList of requested iframe capabilities. At least one view capability must remain after scope filtering.
The response contains iframeUrl. Render that URL in an iframe on your frontend.
{
  "data": {
    "iframeUrl": "https://app.yo-lead.com/embed/chats/64f000000000000000000002#token=eyJ...",
    "embedToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "expiresAt": "2026-05-08T12:15:00.000Z",
    "capabilities": ["showChatPage"],
    "allowedChatId": "64f000000000000000000002"
  }
}
<iframe src="https://app.yo-lead.com/embed/chats/64f000000000000000000002#token=..." />
Response fields:
FieldTypeDescription
iframeUrlstringURL to render in the customer frontend.
embedTokenstringShort-lived token consumed by the YoLead iframe runtime.
expiresAtstringToken expiration time as an ISO 8601 date-time string. Embed sessions expire after 60 minutes.
capabilitiesarrayEffective capabilities granted to this session after API key scope filtering.
allowedChatIdstringPresent when the session is restricted to a single chat.

Validation rules

  • employeeId must belong to an active employee in the API key company.
  • Requested capabilities are filtered by API key scope.
  • read keys can only grant showChatsList and showChatPage.
  • read-write keys can grant all supported capabilities.
  • At least one view capability is required: showChatsList or showChatPage.
  • If showChatPage is requested without showChatsList, chatId is required.
  • If chatId is provided, the employee must have access to that chat.