You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constresult=awaitclient.agent.process({transcript: 'What meetings do I have today?',user_id: 'user-1',language: 'en',});console.log(result.processed_text);
Agent -- Multi-Turn Chat (Streaming)
conststream=client.agent.chatStream({messages: [{role: 'user',content: 'Summarize the key takeaways.'},],user_id: 'user-1',});forawait(constchunkofstream){if(chunk.type==='text_chunk'){process.stdout.write(chunk.content??'');}}
Token Management (Admin)
Admin token is required for these operations.
// Create a token for a userconsttokenResponse=awaitclient.auth.createToken({user_id: 'my-app',label: 'My Application',});console.log(tokenResponse.token);// List all tokensconsttokens=awaitclient.auth.listTokens();// Revoke a tokenawaitclient.auth.revokeToken(tokenId);// Get usage for a userconstusage=awaitclient.auth.getUsage('user-1',7);// Get aggregated usage summaryconstsummary=awaitclient.auth.getUsageSummary();
User Authentication
// Sign upawaitclient.userAuth.signup({email: 'user@example.com',password: 'securepass123',});// Login (cookies are stored automatically)awaitclient.userAuth.login({email: 'user@example.com',password: 'securepass123',});// Get current userconstme=awaitclient.userAuth.getMe();// Guest access (no credentials needed)awaitclient.userAuth.guest();// Forgot passwordawaitclient.userAuth.forgotPassword('user@example.com');// Reset passwordawaitclient.userAuth.resetPassword({token: 'token-from-email',password: 'newpassword123',});// Verify emailawaitclient.userAuth.verifyEmail({token: 'token-from-email'});// Get auth configurationconstconfig=awaitclient.userAuth.getConfig();// Google OAuthconstgoogleUrl=client.userAuth.getGoogleOAuthUrl();
Voice Calling
Voice Agents
// Create a voice agentconstagent=awaitclient.voiceCalling.createAgent({name: 'Sales Rep',system_prompt: 'You are a helpful sales assistant for Acme Corp.',greeting: 'Hi there! How can I help you today?',voice: 'tara',voice_gender: 'female',llm_model: 'gemini-2.5-flash',});// List agentsconstagents=awaitclient.voiceCalling.listAgents();// Get agent by IDconstagentDetails=awaitclient.voiceCalling.getAgent(agent.id);// Update agentawaitclient.voiceCalling.updateAgent(agent.id,{name: 'Senior Sales Rep',});// Delete agentawaitclient.voiceCalling.deleteAgent(agent.id);
// Create a customerconstcustomer=awaitclient.voiceCalling.createCustomer({name: 'Jane Smith',phone_number: '+14155551234',email: 'jane@example.com',});// List customersconstcustomers=awaitclient.voiceCalling.listCustomers();// Get customer by IDconstcustomerDetails=awaitclient.voiceCalling.getCustomer(customer.id);// Update customerawaitclient.voiceCalling.updateCustomer(customer.id,{name: 'Jane Doe',});// Delete customerawaitclient.voiceCalling.deleteCustomer(customer.id);
Calls
// List callsconstcalls=awaitclient.voiceCalling.listCalls({agent_id: agent.id,limit: 10,});// Start an outbound callconstcall=awaitclient.voiceCalling.startCall({agent_id: agent.id,customer_id: customer.id,phone_number: '+14155551234',});
Organizations
// Create an organizationconstorg=awaitclient.organizations.create({name: 'Acme Corp',slug: 'acme',});// List organizationsconstorgs=awaitclient.organizations.list();// Get active organizationconstactive=awaitclient.organizations.getActive();// Switch active organizationawaitclient.organizations.switchOrg({organization_id: org.id});// Get organization detailsconstorgDetails=awaitclient.organizations.get(org.id);// Update organizationawaitclient.organizations.update(org.id,{name: 'Acme Corporation'});// Delete organization (owner only)awaitclient.organizations.delete(org.id);// List membersconstmembers=awaitclient.organizations.listMembers(org.id);// Change member roleawaitclient.organizations.updateMemberRole(org.id,userId,{role: 'admin'});
Invitations
// Invite a userconstinvitation=awaitclient.organizations.createInvitation(org.id,{email: 'colleague@example.com',role: 'member',});// List pending invitationsconstinvitations=awaitclient.organizations.listInvitations(org.id);// Revoke an invitationawaitclient.organizations.revokeInvitation(org.id,invitation.id);// Preview an invitation (public)constpreview=awaitclient.organizations.previewInvitation('invitation-token');// Accept an invitationawaitclient.organizations.acceptInvitation({token: 'invitation-token-from-email',});
ASR Info Endpoints
// List loaded ASR modelsconstmodels=awaitclient.asr.getModels();// List available intent labelsconstintents=awaitclient.asr.getIntents();// List supported languagesconstlanguages=awaitclient.asr.getLanguages();// Server statusconststatus=awaitclient.asr.getStatus();
Additional ASR Endpoints
import{readFileSync}from'fs';// Clean transcript (text only, fastest)consttext=awaitclient.asr.transcribeClean({file: readFileSync('audio.mp3'),filename: 'audio.mp3',});// Raw model outputconstraw=awaitclient.asr.transcribeRaw({file: readFileSync('audio.mp3'),filename: 'audio.mp3',});// Transcribe raw PCM audioconstpcmResult=awaitclient.asr.transcribePCM({audio: readFileSync('audio.pcm'),sample_rate: 16000,});// Long audio with VAD segmentationconstlongResult=awaitclient.asr.transcribeLong({file: readFileSync('long-audio.mp3'),filename: 'long-audio.mp3',diarize: true,});// Batch transcriptionconstbatchResults=awaitclient.asr.transcribeBatch({files: [{file: readFileSync('call1.mp3'),filename: 'call1.mp3'},{file: readFileSync('call2.mp3'),filename: 'call2.mp3'},],diarize: true,});