cURL
curl --request POST \ --url https://api.bland.ai/v1/agents/{agent_id}/authorize \ --header 'authorization: <authorization>'
{ "token": "22480c52-0ff1-4214-bcb7-50649b508432" }
Create a single-use session token for a client to talk with your web agent.
import { BlandWebClient } from 'bland-client-js-sdk'; const agentId = 'YOUR-AGENT-ID'; const sessionToken = 'YOUR-SESSION-TOKEN'; document.addEventListener('DOMContentLoaded', async () => { document.getElementById('btn').addEventListener('click', async () => { const blandClient = new BlandWebClient( agentId, sessionToken ); await blandClient.initConversation({ sampleRate: 44100, }); }); });
api.bland.ai
success
error