Skip to main content
Daily.getCallInstance(callClientId?) Returns a valid daily-js call instance. If callClientId is provided, returns the instance with that ID. If omitted, returns the first instance created. When running multiple call instances simultaneously, always pass a callClientId to avoid ambiguity. Returns undefined if no matching valid instance exists. An instance becomes invalid once destroy() has been called on it.

Parameters

callClientId
string
Optional. The callClientId of the specific instance to retrieve. When running multiple call instances simultaneously, use this to look up a specific one.

Return value

Returns the matching DailyCall instance, or undefined if no valid instance exists for the given ID (or no instance exists at all when called without an argument).

Example

console.log(Daily.getCallInstance()); // undefined — no instance yet

const call = Daily.createCallObject();
console.log(Daily.getCallInstance() === call); // true

// With multiple instances, omitting the ID returns the first one created
const callA = Daily.createCallObject();
const callB = Daily.createCallObject();
console.log(Daily.getCallInstance() === callA); // true — callA was created first

// Pass a callClientId to retrieve a specific instance
console.log(Daily.getCallInstance(callB.callClientId()) === callB); // true

callA.destroy();
console.log(Daily.getCallInstance(callA.callClientId())); // undefined — destroyed

See also