> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# resetDocument

> Reset the SWML document to an empty state.

[ref-swmlservice]: /docs/server-sdks/reference/typescript/agents/swml-service

Reset the SWML document to an empty state. Clears all sections and verbs,
leaving only an empty `main` section. Use this to rebuild the document from
scratch without creating a new [`SWMLService`][ref-swmlservice] instance.

## **Returns**

`this` -- returns the service for fluent chaining.

## **Example**

```typescript {8}
import { SWMLService } from '@signalwire/sdk';

const service = new SWMLService({ name: 'my-service' });
service.addVerb('answer', {});
service.addVerb('play', { url: 'https://example.com/old.mp3' });

// Start over with a fresh document
service.resetDocument();
service.addVerb('answer', {});
service.addVerb('ai', { prompt: { text: 'You are a helpful assistant' } });

console.log(service.renderDocument());
```