> ## Documentation Index
> Fetch the complete documentation index at: https://docs.daily.co/llms.txt
> Use this file to discover all available pages before exploring further.

# destroy()

> Destroy a Daily call object and release all associated resources.

`destroy()`

<Badge color="green">{"✓"} Prebuilt</Badge> <Badge color="green">{"✓"} Custom</Badge>

Destroys the call object and frees all associated resources. After `destroy()` completes, [`isDestroyed()`](/reference/daily-js/instance-methods/is-destroyed) returns `true` and any further method calls on the instance will throw an error.

If the call is still active when `destroy()` is called, it will leave the call automatically before releasing resources — so you can call `destroy()` directly without a prior `leave()`. Call [`leave()`](/reference/daily-js/instance-methods/leave) instead when you want to end the current session but reuse the call object for a future `join()` or want access to the call object's state before destroying it.

<Warning>
  By default, if you attempt to create a new call object without first destroying the old one, the factory method will throw an error to prevent event handling conflicts. You must explicitly opt in to multiple-instance mode if you want to create more than one call object. See the [Multiple Instances](/docs/daily-js/guides/multi-instance) guide for details.
</Warning>

## Return value

Returns a `Promise<void>` that resolves once all resources have been released.

## Example

```javascript theme={null}
// When the user is completely done with the call
async function endSession() {
  await call.leave();
  await call.destroy();
  callRef.current = null;
}

// Or listen for the event to clean up references
call.on('call-instance-destroyed', () => {
  callRef.current = null;
});
```

## See also

<CardGroup>
  <Card title="Methods" icon="code" iconType="solid">
    * [leave()](/reference/daily-js/instance-methods/leave)
    * [isDestroyed()](/reference/daily-js/instance-methods/is-destroyed)
  </Card>

  <Card title="Events" icon="bolt" iconType="solid">
    * [call-instance-destroyed](/reference/daily-js/events/lifecycle-events#call-instance-destroyed)
    * [left-meeting](/reference/daily-js/events/lifecycle-events#left-meeting)
  </Card>

  <Card title="Guides" icon="book-open" iconType="solid">
    * [Introduction](/docs/daily-js/introduction)
    * [Multiple instances](/docs/daily-js/guides/multi-instance)
  </Card>
</CardGroup>
